Python PySide2.QtWidgets.QTreeView() Examples
The following are 4
code examples of PySide2.QtWidgets.QTreeView().
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
PySide2.QtWidgets
, or try the search function
.
Example #1
Source File: gui.py From batch_textures_convert with MIT License | 5 votes |
def folderPathDialog(self): """ updates folder_path label when called from pyside native button link to explanation on how to enable multiple directories selection: https://stackoverflow.com/questions/38252419/qt-get-qfiledialog-to-select-and-return-multiple-folders """ if self.folder_path.text() == "": default_path = os.getenv("HOME") else: default_path = self.folder_path.text().split(self.paths_separator)[0] dialog = QtWidgets.QFileDialog(self, "Select a folder with textures for conversion:", default_path) dialog.setFileMode(QtWidgets.QFileDialog.Directory) # don't use native dialog, enable multiple dir selection dialog.setOption(QtWidgets.QFileDialog.DontUseNativeDialog, True) file_view = dialog.findChild(QtWidgets.QListView, 'listView') f_tree_view = dialog.findChild(QtWidgets.QTreeView) if file_view: file_view.setSelectionMode(QtWidgets.QAbstractItemView.MultiSelection) if f_tree_view: f_tree_view.setSelectionMode(QtWidgets.QAbstractItemView.MultiSelection) # exec dialog if dialog.exec_() == QtWidgets.QDialog.Accepted: path = str( self.paths_separator.join( dialog.selectedFiles() ) ) self.folder_path.setText(path)
Example #2
Source File: version_updater_UI_pyside2.py From anima with MIT License | 5 votes |
def setupUi(self, Dialog): Dialog.setObjectName("Dialog") Dialog.setWindowModality(QtCore.Qt.ApplicationModal) Dialog.resize(1304, 753) self.verticalLayout = QtWidgets.QVBoxLayout(Dialog) self.verticalLayout.setObjectName("verticalLayout") self.label = QtWidgets.QLabel(Dialog) self.label.setObjectName("label") self.verticalLayout.addWidget(self.label) self.versions_treeView = QtWidgets.QTreeView(Dialog) self.versions_treeView.setObjectName("versions_treeView") self.verticalLayout.addWidget(self.versions_treeView) self.horizontalWidget = QtWidgets.QWidget(Dialog) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Preferred) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.horizontalWidget.sizePolicy().hasHeightForWidth()) self.horizontalWidget.setSizePolicy(sizePolicy) self.horizontalWidget.setObjectName("horizontalWidget") self.horizontalLayout = QtWidgets.QHBoxLayout(self.horizontalWidget) self.horizontalLayout.setContentsMargins(0, 0, 0, 0) self.horizontalLayout.setObjectName("horizontalLayout") spacerItem = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) self.horizontalLayout.addItem(spacerItem) self.selectNone_pushButton = QtWidgets.QPushButton(self.horizontalWidget) self.selectNone_pushButton.setObjectName("selectNone_pushButton") self.horizontalLayout.addWidget(self.selectNone_pushButton) self.selectAll_pushButton = QtWidgets.QPushButton(self.horizontalWidget) self.selectAll_pushButton.setObjectName("selectAll_pushButton") self.horizontalLayout.addWidget(self.selectAll_pushButton) self.update_pushButton = QtWidgets.QPushButton(self.horizontalWidget) self.update_pushButton.setObjectName("update_pushButton") self.horizontalLayout.addWidget(self.update_pushButton) self.cancel_pushButton = QtWidgets.QPushButton(self.horizontalWidget) self.cancel_pushButton.setObjectName("cancel_pushButton") self.horizontalLayout.addWidget(self.cancel_pushButton) self.verticalLayout.addWidget(self.horizontalWidget) self.retranslateUi(Dialog) QtCore.QMetaObject.connectSlotsByName(Dialog)
Example #3
Source File: ToolBox.py From PyAero with MIT License | 4 votes |
def itemFileSystem(self): self.item_fs = QtWidgets.QWidget() layout = QtWidgets.QVBoxLayout() self.item_fs.setLayout(layout) # instance of QFileSystemModel filesystem_model = FileSystem.FileSystemModel() root_path = filesystem_model.rootPath() self.tree = QtWidgets.QTreeView() self.tree.setModel(filesystem_model) self.tree.setRootIndex(filesystem_model.index(root_path)) self.tree.setAnimated(True) # hide size column self.tree.setColumnHidden(1, True) # hide type column self.tree.setColumnHidden(2, True) # hide date modified column self.tree.setColumnHidden(3, True) # hide the header line of the filesystem tree # the header line would consist of name, date, type, size # the latter three are hidden anyway (see above) header = self.tree.header() header.hide() # handler self.tree.clicked.connect(filesystem_model.onFileSelected) self.tree.doubleClicked.connect(filesystem_model.onFileLoad) layout.addWidget(self.tree, stretch=12) # layout.setAlignment(QtCore.Qt.AlignTop) self.header = QtWidgets.QLabel('Loaded airfoil(s)') self.header.setEnabled(False) layout.addStretch(stretch=2) layout.addWidget(self.header) self.listwidget = ListWidget(self.parent) self.listwidget.setEnabled(False) # allow only single selections self.listwidget.setSelectionMode(QtWidgets.QAbstractItemView. SingleSelection) layout.addWidget(self.listwidget, stretch=5) layout.addStretch(stretch=1)
Example #4
Source File: gui.py From GridCal with GNU General Public License v3.0 | 4 votes |
def setupUi(self, Dialog): Dialog.setObjectName("Dialog") Dialog.resize(941, 590) self.verticalLayout = QtWidgets.QVBoxLayout(Dialog) self.verticalLayout.setContentsMargins(1, 1, 1, 1) self.verticalLayout.setObjectName("verticalLayout") self.frame = QtWidgets.QFrame(Dialog) self.frame.setFrameShape(QtWidgets.QFrame.NoFrame) self.frame.setFrameShadow(QtWidgets.QFrame.Raised) self.frame.setObjectName("frame") self.verticalLayout_2 = QtWidgets.QVBoxLayout(self.frame) self.verticalLayout_2.setContentsMargins(-1, -1, -1, 0) self.verticalLayout_2.setObjectName("verticalLayout_2") self.treeView = QtWidgets.QTreeView(self.frame) self.treeView.setAlternatingRowColors(True) self.treeView.setSelectionMode(QtWidgets.QAbstractItemView.ExtendedSelection) self.treeView.setAnimated(True) self.treeView.setObjectName("treeView") self.verticalLayout_2.addWidget(self.treeView) self.verticalLayout.addWidget(self.frame) self.frame_2 = QtWidgets.QFrame(Dialog) self.frame_2.setFrameShape(QtWidgets.QFrame.NoFrame) self.frame_2.setFrameShadow(QtWidgets.QFrame.Raised) self.frame_2.setObjectName("frame_2") self.horizontalLayout = QtWidgets.QHBoxLayout(self.frame_2) self.horizontalLayout.setContentsMargins(-1, 0, -1, -1) self.horizontalLayout.setObjectName("horizontalLayout") self.accept_selected_pushButton = QtWidgets.QPushButton(self.frame_2) self.accept_selected_pushButton.setText("") icon = QtGui.QIcon() icon.addPixmap(QtGui.QPixmap(":/Icons/icons/accept.svg"), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.accept_selected_pushButton.setIcon(icon) self.accept_selected_pushButton.setObjectName("accept_selected_pushButton") self.horizontalLayout.addWidget(self.accept_selected_pushButton) self.reject_selected_pushButton = QtWidgets.QPushButton(self.frame_2) self.reject_selected_pushButton.setText("") icon1 = QtGui.QIcon() icon1.addPixmap(QtGui.QPixmap(":/Icons/icons/delete.svg"), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.reject_selected_pushButton.setIcon(icon1) self.reject_selected_pushButton.setObjectName("reject_selected_pushButton") self.horizontalLayout.addWidget(self.reject_selected_pushButton) spacerItem = QtWidgets.QSpacerItem(632, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum) self.horizontalLayout.addItem(spacerItem) self.doit_pushButton = QtWidgets.QPushButton(self.frame_2) icon2 = QtGui.QIcon() icon2.addPixmap(QtGui.QPixmap(":/Icons/icons/accept2.svg"), QtGui.QIcon.Normal, QtGui.QIcon.Off) self.doit_pushButton.setIcon(icon2) self.doit_pushButton.setObjectName("doit_pushButton") self.horizontalLayout.addWidget(self.doit_pushButton) self.verticalLayout.addWidget(self.frame_2) self.retranslateUi(Dialog) QtCore.QMetaObject.connectSlotsByName(Dialog)