예제 #1
1
 def createEditor( self, parent, option, index ):
     if index.column() == CANTIDAD:
         spinbox = QSpinBox( parent )
         spinbox.setRange( 0, index.model().lines[index.row()].maxquantity )
         spinbox.setSingleStep( 1 )
         return spinbox
     else:
         QStyledItemDelegate.createEditor( self, parent, option, index )
예제 #2
0
 def createEditor(self, parent, option, index):
     layer = index.data().toPyObject()
     if isinstance(layer, Layer):
         editor = LayerEditor(parent)
         self._editors[layer] = editor
         return editor
     else:
         QStyledItemDelegate.createEditor(self, parent, option, index)
예제 #3
0
 def createEditor(self, parent, option, index):
     if index.column() == NUMAJUSTE:
         spinbox = QSpinBox(parent)
         spinbox.setRange(-1000, 1000)
         spinbox.setSingleStep(1)
         return spinbox
     else:
         QStyledItemDelegate.createEditor(self, parent, option, index)
예제 #4
0
 def createEditor(self, parent, option, index):
     layer = index.data().toPyObject()
     if isinstance(layer, Layer):
         editor = LayerItemWidget(parent=parent)
         editor.setAutoFillBackground(True)
         editor.setPalette( option.palette )
         editor.setBackgroundRole(QPalette.Highlight)
         editor.layer = layer
         return editor
     else:
         QStyledItemDelegate.createEditor(self, parent, option, index)
예제 #5
0
 def createEditor(self, parent, option, index):
     layer = index.data().toPyObject()
     if isinstance(layer, Layer):
         editor = LayerItemWidget(parent=parent)
         editor.setAutoFillBackground(True)
         editor.setPalette(option.palette)
         editor.setBackgroundRole(QPalette.Highlight)
         editor.layer = layer
         return editor
     else:
         QStyledItemDelegate.createEditor(self, parent, option, index)
예제 #6
0
 def createEditor(self, parent, option, index):
     delegate = self.delegates.get(index.column())
     if delegate is not None:
         return delegate.createEditor(parent, option, index)
     else:
         return QStyledItemDelegate.createEditor(self, parent, option,
                                                 index)
예제 #7
0
 def createEditor( self, parent, option, index ):
     if index.column() == DESCRIPCION:
         combo = QComboBox( parent )
         combo.setEditable( True )
         value = index.data().toString()
         self.filtrados.append( value )
         self.proxymodel.setFilterRegExp( self.filter() )
         combo.setModel( self.proxymodel )
         combo.setModelColumn( 1 )
         combo.setCompleter( self.completer )
         return combo
     elif index.column() == BANCO:
         combo = QComboBox( parent )
         #combo.setEditable(True)
         combo.setModel( self.bancosmodel )
         combo.setModelColumn( 1 )
         #combo.setCompleter(self.completer)
         return combo
     elif index.column() == MONTO:
         doublespinbox = QDoubleSpinBox( parent )
         doublespinbox.setMinimum( -1000000 )
         doublespinbox.setMaximum( 1000000 )
         doublespinbox.setDecimals( 4 )
         doublespinbox.setAlignment( Qt.AlignHCenter )
         return doublespinbox
     elif index.column() == REFERENCIA:
         textbox = QStyledItemDelegate.createEditor( self, parent, option, index )
         textbox.setAlignment( Qt.AlignHCenter )
         return textbox
예제 #8
0
 def createEditor(self, parent, option, index):
     if index.column() == TEU:
         spinbox = QSpinBox(parent)
         spinbox.setRange(0, 200000)
         spinbox.setSingleStep(1000)
         spinbox.setAlignment(Qt.AlignRight|Qt.AlignVCenter)
         return spinbox
     elif index.column() == OWNER:
         combobox = QComboBox(parent)
         combobox.addItems(sorted(index.model().owners))
         combobox.setEditable(True)
         return combobox
     elif index.column() == COUNTRY:
         combobox = QComboBox(parent)
         combobox.addItems(sorted(index.model().countries))
         combobox.setEditable(True)
         return combobox
     elif index.column() == NAME:
         editor = QLineEdit(parent)
         editor.returnPressed.connect(self.commitAndCloseEditor)
         return editor
     elif index.column() == DESCRIPTION:
         editor = richtextlineedit.RichTextLineEdit(parent)
         editor.returnPressed.connect(self.commitAndCloseEditor)
         return editor
     else:
         return QStyledItemDelegate.createEditor(self, parent, option,
                                                 index)
