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


Python QCompleter.setCompletionColumn方法代码示例

本文整理汇总了Python中PySide.QtGui.QCompleter.setCompletionColumn方法的典型用法代码示例。如果您正苦于以下问题:Python QCompleter.setCompletionColumn方法的具体用法?Python QCompleter.setCompletionColumn怎么用?Python QCompleter.setCompletionColumn使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PySide.QtGui.QCompleter的用法示例。


在下文中一共展示了QCompleter.setCompletionColumn方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: config_completer

# 需要导入模块: from PySide.QtGui import QCompleter [as 别名]
# 或者: from PySide.QtGui.QCompleter import setCompletionColumn [as 别名]
def config_completer(line_edit, model, field):
    # sets up a completer based on a QSqlTableModel for the specified field on a QLineEdit
    completer = QCompleter()
    completer.setModel(model)
    completer.setCompletionColumn(model.fieldIndex(field))
    completer.setCompletionMode(QCompleter.PopupCompletion)
    completer.setCaseSensitivity(Qt.CaseInsensitive)
    completer.activated.connect(line_edit.returnPressed)
    line_edit.setCompleter(completer)
开发者ID:raulvc,项目名称:seareiros,代码行数:11,代码来源:util.py

示例2: __init__

# 需要导入模块: from PySide.QtGui import QCompleter [as 别名]
# 或者: from PySide.QtGui.QCompleter import setCompletionColumn [as 别名]
    def __init__(self, model, index, parent=None):
        super(ObservationDialog, self).__init__(parent)
        
        self.logger = Logger('root.observationDialog')
        self.logger.debug('Debug set to: %s' % str(parent.logger.debugging))
        
        self.setupUi(self)
#        self.dateTimeEdit.setDateTime(QDateTime.currentDateTime())
        
        # An observation model is passed to the constructor as a parameter
        self.model = model
        
        # Build a QCompleter that is based on a species model's species name.
        # This way user can start typing the name in a line edit and the 
        # completion will suggest suitable species names based on the model
        
        # TODO: language for the species name completion needs to be handled
        # TODO: both completers have model column indexes hard coded in, thus
        # they will break if the model is modified
        sppCompleter = QCompleter(self)
        sppCompleter.setModel(self.model.data_model)
        sppCompleter.setCompletionColumn(4)
        sppCompleter.setCompletionMode(QCompleter.InlineCompletion)
        sppCompleter.setCaseSensitivity(Qt.CaseInsensitive)
        self.sppLineEdit.setCompleter(sppCompleter)
        
        # Build a QCompleter that is based on a species model's abbreviation.
        # This way user can start typing the abbreviation in a line edit and the 
        # completion will suggest suitable species names based on the model
        abbrCompleter = QCompleter(self)
        abbrCompleter.setModel(self.model.data_model)
        abbrCompleter.setCompletionColumn(1)
        abbrCompleter.setCompletionMode(QCompleter.InlineCompletion)
        self.abbrLineEdit.setCompleter(abbrCompleter)
        
        # The underlying (observation) model is automatically updated through 
        # a QDataWidgetMapper
        self.mapper = QDataWidgetMapper(self)
        self.mapper.setSubmitPolicy(QDataWidgetMapper.ManualSubmit)
        self.mapper.setModel(model)
        # ID is mapped to a disabled dummy label in order to include it in the
        # WidgetMapper --> not very elegant
        self.mapper.addMapping(self.idLineEdit, model.ID)
        self.mapper.addMapping(self.sppLineEdit, model.SPECIES)
        self.mapper.addMapping(self.abbrLineEdit, model.ABBR)
        self.mapper.addMapping(self.countSpinBox, model.COUNT)
        self.mapper.addMapping(self.dateTimeEdit, model.TIME)
        self.mapper.addMapping(self.locLineEdit, model.LOCATION)
        self.mapper.addMapping(self.notesTextEdit, model.NOTES)
        self.mapper.setCurrentModelIndex(index)
        
        self.firstButton.clicked.connect(
                            lambda: self.saveRecord(ObservationDialog.FIRST))
        self.prevButton.clicked.connect(
                            lambda: self.saveRecord(ObservationDialog.PREV))
        self.nextButton.clicked.connect(
                            lambda: self.saveRecord(ObservationDialog.NEXT))
        self.lastButton.clicked.connect(
                            lambda: self.saveRecord(ObservationDialog.LAST))
        self.saveButton.clicked.connect(
                            lambda: self.saveRecord(ObservationDialog.CURRENT))
        self.closeButton.clicked.connect(self.reject)
        
        self.sppLineEdit.editingFinished.connect(self.update_fields)
开发者ID:jlehtoma,项目名称:MaeBird,代码行数:66,代码来源:dialogs.py


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