本文整理匯總了Python中PySide.QtGui.QFormLayout.addRow方法的典型用法代碼示例。如果您正苦於以下問題:Python QFormLayout.addRow方法的具體用法?Python QFormLayout.addRow怎麽用?Python QFormLayout.addRow使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類PySide.QtGui.QFormLayout
的用法示例。
在下文中一共展示了QFormLayout.addRow方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: FormWidget
# 需要導入模塊: from PySide.QtGui import QFormLayout [as 別名]
# 或者: from PySide.QtGui.QFormLayout import addRow [as 別名]
class FormWidget(QWidget):
def __init__(self, parent=None, submit_callback=None, inputs=None):
super(FormWidget, self).__init__(parent)
if inputs is None:
inputs = {}
self.submit_callback = submit_callback
self.form = QFormLayout()
self.inputs = {}
for key in inputs:
self.inputs[key] = QLineEdit()
self.form.addRow(QLabel(key), self.inputs[key])
self.submitButton = QPushButton("Submit")
self.submitButton.clicked.connect(self.button_pushed)
self.form.addRow(self.submitButton)
self.setLayout(self.form)
def button_pushed(self, checked):
if self.submit_callback:
values = {key: self.inputs[key].text()
for key in self.inputs}
self.submit_callback(values)
示例2: __init__
# 需要導入模塊: from PySide.QtGui import QFormLayout [as 別名]
# 或者: from PySide.QtGui.QFormLayout import addRow [as 別名]
def __init__(self, parameter, parent=None):
_ParameterWidget.__init__(self, parameter, parent)
# Widgets
self._lbl_u = QLabel('u')
self._lbl_u.setStyleSheet("color: blue")
self._txt_u = MultiNumericalLineEdit()
self._lbl_v = QLabel('v')
self._lbl_v.setStyleSheet("color: blue")
self._txt_v = MultiNumericalLineEdit()
self._lbl_w = QLabel('w')
self._lbl_w.setStyleSheet("color: blue")
self._txt_w = MultiNumericalLineEdit()
# Layouts
layout = QFormLayout()
layout.setContentsMargins(0, 0, 0, 0)
if sys.platform == 'darwin': # Fix for Mac OS
layout.setFieldGrowthPolicy(QFormLayout.FieldGrowthPolicy.ExpandingFieldsGrow)
layout.addRow(self._lbl_u, self._txt_u)
layout.addRow(self._lbl_v, self._txt_v)
layout.addRow(self._lbl_w, self._txt_w)
self.setLayout(layout)
# Signals
self.valuesChanged.connect(self._onChanged)
self.validationRequested.connect(self._onChanged)
self._txt_u.textChanged.connect(self.valuesChanged)
self._txt_v.textChanged.connect(self.valuesChanged)
self._txt_w.textChanged.connect(self.valuesChanged)
self.validationRequested.emit()
示例3: _createFormLayout
# 需要導入模塊: from PySide.QtGui import QFormLayout [as 別名]
# 或者: from PySide.QtGui.QFormLayout import addRow [as 別名]
def _createFormLayout(self):
layout = QFormLayout()
layout.setFieldGrowthPolicy(QFormLayout.AllNonFixedFieldsGrow)
obsFormat = self._docFormat.getObservationFormat(self._obs.__class__.__name__)
fields = dict((f.name, f) for f in self._obs.FIELDS)
self._editors = {}
for fieldName in obsFormat.fieldOrder:
field = fields[fieldName]
label = self._getFieldLabel(field)
fieldFormat = obsFormat.getFieldFormat(fieldName)
value = getattr(self._obs, fieldName)
text = fieldFormat.format(value, editing=True)
editor = _FieldValueEditor(self, fieldFormat)
editor.setText(text)
editor.setToolTip(self._getFieldToolTip(field, fieldFormat))
layout.addRow(label, editor)
self._editors[fieldName] = editor
return layout
示例4: __init__
# 需要導入模塊: from PySide.QtGui import QFormLayout [as 別名]
# 或者: from PySide.QtGui.QFormLayout import addRow [as 別名]
def __init__(self):
super(PhoneFrame, self).__init__()
self.setWindowTitle('Phone Book.')
self.name = QLineEdit()
self.number = QLineEdit()
entry = QFormLayout()
entry.addRow(QLabel('Name'), self.name)
entry.addRow(QLabel('Number'), self.number)
buttons = QHBoxLayout()
button = QPushButton('&Add')
button.clicked.connect(self._addEntry)
buttons.addWidget(button)
button = QPushButton('&Update')
button.clicked.connect(self._updateEntry)
buttons.addWidget(button)
button = QPushButton('&Delete')
button.clicked.connect(self._deleteEntry)
buttons.addWidget(button)
dataDisplay = QTableView()
dataDisplay.setModel(PhoneDataModel())
layout = QVBoxLayout()
layout.addLayout(entry)
layout.addLayout(buttons)
layout.addWidget(dataDisplay)
self.setLayout(layout)
self.show()
示例5: __init__
# 需要導入模塊: from PySide.QtGui import QFormLayout [as 別名]
# 或者: from PySide.QtGui.QFormLayout import addRow [as 別名]
def __init__(self,parent=None):
super(QtReducePreferencesComputation,self).__init__(parent)
reduceGroup = QGroupBox("Reduce")
self.reduceBinary = QLineEdit()
# font = self.reduceBinary.font()
# font.setFamily(QSettings().value("worksheet/fontfamily",
# QtReduceDefaults.FONTFAMILY))
# self.reduceBinary.setFont(font)
self.reduceBinary.setText(QSettings().value("computation/reduce",
QtReduceDefaults.REDUCE))
self.reduceBinary.editingFinished.connect(self.editingFinishedHandler)
reduceLayout = QFormLayout()
reduceLayout.addRow(self.tr("Reduce Binary"),self.reduceBinary)
reduceGroup.setLayout(reduceLayout)
mainLayout = QVBoxLayout()
mainLayout.addWidget(reduceGroup)
self.setLayout(mainLayout)
示例6: SetLayout
# 需要導入模塊: from PySide.QtGui import QFormLayout [as 別名]
# 或者: from PySide.QtGui.QFormLayout import addRow [as 別名]
def SetLayout(self):
formLayout = QFormLayout(self)
labelUsername = QLabel("Username")
txtUsername = QLineEdit()
labelPassword = QLabel("Password")
txtPassword = QLineEdit()
formLayout.addRow(labelUsername, txtUsername)
formLayout.addRow(labelPassword, txtPassword)
self.setLayout(formLayout)
示例7: setLayoutForm
# 需要導入模塊: from PySide.QtGui import QFormLayout [as 別名]
# 或者: from PySide.QtGui.QFormLayout import addRow [as 別名]
def setLayoutForm(self):
"""Présentation du QFormLayout"""
self.setWindowTitle("Form Layout")
formLayout = QFormLayout(self)
labelUser = QLabel("Username")
txtUser = QLineEdit()
labelPass = QLabel("Password")
txtPass = QLineEdit()
formLayout.addRow(labelUser, txtUser)
formLayout.addRow(labelPass, txtPass)
self.setLayout(formLayout)
示例8: SetLayout
# 需要導入模塊: from PySide.QtGui import QFormLayout [as 別名]
# 或者: from PySide.QtGui.QFormLayout import addRow [as 別名]
def SetLayout(self):
formLayout = QFormLayout(self)
lUsername = QLabel("Username")
txtUsername = QLineEdit()
lPasswd = QLabel("Passwd")
txPasswd = QLineEdit()
formLayout.addRow(lUsername, txtUsername)
formLayout.addRow(lPasswd, txPasswd)
self.setLayout(formLayout)
示例9: __init__
# 需要導入模塊: from PySide.QtGui import QFormLayout [as 別名]
# 或者: from PySide.QtGui.QFormLayout import addRow [as 別名]
def __init__(self):
QDialog.__init__(self)
layout = QFormLayout(self)
self.setLayout(layout)
layout.addRow("Python version:", QLabel("%s.%s.%s (%s)" %
(sys.version_info[0],
sys.version_info[1],
sys.version_info[2],
sys.version_info[3])))
layout.addRow("Qt version:", QLabel( qVersion()))
示例10: testGetItemPosition
# 需要導入模塊: from PySide.QtGui import QFormLayout [as 別名]
# 或者: from PySide.QtGui.QFormLayout import addRow [as 別名]
def testGetItemPosition(self):
formlayout = QFormLayout()
row, role = formlayout.getItemPosition(0)
self.assert_(isinstance(row, int))
self.assert_(isinstance(role, QFormLayout.ItemRole))
self.assertEqual(row, -1)
widget = QWidget()
formlayout.addRow(widget)
row, role = formlayout.getItemPosition(0)
self.assert_(isinstance(row, int))
self.assert_(isinstance(role, QFormLayout.ItemRole))
self.assertEqual(row, 0)
self.assertEqual(role, QFormLayout.SpanningRole)
示例11: setup_general_server_group
# 需要導入模塊: from PySide.QtGui import QFormLayout [as 別名]
# 或者: from PySide.QtGui.QFormLayout import addRow [as 別名]
def setup_general_server_group(self):
""" Setup the 'Server' group in the 'General' tab.
Returns:
--------
A QGroupBox widget
"""
group = QGroupBox('Server')
layout = QFormLayout()
layout.setFieldGrowthPolicy(QFormLayout.AllNonFixedFieldsGrow)
email, password = self.auth_credentials()
self.email_edit = QLineEdit(email)
self.email_edit.textChanged.connect(self.update_auth)
layout.addRow('Email', self.email_edit)
self.password_edit = QLineEdit(password)
self.password_edit.setEchoMode(QLineEdit.Password)
self.password_edit.textChanged.connect(self.update_auth)
layout.addRow('Password', self.password_edit)
show_password_widget = QCheckBox()
show_password_widget.stateChanged.connect(self.on_show_password_toggle)
layout.addRow('Show password', show_password_widget)
test_authentication_button = QPushButton('Test Authentication')
test_authentication_button.clicked.connect(self.on_test_authentication)
layout.addRow(test_authentication_button)
group.setLayout(layout)
return group
示例12: _initUI
# 需要導入模塊: from PySide.QtGui import QFormLayout [as 別名]
# 或者: from PySide.QtGui.QFormLayout import addRow [as 別名]
def _initUI(self):
# Widgets
self._txt_showers = QLineEdit()
self._txt_showers.setText(str(self.result().showers))
# Layouts
layout = _SaveableResultWidget._initUI(self)
sublayout = QFormLayout()
if sys.platform == "darwin": # Fix for Mac OS
layout.setFieldGrowthPolicy(QFormLayout.FieldGrowthPolicy.ExpandingFieldsGrow)
sublayout.addRow("Number of showers", self._txt_showers)
layout.addLayout(sublayout)
layout.addStretch()
return layout
示例13: setup_advanced_storage_group
# 需要導入模塊: from PySide.QtGui import QFormLayout [as 別名]
# 或者: from PySide.QtGui.QFormLayout import addRow [as 別名]
def setup_advanced_storage_group(self):
""" Setup the 'Storage' group in the 'Advanced' tab.
Returns:
--------
A QGroupBox widget
"""
group = QGroupBox('Storage')
layout = QFormLayout()
layout.setFieldGrowthPolicy(QFormLayout.AllNonFixedFieldsGrow)
path = Config.get('WEB_SOURCE_STORE', '')
self.message_storage_edit = QLineEdit(path)
self.message_storage_edit.textChanged.connect(self.update_message_storage)
layout.addRow('Message Storage Path', self.message_storage_edit)
group.setLayout(layout)
return group
示例14: setup_advanced_server_group
# 需要導入模塊: from PySide.QtGui import QFormLayout [as 別名]
# 或者: from PySide.QtGui.QFormLayout import addRow [as 別名]
def setup_advanced_server_group(self):
""" Setup the 'Server' group in the 'Advanced' tab.
Returns:
--------
A QGroupBox widget
"""
group = QGroupBox('Server')
layout = QFormLayout()
layout.setFieldGrowthPolicy(QFormLayout.AllNonFixedFieldsGrow)
self.message_url_edit = QLineEdit(Config.get('WS_HOST', ''))
self.message_url_edit.textChanged.connect(self.update_message_url)
layout.addRow('Messages API URL', self.message_url_edit)
group.setLayout(layout)
return group
示例15: __init__
# 需要導入模塊: from PySide.QtGui import QFormLayout [as 別名]
# 或者: from PySide.QtGui.QFormLayout import addRow [as 別名]
def __init__(self, wdg_limit, parent=None):
QDialog.__init__(self, parent)
self.setWindowTitle(wdg_limit.accessibleName())
# Widgets
self._wdg_limit = wdg_limit
buttons = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel)
# Layouts
layout = QFormLayout()
layout.setFieldGrowthPolicy(QFormLayout.FieldGrowthPolicy.ExpandingFieldsGrow) # Fix for Mac OS
layout.addRow(self._wdg_limit)
layout.addRow(buttons)
self.setLayout(layout)
# Signals
buttons.accepted.connect(self._onOk)
buttons.rejected.connect(self.reject)