本文整理汇总了Python中PySide2.QtWidgets.QListWidget方法的典型用法代码示例。如果您正苦于以下问题:Python QtWidgets.QListWidget方法的具体用法?Python QtWidgets.QListWidget怎么用?Python QtWidgets.QListWidget使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PySide2.QtWidgets
的用法示例。
在下文中一共展示了QtWidgets.QListWidget方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: keyPressEvent
# 需要导入模块: from PySide2 import QtWidgets [as 别名]
# 或者: from PySide2.QtWidgets import QListWidget [as 别名]
def keyPressEvent(self, event):
key = event.key()
if key == QtCore.Qt.Key_Delete:
item = self.selectedItems()[0]
row = self.row(item)
self.takeItem(row)
for airfoil in self.parent.airfoils:
if item.text() == airfoil.name:
name = airfoil.name
self.parent.slots.removeAirfoil(name=name)
break
# call original implementation of QListWidget keyPressEvent handler
super().keyPressEvent(event)
示例2: setupUi
# 需要导入模块: from PySide2 import QtWidgets [as 别名]
# 或者: from PySide2.QtWidgets import QListWidget [as 别名]
def setupUi(self, ExcelSelectionDialog):
ExcelSelectionDialog.setObjectName("ExcelSelectionDialog")
ExcelSelectionDialog.resize(272, 229)
ExcelSelectionDialog.setMaximumSize(QtCore.QSize(272, 229))
ExcelSelectionDialog.setModal(True)
self.verticalLayout = QtWidgets.QVBoxLayout(ExcelSelectionDialog)
self.verticalLayout.setObjectName("verticalLayout")
self.sheets_list = QtWidgets.QListWidget(ExcelSelectionDialog)
self.sheets_list.setFrameShape(QtWidgets.QFrame.StyledPanel)
self.sheets_list.setObjectName("sheets_list")
self.verticalLayout.addWidget(self.sheets_list)
self.buttonBox = QtWidgets.QDialogButtonBox(ExcelSelectionDialog)
self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Cancel|QtWidgets.QDialogButtonBox.Ok)
self.buttonBox.setObjectName("buttonBox")
self.verticalLayout.addWidget(self.buttonBox)
self.retranslateUi(ExcelSelectionDialog)
self.buttonBox.accepted.connect(ExcelSelectionDialog.accept)
self.buttonBox.rejected.connect(ExcelSelectionDialog.reject)
QtCore.QMetaObject.connectSlotsByName(ExcelSelectionDialog)
示例3: __init__
# 需要导入模块: from PySide2 import QtWidgets [as 别名]
# 或者: from PySide2.QtWidgets import QListWidget [as 别名]
def __init__(self, parent):
QtWidgets.QDialog.__init__(self, parent)
self.setWindowTitle("Copy bounding box")
self.labelFrom = QtWidgets.QLabel("From")
self.labelTo = QtWidgets.QLabel("To")
self.fromChunk = QtWidgets.QComboBox()
for chunk in Metashape.app.document.chunks:
self.fromChunk.addItem(chunk.label)
self.toChunks = QtWidgets.QListWidget()
self.toChunks.setSelectionMode(QtWidgets.QAbstractItemView.ExtendedSelection)
for chunk in Metashape.app.document.chunks:
self.toChunks.addItem(chunk.label)
self.btnOk = QtWidgets.QPushButton("Ok")
self.btnOk.setFixedSize(90, 50)
self.btnOk.setToolTip("Copy bounding box to all selected chunks")
self.btnQuit = QtWidgets.QPushButton("Close")
self.btnQuit.setFixedSize(90, 50)
layout = QtWidgets.QGridLayout() # creating layout
layout.addWidget(self.labelFrom, 0, 0)
layout.addWidget(self.fromChunk, 0, 1)
layout.addWidget(self.labelTo, 0, 2)
layout.addWidget(self.toChunks, 0, 3)
layout.addWidget(self.btnOk, 1, 1)
layout.addWidget(self.btnQuit, 1, 3)
self.setLayout(layout)
QtCore.QObject.connect(self.btnOk, QtCore.SIGNAL("clicked()"), self.copyBoundingBox)
QtCore.QObject.connect(self.btnQuit, QtCore.SIGNAL("clicked()"), self, QtCore.SLOT("reject()"))
self.exec()
示例4: __init__
# 需要导入模块: from PySide2 import QtWidgets [as 别名]
# 或者: from PySide2.QtWidgets import QListWidget [as 别名]
def __init__(self, root: Directory, parent: QObject = None):
"""
:param root: root of all directories. Directories in root will be displayed with drive icons.
:param parent: parent object.
"""
super().__init__(parent)
self.root = root
self.breadcrumbLabel = QLabel()
self.titleLabel = QLabel()
self.titleLabel.setStyleSheet("font-weight: bold")
self.titleSeparator: QFrame = QFrame()
self.titleSeparator.setFrameShape(QFrame.HLine)
self.listWidget = QListWidget()
self.listWidget.setSortingEnabled(True)
self.listWidget.setContextMenuPolicy(Qt.CustomContextMenu)
self.listWidget.customContextMenuRequested.connect(self.onCustomContextMenu)
self.verticalLayout = QVBoxLayout()
self.verticalLayout.addWidget(self.breadcrumbLabel)
self.verticalLayout.addWidget(self.listWidget)
self.setLayout(self.verticalLayout)
self.listWidget.itemDoubleClicked.connect(self.onItemDoubleClicked)
self.currentPath: Path = Path("/")
self.currentDirectory: Directory = root
self.listCurrentDirectory()
self.currentDirectory.addObserver(self)
示例5: setupUi
# 需要导入模块: from PySide2 import QtWidgets [as 别名]
# 或者: from PySide2.QtWidgets import QListWidget [as 别名]
def setupUi(self, MainWindow):
MainWindow.setObjectName("MainWindow")
MainWindow.resize(476, 263)
self.centralwidget = QtWidgets.QWidget(MainWindow)
self.centralwidget.setObjectName("centralwidget")
self.searchButton = QtWidgets.QPushButton(self.centralwidget)
self.searchButton.setGeometry(QtCore.QRect(340, 10, 131, 31))
self.searchButton.setObjectName("searchButton")
self.selectAll = QtWidgets.QPushButton(self.centralwidget)
self.selectAll.setGeometry(QtCore.QRect(340, 55, 131, 31))
self.selectAll.setObjectName("selectAll")
self.deselectAll = QtWidgets.QPushButton(self.centralwidget)
self.deselectAll.setGeometry(QtCore.QRect(340, 90, 131, 31))
self.deselectAll.setObjectName("deselectAll")
self.line = QtWidgets.QFrame(self.centralwidget)
self.line.setGeometry(QtCore.QRect(340, 35, 131, 31))
self.line.setFrameShape(QtWidgets.QFrame.HLine)
self.line.setFrameShadow(QtWidgets.QFrame.Sunken)
self.line.setObjectName("line")
self.downloadButton = QtWidgets.QPushButton(self.centralwidget)
self.downloadButton.setGeometry(QtCore.QRect(340, 220, 131, 31))
self.downloadButton.setObjectName("downloadButton")
self.animeView = QtWidgets.QListWidget(self.centralwidget)
self.animeView.setGeometry(QtCore.QRect(10, 50, 321, 201))
self.animeView.setObjectName("animeView")
self.searchField = QtWidgets.QLineEdit(self.centralwidget)
self.searchField.setGeometry(QtCore.QRect(10, 10, 321, 31))
self.searchField.setObjectName("searchField")
self.loadingStatus = QtWidgets.QLabel(self.centralwidget)
self.loadingStatus.setEnabled(True)
self.loadingStatus.setGeometry(QtCore.QRect(340, 160, 131, 20))
font = QtGui.QFont()
font.setFamily("Segoe UI")
font.setPointSize(11)
font.setWeight(75)
font.setBold(True)
self.loadingStatus.setFont(font)
self.loadingStatus.setAlignment(QtCore.Qt.AlignCenter)
self.loadingStatus.setObjectName("loadingStatus")
self.selectQuality = QtWidgets.QComboBox(self.centralwidget)
self.selectQuality.setGeometry(QtCore.QRect(340, 190, 131, 22))
self.selectQuality.setObjectName("selectQuality")
self.intellTurn = QtWidgets.QCheckBox(self.centralwidget)
self.intellTurn.setGeometry(QtCore.QRect(340, 130, 131, 17))
self.intellTurn.setObjectName("intellTurn")
MainWindow.setCentralWidget(self.centralwidget)
self.retranslateUi(MainWindow)
QtCore.QMetaObject.connectSlotsByName(MainWindow)