Python PyQt5.QtGui.QStandardItemModel() Examples
The following are 30
code examples of PyQt5.QtGui.QStandardItemModel().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
PyQt5.QtGui
, or try the search function
.
Example #1
Source File: TreeView.py From pyleecan with Apache License 2.0 | 7 votes |
def __init__(self): super(QtWidgets.QTreeView, self).__init__() # self.__typeWidgets = {} # self.__typeWrappers = {} model = QtGui.QStandardItemModel(0, 1) model.setHorizontalHeaderLabels( ["Name", "Value", "Unit", "Class", "Description"] ) self.rootNode = model.invisibleRootItem() self.setModel(model) self.setColumnWidth(0, 150) self.setAlternatingRowColors(True)
Example #2
Source File: sequence.py From ETS2Autopilot with MIT License | 6 votes |
def fill_image_list(self): """ Fill list_image with data. """ data = Data() list_images = self.ui.list_images model = QStandardItemModel(list_images) images = data.get_image_list(self.sequence_id) if len(images) > 0: for image in images: item = QStandardItem("%s - %s" % (image[1], functions.get_indicator(image[5]))) item.setEditable(False) item.setData(str(image[0]), QtCore.Qt.UserRole) model.appendRow(item) list_images.setModel(model)
Example #3
Source File: gui.py From lanzou-gui with MIT License | 6 votes |
def init_rec_ui(self): """回收站ui初始化""" self.model_rec = QStandardItemModel(1, 3) self.config_tableview("rec") self.table_rec.doubleClicked.connect(self.call_rec_folder_dialog) self.btn_rec_select_all.setIcon(QIcon(SRC_DIR + "select_all.ico")) self.btn_rec_select_all.clicked.connect(lambda: self.select_all_btn("reverse")) self.btn_rec_delete.clicked.connect(lambda: self.call_multi_manipulator("delete")) self.btn_rec_delete.setIcon(QIcon(SRC_DIR + "delete.ico")) self.btn_recovery.clicked.connect(lambda: self.call_multi_manipulator("recovery")) self.btn_recovery.setIcon(QIcon(SRC_DIR + "rec_folder.ico")) self.btn_rec_delete.setToolTip("彻底删除选中文件(夹)") self.btn_recovery.setToolTip("恢复选中文件(夹)") self.btn_recovery_all.clicked.connect(lambda: self.call_multi_manipulator("recovery_all")) self.btn_recovery_all.setIcon(QIcon(SRC_DIR + "rec_folder.ico")) self.btn_recovery_all.setToolTip("恢复全部") self.btn_rec_clean.clicked.connect(lambda: self.call_multi_manipulator("clean")) self.btn_rec_clean.setIcon(QIcon(SRC_DIR + "rec_bin.ico")) self.btn_rec_clean.setToolTip("清理回收站全部") self.btn_rec_expire_files.setToolTip("暂时无效!") # shared url
Example #4
Source File: gui.py From lanzou-gui with MIT License | 6 votes |
def init_disk_ui(self): self.model_disk = QStandardItemModel(1, 3) self.config_tableview("disk") self.btn_disk_delete.setIcon(QIcon(SRC_DIR + "delete.ico")) self.btn_disk_dl.setIcon(QIcon(SRC_DIR + "downloader.ico")) self.btn_disk_select_all.setIcon(QIcon(SRC_DIR + "select_all.ico")) self.btn_disk_select_all.setToolTip("按下 Ctrl/Alt + A 全选或则取消全选") self.btn_disk_select_all.clicked.connect(lambda: self.select_all_btn("reverse")) self.table_disk.clicked.connect(lambda: self.select_all_btn("cancel")) self.btn_disk_dl.clicked.connect(lambda: self.call_multi_manipulator("download")) self.btn_disk_mkdir.setIcon(QIcon(SRC_DIR + "add_folder.ico")) self.btn_disk_mkdir.clicked.connect(self.call_mkdir) self.btn_disk_delete.clicked.connect(self.call_remove_files) # 文件拖拽上传 self.table_disk.drop_files.connect(self.show_upload_dialog) self.table_disk.doubleClicked.connect(self.change_dir) # rec tab
Example #5
Source File: elf_info_dlg.py From Dwarf with GNU General Public License v3.0 | 6 votes |
def __init__(self, parent=None, file_path=None): super().__init__(parent=parent) h_box = QHBoxLayout(self) self._ident_titles = ['EI_MAG0', 'EI_MAG1', 'EI_MAG2', 'EI_MAG3', 'EI_CLASS', 'EI_DATA', 'EI_VERSION', 'EI_OSABI', 'EI_ABIVERSION', 'EI_PAD'] self.elf_info = DwarfListView(self) self.elf_info.setRootIsDecorated(True) self.elf_info.setExpandsOnDoubleClick(True) self.elf_info.setContextMenuPolicy(Qt.CustomContextMenu) self.elf_info.customContextMenuRequested.connect(self._on_context_menu) h_box.addWidget(self.elf_info) self._elf_info_mdl = QStandardItemModel(0, 2) self._elf_info_mdl.setHeaderData(0, Qt.Horizontal, 'Name') self._elf_info_mdl.setHeaderData(1, Qt.Horizontal, 'Value') self.elf_info.setModel(self._elf_info_mdl) self.elf_info.doubleClicked.connect(self._on_dblclicked) self.title = "ELF Info" self._elf_file_path = None self.setLayout(h_box) if file_path: self.set_elf_file(file_path)
Example #6
Source File: CColorItems.py From CustomWidgets with GNU General Public License v3.0 | 6 votes |
def __init__(self, colors, *args, **kwargs): super(CColorItems, self).__init__(*args, **kwargs) self.setItemDelegate(StyledItemDelegate(self)) self.setEditTriggers(self.NoEditTriggers) self.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff) self.setFlow(self.LeftToRight) self.setWrapping(True) self.setResizeMode(self.Adjust) self.setSpacing(6) self.setCursor(Qt.PointingHandCursor) self.setFrameShape(self.NoFrame) self._model = QStandardItemModel(self) self.setModel(self._model) for color in colors: self.addColor(color)
Example #7
Source File: CustomWidgetItem.py From PyQt with GNU General Public License v3.0 | 6 votes |
def __init__(self, *args, **kwargs): super(ListView, self).__init__(*args, **kwargs) # 模型 self._model = QStandardItemModel(self) self.setModel(self._model) # 循环生成10个自定义控件 for i in range(10): item = QStandardItem() self._model.appendRow(item) # 添加item # 得到索引 index = self._model.indexFromItem(item) widget = CustomWidget(str(i)) item.setSizeHint(widget.sizeHint()) # 主要是调整item的高度 # 设置自定义的widget self.setIndexWidget(index, widget)
Example #8
Source File: quick.py From quick with GNU General Public License v3.0 | 6 votes |
def data(self, index, role=QtCore.Qt.DisplayRole): if role == QtCore.Qt.DisplayRole: dstr = QtGui.QStandardItemModel.data(self, index, role) if dstr == "" or dstr is None: if isinstance(self.type, click.types.Tuple): row = index.row() if 0 <= row < len(self.type.types): tp = self.type.types[row] dstr = tp.name else: dstr = self.type.name return dstr if role == _GTypeRole: tp = click.STRING if isinstance(self.type, click.types.Tuple): row = index.row() if 0 <= row < len(self.type.types): tp = self.type.types[row] elif isinstance(self.type, click.types.ParamType): tp = self.type return tp return QtGui.QStandardItemModel.data(self, index, role)
Example #9
Source File: ValueViewEx.py From DIE with MIT License | 6 votes |
def _model_builder(self, model): """ Build the function model. @param model: QStandardItemModel object """ model.clear() # Clear the model root_node = model.invisibleRootItem() model.setHorizontalHeaderLabels(("Type", "Score", "Value", "Description", "Raw Value")) if self.die_db is None: return value_list = self.die_db.get_all_values() for value in value_list: value_data_item_list = self._make_value_item(value) root_node.appendRow(value_data_item_list)
Example #10
Source File: main_win.py From BlindWatermark with GNU General Public License v3.0 | 6 votes |
def init_listVIew(self): self.listView.setViewMode(QListView.ListMode)#或者使用QListView.IconMode QListView.ListMode #self.listView.setMovement(QListView.Static) self.listView.setIconSize(QSize(20,20))#图标的大小(原始图标大小如果100,100,此时设置草果原始大小则失效) self.listView.setGridSize(QSize(60,40))#每个选项所在网格大小(每个选项外层grid宽高) #self.listView.setMaximumHeight(200)#listView整体最大高度 #self.listView.setMinimumSize(QSize(200,200))#listView最小面积(一般如果设置最大高和宽属性后就不设置这个属性了) #self.listView.setMaximumSize(QSize(500,500))#listVIew最大面积(一般如果设置最大高和宽属性后就不设置这个属性了) self.listView.setMinimumHeight(80)#listView最小高度 self.listView.setResizeMode(QListView.Adjust) #self.listView.setMovement(QListView.Static)#设置图标可不可以移动,默认是可移动的,但可以改成静态的: self.listView_model=QStandardItemModel() self.listView.setModel(self.listView_model) self.listView.clicked.connect(self.checkItem)
Example #11
Source File: namespace_widget.py From opcua-modeler with GNU General Public License v3.0 | 6 votes |
def __init__(self, view): QObject.__init__(self, view) self.view = view self.model = QStandardItemModel() self.view.setModel(self.model) delegate = MyDelegate(self.view, self) delegate.error.connect(self.error.emit) self.view.setItemDelegate(delegate) self.node = None self.view.header().setSectionResizeMode(1) self.addNamespaceAction = QAction("Add Namespace", self.model) self.addNamespaceAction.triggered.connect(self.add_namespace) self.removeNamespaceAction = QAction("Remove Namespace", self.model) self.removeNamespaceAction.triggered.connect(self.remove_namespace) self.view.setContextMenuPolicy(Qt.CustomContextMenu) self.view.customContextMenuRequested.connect(self.showContextMenu) self._contextMenu = QMenu() self._contextMenu.addAction(self.addNamespaceAction) self._contextMenu.addAction(self.removeNamespaceAction)
Example #12
Source File: refnodesets_widget.py From opcua-modeler with GNU General Public License v3.0 | 6 votes |
def __init__(self, view): QObject.__init__(self, view) self.view = view self.model = QStandardItemModel() self.view.setModel(self.model) self.nodesets = [] self.server_mgr = None self.view.header().setSectionResizeMode(1) addNodeSetAction = QAction("Add Reference Node Set", self.model) addNodeSetAction.triggered.connect(self.add_nodeset) self.removeNodeSetAction = QAction("Remove Reference Node Set", self.model) self.removeNodeSetAction.triggered.connect(self.remove_nodeset) self.view.setContextMenuPolicy(Qt.CustomContextMenu) self.view.customContextMenuRequested.connect(self.showContextMenu) self._contextMenu = QMenu() self._contextMenu.addAction(addNodeSetAction) self._contextMenu.addAction(self.removeNodeSetAction)
Example #13
Source File: first.py From FIRST-plugin-ida with GNU General Public License v2.0 | 6 votes |
def _model_builder(self, model, data, initialize=False): ''' Build the function model. @param model: QStandardItemModel object ''' if initialize: model.clear() # Clear the model FIRSTUI.SharedObjects.make_model_headers(model) if not data: return model.add_data(data) # Add db functions to the model root_node = model.invisibleRootItem() for address, matches in data.iteritems(): function = FIRST.Metadata.get_function(address) func_row = self._make_function_item(function, len(matches)) root_node.appendRow(func_row) for match in matches: info_list = FIRSTUI.SharedObjects.make_match_info(match) func_row[0].appendRow(info_list)
Example #14
Source File: detection.py From detection with GNU General Public License v2.0 | 6 votes |
def populateUI(self): self.availableObjectsList.addItems(Detector.getDefaultAvailableObjects()) for sourceMode in self.__sourceModes: self.sourceCBox.addItem(sourceMode) for displayMode in self.__displayModes: self.displayCBox.addItem(displayMode) for shapeMode in self.__shapeModes: self.shapeCBox.addItem(shapeMode) for fillMode in self.__fillModes: self.fillCBox.addItem(fillMode) for bgMode in self.__bgModes: self.bgCBox.addItem(bgMode) model = QtGui.QStandardItemModel(self) func = lambda node, parent: self.populateTree(node, parent) Detector.getDefaultObjectsTree().map(model, func) self.objectsTree.setModel(model)
Example #15
Source File: dockwidgets.py From Lector with GNU General Public License v3.0 | 6 votes |
def populate(self): self.setFeatures(QtWidgets.QDockWidget.DockWidgetClosable) self.setTitleBarWidget(QtWidgets.QWidget(self)) # Removes titlebar self.sideDockTabWidget = QtWidgets.QTabWidget(self) self.setWidget(self.sideDockTabWidget) # This order is important self.bookmarkModel = QtGui.QStandardItemModel(self) self.bookmarkProxyModel = BookmarkProxyModel(self) self.bookmarks = Bookmarks(self) self.bookmarks.generate_bookmark_model() if not self.parent.are_we_doing_images_only: self.annotationModel = QtGui.QStandardItemModel(self) self.annotations = Annotations(self) self.annotations.generate_annotation_model() self.searchResultsModel = QtGui.QStandardItemModel(self) self.search = Search(self)
Example #16
Source File: main.py From ETS2Autopilot with MIT License | 6 votes |
def fill_sequence_list(self): """ Fill sequence_list with data. """ data = Data() sequence_list = self.ui.sequence_list model = QStandardItemModel(sequence_list) sequences = data.get_sequence_list() if len(sequences) > 0: for sequence in sequences: note = "" if sequence[4] is not None: note = " - %s" % sequence[4] item = QStandardItem("%s%s" % (sequence[1], note)) item.setEditable(False) item.setData(str(sequence[0]), QtCore.Qt.UserRole) model.insertRow(0, item) sequence_list.setModel(model)
Example #17
Source File: listcategory.py From qutebrowser with GNU General Public License v3.0 | 6 votes |
def __init__(self, name: str, items: typing.Iterable[_ItemType], sort: bool = True, delete_func: util.DeleteFuncType = None, parent: QWidget = None): super().__init__(parent) self.name = name self.srcmodel = QStandardItemModel(parent=self) self._pattern = '' # ListCategory filters all columns self.columns_to_filter = [0, 1, 2] self.setFilterKeyColumn(-1) for item in items: self.srcmodel.appendRow([QStandardItem(x) for x in item]) self.setSourceModel(self.srcmodel) self.delete_func = delete_func self._sort = sort
Example #18
Source File: main.py From mu with GNU General Public License v3.0 | 6 votes |
def add_debug_inspector(self): """ Display a debug inspector to view the call stack. """ self.debug_inspector = DebugInspector() self.debug_model = QStandardItemModel() self.debug_inspector.setModel(self.debug_model) self.inspector = QDockWidget(_("Debug Inspector")) self.inspector.setWidget(self.debug_inspector) self.inspector.setFeatures(QDockWidget.DockWidgetMovable) self.inspector.setAllowedAreas( Qt.BottomDockWidgetArea | Qt.LeftDockWidgetArea | Qt.RightDockWidgetArea ) self.addDockWidget(Qt.RightDockWidgetArea, self.inspector) self.connect_zoom(self.debug_inspector)
Example #19
Source File: QualisysTab.py From crazyflie-clients-python with GNU General Public License v2.0 | 6 votes |
def path_changed(self): if self.flight_mode == FlightModeStates.PATH: self.switch_flight_mode(FlightModeStates.HOVERING) time.sleep(0.1) # Flight path ui table setup self.model = QStandardItemModel(10, 4) self.model.setHorizontalHeaderItem(0, QStandardItem('X (m)')) self.model.setHorizontalHeaderItem(1, QStandardItem('Y (m)')) self.model.setHorizontalHeaderItem(2, QStandardItem('Z (m)')) self.model.setHorizontalHeaderItem(3, QStandardItem('Yaw (deg)')) # Populate the table with data if (len(self.flight_paths) == 0): return current = self.flight_paths[self.pathSelector.currentIndex()] for i in range(1, len(current)): for j in range(0, 4): self.model.setItem(i - 1, j, QStandardItem(str(current[i][j]))) self._flight_path_set_model.emit(self.model) Config().set("flight_paths", self.flight_paths)
Example #20
Source File: quick.py From quick with GNU General Public License v3.0 | 5 votes |
def __init__(self, n, parent=None, opt_type=click.STRING, default=None): super(QtGui.QStandardItemModel, self).__init__(0, 1, parent) self.type = opt_type for row in range(n): if hasattr(default, "__len__"): self.insertRow(row, default[row]) else: self.insertRow(row, default)
Example #21
Source File: CityLinkage.py From PyQt with GNU General Public License v3.0 | 5 votes |
def __init__(self, *args, **kwargs): super(SortFilterProxyModel, self).__init__(*args, **kwargs) self.setFilterRole(Qt.ToolTipRole) # 根据Qt.ToolTipRole角色过滤 self._model = QStandardItemModel(self) self.setSourceModel(self._model)
Example #22
Source File: values_display.py From pySPM with Apache License 2.0 | 5 votes |
def __init__(self, data): QWidget.__init__(self) self.treeView = QTreeView() self.model = QStandardItemModel() self.addItems(self.model, data) self.treeView.setModel(self.model) layout = QVBoxLayout() layout.addWidget(self.treeView) self.setLayout(layout)
Example #23
Source File: Q_dict_tree_view.py From pyNMS with GNU General Public License v3.0 | 5 votes |
def __init__(self, data=None): super().__init__() self.header().hide() self.root_model = QStandardItemModel() self.setModel(self.root_model) if data: self.populate_tree(data)
Example #24
Source File: dialog_scripts.py From Dwarf with GNU General Public License v3.0 | 5 votes |
def __init__(self, parent=None): super(ScriptsTable, self).__init__(parent=parent) self._scripts_model = QStandardItemModel(0, 6) self._scripts_model.setHeaderData(0, Qt.Horizontal, 'Name') self._scripts_model.setHeaderData(1, Qt.Horizontal, 'Author') self._scripts_model.setHeaderData(1, Qt.Horizontal, Qt.AlignCenter, Qt.TextAlignmentRole) self._scripts_model.setHeaderData(2, Qt.Horizontal, 'A') self._scripts_model.setHeaderData(2, Qt.Horizontal, Qt.AlignCenter, Qt.TextAlignmentRole) self._scripts_model.setHeaderData(3, Qt.Horizontal, 'I') self._scripts_model.setHeaderData(3, Qt.Horizontal, Qt.AlignCenter, Qt.TextAlignmentRole) self._scripts_model.setHeaderData(4, Qt.Horizontal, 'W') self._scripts_model.setHeaderData(4, Qt.Horizontal, Qt.AlignCenter, Qt.TextAlignmentRole) self._scripts_model.setHeaderData(5, Qt.Horizontal, 'Description') self.setModel(self._scripts_model) self.header().setSectionResizeMode(0, QHeaderView.ResizeToContents) self.header().setSectionResizeMode(1, QHeaderView.ResizeToContents) self.header().setSectionResizeMode(2, QHeaderView.ResizeToContents) self.header().setSectionResizeMode(3, QHeaderView.ResizeToContents) self.header().setSectionResizeMode(4, QHeaderView.ResizeToContents) self.doubleClicked.connect(self._item_doubleclicked)
Example #25
Source File: panel_java_explorer.py From Dwarf with GNU General Public License v3.0 | 5 votes |
def _setup_models(self): # left list self._methods_model = QStandardItemModel(0, 3) self._methods_model.setHeaderData(0, Qt.Horizontal, 'Name') self._methods_model.setHeaderData(1, Qt.Horizontal, 'Return') self._methods_model.setHeaderData(2, Qt.Horizontal, 'Arguments') self._methods_list.setModel(self._methods_model) self._methods_list.header().setSectionResizeMode( 0, QHeaderView.ResizeToContents) self._methods_list.header().setSectionResizeMode( 1, QHeaderView.ResizeToContents) # center list self._native_fields_model = QStandardItemModel(0, 2) self._native_fields_model.setHeaderData(0, Qt.Horizontal, 'Name') self._native_fields_model.setHeaderData(1, Qt.Horizontal, 'Value') self._native_fields_list.setModel(self._native_fields_model) self._native_fields_list.header().setSectionResizeMode( 0, QHeaderView.ResizeToContents) # right list self._fields_model = QStandardItemModel(0, 2) self._fields_model.setHeaderData(0, Qt.Horizontal, 'Name') self._fields_model.setHeaderData(1, Qt.Horizontal, 'Class') self._fields_list.setModel(self._fields_model) self._fields_list.header().setSectionResizeMode( 0, QHeaderView.ResizeToContents) # ************************************************************************ # **************************** Functions ********************************* # ************************************************************************
Example #26
Source File: ui.py From Quantdom with Apache License 2.0 | 5 votes |
def on_symbols_loaded(self, symbols): self.shares_symbol_list.clear() self.shares_symbol_list.setEnabled(True) # self.symbols = ['%s/%s' % (ticker, name) for ticker, name in symbols] # self.shares_symbol_list.addItems(self.symbols) model = QtGui.QStandardItemModel() model.setHorizontalHeaderLabels(SYMBOL_COLUMNS) for irow, (ticker, name) in enumerate(symbols): model.setItem(irow, 0, QtGui.QStandardItem(ticker)) model.setItem(irow, 1, QtGui.QStandardItem(name)) table_view = QtGui.QTableView() table_view.setModel(model) table_view.setSelectionBehavior(QtGui.QAbstractItemView.SelectRows) table_view.verticalHeader().setVisible(False) table_view.setAutoScroll(False) table_view.setShowGrid(False) table_view.resizeRowsToContents() table_view.setColumnWidth(0, 60) table_view.setColumnWidth(1, 240) table_view.setMinimumWidth(300) completer = QtGui.QCompleter(model) completer.setCaseSensitivity(QtCore.Qt.CaseInsensitive) completer.setModel(model) self.symbols = symbols self.shares_symbol_list.setModel(model) self.shares_symbol_list.setView(table_view) self.shares_symbol_list.setCompleter(completer) # set default symbol self.shares_symbol_list.setCurrentIndex( self.shares_symbol_list.findText(DEFAULT_TICKER) )
Example #27
Source File: labels_tableview.py From CvStudio with MIT License | 5 votes |
def __init__(self, parent=None): super(LabelsTableView, self).__init__(parent) self._model = QStandardItemModel(0, 3) self._model.setHorizontalHeaderLabels(["name", "color"]) self.setModel(self._model) self.setSelectionBehavior(QAbstractItemView.SelectRows) self.setSelectionMode(QAbstractItemView.SingleSelection) delegate = LabelsTableDelegate() self.setItemDelegate(delegate) self.setCursor(QtCore.Qt.PointingHandCursor) header = self.horizontalHeader() self.setEditTriggers(QAbstractItemView.NoEditTriggers) header.setSectionResizeMode(0, QHeaderView.Stretch) header.setSectionResizeMode(1, QHeaderView.Stretch) self.setColumnHidden(2, True)
Example #28
Source File: reqtree.py From guppy-proxy with MIT License | 5 votes |
def clear(self): self.nodes = {} self.root = QStandardItemModel() self.tree_view.setModel(self.root)
Example #29
Source File: xrefwindow.py From MARA_Framework with GNU Lesser General Public License v3.0 | 5 votes |
def __init__(self, parent=None, win=None, xrefs=None, headers=None): super(XrefValueWindow, self).__init__(parent) self.parent = parent self.mainwin = win self.xrefs = xrefs self.headers = headers self.reverse_strings = {} self.proxyModel = QtCore.QSortFilterProxyModel() self.proxyModel.setDynamicSortFilter(True) self.model = QtGui.QStandardItemModel(len(self.xrefs), len(self.headers), self) column = 0 for header in headers: self.model.setHeaderData(column, QtCore.Qt.Horizontal, header) column += 1 row = 0 for ref in xrefs: for column in range(len(self.headers)): self.model.setData(self.model.index( row, column, QtCore.QModelIndex()), "%s" % ref[column]) row += 1 self.proxyModel.setSourceModel(self.model) self.setRootIsDecorated(False) self.setAlternatingRowColors(True) self.setModel(self.proxyModel) self.setSortingEnabled(True) self.setEditTriggers(QtWidgets.QAbstractItemView.NoEditTriggers) self.doubleClicked.connect(self.slotDoubleClicked)
Example #30
Source File: reqtree.py From guppy-proxy with MIT License | 5 votes |
def __init__(self): QWidget.__init__(self) self.setLayout(QVBoxLayout()) self.layout().setSpacing(0) self.layout().setContentsMargins(0, 0, 0, 0) self.nodes = {} self.tree_view = QTreeView() self.tree_view.header().close() self.root = QStandardItemModel() self.tree_view.setModel(self.root) self.layout().addWidget(self.tree_view)