本文整理汇总了Python中PyQt5.QtCore.Qt.NoItemFlags方法的典型用法代码示例。如果您正苦于以下问题:Python Qt.NoItemFlags方法的具体用法?Python Qt.NoItemFlags怎么用?Python Qt.NoItemFlags使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt5.QtCore.Qt
的用法示例。
在下文中一共展示了Qt.NoItemFlags方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: flags
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import NoItemFlags [as 别名]
def flags(self, index):
"""Return the item flags for index.
Override QAbstractItemModel::flags.
Return: The item flags, or Qt.NoItemFlags on error.
"""
if not index.isValid():
return Qt.NoItemFlags
if index.parent().isValid():
# item
return (Qt.ItemIsEnabled | Qt.ItemIsSelectable |
Qt.ItemNeverHasChildren)
else:
# category
return Qt.NoItemFlags
示例2: flags
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import NoItemFlags [as 别名]
def flags(self, index: QModelIndex):
if not index.isValid():
return None
j = index.column()
device = self.get_device_at(index.row())
if j == 0 and not device.has_native_backend and not device.has_gnuradio_backend:
return Qt.NoItemFlags
if j in [1, 2, 3] and not device.is_enabled:
return Qt.NoItemFlags
if j == 2 and not device.has_native_backend:
return Qt.NoItemFlags
if j == 3 and not device.has_gnuradio_backend:
return Qt.NoItemFlags
flags = Qt.ItemIsEnabled
if j in [0, 2, 3]:
flags |= Qt.ItemIsUserCheckable
return flags
示例3: set_server_mgr
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import NoItemFlags [as 别名]
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()
示例4: flags
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import NoItemFlags [as 别名]
def flags(self, index):
if not index.isValid():
return Qt.NoItemFlags
return Qt.ItemIsEnabled | Qt.ItemIsSelectable
示例5: flags
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import NoItemFlags [as 别名]
def flags(self, index):
if not index.isValid():
return Qt.NoItemFlags
return Qt.ItemIsEnabled | Qt.ItemIsUserCheckable
示例6: flags
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import NoItemFlags [as 别名]
def flags(self, index):
if not index.isValid():
return Qt.NoItemFlags
return Qt.ItemIsEnabled
示例7: flags
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import NoItemFlags [as 别名]
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
示例8: flags
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import NoItemFlags [as 别名]
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
示例9: flags
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import NoItemFlags [as 别名]
def flags(self, index: QModelIndex):
if not index.isValid():
return Qt.NoItemFlags
return Qt.ItemIsEditable | Qt.ItemIsEnabled | Qt.ItemIsSelectable
示例10: conteudoTabela
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import NoItemFlags [as 别名]
def conteudoTabela(self, tabela, row, col, data):
item = QtWidgets.QTableWidgetItem()
item.setTextAlignment(Qt.AlignJustify |
Qt.AlignHCenter | Qt.AlignVCenter)
item.setFlags(Qt.NoItemFlags)
item.setText(data)
tabela.setItem(row, col, item)
# Conteudo tabela alinhado a esquerda
示例11: conteudoTabelaLeft
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import NoItemFlags [as 别名]
def conteudoTabelaLeft(self, tabela, row, col, data):
item = QtWidgets.QTableWidgetItem()
item.setTextAlignment(Qt.AlignJustify |
Qt.AlignLeft | Qt.AlignVCenter)
item.setFlags(Qt.NoItemFlags)
item.setText(data)
tabela.setItem(row, col, item)
# Botão Tabela
示例12: botaoTabela
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import NoItemFlags [as 别名]
def botaoTabela(self, tabela, row, col, funcao, bg):
item = QtWidgets.QPushButton()
# item.setFixedWidth(30)
# item.setFixedHeight(30)
item.setCursor(QtGui.QCursor(Qt.PointingHandCursor))
item.setFocusPolicy(Qt.NoFocus)
item.setFlat(Qt.NoItemFlags)
item.setStyleSheet("QPushButton{\n"
"background-color: #1E87F0;\n"
"border-radius: 2px;\n"
"padding: 2px;\n"
"color: #FFF;\n"
"font: 10px \"Tahoma\" Bold\n"
"}\n"
"QPushButton:hover{\n"
"background-color: #40a286\n"
"}")
item.setText("EDITAR")
icon1 = QtGui.QIcon()
icon1.addPixmap(QtGui.QPixmap(
self.resourcepath('Images/editar.png')),
QtGui.QIcon.Normal, QtGui.QIcon.Off)
item.setIcon(icon1)
tabela.setCellWidget(row, col, item)
item.clicked.connect(funcao)
# Botão Remove Item
示例13: botaoRemoveItem
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import NoItemFlags [as 别名]
def botaoRemoveItem(self, tabela, row, col, funcao, bg):
item = QtWidgets.QPushButton()
# item.setFixedWidth(30)
# item.setFixedHeight(30)
item.setCursor(QtGui.QCursor(Qt.PointingHandCursor))
item.setFocusPolicy(Qt.NoFocus)
item.setFlat(Qt.NoItemFlags)
item.setStyleSheet("QPushButton{\n"
"background-color: " + bg + ";\n"
"border-radius: 2px;\n"
"padding: 2px;\n"
"}\n"
"QPushButton:hover{\n"
"background-color: #40a286\n"
"}")
item.setText("")
icon1 = QtGui.QIcon()
icon1.addPixmap(QtGui.QPixmap(
self.resourcepath('Images/edit-delete.png')),
QtGui.QIcon.Normal, QtGui.QIcon.Off)
item.setIcon(icon1)
tabela.setCellWidget(row, col, item)
item.clicked.connect(funcao)
# data e Status entrega tabela compra / venda
示例14: botaoReceberParcela
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import NoItemFlags [as 别名]
def botaoReceberParcela(self, tabela, row, col, funcao, texto, status):
item = QtWidgets.QPushButton()
# item.setFixedWidth(70)
# item.setFixedHeight(30)
item.setCursor(QtGui.QCursor(Qt.PointingHandCursor))
if status == 1:
item.setDisabled(True)
item.setFocusPolicy(Qt.NoFocus)
item.setFlat(Qt.NoItemFlags)
item.setStyleSheet("QPushButton{\n"
"background-color: #7AB32E;\n"
"border-radius: 2px;\n"
"padding: 2px;\n"
"border: none;\n"
"text-transform: uppercase;\n"
"font: 10px \"Arial\";\n"
"}\n"
"QPushButton:hover{\n"
"background-color: #40a286\n"
"}"
)
item.setText(texto)
font = QtGui.QFont()
font.setFamily("Tahoma")
font.setPointSize(10)
item.setFont(font)
icon1 = QtGui.QIcon()
icon1.addPixmap(QtGui.QPixmap(
self.resourcepath('Images/money.png')),
QtGui.QIcon.Normal, QtGui.QIcon.Off)
item.setIcon(icon1)
tabela.setCellWidget(row, col, item)
item.clicked.connect(funcao)
# Input receber/pagar parcela compra e venda
示例15: _process_row
# 需要导入模块: from PyQt5.QtCore import Qt [as 别名]
# 或者: from PyQt5.QtCore.Qt import NoItemFlags [as 别名]
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())
if block in bytes(string.printable, 'ascii'):
item.setFont(self.bold_font)
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.setFlags(Qt.NoItemFlags)
item.setTextAlignment(Qt.AlignHCenter)
self.setItem(y, j, item)
text = self._bytes_to_ascii(row)
item = QTableWidgetItem(text)
item.setFlags(Qt.NoItemFlags)
text_widget = QPlainTextEdit()
# Prevent vertical scrollbars in ASCII view
def _fix_widget_size():
if text_widget.verticalScrollBar():
text_widget.setMinimumWidth(text_widget.width() + 25)
text_widget.textChanged.connect(_fix_widget_size)
text_widget.setReadOnly(True)
text_widget.setFrameStyle(QFrame.NoFrame)
text_widget.setPlainText(text)
text_widget.setFont(self.ascii_font)
text_widget.setLineWrapMode(QPlainTextEdit.NoWrap)
text_widget.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
self.setColumnWidth(cols - 1, 250)
if self._read_only:
item.setFlags(Qt.ItemIsSelectable | Qt.ItemIsEnabled)
else:
item.setFlags(Qt.ItemIsSelectable | Qt.ItemIsEnabled | Qt.ItemIsEditable)
item.setFlags(Qt.NoItemFlags)
self.setCellWidget(y, cols - 1, text_widget)