Python PyQt5.QtCore.Qt 模块,NoItemFlags() 实例源码

我们从Python开源项目中,提取了以下13个代码示例,用于说明如何使用PyQt5.QtCore.Qt.NoItemFlags()

项目:opcua-modeler    作者:FreeOpcUa    | 项目源码 | 文件源码
def set_server_mgr(self, server_mgr):
        self.server_mgr = server_mgr
        self.nodesets = []
        self.model.clear()
        self.model.setHorizontalHeaderLabels(['Node Sets'])
        item = QStandardItem("Opc.Ua.NodeSet2.xml")
        item.setFlags(Qt.NoItemFlags)
        self.model.appendRow([item])
        self.view.expandAll()
项目:Py2DSpectroscopy    作者:SvenBo90    | 项目源码 | 文件源码
def cb_function_selected(self, index):

        # get the peak number of the changed function
        i_peak = int(self.sender().objectName()[-1])

        # check which function has been selected and update the table flags accordingly
        if index == 0:

            # peak has been turned off
            for i_row in range(1, 5):
                self.ui.table_widget.item(i_peak, i_row).setFlags(Qt.NoItemFlags)

        elif index == 1:

            # gaussian  has been selected
            for i_row in range(1, 4):
                self.ui.table_widget.item(i_peak, i_row).setFlags(
                    Qt.ItemIsSelectable | Qt.ItemIsEnabled | Qt.ItemIsEditable)
            self.ui.table_widget.item(i_peak, 4).setFlags(Qt.NoItemFlags)

        elif index == 2:

            # lorentzian has been selected
            for i_row in range(1, 3):
                self.ui.table_widget.item(i_peak, i_row).setFlags(
                    Qt.ItemIsSelectable | Qt.ItemIsEnabled | Qt.ItemIsEditable)
            self.ui.table_widget.item(i_peak, 3).setFlags(Qt.NoItemFlags)
            self.ui.table_widget.item(i_peak, 4).setFlags(
                Qt.ItemIsSelectable | Qt.ItemIsEnabled | Qt.ItemIsEditable)

        elif index == 3:

            # voigt has been selected
            for i_row in range(1, 5):
                self.ui.table_widget.item(i_peak, i_row).setFlags(
                    Qt.ItemIsSelectable | Qt.ItemIsEnabled | Qt.ItemIsEditable)
项目:deen    作者:takeshixx    | 项目源码 | 文件源码
def _process_row(self, y, row):
        cols = self.columnCount()
        for x, i in enumerate(range(0, len(row), self._width)):
            block = row[i:i+self._width]
            item = QTableWidgetItem(codecs.encode(block, 'hex').decode())
            item.setBackground(QBrush(QColor('lightgray')))
            item.setForeground(QBrush(QColor('black')))
            item.setTextAlignment(Qt.AlignHCenter | Qt.AlignVCenter)
            item.setData(Qt.UserRole, block)  # store original data
            if self._read_only:
                item.setFlags(Qt.ItemIsSelectable | Qt.ItemIsEnabled)
            else:
                item.setFlags(Qt.ItemIsSelectable | Qt.ItemIsEnabled | Qt.ItemIsEditable)
            self.setItem(y, x, item)

        # process remaining, unfilled cells
        for j in range(x+1, cols):
            item = QTableWidgetItem()
            item.setBackground(QBrush(QColor('white')))
            item.setFlags(Qt.NoItemFlags)
            item.setTextAlignment(Qt.AlignHCenter)
            self.setItem(y, j, item)

        text = self._bytes_to_ascii(row)
        item = QTableWidgetItem(text)
        item.setData(Qt.UserRole, row)  # store original data
        item.setTextAlignment(Qt.AlignLeft| Qt.AlignVCenter)
        item.setBackground(QBrush(QColor('lightblue')))
        item.setForeground(QBrush(QColor('black')))
        if self._read_only:
            item.setFlags(Qt.ItemIsSelectable | Qt.ItemIsEnabled)
        else:
            item.setFlags(Qt.ItemIsSelectable | Qt.ItemIsEnabled | Qt.ItemIsEditable)
        self.setItem(y, cols - 1, item)
项目:Mac-Python-3.X    作者:L1nwatch    | 项目源码 | 文件源码
def flags(self, index):
        if not index.isValid():
            return Qt.NoItemFlags

        return Qt.ItemIsEnabled | Qt.ItemIsSelectable
项目:Mac-Python-3.X    作者:L1nwatch    | 项目源码 | 文件源码
def flags(self, index):
        if not index.isValid():
            return Qt.NoItemFlags

        return Qt.ItemIsEnabled | Qt.ItemIsSelectable