예제 #9
0
 def createEditor(self, parent, option, index):
     if index.column() == TEU:
         spinbox = QSpinBox(parent)
         spinbox.setRange(0, 200000)
         spinbox.setSingleStep(1000)
         spinbox.setAlignment(Qt.AlignRight|Qt.AlignVCenter)
         return spinbox
     elif index.column() == OWNER:
         combobox = QComboBox(parent)
         combobox.addItems(sorted(index.model().owners))
         combobox.setEditable(True)
         return combobox
     elif index.column() == COUNTRY:
         combobox = QComboBox(parent)
         combobox.addItems(sorted(index.model().countries))
         combobox.setEditable(True)
         return combobox
     elif index.column() == NAME:
         editor = QLineEdit(parent)
         self.connect(editor, SIGNAL("returnPressed()"),
                      self.commitAndCloseEditor)
         return editor
     elif index.column() == DESCRIPTION:
         editor = richtextlineedit.RichTextLineEdit(parent)
         self.connect(editor, SIGNAL("returnPressed()"),
                      self.commitAndCloseEditor)
         return editor
     else:
         return QStyledItemDelegate.createEditor(self, parent, option,
                                                 index)
예제 #10
0
 def createEditor(self, parent, option, index):
     delegate = self.delegates.get(index.column())
     if delegate is not None:
         return delegate.createEditor(parent, option, index)
     else:
         return QStyledItemDelegate.createEditor(self, parent, option,
                                                 index)
예제 #11
0
 def createEditor(self, parent, option, index):
     """
     Create an editor widget.  Note that the LayerWidget always uses persistent editors.
     """
     layer = index.data().toPyObject()
     if isinstance(layer, Layer):
         editor = LayerItemWidget(parent=parent)
         editor.is_editor = True
         # We set a custom objectName for debug and eventcapture testing purposes.
         editor.setObjectName("LayerItemWidget_{}".format(layer.name))
         editor.setAutoFillBackground(True)
         editor.setPalette( option.palette )
         editor.setBackgroundRole(QPalette.Highlight)
         editor.layer = layer
         self._editors[layer] = editor
         return editor
     else:
         QStyledItemDelegate.createEditor(self, parent, option, index)
예제 #12
0
 def createEditor(self, parent, option, index):
     if index.isValid() and index.column() == 0:
         finishmentWidget = QComboBox(parent)
         finishmentWidget.addItems(
             [self.trUtf8("已完成"),
              self.trUtf8("进行中"),
              self.trUtf8("未完成")])
         return finishmentWidget
     return QStyledItemDelegate.createEditor(self, parent, option, index)
예제 #13
0
    def createEditor(self, parent, option, index):
        # Create combobox editor for sort order column
        if index.column() == self._sort_cold_idx:
            combo = QComboBox(parent)
            for enum, txt in SORT_ORDER_NAME.iteritems():
                combo.addItem(txt, enum)

            return combo
        else:
            return QStyledItemDelegate.createEditor(
                self,
                parent,
                option,
                index
            )
예제 #14
0
 def createEditor( self, parent, option, index ):
     """
     Aca se inicializa el control que se usara para editar
     """
     if index.column() == EMAIL:
         lineedit = QLineEdit( parent )
         #accepts only mail
         validator = QRegExpValidator( QRegExp( r"^([a-zA-Z0-9_\.\-\+])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$" ), self )
         lineedit.setValidator( validator )
         return lineedit
     elif index.column() == TELEFONO:
         lineedit = QLineEdit( parent )
         validator = QIntValidator( self )
         lineedit.setValidator( validator )
         return lineedit
     else:
         return QStyledItemDelegate.createEditor( self, parent, option, index )
