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


Python QtWidgets.QTableWidgetItem方法代码示例

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


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

示例1: settingsChanged

# 需要导入模块: from qgis.PyQt import QtWidgets [as 别名]
# 或者: from qgis.PyQt.QtWidgets import QTableWidgetItem [as 别名]
def settingsChanged(self):
        self.initLabel()
        if self.numCol != self.settings.multiZoomNumCol + 3:
            # The number of columns have changed
            self.numCol = 3 + self.settings.multiZoomNumCol
            self.resultsTable.blockSignals(True)
            self.resultsTable.setColumnCount(self.numCol)
            self.resultsTable.setHorizontalHeaderLabels(LABELS[0:self.numCol])
            rowcnt = self.resultsTable.rowCount()
            for i in range(rowcnt):
                item = self.resultsTable.item(i, 0).data(Qt.UserRole)
                if self.numCol > 3:
                    for j in range(3, self.numCol):
                        self.resultsTable.setItem(i, j, QTableWidgetItem(item.data[j - 3]))

            self.resultsTable.clearSelection()
            self.resultsTable.blockSignals(False)
            self.geomChanged()
            self.updateDisplayedMarkers() 
开发者ID:NationalSecurityAgency,项目名称:qgis-latlontools-plugin,代码行数:21,代码来源:multizoom.py

示例2: addCoord

# 需要导入模块: from qgis.PyQt import QtWidgets [as 别名]
# 或者: from qgis.PyQt.QtWidgets import QTableWidgetItem [as 别名]
def addCoord(self, lat, lon, label='', data=[]):
        '''Add a coordinate to the list.'''
        rowcnt = self.resultsTable.rowCount()
        if rowcnt >= self.maxResults:
            return
        self.resultsTable.blockSignals(True)
        self.resultsTable.insertRow(rowcnt)
        item = QTableWidgetItem(str(lat))
        item.setData(Qt.UserRole, LatLonItem(lat, lon, label, data))
        item.setFlags(item.flags() & ~Qt.ItemIsEditable)
        self.resultsTable.setItem(rowcnt, 0, item)
        item = QTableWidgetItem(str(lon))
        item.setFlags(item.flags() & ~Qt.ItemIsEditable)
        self.resultsTable.setItem(rowcnt, 1, item)
        self.resultsTable.setItem(rowcnt, 2, QTableWidgetItem(label))
        if self.numCol > 3 and len(data) > 0:
            for i in range(min(self.numCol - 3, len(data))):
                self.resultsTable.setItem(rowcnt, i + 3, QTableWidgetItem(data[i]))

        self.resultsTable.blockSignals(False)
        return(rowcnt) 
开发者ID:NationalSecurityAgency,项目名称:qgis-latlontools-plugin,代码行数:23,代码来源:multizoom.py

示例3: NewEntry

# 需要导入模块: from qgis.PyQt import QtWidgets [as 别名]
# 或者: from qgis.PyQt.QtWidgets import QTableWidgetItem [as 别名]
def NewEntry(self, Dic, DicKey,TabElement, New = False):
        '''Actualiza la lista de las variables en una tabla'''
        #Busca si ese nombre ya se encuentra en la tabla
        try:
            #Si esta, remplaza esa posicion
            pos = self.TabNames.index(DicKey)
            suma = 0
        except:
            #Si no esta, lo pone al final.
            pos = self.NumRows
            self.TabNames.append(DicKey)
            suma = 1
        #for keyParam in Dic:
        if New:
            TabElement.setItem (pos, 0, QTableWidgetItem (Dic["nombre"]+'*'))
        else:
            TabElement.setItem (pos, 0, QTableWidgetItem (Dic["nombre"]))
        TabElement.setItem (pos, 1, QTableWidgetItem (Dic["tipo"]))
        TabElement.setItem (pos, 2, QTableWidgetItem (str (Dic["shape"])))
        TabElement.setItem (pos, 3, QTableWidgetItem (Dic["categoria"]))
        self.NumRows += suma 
开发者ID:nicolas998,项目名称:WMF,代码行数:23,代码来源:HydroSEDPlugin_dockwidget.py

示例4: addLayerFields

