Python PyQt5.QtWidgets.QListView() Examples
The following are 18
code examples of PyQt5.QtWidgets.QListView().
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.QtWidgets
, or try the search function
.
Example #1
Source File: ui_dialog_select_file.py From QualCoder with MIT License | 6 votes |
def setupUi(self, Dialog_selectfile): Dialog_selectfile.setObjectName("Dialog_selectfile") Dialog_selectfile.resize(400, 433) self.buttonBox = QtWidgets.QDialogButtonBox(Dialog_selectfile) self.buttonBox.setGeometry(QtCore.QRect(190, 390, 191, 32)) self.buttonBox.setOrientation(QtCore.Qt.Horizontal) self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Cancel|QtWidgets.QDialogButtonBox.Ok) self.buttonBox.setObjectName("buttonBox") self.listView = QtWidgets.QListView(Dialog_selectfile) self.listView.setGeometry(QtCore.QRect(10, 10, 371, 361)) self.listView.setObjectName("listView") self.retranslateUi(Dialog_selectfile) self.buttonBox.accepted.connect(Dialog_selectfile.accept) self.buttonBox.rejected.connect(Dialog_selectfile.reject) QtCore.QMetaObject.connectSlotsByName(Dialog_selectfile)
Example #2
Source File: puzzle.py From Miyamoto with GNU General Public License v3.0 | 6 votes |
def __init__(self, parent=None): super(displayWidget, self).__init__(parent) self.setMinimumWidth(426) self.setMaximumWidth(426) self.setMinimumHeight(404) self.setDragEnabled(True) self.setViewMode(QtWidgets.QListView.IconMode) self.setIconSize(QtCore.QSize(24,24)) self.setGridSize(QtCore.QSize(25,25)) self.setMovement(QtWidgets.QListView.Static) self.setAcceptDrops(False) self.setDropIndicatorShown(True) self.setResizeMode(QtWidgets.QListView.Adjust) self.setUniformItemSizes(True) self.setBackgroundRole(QtGui.QPalette.BrightText) self.setMouseTracking(True) self.setSelectionMode(QtWidgets.QAbstractItemView.ExtendedSelection) self.setItemDelegate(self.TileItemDelegate())
Example #3
Source File: first.py From FIRST-plugin-ida with GNU General Public License v2.0 | 6 votes |
def populate_main_form(self): list_view = QtWidgets.QListView() list_view.setFixedWidth(115) list_view.setModel(self.views_model) select = QtCore.QItemSelectionModel.Select list_view.selectionModel().select(self.views_model.createIndex(0, 0), select) list_view.clicked.connect(self.view_clicked) current_view = QtWidgets.QWidget() view = self.view_about() if not view: view = QtWidgets.QBoxLayout() current_view.setLayout(view) self.splitter = QtWidgets.QSplitter(Qt.Horizontal) self.splitter.addWidget(list_view) self.splitter.addWidget(current_view) self.splitter.setChildrenCollapsible(False) self.splitter.show() outer_layout = QtWidgets.QHBoxLayout() outer_layout.addWidget(self.splitter) self.parent.setLayout(outer_layout)
Example #4
Source File: widgets.py From Lector with GNU General Public License v3.0 | 6 votes |
def __init__(self, main_window, parent): super(DragDropListView, self).__init__(parent) self.main_window = main_window self.setAcceptDrops(True) self.setDragDropMode(QtWidgets.QAbstractItemView.InternalMove) self.setSelectionMode(QtWidgets.QAbstractItemView.ExtendedSelection) self.setResizeMode(QtWidgets.QListView.Fixed) self.setLayoutMode(QtWidgets.QListView.SinglePass) self.setViewMode(QtWidgets.QListView.IconMode) self.setEditTriggers(QtWidgets.QAbstractItemView.NoEditTriggers) self.setProperty("showDropIndicator", False) self.setProperty("isWrapping", True) self.setFrameShape(QtWidgets.QFrame.NoFrame) self.setUniformItemSizes(True) self.setWordWrap(True) self.setObjectName("listView")
Example #5
Source File: configurator.py From awesometts-anki-addon with GNU General Public License v3.0 | 6 votes |
def accept(self): """Saves state on inputs; rough opposite of show().""" for list_view in self.findChildren(QtWidgets.QListView): for editor in list_view.findChildren(QtWidgets.QWidget, 'editor'): list_view.commitData(editor) # if an editor is open, save it self._addon.config.update({ widget.objectName(): ( widget.isChecked() if isinstance(widget, Checkbox) else widget.atts_value if isinstance(widget, QtWidgets.QPushButton) else widget.value() if isinstance(widget, QtWidgets.QSpinBox) else widget.itemData(widget.currentIndex()) if isinstance( widget, QtWidgets.QComboBox) else [ i for i in widget.model().raw_data if i['compiled'] and 'bad_replace' not in i ] if isinstance(widget, QtWidgets.QListView) else widget.text() ) for widget in self.findChildren(self._PROPERTY_WIDGETS) if widget.objectName() in self._PROPERTY_KEYS }) super(Configurator, self).accept()
Example #6
Source File: Combobox.py From COMTool with GNU Lesser General Public License v3.0 | 5 votes |
def __init__(self): QComboBox.__init__(self) listView = QListView() self.setView(listView) return
Example #7
Source File: ui_sequence.py From ETS2Autopilot with MIT License | 5 votes |
def setupUi(self, MainWindow): MainWindow.setObjectName("MainWindow") MainWindow.resize(462, 431) self.list_images = QtWidgets.QListView(MainWindow) self.list_images.setGeometry(QtCore.QRect(10, 10, 180, 371)) self.list_images.setObjectName("list_images") self.b_delete = QtWidgets.QPushButton(MainWindow) self.b_delete.setGeometry(QtCore.QRect(10, 390, 180, 30)) self.b_delete.setObjectName("b_delete") self.captured_image = QtWidgets.QLabel(MainWindow) self.captured_image.setGeometry(QtCore.QRect(200, 10, 250, 100)) self.captured_image.setFrameShape(QtWidgets.QFrame.Box) self.captured_image.setText("") self.captured_image.setObjectName("captured_image") self.b_save = QtWidgets.QPushButton(MainWindow) self.b_save.setGeometry(QtCore.QRect(360, 390, 95, 30)) self.b_save.setObjectName("b_save") self.groupBox = QtWidgets.QGroupBox(MainWindow) self.groupBox.setGeometry(QtCore.QRect(200, 180, 141, 151)) self.groupBox.setObjectName("groupBox") self.b_noIndicator = QtWidgets.QPushButton(self.groupBox) self.b_noIndicator.setGeometry(QtCore.QRect(10, 30, 121, 30)) self.b_noIndicator.setObjectName("b_noIndicator") self.b_leftIndicator = QtWidgets.QPushButton(self.groupBox) self.b_leftIndicator.setGeometry(QtCore.QRect(10, 70, 121, 30)) self.b_leftIndicator.setObjectName("b_leftIndicator") self.b_rightIndicator = QtWidgets.QPushButton(self.groupBox) self.b_rightIndicator.setGeometry(QtCore.QRect(10, 110, 121, 30)) self.b_rightIndicator.setObjectName("b_rightIndicator") self.retranslateUi(MainWindow) QtCore.QMetaObject.connectSlotsByName(MainWindow)
Example #8
Source File: puzzle.py From Miyamoto with GNU General Public License v3.0 | 5 votes |
def __init__(self, parent=None): super(objectList, self).__init__(parent) self.setViewMode(QtWidgets.QListView.IconMode) self.setIconSize(QtCore.QSize(96,96)) self.setGridSize(QtCore.QSize(114,114)) self.setMovement(QtWidgets.QListView.Static) self.setBackgroundRole(QtGui.QPalette.BrightText) self.setWrapping(False) self.setMinimumHeight(140) self.setMaximumHeight(140)
Example #9
Source File: groups.py From awesometts-anki-addon with GNU General Public License v3.0 | 5 votes |
def _pull_presets(self): """Update current group's presets.""" name = self._current_group if not name or name not in self._groups: return list_view = self.findChild(QtWidgets.QListView, 'presets') for editor in list_view.findChildren(QtWidgets.QWidget, 'editor'): list_view.commitData(editor) # if an editor is open, save it self._groups[name]['presets'] = list_view.model().raw_data
Example #10
Source File: saveds.py From IDAngr with BSD 2-Clause "Simplified" License | 5 votes |
def setupUi(self, IDAngrSavedsDialog): IDAngrSavedsDialog.setObjectName("IDAngrSavedsDialog") IDAngrSavedsDialog.resize(941, 569) self.gridLayout = QtWidgets.QGridLayout(IDAngrSavedsDialog) self.gridLayout.setObjectName("gridLayout") self.splitter = QtWidgets.QSplitter(IDAngrSavedsDialog) self.splitter.setOrientation(QtCore.Qt.Horizontal) self.splitter.setObjectName("splitter") self.selectorList = QtWidgets.QListView(self.splitter) self.selectorList.setMaximumSize(QtCore.QSize(270, 16777215)) self.selectorList.setEditTriggers(QtWidgets.QAbstractItemView.NoEditTriggers) self.selectorList.setObjectName("selectorList") self.codeView = QtWidgets.QPlainTextEdit(self.splitter) self.codeView.setReadOnly(True) self.codeView.setObjectName("codeView") self.gridLayout.addWidget(self.splitter, 0, 0, 1, 1) self.buttonBox = QtWidgets.QDialogButtonBox(IDAngrSavedsDialog) self.buttonBox.setMaximumSize(QtCore.QSize(16777215, 48)) self.buttonBox.setOrientation(QtCore.Qt.Horizontal) self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Cancel|QtWidgets.QDialogButtonBox.Ok) self.buttonBox.setObjectName("buttonBox") self.gridLayout.addWidget(self.buttonBox, 1, 0, 1, 1) self.retranslateUi(IDAngrSavedsDialog) self.buttonBox.accepted.connect(IDAngrSavedsDialog.accept) self.buttonBox.rejected.connect(IDAngrSavedsDialog.reject) QtCore.QMetaObject.connectSlotsByName(IDAngrSavedsDialog)
Example #11
Source File: Combobox.py From kflash_gui with GNU Lesser General Public License v3.0 | 5 votes |
def __init__(self): QComboBox.__init__(self) listView = QListView() self.setView(listView) return
Example #12
Source File: dockwidgets.py From Lector with GNU General Public License v3.0 | 5 votes |
def create_widgets(self): self.annotationListView.setEditTriggers(QtWidgets.QListView.NoEditTriggers) self.annotationListView.doubleClicked.connect( self.parent.contentView.toggle_annotation_mode) # Add widget to side dock self.parent.sideDockTabWidget.addTab( self.annotationListView, self.annotations_string)
Example #13
Source File: dockwidgets.py From Lector with GNU General Public License v3.0 | 5 votes |
def __init__(self, parent): self.parent = parent self.parentTab = self.parent.parent self.annotationListView = QtWidgets.QListView(self.parent) self._translate = QtCore.QCoreApplication.translate self.annotations_string = self._translate('SideDock', 'Annotations') self.create_widgets()
Example #14
Source File: configurator.py From awesometts-anki-addon with GNU General Public License v3.0 | 4 votes |
def show(self, *args, **kwargs): """Restores state on inputs; rough opposite of the accept().""" for widget, value in [ (widget, self._addon.config[widget.objectName()]) for widget in self.findChildren(self._PROPERTY_WIDGETS) if widget.objectName() in self._PROPERTY_KEYS ]: if isinstance(widget, Checkbox): widget.setChecked(value) widget.stateChanged.emit(value) elif isinstance(widget, QtWidgets.QLineEdit): widget.setText(value) elif isinstance(widget, QtWidgets.QPushButton): widget.atts_value = value widget.setText(key_combo_desc(widget.atts_value)) elif isinstance(widget, QtWidgets.QComboBox): widget.setCurrentIndex(max(widget.findData(value), 0)) elif isinstance(widget, QtWidgets.QSpinBox): widget.setValue(value) elif isinstance(widget, QtWidgets.QListView): widget.setModel(value) widget = self.findChild(QtWidgets.QPushButton, 'on_cache') widget.atts_list = ( [filename for filename in os.listdir(self._addon.paths.cache)] if os.path.isdir(self._addon.paths.cache) else [] ) if widget.atts_list: widget.setEnabled(True) widget.setText("Delete Files (%s)" % locale("%d", len(widget.atts_list), grouping=True)) else: widget.setEnabled(False) widget.setText("Delete Files") widget = self.findChild(QtWidgets.QPushButton, 'on_forget') fail_count = self._addon.router.get_failure_count() if fail_count: widget.setEnabled(True) widget.setText("Forget Failures (%s)" % locale("%d", fail_count, grouping=True)) else: widget.setEnabled(False) widget.setText("Forget Failures") super(Configurator, self).show(*args, **kwargs)
Example #15
Source File: AddRedditObjectDialog.py From DownloaderForReddit with GNU General Public License v3.0 | 4 votes |
def __init__(self, object_type, parent=None): """ A dialog that opens to allow for the user to add a new reddit username to the username list. An instance of this class is also used as a dialog to add subreddits, but two object names are overwritten. This dialog is basically a standard input dialog, but with the addition of a third button that allows the user to add more than one name without closing the dialog. Shortcut keys have also been added to facilitate ease of use """ QtWidgets.QDialog.__init__(self, parent=parent) self.setupUi(self) self.logger = logging.getLogger('DownloaderForReddit.%s' % __name__) self.settings_manager = Injector.get_settings_manager() self.object_type = object_type self.layout_style = 'SINGLE' self.object_name_list_view = QtWidgets.QListView() self.object_name_list_view.setSelectionMode(QtWidgets.QAbstractItemView.ExtendedSelection) self.object_name_list_model = AddRedditObjectListModel(self.object_type, self) self.object_name_list_model.name_list_updated.connect(self.name_count_updated) self.object_name_list_view.setModel(self.object_name_list_model) self.name_count_label = QtWidgets.QLabel() self.add_to_list_button = QtWidgets.QToolButton() self.add_to_list_button.setText('+') self.add_to_list_button.clicked.connect(self.add_name_to_list) self.remove_from_list_button = QtWidgets.QToolButton() self.remove_from_list_button.setText('-') self.remove_from_list_button.clicked.connect(self.remove_name_from_list) self.button_layout = QtWidgets.QHBoxLayout() self.button_layout.addWidget(self.name_count_label) self.button_layout.addWidget(self.add_to_list_button) self.button_layout.addWidget(self.remove_from_list_button) self.list_layout = QtWidgets.QVBoxLayout() self.list_layout.addWidget(self.object_name_list_view) self.list_layout.addLayout(self.button_layout) self.name = None self.init_download_on_add_checkbox() self.download_on_add_checkbox.toggled.connect(self.toggle_download_on_add_checkbox) self.ok_cancel_button_box.accepted.connect(self.accept) self.ok_cancel_button_box.rejected.connect(self.close) self.object_name_line_edit.textChanged.connect(self.check_line_edit_text) self.setContextMenuPolicy(QtCore.Qt.CustomContextMenu) self.customContextMenuRequested.connect(lambda: self.show_context_menu(False)) self.object_name_line_edit.setContextMenuPolicy(QtCore.Qt.CustomContextMenu) self.object_name_line_edit.customContextMenuRequested.connect(lambda: self.show_context_menu(True))
Example #16
Source File: list_models.py From Mastering-GUI-Programming-with-Python with MIT License | 4 votes |
def __init__(self): """MainWindow constructor. This widget will be our main window. We'll define all the UI components in here. """ super().__init__() # Main UI code goes here self.setLayout(qtw.QVBoxLayout()) data = [ 'Hamburger', 'Cheeseburger', 'Chicken Nuggets', 'Hot Dog', 'Fish Sandwich' ] listwidget = qtw.QListWidget() listwidget.addItems(data) combobox = qtw.QComboBox() combobox.addItems(data) self.layout().addWidget(listwidget) self.layout().addWidget(combobox) # make the list widget editable for i in range(listwidget.count()): item = listwidget.item(i) item.setFlags(item.flags() | qtc.Qt.ItemIsEditable) # The same, but with a model model = qtc.QStringListModel(data) listview = qtw.QListView() listview.setModel(model) model_combobox = qtw.QComboBox() model_combobox.setModel(model) self.layout().addWidget(listview) self.layout().addWidget(model_combobox) # End main UI code self.show()
Example #17
Source File: Ui_MainWindow.py From PyQt with GNU General Public License v3.0 | 4 votes |
def setupUi(self, MainWindow): MainWindow.setObjectName("MainWindow") MainWindow.resize(486, 313) MainWindow.setStyleSheet("QListView::item:alternate {\n" " \n" " background-color: rgb(85, 255, 255);\n" "}") MainWindow.setTabShape(QtWidgets.QTabWidget.Rounded) MainWindow.setDockOptions(QtWidgets.QMainWindow.AllowTabbedDocks|QtWidgets.QMainWindow.AnimatedDocks) self.centralWidget = QtWidgets.QWidget(MainWindow) self.centralWidget.setObjectName("centralWidget") self.verticalLayout = QtWidgets.QGridLayout(self.centralWidget) self.verticalLayout.setObjectName("verticalLayout") self.l3 = QtWidgets.QLineEdit(self.centralWidget) self.l3.setObjectName("l3") self.verticalLayout.addWidget(self.l3, 6, 0, 1, 1) self.l1 = QtWidgets.QLineEdit(self.centralWidget) self.l1.setObjectName("l1") self.verticalLayout.addWidget(self.l1, 4, 0, 1, 1) self.l2 = QtWidgets.QLineEdit(self.centralWidget) self.l2.setObjectName("l2") self.verticalLayout.addWidget(self.l2, 5, 0, 1, 1) self.pre_btn = QtWidgets.QPushButton(self.centralWidget) self.pre_btn.setObjectName("pre_btn") self.verticalLayout.addWidget(self.pre_btn, 1, 0, 1, 1) self.tableView = QtWidgets.QTableView(self.centralWidget) self.tableView.setObjectName("tableView") self.verticalLayout.addWidget(self.tableView, 0, 0, 1, 1) self.next_btn = QtWidgets.QPushButton(self.centralWidget) self.next_btn.setObjectName("next_btn") self.verticalLayout.addWidget(self.next_btn, 2, 0, 1, 1) self.listView = QtWidgets.QListView(self.centralWidget) self.listView.setObjectName("listView") self.verticalLayout.addWidget(self.listView, 0, 1, 1, 1) self.sub_btn = QtWidgets.QPushButton(self.centralWidget) self.sub_btn.setObjectName("sub_btn") self.verticalLayout.addWidget(self.sub_btn, 3, 0, 1, 1) self.l4 = QtWidgets.QLineEdit(self.centralWidget) self.l4.setObjectName("l4") self.verticalLayout.addWidget(self.l4, 7, 0, 1, 1) self.l5 = QtWidgets.QLineEdit(self.centralWidget) self.l5.setObjectName("l5") self.verticalLayout.addWidget(self.l5, 8, 0, 1, 1) MainWindow.setCentralWidget(self.centralWidget) self.saveaction = QtWidgets.QAction(MainWindow) self.saveaction.setObjectName("saveaction") self.action12 = QtWidgets.QAction(MainWindow) self.action12.setObjectName("action12") self.actionas = QtWidgets.QAction(MainWindow) self.actionas.setObjectName("actionas") self.actiondz = QtWidgets.QAction(MainWindow) self.actiondz.setObjectName("actiondz") self.actiongc = QtWidgets.QAction(MainWindow) self.actiongc.setObjectName("actiongc") self.actiondb = QtWidgets.QAction(MainWindow) self.actiondb.setObjectName("actiondb") self.retranslateUi(MainWindow) QtCore.QMetaObject.connectSlotsByName(MainWindow)
Example #18
Source File: ui_plugins.py From urh with GNU General Public License v3.0 | 4 votes |
def setupUi(self, FramePlugins): FramePlugins.setObjectName("FramePlugins") FramePlugins.resize(806, 683) self.verticalLayout_3 = QtWidgets.QVBoxLayout(FramePlugins) self.verticalLayout_3.setObjectName("verticalLayout_3") self.horizontalLayout = QtWidgets.QHBoxLayout() self.horizontalLayout.setObjectName("horizontalLayout") self.verticalLayout_2 = QtWidgets.QVBoxLayout() self.verticalLayout_2.setObjectName("verticalLayout_2") self.label = QtWidgets.QLabel(FramePlugins) self.label.setObjectName("label") self.verticalLayout_2.addWidget(self.label) self.listViewPlugins = QtWidgets.QListView(FramePlugins) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.MinimumExpanding) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.listViewPlugins.sizePolicy().hasHeightForWidth()) self.listViewPlugins.setSizePolicy(sizePolicy) self.listViewPlugins.setObjectName("listViewPlugins") self.verticalLayout_2.addWidget(self.listViewPlugins) self.horizontalLayout.addLayout(self.verticalLayout_2) self.verticalLayout = QtWidgets.QVBoxLayout() self.verticalLayout.setObjectName("verticalLayout") self.label_2 = QtWidgets.QLabel(FramePlugins) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Preferred) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.label_2.sizePolicy().hasHeightForWidth()) self.label_2.setSizePolicy(sizePolicy) self.label_2.setObjectName("label_2") self.verticalLayout.addWidget(self.label_2) self.txtEditPluginDescription = QtWidgets.QTextEdit(FramePlugins) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.txtEditPluginDescription.sizePolicy().hasHeightForWidth()) self.txtEditPluginDescription.setSizePolicy(sizePolicy) self.txtEditPluginDescription.setReadOnly(True) self.txtEditPluginDescription.setPlaceholderText("") self.txtEditPluginDescription.setObjectName("txtEditPluginDescription") self.verticalLayout.addWidget(self.txtEditPluginDescription) self.horizontalLayout.addLayout(self.verticalLayout) self.verticalLayout_3.addLayout(self.horizontalLayout) self.groupBoxSettings = QtWidgets.QGroupBox(FramePlugins) sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Expanding) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.groupBoxSettings.sizePolicy().hasHeightForWidth()) self.groupBoxSettings.setSizePolicy(sizePolicy) self.groupBoxSettings.setMaximumSize(QtCore.QSize(16777215, 16777215)) self.groupBoxSettings.setObjectName("groupBoxSettings") self.verticalLayout_3.addWidget(self.groupBoxSettings) self.retranslateUi(FramePlugins)