本文整理汇总了Python中PyQt5.QtWidgets.QCompleter方法的典型用法代码示例。如果您正苦于以下问题:Python QtWidgets.QCompleter方法的具体用法?Python QtWidgets.QCompleter怎么用?Python QtWidgets.QCompleter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt5.QtWidgets
的用法示例。
在下文中一共展示了QtWidgets.QCompleter方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QCompleter [as 别名]
def __init__(self, search_result, parent=None):
super(SearchWindow, self).__init__(parent)
loadUi("UI/Search.ui", self)
self.search_result = search_result
self.color.addItems(["None"])
self.color.addItems(Database.get_instance().get_car_color_list())
completer = QCompleter()
self.substring.setCompleter(completer)
model = QStringListModel()
completer.setModel(model)
licenseList = Database.get_instance().get_licenses()
model.setStringList(licenseList)
self.search_button.clicked.connect(self.search)
cams = Database.get_instance().get_cam_list(None)
self.camera.clear()
self.camera.addItems(["None"])
self.camera.addItems(id for id, cam, feed in cams)
self.camera.setCurrentIndex(0)
示例2: __init__
# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QCompleter [as 别名]
def __init__(self, filename="", parent=None):
super().__init__(parent)
self.ui = Ui_DialogCSVImport()
self.ui.setupUi(self)
self.setAttribute(Qt.WA_DeleteOnClose)
self.setWindowFlags(Qt.Window)
self.ui.btnAutoDefault.hide()
completer = QCompleter()
completer.setModel(QDirModel(completer))
self.ui.lineEditFilename.setCompleter(completer)
self.filename = None # type: str
self.ui.lineEditFilename.setText(filename)
self.update_file()
self.ui.tableWidgetPreview.setColumnHidden(self.COLUMNS["T"], True)
self.update_preview()
self.create_connects()
示例3: __init__
# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QCompleter [as 别名]
def __init__(self, search_result, parent=None):
super(SearchWindow, self).__init__(parent)
loadUi("UI/Search.ui", self)
self.search_result = search_result
self.color.addItems(["None"])
self.color.addItems(Database.getInstance().getCarColorsList())
completer = QCompleter()
self.substring.setCompleter(completer)
model = QStringListModel()
completer.setModel(model)
licenseList = Database.getInstance().getLicenseList()
model.setStringList(licenseList)
self.search_button.clicked.connect(self.search)
cams = Database.getInstance().getCamList(None)
self.camera.clear()
self.camera.addItems(["None"])
self.camera.addItems(id for id, cam, feed in cams)
self.camera.setCurrentIndex(0)
示例4: __init__
# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QCompleter [as 别名]
def __init__(self, model, linktypes, fromname, parent=None):
super(DialogLinkTo, self).__init__(parent) # overrride accept method
self.linktype = None
self.linkitem = None
self.linktypes = linktypes
self.model = model
self.setupUi()
completer = QtWidgets.QCompleter()#[x['name'] for x in model.nativedata])
completer.setCompletionMode(QtWidgets.QCompleter.InlineCompletion)
completer.setCompletionColumn(0)
completer.setCompletionRole(Qt.DisplayRole)
completer.setCaseSensitivity(Qt.CaseInsensitive)
completer.setModel(model)
self.lineEdit.setCompleter(completer)
self.combo.setModel(linktypes)
self.setWindowTitle('Create link to %s'%fromname)
self.setSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed);
示例5: __init__
# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QCompleter [as 别名]
def __init__(self, sorted_keys, channels_db, *args, **kwargs):
super().__init__(*args, **kwargs)
self.setupUi(self)
self.channels_db = channels_db
self.matches = 0
self.current_index = 1
self.entries = []
completer = QtWidgets.QCompleter(sorted_keys, self)
completer.setCaseSensitivity(QtCore.Qt.CaseInsensitive)
completer.setModelSorting(QtWidgets.QCompleter.CaseInsensitivelySortedModel)
completer.setFilterMode(QtCore.Qt.MatchContains)
self.search.setCompleter(completer)
self.search.textChanged.connect(self.display_results)
self.up_btn.clicked.connect(self.up)
self.down_btn.clicked.connect(self.down)
示例6: __init__
# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QCompleter [as 别名]
def __init__(self, ticks, parent = None):
QtWidgets.QDialog.__init__(self, parent)
self.setupUi(self)
completer = QtWidgets.QCompleter()
completer.setCaseSensitivity(False)
self.tickEdit.setCompleter(completer)
model = QtCore.QStringListModel()
completer.setModel(model)
model.setStringList(ticks)
self.okBut.clicked.connect(self.accept)
self.cancelBut.clicked.connect(self.close)
示例7: setupUi
# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QCompleter [as 别名]
def setupUi(self):
ui_hw_word_dlg.Ui_HardwareWalletWordDlg.setupUi(self, self)
self.setWindowTitle('')
self.lblWord.setText(self.message)
self.setWindowTitle('Get word')
model = QStringListModel()
model.setStringList(self.wordlist)
self.completer = QCompleter()
self.completer.setModel(model)
self.edtWord.setCompleter(self.completer)
self.layout().setSizeConstraint(QLayout.SetFixedSize)
示例8: __init__
# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QCompleter [as 别名]
def __init__(self, *args, **kwargs):
QtWidgets.QDialog.__init__(self, *args, **kwargs)
self.completer = QtWidgets.QCompleter()
self.completer_model = QtWidgets.QFileSystemModel(self.completer)
self.completer.setModel(self.completer_model)
self.completer.setMaxVisibleItems(8)
loadUi(get_resource('dialog_config.ui'), self)
self.ok_button.released.connect(
self.setAttributes)
self.ok_button.released.connect(
self.close)
self.apply_button.released.connect(
self.setAttributes)
self.vector_color_picker = QtWidgets.QColorDialog(self)
self.vector_color_picker. \
setCurrentColor(QtGui.QColor(*getConfig().vector_color))
self.vector_color_picker. \
setOption(self.vector_color_picker.ShowAlphaChannel)
self.vector_color_picker.colorSelected.connect(
self.updateVectorColor)
self.vector_color_picker.setModal(True)
self.vector_color.clicked.connect(
self.vector_color_picker.show)
self.vector_color.setValue = self.setButtonColor
self.vector_color.value = self.getButtonColor
self.chooseStoreDirButton.released.connect(
self.chooseStoreDir)
self.completer_model.setRootPath('')
self.completer.setParent(self.default_gf_dir)
self.default_gf_dir.setCompleter(self.completer)
self.getAttributes()
示例9: get_QCompleter
# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QCompleter [as 别名]
def get_QCompleter():
"""QCompleter getter."""
try:
import PySide.QtGui as QtGui
return QtGui.QCompleter
except ImportError:
import PyQt5.QtWidgets as QtWidgets
return QtWidgets.QCompleter
示例10: _on_user_find_success
# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QCompleter [as 别名]
def _on_user_find_success(self, job):
users = job.ret
completer = QCompleter(users)
completer.setCaseSensitivity(Qt.CaseInsensitive)
self.line_edit_share.setCompleter(completer)
self.line_edit_share.completer().complete()
示例11: __init__
# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QCompleter [as 别名]
def __init__(
self,
message,
placeholder="",
default_text="",
completion=None,
button_text=None,
validator=None,
):
super().__init__()
self.setupUi(self)
self.dialog = None
button_text = button_text or _("ACTION_OK")
self.button_ok.setText(button_text)
self.label_message.setText(message)
self.line_edit_text.setPlaceholderText(placeholder)
self.line_edit_text.setText(default_text)
if validator:
self.line_edit_text.setValidator(validator)
if completion:
completer = QCompleter(completion)
completer.setCaseSensitivity(Qt.CaseInsensitive)
completer.popup().setStyleSheet("border: 1px solid rgb(30, 78, 162);")
self.line_edit_text.setCompleter(completer)
self.button_ok.clicked.connect(self._on_button_clicked)
self.setFocus()
self.line_edit_text.setFocus()
示例12: test_expression_line_edit
# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QCompleter [as 别名]
def test_expression_line_edit(self):
e = ExpressionLineEdit()
e.setCompleter(QCompleter(self.form.simulator_tab_controller.completer_model, e))
e.setValidator(RuleExpressionValidator(self.form.simulator_tab_controller.sim_expression_parser))
self.assertEqual(e.text(), "")
QTest.keyClick(e, Qt.Key_R, Qt.NoModifier)
self.assertEqual(e.text(), "r")
示例13: __init__
# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QCompleter [as 别名]
def __init__(self, new_project=True, project_manager: ProjectManager = None, parent=None):
super().__init__(parent)
if not new_project:
assert project_manager is not None
self.ui = Ui_ProjectDialog()
self.ui.setupUi(self)
self.setWindowFlags(Qt.Window)
if new_project:
self.participant_table_model = ParticipantTableModel([])
else:
self.participant_table_model = ParticipantTableModel(project_manager.participants)
self.ui.spinBoxSampleRate.setValue(project_manager.device_conf["sample_rate"])
self.ui.spinBoxFreq.setValue(project_manager.device_conf["frequency"])
self.ui.spinBoxBandwidth.setValue(project_manager.device_conf["bandwidth"])
self.ui.spinBoxGain.setValue(project_manager.device_conf.get("gain", config.DEFAULT_GAIN))
self.ui.txtEdDescription.setPlainText(project_manager.description)
self.ui.lineEdit_Path.setText(project_manager.project_path)
self.ui.lineEditBroadcastAddress.setText(project_manager.broadcast_address_hex)
self.ui.btnSelectPath.hide()
self.ui.lineEdit_Path.setDisabled(True)
self.setWindowTitle("Edit project settings")
self.ui.lNewProject.setText("Edit project")
self.ui.tblParticipants.setModel(self.participant_table_model)
self.participant_table_model.update()
self.ui.lineEditBroadcastAddress.setValidator(QRegExpValidator(QRegExp("([a-fA-F ]|[0-9]){,}")))
self.sample_rate = self.ui.spinBoxSampleRate.value()
self.freq = self.ui.spinBoxFreq.value()
self.bandwidth = self.ui.spinBoxBandwidth.value()
self.gain = self.ui.spinBoxGain.value()
self.description = self.ui.txtEdDescription.toPlainText()
self.broadcast_address_hex = self.ui.lineEditBroadcastAddress.text()
self.path = self.ui.lineEdit_Path.text()
self.new_project = new_project
self.committed = False
self.setModal(True)
completer = QCompleter()
completer.setModel(QDirModel(completer))
self.ui.lineEdit_Path.setCompleter(completer)
self.create_connects()
# add two participants
if self.participant_table_model.rowCount() == 0 and new_project:
self.ui.btnAddParticipant.click()
self.ui.btnAddParticipant.click()
if new_project:
self.ui.lineEdit_Path.setText(os.path.realpath(os.path.join(os.curdir, "new")))
self.on_line_edit_path_text_edited()
self.restoreGeometry(settings.read("{}/geometry".format(self.__class__.__name__), type=bytes))
示例14: __init__
# 需要导入模块: from PyQt5 import QtWidgets [as 别名]
# 或者: from PyQt5.QtWidgets import QCompleter [as 别名]
def __init__(self, device_name: str, project_manager: ProjectManager, signal=None, backend_handler=None,
network_raw_mode=False, signals=None, parent=None):
super().__init__(parent)
self.ui = Ui_SniffSettings()
self.ui.setupUi(self)
signals = signals if signals is not None else []
self.project_manager = project_manager
for encoding in self.project_manager.decodings:
self.ui.comboBox_sniff_encoding.addItem(encoding.name)
self.bootstrap(project_manager.device_conf, signal, enforce_default=True)
self.sniffer = ProtocolSniffer(samples_per_symbol=self.ui.spinbox_sniff_SamplesPerSymbol.value(),
center=self.ui.spinbox_sniff_Center.value(),
center_spacing=self.ui.spinBoxCenterSpacing.value(),
noise=self.ui.spinbox_sniff_Noise.value(),
tolerance=self.ui.spinbox_sniff_ErrorTolerance.value(),
modulation_type=self.ui.combox_sniff_Modulation.currentText(),
bits_per_symbol=self.ui.spinBoxBitsPerSymbol.value(),
device=device_name,
backend_handler=BackendHandler() if backend_handler is None else backend_handler,
network_raw_mode=network_raw_mode)
self.sniffer.adaptive_noise = self.ui.checkBoxAdaptiveNoise.isChecked()
self.sniffer.automatic_center = self.ui.checkBoxAutoCenter.isChecked()
self.__set_center_offset_visibility()
self.create_connects()
self.ui.comboBox_sniff_encoding.currentIndexChanged.emit(self.ui.comboBox_sniff_encoding.currentIndex())
self.ui.comboBox_sniff_viewtype.setCurrentIndex(settings.read('default_view', 0, int))
# Auto Complete like a Boss
completer = QCompleter()
completer.setModel(QDirModel(completer))
self.ui.lineEdit_sniff_OutputFile.setCompleter(completer)
self.signals = signals
if len(signals) == 0:
self.ui.label_sniff_Signal.hide()
self.ui.btn_sniff_use_signal.hide()
self.ui.comboBox_sniff_signal.hide()
else:
for signal in signals:
self.ui.comboBox_sniff_signal.addItem(signal.name)