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


Python Qt.ItemIsEditable方法代码示例

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


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

示例1: paint

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import ItemIsEditable [as 别名]
def paint(self, painter, option, index):
        ''' 
        Paint a checkbox without the label.
        '''
        checked = bool(index.model().data(index, Qt.DisplayRole))
        opts = QStyleOptionButton()
        opts.state |= QStyle.State_Active
        if index.flags() & Qt.ItemIsEditable:
            opts.state |= QStyle.State_Enabled
        else:
            opts.state |= QStyle.State_ReadOnly
        if checked:
            opts.state |= QStyle.State_On
        else:
            opts.state |= QStyle.State_Off
        opts.rect = self.getCheckBoxRect(option)
        QApplication.style().drawControl(QStyle.CE_CheckBox, opts, painter) 
开发者ID:aseylys,项目名称:KStock,代码行数:19,代码来源:CheckBoxDelegateQt.py

示例2: editorEvent

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import ItemIsEditable [as 别名]
def editorEvent(self, event, model, option, index):
        ''' 
        Change the data in the model and the state of the checkbox if the
        user presses the left mouse button and this cell is editable. Otherwise do nothing.
        '''
        if not (index.flags() & Qt.ItemIsEditable):
            return False
        if event.button() == Qt.LeftButton:
            if event.type() == QEvent.MouseButtonRelease:
                if self.getCheckBoxRect(option).contains(event.pos()):
                    self.setModelData(None, model, index)
                    return True
            elif event.type() == QEvent.MouseButtonDblClick:
                if self.getCheckBoxRect(option).contains(event.pos()):
                    return True
        return False 
开发者ID:aseylys,项目名称:KStock,代码行数:18,代码来源:CheckBoxDelegateQt.py

示例3: flags

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import ItemIsEditable [as 别名]
def flags(self, index):
        if not index.isValid():
            return 0

        if index.column() == 0:
            return Qt.ItemIsEnabled | Qt.ItemIsSelectable

        return Qt.ItemIsEditable | Qt.ItemIsEnabled | Qt.ItemIsSelectable 
开发者ID:benhoff,项目名称:CHATIMUSMAXIMUS,代码行数:10,代码来源:settings_model.py

示例4: flags

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import ItemIsEditable [as 别名]
def flags(self, index):
        flags = QAbstractTableModel.flags(self, index)
        if not index.isValid():
            return flags
        prop = self.getProperty(index)
        if prop is None:
            return flags
        flags |= Qt.ItemIsEnabled
        flags |= Qt.ItemIsSelectable
        mode = prop.get('mode', "Read/Write")
        if "Write" in mode:
            flags |= Qt.ItemIsEditable
        return flags 
开发者ID:aseylys,项目名称:KStock,代码行数:15,代码来源:ObjList.py

示例5: flags

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import ItemIsEditable [as 别名]
def flags(self, index):
        return Qt.ItemIsEditable | Qt.ItemIsEnabled | Qt.ItemIsSelectable 
开发者ID:FrancescoCeruti,项目名称:linux-show-player,代码行数:4,代码来源:qmodels.py

示例6: flags

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import ItemIsEditable [as 别名]
def flags(self, qindex: QModelIndex):
        if qindex.isValid():
            if qindex.column() in (1, 2, 3):
                return super().flags(qindex) & ~Qt.ItemIsEditable
        return super().flags(qindex) 
开发者ID:fre-sch,项目名称:mhw_armor_edit,代码行数:7,代码来源:otomo_armor_editor.py

示例7: flags

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import ItemIsEditable [as 别名]
def flags(self, index):
        if not index.isValid():
            return super().flags(index)
        node = index.internalPointer()
        if isinstance(node, ShellTreeEntryNode) and index.column() in (1, 2, 3):
            return super().flags(index) | Qt.ItemIsEditable
        return super().flags(index) 
开发者ID:fre-sch,项目名称:mhw_armor_edit,代码行数:9,代码来源:shell_table_editor.py

示例8: flags

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import ItemIsEditable [as 别名]
def flags(self, qindex):
        flags = super().flags(qindex)
        if qindex.column() in (WpDatGEntry.id.index,
                               WpDatGEntry.gmd_name_index.index,
                               WpDatGEntry.gmd_description_index):
            return flags & ~Qt.ItemIsEditable
        return flags 
开发者ID:fre-sch,项目名称:mhw_armor_edit,代码行数:9,代码来源:weapon_gun_editor.py

示例9: flags

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import ItemIsEditable [as 别名]
def flags(self, QModelIndex):
        return Qt.ItemIsEditable | Qt.ItemIsSelectable | Qt.ItemIsEnabled 
开发者ID:MalloyDelacroix,项目名称:DownloaderForReddit,代码行数:4,代码来源:ListModel.py

