本文整理汇总了Python中PySide.QtGui.QComboBox.setEditable方法的典型用法代码示例。如果您正苦于以下问题:Python QComboBox.setEditable方法的具体用法?Python QComboBox.setEditable怎么用?Python QComboBox.setEditable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PySide.QtGui.QComboBox
的用法示例。
在下文中一共展示了QComboBox.setEditable方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: create_combobox
# 需要导入模块: from PySide.QtGui import QComboBox [as 别名]
# 或者: from PySide.QtGui.QComboBox import setEditable [as 别名]
def create_combobox(self, parent, editable=False):
""" Returns an adapted QComboBox control.
"""
control = QComboBox(check_parent(parent))
control.setEditable(editable)
return control_adapter(control)
示例2: AddAreaDlg
# 需要导入模块: from PySide.QtGui import QComboBox [as 别名]
# 或者: from PySide.QtGui.QComboBox import setEditable [as 别名]
class AddAreaDlg(QDialog):
def __init__(self, parent=None):
super(AddAreaDlg, self).__init__(parent)
self.setWindowTitle("New Relief Device Area")
name_label = QLabel("&Name:")
self.name_lineedit = QLineEdit()
self.name_lineedit.setMaxLength(200)
name_label.setBuddy(self.name_lineedit)
location_label = QLabel("&Location:")
self.location_combobox = QComboBox()
self.location_combobox.setEditable(True)
location_label.setBuddy(self.location_combobox)
self.browse_button = QPushButton("&Browse...")
button_box = QDialogButtonBox(QDialogButtonBox.Ok|QDialogButtonBox.Cancel)
layout = QGridLayout()
layout.addWidget(name_label, 0, 0)
layout.addWidget(self.name_lineedit, 0, 1)
layout.addWidget(location_label, 1, 0)
layout.addWidget(self.location_combobox, 1, 1)
layout.addWidget(self.browse_button, 1, 2)
#layout.addWidget(QFrame.HLine, 2, 0)
layout.addWidget(button_box, 2, 1)
self.setLayout(layout)
self.browse_button.clicked.connect(self.browseFiles)
button_box.accepted.connect(self.accept)
button_box.rejected.connect(self.reject)
def browseFiles(self):
self.dirname = QFileDialog.getExistingDirectory(self, "Select file location", options=QFileDialog.ShowDirsOnly)
self.location_combobox.insertItem(0, self.dirname)
self.location_combobox.setCurrentIndex(0)
def accept(self):
if len(self.name_lineedit.text().strip()) == 0:
QMessageBox.warning(self, "Error: Relief Device Area Name Blank", "The relief device area must be given a name.", QMessageBox.Ok)
self.name_lineedit.setFocus()
return
if len(self.location_combobox.currentText().strip()) == 0:
QMessageBox.warning(self, "Error: Location Blank", "You must save the relief device area file to a valid directory.", QMessageBox.Ok)
self.location_combobox.setFocus()
return
if not os.path.exists(self.location_combobox.currentText().replace("\\", "/")):
QMessageBox.warning(self, "Error: Directory Does Not Exist", "The specified directory does not exist.", QMessageBox.Ok)
self.location_combobox.setFocus()
return
if os.path.isfile(self.location_combobox.currentText().replace("\\", "/") + "/" + self.name_lineedit.text() + ".rda"):
if QMessageBox.question(self, "File Already Exists",
"The file {0} already exists at {1}. Are you sure you want to proceed and overwrite this file?".format(self.name_lineedit.text() + ".rda",
self.location_combobox.currentText().replace("\\", "/")), QMessageBox.Yes|QMessageBox.No) == QMessageBox.No:
self.name_lineedit.setFocus()
return
QDialog.accept(self)
def returnVals(self):
return self.name_lineedit.text(), self.location_combobox.currentText().replace("\\", "/") + "/"
示例3: MainWindow
# 需要导入模块: from PySide.QtGui import QComboBox [as 别名]
# 或者: from PySide.QtGui.QComboBox import setEditable [as 别名]
#.........这里部分代码省略.........
self.sync_button = QToolButton()
self.sync_button.setIconSize(QSize(30, 30))
self.sync_button.setIcon(QIcon(os.path.join("icons", "ic_action_sync.png")))
self.sync_button.setStyleSheet("border: 0px;")
self.sync_button.setToolTip("Sync")
self.sync_button.clicked.connect(self.sync_clicked)
self.sync_button.setVisible(False)
layout.addWidget(self.sync_button)
self.clipboard_button = QToolButton()
self.clipboard_button.setIconSize(QSize(30, 30))
self.clipboard_button.setIcon(QIcon(os.path.join("icons", "ic_action_copy.png")))
self.clipboard_button.setStyleSheet("border: 0px;")
self.clipboard_button.setToolTip("in die Zwischenablage")
self.clipboard_button.clicked.connect(self.copy_to_clipboard)
self.clipboard_button.setVisible(False)
layout.addWidget(self.clipboard_button)
# noinspection PyUnresolvedReferences
def create_main_area(self, layout):
# Master password
master_password_label = QLabel("&Master-Passwort:")
self.master_password_edit = QLineEdit()
self.master_password_edit.setEchoMode(QLineEdit.EchoMode.Password)
self.master_password_edit.textChanged.connect(self.masterpassword_changed)
self.master_password_edit.returnPressed.connect(self.move_focus)
self.master_password_edit.editingFinished.connect(self.masterpassword_entered)
self.master_password_edit.setMaximumHeight(28)
master_password_label.setBuddy(self.master_password_edit)
layout.addWidget(master_password_label)
layout.addWidget(self.master_password_edit)
# Domain
domain_label = QLabel("&Domain:")
self.domain_edit = QComboBox()
self.domain_edit.setEditable(True)
self.domain_edit.textChanged.connect(self.domain_changed)
self.domain_edit.currentIndexChanged.connect(self.domain_changed)
self.domain_edit.lineEdit().editingFinished.connect(self.domain_entered)
self.domain_edit.lineEdit().returnPressed.connect(self.move_focus)
self.domain_edit.setMaximumHeight(28)
domain_label.setBuddy(self.domain_edit)
layout.addWidget(domain_label)
layout.addWidget(self.domain_edit)
# Username
self.username_label = QLabel("&Username:")
self.username_label.setVisible(False)
self.username_edit = QLineEdit()
self.username_edit.textChanged.connect(self.username_changed)
self.username_edit.returnPressed.connect(self.move_focus)
self.username_edit.setMaximumHeight(28)
self.username_edit.setVisible(False)
self.username_label.setBuddy(self.username_edit)
layout.addWidget(self.username_label)
layout.addWidget(self.username_edit)
# Password strength
self.strength_label = QLabel("&Passwortstärke:")
self.strength_label.setVisible(False)
self.strength_selector = PasswordStrengthSelector()
self.strength_selector.set_min_length(4)
self.strength_selector.set_max_length(36)
self.strength_selector.setMinimumHeight(60)
self.strength_selector.set_length(12)
self.strength_selector.set_complexity(6)
self.strength_selector.strength_changed.connect(self.strength_changed)
self.strength_selector.setVisible(False)
self.strength_label.setBuddy(self.strength_selector)
layout.addWidget(self.strength_label)
示例4: ParameterBox
# 需要导入模块: from PySide.QtGui import QComboBox [as 别名]
# 或者: from PySide.QtGui.QComboBox import setEditable [as 别名]
class ParameterBox(QWidget):
'''ParameterBox is a widget to select certain parameters for the numerical
simulation.
Arguments
---------
parent : QWidget
the parent widget
'''
def __init__(self, parent):
super(ParameterBox, self).__init__(parent)
'''
sliders
'''
self.sliders = {}
slider = ParameterSlider(self, 'F')
slider.set_range(0, 0.1, 0.001)
slider.set_value(0.035)
self.sliders['F'] = slider
slider = ParameterSlider(self, 'k')
slider.set_range(0, 0.1, 0.001)
slider.set_value(0.06)
self.sliders['k'] = slider
slider = ParameterSlider(self, 'timesteps')
slider.set_format('.0f')
slider.set_range(0, 100000, 1000)
slider.set_value(10000)
self.sliders['timesteps'] = slider
slider = ParameterSlider(self, 'keyframe distance')
slider.set_format('.0f')
slider.set_range(1, 100, 1)
slider.set_value(10)
self.sliders['keyframe_distance'] = slider
slider = ParameterSlider(self, 'size')
slider.set_format('.0f')
slider.set_range(32, 256, 32)
slider.set_value(128)
self.sliders['size'] = slider
'''
Combo box for default settings
'''
self.default_coefficients = QComboBox()
self.default_coefficients.setEditable(False)
for key in sorted([key for key in predefined_coefficients]):
self.default_coefficients.addItem(key)
self.default_coefficients.activated.connect(self._load_predefined)
self.default_coefficients.setCurrentIndex(0)
self._load_predefined(0)
'''
create layout
'''
box = QVBoxLayout()
box.addWidget(self.default_coefficients)
box.addWidget(self.sliders['F'])
box.addWidget(self.sliders['k'])
box.addWidget(self.sliders['timesteps'])
box.addWidget(self.sliders['keyframe_distance'])
box.addWidget(self.sliders['size'])
self.setLayout(box)
def _load_predefined(self, index):
key = self.default_coefficients.itemText(index)
if key in predefined_coefficients:
coefficients = predefined_coefficients[key]
self.sliders['F'].set_value(coefficients['F'])
self.sliders['k'].set_value(coefficients['k'])
def parameters(self):
coefficients = {}
coefficients['Du'] = 0.16
coefficients['Dv'] = 0.08
coefficients['F'] = self.sliders['F'].value()
coefficients['k'] = self.sliders['k'].value()
params = {}
params['coefficients'] = coefficients
params['keyframe_distance'] = int(self.sliders['keyframe_distance'].value())
params['size'] = int(self.sliders['size'].value())
params['timesteps'] = int(self.sliders['timesteps'].value())
return params
示例5: ConsoleWidget
# 需要导入模块: from PySide.QtGui import QComboBox [as 别名]
# 或者: from PySide.QtGui.QComboBox import setEditable [as 别名]
class ConsoleWidget(QMainWindow):
def __init__(self):
super(ConsoleWidget, self).__init__()
self.setWindowTitle('1c query')
self._connection = None
self._home = os.path.expanduser('~/%s' % QApplication.applicationName())
if not os.path.isdir(self._home):
os.mkdir(self._home)
self.queryToolBar = self.addToolBar('Query')
self.queryAction = self.queryToolBar.addAction('Run', self.executeQuery)
self.queryAction.setDisabled(True)
uri_history = list()
path = os.path.join(self._home, 'uri_history.txt')
if os.path.isfile(path):
uri_history = open(path, 'r').read().split('\n')
self.connectionToolBar = self.addToolBar('Connection')
self.connectionUriCombo = QComboBox(self)
self.connectionUriCombo.setEditable(True)
if not uri_history:
self.connectionUriCombo.addItem('File="";usr="";pwd="";')
self.connectionUriCombo.addItem('Srvr="{host}";Ref="{ref}";Usr="{user}";Pwd="{password}";')
else:
self.connectionUriCombo.addItems(uri_history)
self.connectionUriCombo.setCurrentIndex(len(uri_history) - 1)
self.connectionUriCombo.setSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.Maximum)
self.connectionToolBar.addWidget(self.connectionUriCombo)
self.onesVersionCombo = QComboBox(self)
self.onesVersionCombo.addItems(['8.3', '8.2', '8.1', '8.0'])
self.onesVersionCombo.setCurrentIndex(0)
self.connectionToolBar.addWidget(self.onesVersionCombo)
self.connectAction = self.connectionToolBar.addAction('Connect', self.connectOneS)
self.disconnectAction = self.connectionToolBar.addAction('Disconnect', self.disconnectOneS)
self.disconnectAction.setDisabled(True)
self.logEdit = QPlainTextEdit(self)
self.logDock = QDockWidget('Log', self)
self.logDock.setWidget(self.logEdit)
self.addDockWidget(Qt.BottomDockWidgetArea, self.logDock, Qt.Horizontal)
self.splitter = QSplitter(Qt.Vertical, self)
self.setCentralWidget(self.splitter)
self.sqlEdit = QTextEdit(self)
self.sqlEdit.setLineWrapMode(QTextEdit.NoWrap)
path = os.path.join(self._home, 'last-sql.txt')
if os.path.isfile(path):
sql = open(path, 'r').read()
self.sqlEdit.setText(sql)
self.model = QStandardItemModel(self)
self.tableView = QTableView(self)
self.tableView.setModel(self.model)
self.splitter.addWidget(self.sqlEdit)
self.splitter.addWidget(self.tableView)
self.splitter.setStretchFactor(0, 3)
self.splitter.setStretchFactor(1, 2)
def query(self, sql):
if not self._connection:
self.logEdit.appendPlainText('No connection')
return None
try:
query = self._connection.NewObject('Query', sql)
result = query.Execute()
except Exception as e:
self.logEdit.appendPlainText(str(e))
return None
return result
def refresh(self, result):
self.model.clear()
columns = list()
result_columns = result.Columns
for index in range(result_columns.Count()):
name = result_columns.Get(index).Name
columns.append(name)
self.model.setColumnCount(len(columns))
for section, name in enumerate(columns):
self.model.setHeaderData(section, Qt.Horizontal, name)
select = result.Choose()
self.logEdit.appendPlainText('Selected %d records' % select.Count())
while select.Next():
items = list()
for index in range(len(columns)):
value = select.Get(index)
item = QStandardItem('')
#.........这里部分代码省略.........