# 需要导入模块: from qgis.PyQt import QtWidgets [as 别名]
# 或者: from qgis.PyQt.QtWidgets import QTableWidgetItem [as 别名]
def addLayerFields(self, layer_source):
        layer = layer_source.layer

        if layer.type() != QgsMapLayer.VectorLayer:
            return

        for i, field in enumerate(layer.fields()):
            row = self.rowCount()
            ews = layer.editorWidgetSetup(i)

            if ews.type() == 'ExternalResource':
                # for later: if ews.config().get('DocumentViewer', QgsExternalResourceWidget.NoContent) == QgsExternalResourceWidget.Image:
                self.insertRow(row)
                item = QTableWidgetItem(layer.name())
                item.setData(Qt.UserRole, layer_source)
                self.setItem(row, 0, item)
                item = QTableWidgetItem(field.name())
                self.setItem(row, 1, item)
                ew = QgsFieldExpressionWidget()
                ew.setLayer(layer)
                expression = layer_source.photo_naming(field.name())
                ew.setExpression(expression)
                self.setCellWidget(row, 2, ew)

        self.resizeColumnsToContents() 
开发者ID:opengisch,项目名称:qfieldsync,代码行数:27,代码来源:photo_naming_widget.py

示例5: populateTable

# 需要导入模块: from qgis.PyQt import QtWidgets [as 别名]
# 或者: from qgis.PyQt.QtWidgets import QTableWidgetItem [as 别名]
def populateTable(self):
        '''
        Populates the servers table
        '''
        currentConnections = self.getServers()
        self.tableWidget.setRowCount(len(currentConnections))
        for i, connection in enumerate(currentConnections):
            self.tableWidget.setItem(i, 0, QTableWidgetItem(connection))
            (host, port, user, password, isDefault) = self.getServerConfiguration(connection)
            self.tableWidget.setItem(i, 1, QTableWidgetItem(host))
            self.tableWidget.setItem(i, 2, QTableWidgetItem(port))
            self.tableWidget.setItem(i, 3, QTableWidgetItem(user))
            if not password or len(password) == 0:
                self.tableWidget.setItem(i, 4, QTableWidgetItem(self.tr('Not Saved')))
            else:
                self.tableWidget.setItem(i, 4, QTableWidgetItem(self.tr('Saved')))
            radio = QRadioButton(self.tableWidget)
            radio.setAutoExclusive(True)
            if isDefault:
                radio.setChecked(True)
            self.tableWidget.setCellWidget(i, 5, radio) 
开发者ID:dsgoficial,项目名称:DsgTools,代码行数:23,代码来源:viewServers.py

示例6: EditedEntry

# 需要导入模块: from qgis.PyQt import QtWidgets [as 别名]
# 或者: from qgis.PyQt.QtWidgets import QTableWidgetItem [as 别名]
def EditedEntry(self, KeyEdited, TabElement, New_or_Edited = 'Edited'):
        '''Establece en la tabla visual si una entrada ha sido editada'''
        #Encuentra la pos
        pos = self.TabNames.index(KeyEdited)
        #Edita el nombre en la tabla 
        TabElement.setItem(pos, 0, QTableWidgetItem(KeyEdited+'*')) 
开发者ID:nicolas998,项目名称:WMF,代码行数:8,代码来源:HydroSEDPlugin_dockwidget.py

示例7: SavedEntry

# 需要导入模块: from qgis.PyQt import QtWidgets [as 别名]
# 或者: from qgis.PyQt.QtWidgets import QTableWidgetItem [as 别名]
def SavedEntry(self, TabElement):
        '''Busca los elementos de la tabla que terminen con * y se los quita, solo para
        que el usuario sepa que han sido guardados'''
        #Busca en cada entrada
        for i in range(self.NumRows):
            Nombre = TabElement.takeItem(i,0).text()
            if Nombre[-1] == '*':
                TabElement.setItem(i,0, QTableWidgetItem(Nombre[:-1]))
            else:
                TabElement.setItem(i,0, QTableWidgetItem(Nombre)) 
开发者ID:nicolas998,项目名称:WMF,代码行数:12,代码来源:HydroSEDPlugin_dockwidget.py

示例8: addFoundItem

