本文整理匯總了Python中PyQt5.QtCore.QStringListModel方法的典型用法代碼示例。如果您正苦於以下問題:Python QtCore.QStringListModel方法的具體用法?Python QtCore.QStringListModel怎麽用?Python QtCore.QStringListModel使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類PyQt5.QtCore
的用法示例。
在下文中一共展示了QtCore.QStringListModel方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: __init__
# 需要導入模塊: from PyQt5 import QtCore [as 別名]
# 或者: from PyQt5.QtCore import QStringListModel [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 QtCore [as 別名]
# 或者: from PyQt5.QtCore import QStringListModel [as 別名]
def __init__(self, folder, title):
QtWidgets.QDialog.__init__(self)
self.ui = Ui_IDAngrSavedsDialog()
self.ui.setupUi(self)
self.setWindowTitle(title)
self.h = PythonHighlighter(self.ui.codeView.document())
self.folder = folder
self.files_list = []
for path in glob.glob(os.path.join(folder, "*.py")):
self.files_list.append(os.path.basename(path)[:-3])
self.ui.selectorList.setModel(QtCore.QStringListModel(self.files_list))
self.model = self.ui.selectorList.selectionModel()
self.model.selectionChanged.connect(self.selector_clicked)
示例3: list_mcu_files
# 需要導入模塊: from PyQt5 import QtCore [as 別名]
# 或者: from PyQt5.QtCore import QStringListModel [as 別名]
def list_mcu_files(self):
file_list = []
try:
file_list = self._connection.list_files()
except OperationError:
QMessageBox().critical(self, "Operation failed", "Could not list files.", QMessageBox.Ok)
return
self._mcu_files_model = QStringListModel()
for file in file_list:
idx = self._mcu_files_model.rowCount()
self._mcu_files_model.insertRow(idx)
self._mcu_files_model.setData(self._mcu_files_model.index(idx), file)
self.mcuFilesListView.setModel(self._mcu_files_model)
self.mcu_file_selection_changed()
示例4: __init__
# 需要導入模塊: from PyQt5 import QtCore [as 別名]
# 或者: from PyQt5.QtCore import QStringListModel [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)
示例5: eventFilter
# 需要導入模塊: from PyQt5 import QtCore [as 別名]
# 或者: from PyQt5.QtCore import QStringListModel [as 別名]
def eventFilter(self, obj, e):
if obj == self.command and e.type() == QEvent.KeyPress:
history = self.device.history
if e.modifiers() & Qt.ControlModifier:
if e.key() == Qt.Key_H:
d = DeviceConsoleHistory(self.device.env.devices)
if d.exec_() == QDialog.Accepted:
self.command.setText(d.command)
elif len(history) > 0:
if e.key() == Qt.Key_E:
self.command.setText(history[0])
if e.key() == Qt.Key_Down:
self.command.completer().setModel(QStringListModel(history))
self.command.setText(' ')
self.command.completer().complete()
return False
return QDockWidget.eventFilter(self, obj, e)
示例6: tutorial
# 需要導入模塊: from PyQt5 import QtCore [as 別名]
# 或者: from PyQt5.QtCore import QStringListModel [as 別名]
def tutorial(self):
self.center.search_input.setDisabled(True)
conf_file = self.settings.fileName()
chat = [
' • config file is in {}'.format(conf_file),
' • database is in {}/angrysearch/angry_database.db'.format(
CACHE_PATH),
' • one million files can take ~200MB and ~2 min to index',
'',
' • double-click on name opens it in associated application',
' • double-click on path opens the location in file manager',
'',
' • checkbox in the right top corner changes search behavior',
' • by default checked, it provides very fast searching',
' • drawback is that it can\'t do word bound substrings',
' • it would not find "Pi<b>rate</b>s", or Whip<b>lash</b>"',
' • it would find "<b>Pir</b>ates", or "The-<b>Fif</b>th"',
' • unchecking it provides substring searches, but slower',
]
self.center.table.setModel(Qc.QStringListModel(chat))
self.center.table.setDisabled(True)
self.status_bar.showMessage(
'Press the update button in the top right corner')
# CREATE INSTANCE OF UPDATE THE DATABASE DIALOG WINDOW
示例7: execute_mcu_code
# 需要導入模塊: from PyQt5 import QtCore [as 別名]
# 或者: from PyQt5.QtCore import QStringListModel [as 別名]
def execute_mcu_code(self):
idx = self.mcuFilesListView.currentIndex()
assert isinstance(idx, QModelIndex)
model = self.mcuFilesListView.model()
assert isinstance(model, QStringListModel)
file_name = model.data(idx, Qt.EditRole)
self._connection.run_file(file_name)
示例8: remove_file
# 需要導入模塊: from PyQt5 import QtCore [as 別名]
# 或者: from PyQt5.QtCore import QStringListModel [as 別名]
def remove_file(self):
idx = self.mcuFilesListView.currentIndex()
assert isinstance(idx, QModelIndex)
model = self.mcuFilesListView.model()
assert isinstance(model, QStringListModel)
file_name = model.data(idx, Qt.EditRole)
try:
self._connection.remove_file(file_name)
except OperationError:
QMessageBox().critical(self, "Operation failed", "Could not remove the file.", QMessageBox.Ok)
return
self.list_mcu_files()
示例9: read_mcu_file
# 需要導入模塊: from PyQt5 import QtCore [as 別名]
# 或者: from PyQt5.QtCore import QStringListModel [as 別名]
def read_mcu_file(self, idx):
assert isinstance(idx, QModelIndex)
model = self.mcuFilesListView.model()
assert isinstance(model, QStringListModel)
file_name = model.data(idx, Qt.EditRole)
progress_dlg = FileTransferDialog(FileTransferDialog.DOWNLOAD)
progress_dlg.finished.connect(lambda: self.finished_read_mcu_file(file_name, progress_dlg.transfer))
progress_dlg.show()
self._connection.read_file(file_name, progress_dlg.transfer)
示例10: transfer_to_pc
# 需要導入模塊: from PyQt5 import QtCore [as 別名]
# 或者: from PyQt5.QtCore import QStringListModel [as 別名]
def transfer_to_pc(self):
idx = self.mcuFilesListView.currentIndex()
assert isinstance(idx, QModelIndex)
model = self.mcuFilesListView.model()
assert isinstance(model, QStringListModel)
remote_path = model.data(idx, Qt.EditRole)
local_path = self.localPathEdit.text() + "/" + remote_path
progress_dlg = FileTransferDialog(FileTransferDialog.DOWNLOAD)
progress_dlg.finished.connect(lambda: self.finished_transfer_to_pc(local_path, progress_dlg.transfer))
progress_dlg.show()
self._connection.read_file(remote_path, progress_dlg.transfer)
示例11: __init__
# 需要導入模塊: from PyQt5 import QtCore [as 別名]
# 或者: from PyQt5.QtCore import QStringListModel [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)
示例12: setupUi
# 需要導入模塊: from PyQt5 import QtCore [as 別名]
# 或者: from PyQt5.QtCore import QStringListModel [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)
示例13: get_QStringListModel
# 需要導入模塊: from PyQt5 import QtCore [as 別名]
# 或者: from PyQt5.QtCore import QStringListModel [as 別名]
def get_QStringListModel():
"""QStringListModel getter."""
try:
import PySide.QtGui as QtGui
return QtGui.QStringListModel
except ImportError:
import PyQt5.QtCore as QtCore
return QtCore.QStringListModel
示例14: __init__
# 需要導入模塊: from PyQt5 import QtCore [as 別名]
# 或者: from PyQt5.QtCore import QStringListModel [as 別名]
def __init__(self, string_list, parent=None):
super(ExtendedComboBox, self).__init__(parent)
self.setFocusPolicy(Qt.StrongFocus)
self.setEditable(True)
# add a filter model to filter matching items
self.pFilterModel = QSortFilterProxyModel(self)
self.pFilterModel.setFilterCaseSensitivity(Qt.CaseInsensitive)
self.pFilterModel.setSourceModel(self.model())
# add a completer, which uses the filter model
self.completer = QCompleter(self.pFilterModel, self)
# always show all (filtered) completions
self.completer.setCompletionMode(QCompleter.UnfilteredPopupCompletion)
self.setCompleter(self.completer)
# connect signals
self.lineEdit().textEdited.connect(self.pFilterModel.setFilterFixedString)
self.completer.activated.connect(self.on_completer_activated)
# either fill the standard model of the combobox
self.addItems(string_list)
# or use another model
# combo.setModel(QStringListModel(string_list))
# on selection of an item from the completer, select the corresponding item from combobox
示例15: fuzzy_search_action
# 需要導入模塊: from PyQt5 import QtCore [as 別名]
# 或者: from PyQt5.QtCore import QStringListModel [as 別名]
def fuzzy_search_action(self):
"""Open a dialog for quick access to actions
with fuzzy search."""
focussed_widget = QApplication.focusWidget()
self.fuzzy_search_ui.ui.fuzzy_search_field.setFocus()
def get_data(model):
plugins = [x[1].name for x in self.plugins.available_plugins]
for p in self.plugins.codecs + \
self.plugins.compressions +\
self.plugins.assemblies:
plugins.append('-' + p[1].name)
plugins.extend(['-' + x for x in p[1].aliases])
for p in self.plugins.available_plugins:
plugins.extend(p[1].aliases)
model.setStringList(plugins)
completer = QCompleter()
self.fuzzy_search_ui.ui.fuzzy_search_field.setCompleter(completer)
model = QStringListModel()
completer.setModel(model)
get_data(model)
if self.fuzzy_search_ui.exec_() == 0:
return
search_data = self.fuzzy_search_ui.ui.fuzzy_search_field.text()
parent_encoder = self.get_parent_encoder(focussed_widget)
if parent_encoder:
parent_encoder.action_fuzzy(search_data)
else:
LOGGER.error('Unable to find parent encoder for ' + str(focussed_widget))