예제 #15
0
    def createEditor(self, parent, option, index):
        column = index.column()

        fieldType = FieldsMappingModel.columns[column]['type']
        if fieldType == QVariant.Type:
            editor = QComboBox(parent)
            for key, text in FieldsMappingModel.fieldTypes.iteritems():
                editor.addItem(text, key)

        elif fieldType == QgsExpression:
            editor = QgsFieldExpressionWidget(parent)
            editor.setLayer(index.model().layer())
            editor.fieldChanged.connect(self.on_expression_fieldChange)

        else:
            editor = QStyledItemDelegate.createEditor(self, parent, option, index)

        editor.setAutoFillBackground(True)
        return editor
예제 #16
0
파일: gsbui.py 프로젝트: toyg/plasmaapplets
 def createEditor(self,parent,option,index):
     """create widgets to edit values"""
     if index.isValid():
         model = index.model()
         column = index.column()
         if (column == model.position_for_header('date')) or \
            (column == model.position_for_header('expected_date')) :
                 data = model.data(index,Qt.DisplayRole)
                 if data.toString() == "":
                     data = datetime.today()
                 editor = QDateTimeEdit(data)
                 editor.setCalendarPopup(True)                    
                 self.updateEditorGeometry(editor, option,index )
                 # by default it's a bit too small
                 editor.setFixedWidth(option.rect.width() + 50)
                 # FIXME: resulting position is still wrong
                 return editor
                 
     return QStyledItemDelegate.createEditor(self,parent,option,index)
예제 #17
0
 def createEditor(self, parent, option, index):
     node = index.internalPointer()
     if node.typeInfo == 'CODE':
         if node.valueFormat == 'percent':
             editor = QDoubleSpinBox(parent)
             editor.setSuffix('%')
         elif node.valueFormat == 'integer':
             editor = QSpinBox(parent)
         else:
             editor = QDoubleSpinBox(parent)
         editor.setMaximum(100000000)
     elif node.typeInfo == 'BAREME':
         editor = QPushButton(parent)
         editor.setText('Editer')
         value = node._value
         value.marToMoy()
         self.baremeDialog = BaremeDialog(value, self._parent)
         self.connect(editor, SIGNAL('clicked()'), self.runBaremeDialog)
         self.runBaremeDialog()
     else:
         editor = QStyledItemDelegate.createEditor(self, parent, option, index)
     return editor
예제 #18
0
 def createEditor(self, parent, option, index):
     node = index.internalPointer()
     if node.typeInfo == 'CODE':
         if node.valueFormat == 'percent':
             editor = QDoubleSpinBox(parent)
             editor.setSuffix('%')
         elif node.valueFormat == 'integer':
             editor = QSpinBox(parent)
         else:
             editor = QDoubleSpinBox(parent)
         editor.setMaximum(100000000)
     elif node.typeInfo == 'BAREME':
         editor = QPushButton(parent)
         editor.setText('Editer')
         value = node._value
         value.marToMoy()
         self.baremeDialog = BaremeDialog(value, self._parent)
         self.connect(editor, SIGNAL('clicked()'), self.runBaremeDialog)
         self.runBaremeDialog()
     else:
         editor = QStyledItemDelegate.createEditor(self, parent, option,
                                                   index)
     return editor
 def createEditor(self, parent, option, index):
     if index.model().get_item(index).waiting_evaluation:
         return AskVerdict(parent, self)
     else:
         return QStyledItemDelegate.createEditor(self, parent, option,
                                                 index)
예제 #20
0
 def createEditor(self, parent, option, index):
     return QStyledItemDelegate.createEditor(self, parent, option, index)
예제 #21
0
 def createEditor(self, parent, option, index):
     if index.isValid() and index.column() == 0:
         finishmentWidget = QComboBox(parent)
         finishmentWidget.addItems([self.trUtf8("已完成"), self.trUtf8("进行中"), self.trUtf8("未完成")])
         return finishmentWidget
     return QStyledItemDelegate.createEditor(self, parent, option, index)
예제 #22
0
 def createEditor(self, parent, option, index):
     return QStyledItemDelegate.createEditor(self, parent, option,
                                             index)
예제 #23
0
 def createEditor(self, parent, option, index):
     layer = index.data().toPyObject()
     if isinstance(layer, Layer):
         return LayerEditor(parent)
     else:
         QStyledItemDelegate.createEditor(self, parent, option, index)