def PopulateForm(self): ### init widgets # model self.sim = QtGui.QStandardItemModel() self.sim.setHorizontalHeaderLabels( ['ThreadId', 'Address', 'Disasm', 'Stack Comment', 'CPU Context']) # toolbar self.utb = QtWidgets.QToolBar() self.ltb = QtWidgets.QToolBar() # tree view self.treeView = QtWidgets.QTreeView() self.treeView.setExpandsOnDoubleClick(True) self.treeView.setSortingEnabled(False) self.treeView.setSelectionBehavior( QtWidgets.QAbstractItemView.SelectRows) self.treeView.setToolTip( 'Highlights:\n Rust red - Input\n Violet - Output\n Olive - Both') ### populate widgets # fill model with data self.PopulateModel() # fill toolbar with data self.PopulateUpperToolbar() self.PopulateLowerToolbar() self.treeView.setModel(self.sim) # finalize layout layout = QtWidgets.QGridLayout() layout.addWidget(self.utb) layout.addWidget(self.treeView) layout.addWidget(self.ltb) self.parent.setLayout(layout)
def PopulateForm(self): ### init widgets # model self.sim = QtGui.QStandardItemModel() self.sim.setHorizontalHeaderLabels( ['ThreadId', 'Address', 'Disasm', 'Stack Comment', 'CPU Context']) # toolbar self.ftb = QtWidgets.QToolBar() self.stb = QtWidgets.QToolBar() # tree view self.treeView = QtWidgets.QTreeView() self.treeView.setToolTip('Double click a grade to filter') self.treeView.setExpandsOnDoubleClick(True) self.treeView.setSortingEnabled(False) self.treeView.setSelectionBehavior( QtWidgets.QAbstractItemView.SelectRows) # Context menus self.treeView.setContextMenuPolicy(QtCore.Qt.CustomContextMenu) self.treeView.customContextMenuRequested.connect( self.OnCustomContextMenu) self.treeView.doubleClicked.connect(self.ItemDoubleClickSlot) self.treeView.setModel(self.sim) ### populate widgets # fill model with data self.PopulateModel(0) # finalize layout layout = QtWidgets.QGridLayout() layout.addWidget(self.treeView) self.parent.setLayout(layout)