本文整理汇总了Python中PySide.QtGui.QListWidget方法的典型用法代码示例。如果您正苦于以下问题:Python QtGui.QListWidget方法的具体用法?Python QtGui.QListWidget怎么用?Python QtGui.QListWidget使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PySide.QtGui
的用法示例。
在下文中一共展示了QtGui.QListWidget方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: setupUi
# 需要导入模块: from PySide import QtGui [as 别名]
# 或者: from PySide.QtGui import QListWidget [as 别名]
def setupUi(self, Form):
Form.setObjectName("Form")
Form.resize(241, 367)
self.gridLayout = QtGui.QGridLayout(Form)
self.gridLayout.setSpacing(0)
self.gridLayout.setObjectName("gridLayout")
self.label = QtGui.QLabel(Form)
self.label.setObjectName("label")
self.gridLayout.addWidget(self.label, 0, 0, 1, 3)
self.itemTree = QtGui.QTreeWidget(Form)
self.itemTree.setObjectName("itemTree")
self.itemTree.headerItem().setText(0, "1")
self.itemTree.header().setVisible(False)
self.gridLayout.addWidget(self.itemTree, 1, 0, 1, 3)
self.label_2 = QtGui.QLabel(Form)
self.label_2.setObjectName("label_2")
self.gridLayout.addWidget(self.label_2, 2, 0, 1, 3)
self.formatList = QtGui.QListWidget(Form)
self.formatList.setObjectName("formatList")
self.gridLayout.addWidget(self.formatList, 3, 0, 1, 3)
self.exportBtn = QtGui.QPushButton(Form)
self.exportBtn.setObjectName("exportBtn")
self.gridLayout.addWidget(self.exportBtn, 6, 1, 1, 1)
self.closeBtn = QtGui.QPushButton(Form)
self.closeBtn.setObjectName("closeBtn")
self.gridLayout.addWidget(self.closeBtn, 6, 2, 1, 1)
self.paramTree = ParameterTree(Form)
self.paramTree.setObjectName("paramTree")
self.paramTree.headerItem().setText(0, "1")
self.paramTree.header().setVisible(False)
self.gridLayout.addWidget(self.paramTree, 5, 0, 1, 3)
self.label_3 = QtGui.QLabel(Form)
self.label_3.setObjectName("label_3")
self.gridLayout.addWidget(self.label_3, 4, 0, 1, 3)
self.copyBtn = QtGui.QPushButton(Form)
self.copyBtn.setObjectName("copyBtn")
self.gridLayout.addWidget(self.copyBtn, 6, 0, 1, 1)
self.retranslateUi(Form)
QtCore.QMetaObject.connectSlotsByName(Form)
示例2: __init__
# 需要导入模块: from PySide import QtGui [as 别名]
# 或者: from PySide.QtGui import QListWidget [as 别名]
def __init__(self, name, config, parent=None):
ActionOption.__init__(self, name, config)
QtGui.QListWidget.__init__(self, parent=parent)
self._choices = config.get('choices', [])
self._multiple = config.get('multiple', False)
self.setToolTip(self.tooltip)
self.addItems(self.choices)
if self.multiple:
self.setSelectionMode(QtGui.QAbstractItemView.ExtendedSelection)
else:
self.setSelectionMode(QtGui.QAbstractItemView.SingleSelection)
if self.multiple:
for text in self.default:
items = self.findItems(text, QtCore.Qt.MatchExactly)
for item in items:
item.setSelected(True)
else:
items = self.findItems(self.default, QtCore.Qt.MatchExactly)
for item in items:
item.setSelected(True)
self.itemSelectionChanged.connect(lambda: self.value_changed.emit())
# -----------------------------------------------------------------------------
示例3: __init__
# 需要导入模块: from PySide import QtGui [as 别名]
# 或者: from PySide.QtGui import QListWidget [as 别名]
def __init__(self, *args, **kwargs):
QtGui.QListWidget.__init__(self)
self.multiselect = 0
Custom.__init__(self, *args, **kwargs)
self._source = ''
示例4: drawUI
# 需要导入模块: from PySide import QtGui [as 别名]
# 或者: from PySide.QtGui import QListWidget [as 别名]
def drawUI(self):
# Our main window is a QDialog
# make this dialog stay above the others, always visible
self.setWindowFlags( QtCore.Qt.WindowStaysOnTopHint )
self.setModal(False)
self.setWindowTitle('Insert a Part')
self.setWindowIcon( QtGui.QIcon( os.path.join( Asm4.iconPath , 'FreeCad.svg' ) ) )
self.setMinimumSize(400, 500)
self.resize(400,500)
# Define the individual widgets
# The part list is a QListWidget
self.partList = QtGui.QListWidget(self)
# Create a line that will contain the name of the link (in the tree)
self.linkNameInput = QtGui.QLineEdit(self)
# Cancel button
self.cancelButton = QtGui.QPushButton('Cancel', self)
# Insert Link button
self.insertButton = QtGui.QPushButton('Insert', self)
self.insertButton.setDefault(True)
# Place the widgets with layouts
self.mainLayout = QtGui.QVBoxLayout(self)
self.mainLayout.addWidget(QtGui.QLabel("Select Part to be inserted :"))
self.mainLayout.addWidget(self.partList)
self.mainLayout.addWidget(QtGui.QLabel("Enter a Name for the link :\n(Must be unique in the Model tree)"))
self.mainLayout.addWidget(self.linkNameInput)
self.mainLayout.addWidget(QtGui.QLabel(' '))
self.buttonsLayout = QtGui.QHBoxLayout(self)
self.buttonsLayout.addWidget(self.cancelButton)
self.buttonsLayout.addStretch()
self.buttonsLayout.addWidget(self.insertButton)
self.mainLayout.addLayout(self.buttonsLayout)
self.setLayout(self.mainLayout)
# Actions
self.cancelButton.clicked.connect(self.onCancel)
self.insertButton.clicked.connect(self.onCreateLink)
self.partList.itemClicked.connect( self.onItemClicked)
示例5: __init__
# 需要导入模块: from PySide import QtGui [as 别名]
# 或者: from PySide.QtGui import QListWidget [as 别名]
def __init__(self):
super(Gui, self).__init__()
self.resize(250, 300)
self._list = QtGui.QListWidget(self)
self._button1 = QtGui.QPushButton("Test CallbackEvent", self)
self._button2 = QtGui.QPushButton("Test CallbackPool", self)
layout = QtGui.QVBoxLayout(self)
layout.setSpacing(2)
layout.addWidget(self._button1)
line = QtGui.QFrame(self)
line.setFrameStyle(line.HLine)
layout.addSpacing(6)
layout.addWidget(line)
layout.addSpacing(6)
layout.addWidget(self._list)
layout.addWidget(self._button2)
self._pool = CallbackThreadPool(4)
self._button1.clicked.connect(self.runCallbackEvents)
self._button2.clicked.connect(self.runCallbackPool)
示例6: dropEvent
# 需要导入模块: from PySide import QtGui [as 别名]
# 或者: from PySide.QtGui import QListWidget [as 别名]
def dropEvent(self, event):
"""
A trivial redefinition of :py:meth:`.QtGui.QListWidget.dropEvent`
that calls the parent `dropEvent` and then calls :py:attr:`~.Subject_List.drop_fn`
Args:
event: A :class:`.QtCore.QEvent` simply forwarded to the superclass.
"""
# call the parent dropEvent to make sure all the list ops happen
super(Subject_List, self).dropEvent(event)
# then we call the drop_fn passed to us
self.drop_fn()
示例7: __init__
# 需要导入模块: from PySide import QtGui [as 别名]
# 或者: from PySide.QtGui import QListWidget [as 别名]
def __init__(self):
QtGui.QWidget.__init__(self)
self.protocol_dir = prefs.PROTOCOLDIR
topLabel = QtGui.QLabel("Protocols:")
# List available protocols
protocol_list = os.listdir(self.protocol_dir)
protocol_list = [os.path.splitext(p)[0] for p in protocol_list]
self.protocol_listbox = QtGui.QListWidget()
self.protocol_listbox.insertItems(0, protocol_list)
self.protocol_listbox.currentItemChanged.connect(self.protocol_changed)
# Make Step combobox
self.step_selection = QtGui.QComboBox()
self.step_selection.currentIndexChanged.connect(self.step_changed)
layout = QtGui.QVBoxLayout()
layout.addWidget(topLabel)
layout.addWidget(self.protocol_listbox)
layout.addWidget(self.step_selection)
self.setLayout(layout)
# Dict to return values
self.values = {}
示例8: drawUI
# 需要导入模块: from PySide import QtGui [as 别名]
# 或者: from PySide.QtGui import QListWidget [as 别名]
def drawUI(self):
# Build the window layout
self.mainLayout = QtGui.QVBoxLayout()
# the name as seen in the tree of the selected link
self.formLayout = QtGui.QFormLayout()
self.FStype = QtGui.QLineEdit()
self.FStype.setReadOnly(True)
self.formLayout.addRow(QtGui.QLabel('Fastener :'),self.FStype)
# combobox showing all available App::Link
self.parentList = QtGui.QComboBox()
self.formLayout.addRow(QtGui.QLabel('Attach to :'),self.parentList)
self.mainLayout.addLayout(self.formLayout)
# the document containing the linked object
self.parentDoc = QtGui.QLineEdit()
self.parentDoc.setReadOnly(True)
self.mainLayout.addWidget(self.parentDoc)
# The list of all attachment LCS in the assembly is a QListWidget
# it is populated only when the parent combo-box is activated
self.mainLayout.addWidget(QtGui.QLabel("Select attachment LCS in parent Part :"))
self.attLCSlist = QtGui.QListWidget()
self.mainLayout.addWidget(self.attLCSlist)
# Rotation Buttons
self.rotButtonsLayout = QtGui.QHBoxLayout()
self.RotXButton = QtGui.QPushButton('Rot X')
self.RotXButton.setToolTip("Rotate the instance around the X axis by 90deg")
self.RotYButton = QtGui.QPushButton('Rot Y')
self.RotYButton.setToolTip("Rotate the instance around the Y axis by 90deg")
self.RotZButton = QtGui.QPushButton('Rot Z')
self.RotZButton.setToolTip("Rotate the instance around the Z axis by 90deg")
# add the buttons
self.rotButtonsLayout.addStretch()
self.rotButtonsLayout.addWidget(self.RotXButton)
self.rotButtonsLayout.addWidget(self.RotYButton)
self.rotButtonsLayout.addWidget(self.RotZButton)
self.rotButtonsLayout.addStretch()
self.mainLayout.addLayout(self.rotButtonsLayout)
# apply the layout to the main window
self.form.setLayout(self.mainLayout)
# Actions
self.parentList.currentIndexChanged.connect( self.onParentList )
self.attLCSlist.itemClicked.connect( self.onDatumClicked )
self.RotXButton.clicked.connect( self.onRotX )
self.RotYButton.clicked.connect( self.onRotY )
self.RotZButton.clicked.connect( self.onRotZ)
示例9: drawUI
# 需要导入模块: from PySide import QtGui [as 别名]
# 或者: from PySide.QtGui import QListWidget [as 别名]
def drawUI(self):
# the layout for the main window is vertical (top to down)
self.mainLayout = QtGui.QVBoxLayout(self.form)
# Selected Datum
self.mainLayout.addWidget(QtGui.QLabel('Selected Datum :'))
self.lscName = QtGui.QLineEdit()
self.lscName.setReadOnly(True)
self.mainLayout.addWidget(self.lscName)
# combobox showing all available App::Link
self.mainLayout.addWidget(QtGui.QLabel('Attach to :'))
self.parentList = QtGui.QComboBox()
self.mainLayout.addWidget(self.parentList)
# the document containing the linked object
self.parentDoc = QtGui.QLineEdit()
self.parentDoc.setReadOnly(True)
self.mainLayout.addWidget(self.parentDoc)
# The list of all attachment LCS in the assembly is a QListWidget
# it is populated only when the parent combo-box is activated
self.mainLayout.addWidget(QtGui.QLabel('Select LCS in Parent :'))
self.attLCSlist = QtGui.QListWidget()
self.mainLayout.addWidget(self.attLCSlist)
# Rot Buttons
self.rotButtonsLayout = QtGui.QHBoxLayout()
# RotX button
self.RotXButton = QtGui.QPushButton('Rot X')
self.RotXButton.setToolTip("Rotate the Datum around the X axis by 90deg")
# RotY button
self.RotYButton = QtGui.QPushButton('Rot Y')
self.RotYButton.setToolTip("Rotate the Datum around the Y axis by 90deg")
# RotZ button
self.RotZButton = QtGui.QPushButton('Rot Z')
self.RotZButton.setToolTip("Rotate the Datum around the Z axis by 90deg")
# add the buttons
self.rotButtonsLayout.addStretch()
self.rotButtonsLayout.addWidget(self.RotXButton)
self.rotButtonsLayout.addWidget(self.RotYButton)
self.rotButtonsLayout.addWidget(self.RotZButton)
self.rotButtonsLayout.addStretch()
self.mainLayout.addLayout(self.rotButtonsLayout)
# apply the layout to the main window
self.form.setLayout(self.mainLayout)
# Actions
self.parentList.currentIndexChanged.connect( self.onParentSelected )
self.attLCSlist.currentItemChanged.connect( self.onDatumSelected )
self.attLCSlist.itemClicked.connect( self.onDatumSelected )
self.RotXButton.clicked.connect( self.onRotX )
self.RotYButton.clicked.connect( self.onRotY )
self.RotZButton.clicked.connect( self.onRotZ)
示例10: PopulateWidget
# 需要导入模块: from PySide import QtGui [as 别名]
# 或者: from PySide.QtGui import QListWidget [as 别名]
def PopulateWidget(self):
signatures_widget = QtWidgets.QFrame()
layout = QtWidgets.QVBoxLayout()
layout.addWidget(QtWidgets.QLabel('Signatures'))
self.signatures_list = QtWidgets.QListWidget()
layout.addWidget(self.signatures_list)
signatures_widget.setLayout(layout)
container2 = QtWidgets.QGridLayout()
container2.addWidget(signatures_widget, 0, 0)
subsignatures_widget = QtWidgets.QFrame()
layout = QtWidgets.QVBoxLayout()
self.subsignatures_list = QtWidgets.QListWidget()
layout.addWidget(QtWidgets.QLabel("LDB subsignatures"))
layout.addWidget(self.subsignatures_list)
subsignatures_widget.setLayout(layout)
container2.addWidget(subsignatures_widget, 0, 1)
#subsignatures_widget.hide()
container3 = QtWidgets.QVBoxLayout()
container3.addLayout(container2)
self.match_label = QtWidgets.QLabel()
container3.addWidget(self.match_label)
self.signature_line_edit = QtWidgets.QLineEdit()
container3.addWidget(self.signature_line_edit)
container4 = QtWidgets.QHBoxLayout()
container3.addLayout(container4)
add_signature_button = QtWidgets.QPushButton("Add signature")
remove_signature_button = QtWidgets.QPushButton("Remove signature")
container4.addWidget(add_signature_button)
container4.addWidget(remove_signature_button)
self.signature_line_edit.returnPressed.connect(self.add_signature)
add_signature_button.clicked.connect(self.add_signature)
remove_signature_button.clicked.connect(self.remove_signature)
self.signatures_list.itemActivated.connect(self.signature_selected)
self.subsignatures_list.itemActivated.connect(self.subsignature_selected)
item = QtWidgets.QListWidgetItem("Clear selection")
item.parsed_signature = None
self.signatures_list.addItem(item)
self.setLayout(container3)