项目:examples    作者:pyqt    | 项目源码 | 文件源码
def flags(self, index):
        if not index.isValid():
            return Qt.NoItemFlags

        return Qt.ItemIsEnabled | Qt.ItemIsSelectable
项目:examples    作者:pyqt    | 项目源码 | 文件源码
def flags(self, index):
        if not index.isValid():
            return Qt.NoItemFlags

        return Qt.ItemIsEnabled | Qt.ItemIsSelectable
项目:urh    作者:jopohl    | 项目源码 | 文件源码
def flags(self, index):
        if not index.isValid():
            return Qt.NoItemFlags

        try:
            _ = self.message_type[index.row()]
        except IndexError:
            return Qt.NoItemFlags

        return Qt.ItemIsEditable | Qt.ItemIsEnabled | Qt.ItemIsSelectable
项目:urh    作者:jopohl    | 项目源码 | 文件源码
def flags(self, index: QModelIndex):
            if not index.isValid():
                return Qt.NoItemFlags

            return Qt.ItemIsEditable | Qt.ItemIsEnabled | Qt.ItemIsSelectable
项目:urh    作者:jopohl    | 项目源码 | 文件源码
def flags(self, index):
            if not index.isValid():
                return Qt.NoItemFlags

            try:
                _ = self.checksum_label.data_ranges[index.row()]
            except IndexError:
                return Qt.NoItemFlags

            return Qt.ItemIsEditable | Qt.ItemIsEnabled | Qt.ItemIsSelectable
项目:pyqt5-example    作者:guinslym    | 项目源码 | 文件源码
def flags(self, index):
        if not index.isValid():
            return Qt.NoItemFlags

        return Qt.ItemIsEnabled | Qt.ItemIsSelectable
项目:pyqt5-example    作者:guinslym    | 项目源码 | 文件源码
def flags(self, index):
        if not index.isValid():
            return Qt.NoItemFlags

        return Qt.ItemIsEnabled | Qt.ItemIsSelectable
项目:uitester    作者:IfengAutomation    | 项目源码 | 文件源码
def set_conflict_tags_table_widget(self):
        self.conflict_tag_table_widget.setColumnCount(5)
        self.conflict_tag_table_widget.setRowCount(len(self.conflict_tags_message_dict.keys()))
        # set table header
        self.conflict_tag_table_widget.setHorizontalHeaderItem(0, QTableWidgetItem('??Id'))
        self.conflict_tag_table_widget.setHorizontalHeaderItem(1, QTableWidgetItem('????'))
        self.conflict_tag_table_widget.setHorizontalHeaderItem(2, QTableWidgetItem('????'))
        self.conflict_tag_table_widget.setHorizontalHeaderItem(3, QTableWidgetItem('??????'))
        self.conflict_tag_table_widget.setHorizontalHeaderItem(4, QTableWidgetItem('??????'))
        self.conflict_tag_table_widget.horizontalHeader().setStyleSheet("QHeaderView::section{background:   #ECF5FF;}")
        self.conflict_tag_table_widget.horizontalHeader().setStretchLastSection(True)
        # set table data
        row = 0
        for key in self.conflict_tags_message_dict:
            conflict_tag = self.conflict_tags_message_dict[key]
            self.conflict_tag_table_widget.setItem(row, 0, QTableWidgetItem(str(conflict_tag['id'])))
            # tag_name
            tag_name_item = QTableWidgetItem(conflict_tag['name'])
            tag_name_item.setForeground(Qt.red)
            tag_name_item.setFont(QFont("Times", 10, QFont.Black))
            self.conflict_tag_table_widget.setItem(row, 1, tag_name_item)

            # tag_description
            if type(conflict_tag['description']) is float and math.isnan(conflict_tag['description']):
                description = ''
            else:
                description = conflict_tag['description']
            self.conflict_tag_table_widget.setItem(row, 2, QTableWidgetItem(description))

            src_name_widget_item = QTableWidgetItem(conflict_tag['src_name'])
            src_name_widget_item.setFlags(Qt.NoItemFlags)
            self.conflict_tag_table_widget.setItem(row, 3, src_name_widget_item)
            if type(conflict_tag['src_description']) is float and math.isnan(conflict_tag['src_description']):
                src_description = ''
            else:
                src_description = conflict_tag['src_description']
            src_description_widget_item = QTableWidgetItem(src_description)
            src_description_widget_item.setFlags(Qt.NoItemFlags)
            self.conflict_tag_table_widget.setItem(row, 4, src_description_widget_item)
            row += 1
        self.conflict_tag_table_widget.setColumnHidden(0, True)
        self.conflict_tag_table_widget.setColumnHidden(3, True)
        self.conflict_tag_table_widget.setColumnHidden(4, True)