# 需要导入模块: from qgis.PyQt import QtWidgets [as 别名]
# 或者: from qgis.PyQt.QtWidgets import QTableWidgetItem [as 别名]
def addFoundItem(self, layer, feature, attrname, value):
        '''We found an item so add it to the found list.'''
        self.resultsTable.insertRow(self.found)
        self.results.append([layer, feature])
        self.resultsTable.setItem(self.found, 0, QTableWidgetItem(value))
        self.resultsTable.setItem(self.found, 1, QTableWidgetItem(layer.name()))
        self.resultsTable.setItem(self.found, 2, QTableWidgetItem(attrname))
        self.resultsTable.setItem(self.found, 3, QTableWidgetItem(str(feature.id())))
        self.found += 1 
开发者ID:NationalSecurityAgency,项目名称:qgis-searchlayers-plugin,代码行数:11,代码来源:searchDialog.py

示例9: unitsChanged

# 需要导入模块: from qgis.PyQt import QtWidgets [as 别名]
# 或者: from qgis.PyQt.QtWidgets import QTableWidgetItem [as 别名]
def unitsChanged(self):
        label = "Distance [{}]".format(DISTANCE_LABELS[self.unitsComboBox.currentIndex()])
        item = QTableWidgetItem(label)
        self.tableWidget.setHorizontalHeaderItem(2, item)
        ptcnt = len(self.capturedPoints)
        if ptcnt >= 2:
            i = 0
            while i < ptcnt - 1:
                item = QTableWidgetItem('{:.4f}'.format(self.unitDistance(self.distances[i])))
                self.tableWidget.setItem(i, 2, item)
                i += 1
            self.formatTotal() 
开发者ID:NationalSecurityAgency,项目名称:qgis-shapetools-plugin,代码行数:14,代码来源:geodesicMeasureTool.py

示例10: insertParams

# 需要导入模块: from qgis.PyQt import QtWidgets [as 别名]
# 或者: from qgis.PyQt.QtWidgets import QTableWidgetItem [as 别名]
def insertParams(self, position, distance, startAngle, endAngle):
        if position > self.tableWidget.rowCount():
            self.tableWidget.insertRow(position - 1)
        item = QTableWidgetItem('{:.4f}'.format(self.unitDistance(distance)))
        item.setFlags(Qt.ItemIsSelectable | Qt.ItemIsEnabled)
        self.tableWidget.setItem(position - 1, 2, item)
        item = QTableWidgetItem('{:.4f}'.format(startAngle))
        item.setFlags(Qt.ItemIsSelectable | Qt.ItemIsEnabled)
        self.tableWidget.setItem(position - 1, 0, item)
        item = QTableWidgetItem('{:.4f}'.format(endAngle))
        item.setFlags(Qt.ItemIsSelectable | Qt.ItemIsEnabled)
        self.tableWidget.setItem(position - 1, 1, item) 
开发者ID:NationalSecurityAgency,项目名称:qgis-shapetools-plugin,代码行数:14,代码来源:geodesicMeasureTool.py

示例11: addItemInTableWidget

# 需要导入模块: from qgis.PyQt import QtWidgets [as 别名]
# 或者: from qgis.PyQt.QtWidgets import QTableWidgetItem [as 别名]
def addItemInTableWidget(self, codeText = '', valueText = ''):
        index = self.tableWidget.rowCount()
        self.tableWidget.insertRow(index)
        codeItem = QtGui.QTableWidgetItem(codeText)
        valueItem = QtGui.QTableWidgetItem(valueText)
        self.tableWidget.setItem(self.tableWidget.rowCount()-1, 0, codeItem)
        self.tableWidget.setItem(self.tableWidget.rowCount()-1, 1, valueItem)
        if index == 0:
            self.oldBackground = self.tableWidget.item(0,0).background() 
开发者ID:dsgoficial,项目名称:DsgTools,代码行数:11,代码来源:newDomainWidget.py

示例12: addItem