示例10: createGUI

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import ItemIsEditable [as 别名]
def createGUI(self):

        tableData = pd.read_csv('DLart/networks.csv')
        self.networkHist = []
        for i in range(pd.DataFrame.count(tableData)['name']):
            self.networkHist.append(tableData.iloc[i]['name'])
        length = len(self.networkHist)
        self.table = QTableWidget(length, 2)
        self.table.setHorizontalHeaderLabels(["Network Name", "Network Path"])
        self.table.verticalHeader().setVisible(True)
        self.table.setSizeAdjustPolicy(QtWidgets.QAbstractScrollArea.AdjustToContents)

        self.table.cellDoubleClicked.connect(self.editCell)
        self.table.cellChanged.connect(self.cellChanged)

        for i in range(length):
            name = tableData.at[i,'name']
            nameItem = QTableWidgetItem(name)
            nameItem.setFlags(nameItem.flags() | Qt.ItemIsEditable)
            path = tableData.at[i,'path'].replace(".", "/") + '.py'
            pathItem = QTableWidgetItem(path)
            self.table.setItem(i, 0, nameItem)
            self.table.setItem(i, 1, pathItem)

        self.table.resizeColumnToContents(0)
        self.table.horizontalHeader().setStretchLastSection(True)

        self.layout = QGridLayout()
        self.layout.addWidget(self.table, 0, 0)
        self.setLayout(self.layout)

        self.setWindowTitle("Predefined Neural Networks Editor") 
开发者ID:thomaskuestner,项目名称:CNNArt,代码行数:34,代码来源:predefined_networks.py

示例11: createGUI

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import ItemIsEditable [as 别名]
def createGUI(self):
        length = len(self.labelHist)
        tableData = pandas.read_csv('configGUI/predefined_label.csv')

        self.table = QTableWidget(length, 2)
        self.table.setHorizontalHeaderLabels(["Label Name", "Label Color"])
        self.table.verticalHeader().setVisible(True)
        self.table.setSizeAdjustPolicy(QtWidgets.QAbstractScrollArea.AdjustToContents)

        self.table.cellDoubleClicked.connect(self.editCell)
        self.table.cellChanged.connect(self.cellChanged)

        for i in range(length):
            name = tableData.at[i,'label name']
            nameItem = QTableWidgetItem(name)
            nameItem.setFlags(nameItem.flags() | Qt.ItemIsEditable)
            color = QColor(tableData.at[i,'label color'])
            colorItem = QTableWidgetItem()
            colorItem.setData(Qt.DisplayRole, color)
            colorItem.setFlags(colorItem.flags() | Qt.ItemIsEditable)
            self.table.setItem(i, 0, nameItem)
            self.table.setItem(i, 1, colorItem)

        self.table.resizeColumnToContents(0)

        self.layout = QGridLayout()
        self.layout.addWidget(self.table, 0, 0)
        self.setLayout(self.layout)

        self.setWindowTitle("Predefined Label Editor") 
开发者ID:thomaskuestner,项目名称:CNNArt,代码行数:32,代码来源:predefined_label.py

示例12: flags

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import ItemIsEditable [as 别名]
def flags(self, index):
        base_flag = Qt.ItemIsEnabled | Qt.ItemIsSelectable
        if self.is_editable:
            return base_flag | Qt.ItemIsEditable
        else:
            return base_flag 
开发者ID:mjhoptics,项目名称:ray-optics,代码行数:8,代码来源:pytablemodel.py

示例13: flags

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import ItemIsEditable [as 别名]
def flags(self, index):
        f = Qt.ItemIsEnabled | Qt.ItemIsSelectable
        if index.column() == 0:
            f = f | Qt.ItemIsUserCheckable | Qt.ItemIsEditable
        return f 
开发者ID:roglew,项目名称:guppy-proxy,代码行数:7,代码来源:macros.py

示例14: _redraw_strcol

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import ItemIsEditable [as 别名]
def _redraw_strcol(self, row):
        start = self.row_size * row
        end = start + self.row_size
        data = self.data[start:end]
        print_data = printable_data(data, include_newline=False)
        item = QTableWidgetItem(print_data)
        item.setFlags(item.flags() ^ Qt.ItemIsEditable)
        self.datatable.setItem(row, self.str_col, item) 
开发者ID:roglew,项目名称:guppy-proxy,代码行数:10,代码来源:hexteditor.py

示例15: redraw_table

# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import ItemIsEditable [as 别名]
def redraw_table(self, length=None):
        with DisableUpdates(self.datatable):
            oldsig = self.datatable.blockSignals(True)
            self.row_size = length or self.row_size
            self.datatable.setColumnCount(self.row_size + 1)
            self.datatable.setRowCount(0)
            self.str_col = self.row_size

            self.datatable.horizontalHeader().hide()
            self.datatable.verticalHeader().hide()

            rows = int(len(self.data) / self.row_size)
            if len(self.data) % self.row_size > 0:
                rows += 1
            self.datatable.setRowCount(rows)

            for i in range(rows * self.row_size):
                row = i / self.row_size
                col = i % self.row_size
                if i < len(self.data):
                    dataval = "%02x" % self.data[i]
                    item = QTableWidgetItem(dataval)
                    if self.read_only:
                        item.setFlags(item.flags() ^ Qt.ItemIsEditable)
                else:
                    item = QTableWidgetItem("")
                    item.setFlags(item.flags() ^ Qt.ItemIsEditable)
                self.datatable.setItem(row, col, item)

            for row in range(rows):
                self._redraw_strcol(row)
            self.datatable.blockSignals(oldsig)
            self.datatable.resizeColumnsToContents()
            self.datatable.resizeRowsToContents() 
开发者ID:roglew,项目名称:guppy-proxy,代码行数:36,代码来源:hexteditor.py


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