当前位置: 首页>>代码示例>>Python>>正文


Python QtCore.QStringListModel方法代码示例

本文整理汇总了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) 
开发者ID:rahatzamancse,项目名称:Traffic-Rules-Violation-Detection,代码行数:25,代码来源:SearchWindow.py

示例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) 
开发者ID:andreafioraldi,项目名称:IDAngr,代码行数:19,代码来源:main_gui.py

示例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() 
开发者ID:BetaRavener,项目名称:uPyLoader,代码行数:19,代码来源:main_window.py

示例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) 
开发者ID:sakibreza,项目名称:Traffic-Rules-Violation-Detection-System,代码行数:25,代码来源:SearchWindow.py

示例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) 
开发者ID:jziolkowski,项目名称:tdm,代码行数:22,代码来源:Console.py

示例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 
开发者ID:DoTheEvo,项目名称:ANGRYsearch,代码行数:28,代码来源:angrysearch.py

示例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) 
开发者ID:BetaRavener,项目名称:uPyLoader,代码行数:9,代码来源:main_window.py

示例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() 
开发者ID:BetaRavener,项目名称:uPyLoader,代码行数:14,代码来源:main_window.py

示例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) 
开发者ID:BetaRavener,项目名称:uPyLoader,代码行数:12,代码来源:main_window.py

示例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) 
开发者ID:BetaRavener,项目名称:uPyLoader,代码行数:14,代码来源:main_window.py

示例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) 
开发者ID:aseylys,项目名称:KStock,代码行数:16,代码来源:Helpers.py

示例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) 
开发者ID:Bertrand256,项目名称:dash-masternode-tool,代码行数:13,代码来源:hw_word_dlg.py

示例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 
开发者ID:AirbusCyber,项目名称:grap,代码行数:11,代码来源:QtShim.py

示例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 
开发者ID:adamerose,项目名称:pandasgui,代码行数:30,代码来源:extended_combobox.py

示例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)) 
开发者ID:takeshixx,项目名称:deen,代码行数:30,代码来源:core.py


注:本文中的PyQt5.QtCore.QStringListModel方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。