# 需要导入模块: from qgis.PyQt import QtWidgets [as 别名]
# 或者: from qgis.PyQt.QtWidgets import QTableWidgetItem [as 别名]
def addItem(self, row, col, text):
        """
        Gets an item to be added to the table that may be set to not be editable.
        :param row: (int) row index to be added.
        :param col: (int) column index to be added.
        :param text: (str) name to be exposed on table cell.
        :return: (QTableWidgetItem) item added as to table cell.
        """
        item = QtWidgets.QTableWidgetItem()
        item.setText(text)
        item.setFlags(Qt.ItemIsEditable) # not editable
        self.tableWidget.setItem(row, col, item)
        return item 
开发者ID:dsgoficial,项目名称:DsgTools,代码行数:15,代码来源:datasourceInfoTable.py

示例13: fillOutDsInfoRow

# 需要导入模块: from qgis.PyQt import QtWidgets [as 别名]
# 或者: from qgis.PyQt.QtWidgets import QTableWidgetItem [as 别名]
def fillOutDsInfoRow(self, row):
        """
        Fills out row with output info for each output column. In here, ouput SRC and EDGV are filled. 
        :param row: (int) row index to have its output columns populated.
        :return: (list-of-object) return a list containing (str) output EDGV version and (QPushButton) output SRC.
        """
        # clear current content, if any
        try:
            self.clearOutDsInforRow(row=row)
        except:
            pass
        # get only outDs widget
        outDs = self.getRowContents(row=row)[DatasourceConversion.OutDs]
        # widget dict keys are defined as group title, which is part of outDs current text
        if outDs:
            groupTitle = outDs.currentText().split(':')[0]
            crsIcon = QIcon(os.path.join(os.path.dirname(__file__), '..', '..', '..', 'icons', 'CRS_qgis.svg'))
        else:
            return []
        if groupTitle in self.outDs:
            containerWidget = self.outDs[groupTitle]
            # only fills line if dictionary is a controlled widget
            # new push button for SRC
            outCrs = QtWidgets.QPushButton()
            outCrs.setIcon(crsIcon)
            # get new text item to add output datasource
            edgvOut = containerWidget.connectionWidget.getDatasourceEdgvVersion()
            edgvOut = edgvOut[5:] if 'EDGV' in edgvOut else edgvOut
            itemEdgvOut = QtWidgets.QTableWidgetItem()
            itemEdgvOut.setText(edgvOut)
            itemEdgvOut.setFlags(Qt.ItemIsEditable) # not editable
            # add both to table
            self.tableWidget.setCellWidget(row, DatasourceConversion.outCrs, outCrs)
            self.tableWidget.setItem(row, DatasourceConversion.OutEdgv, itemEdgvOut)
            return [edgvOut, outCrs]
        else:
            # if is not controlled, clear line
            return [] 
开发者ID:dsgoficial,项目名称:DsgTools,代码行数:40,代码来源:datasourceConversion.py

示例14: addItemToTable

# 需要导入模块: from qgis.PyQt import QtWidgets [as 别名]
# 或者: from qgis.PyQt.QtWidgets import QTableWidgetItem [as 别名]
def addItemToTable(self, col, row, text='', isEditable=True):
        """
        Adds an item to the mapping table into a given column and row.
        :param col: (int) column containing new item.
        :param row: (int) row containing new item.
        :param text: (str) name to be exposed on table cell.
        :param isEditable: (bool) boolean indicating whether cell content should be editable.
        :return: (QTableWidgetItem) item added.
        """
        newItem = self.getNewTableItem(text=text, isEditable=isEditable)
        self.tableWidget.setItem(row, col, newItem)
        return newItem 
开发者ID:dsgoficial,项目名称:DsgTools,代码行数:14,代码来源:datasourceConversion.py

示例15: populateFieldsTable

# 需要导入模块: from qgis.PyQt import QtWidgets [as 别名]
# 或者: from qgis.PyQt.QtWidgets import QTableWidgetItem [as 别名]
def populateFieldsTable(self):
        """
        Populates field map to codelist table.
        """
        fieldMap = self.currentFieldMap()
        self.tableWidget.setRowCount(len(fieldMap))
        for row, (code, value) in enumerate(fieldMap.items()):
            self.tableWidget.setItem(row, 0, QTableWidgetItem(value))
            self.tableWidget.setItem(row, 1, QTableWidgetItem(code))
        self.tableWidget.sortItems(1) 
开发者ID:dsgoficial,项目名称:DsgTools,代码行数:12,代码来源:code_list.py


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