本文整理汇总了Python中PyQt5.QtWidgets.QTableWidget.setUpdatesEnabled方法的典型用法代码示例。如果您正苦于以下问题:Python QTableWidget.setUpdatesEnabled方法的具体用法?Python QTableWidget.setUpdatesEnabled怎么用?Python QTableWidget.setUpdatesEnabled使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt5.QtWidgets.QTableWidget
的用法示例。
在下文中一共展示了QTableWidget.setUpdatesEnabled方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: LocationDialog
# 需要导入模块: from PyQt5.QtWidgets import QTableWidget [as 别名]
# 或者: from PyQt5.QtWidgets.QTableWidget import setUpdatesEnabled [as 别名]
#.........这里部分代码省略.........
self.organizationComboBox.lineEdit().editingFinished.connect(self.updateLocationsTable)
self.applicationComboBox.lineEdit().editingFinished.connect(self.updateLocationsTable)
self.buttonBox.accepted.connect(self.accept)
self.buttonBox.rejected.connect(self.reject)
locationsLayout = QVBoxLayout()
locationsLayout.addWidget(self.locationsTable)
self.locationsGroupBox.setLayout(locationsLayout)
mainLayout = QGridLayout()
mainLayout.addWidget(formatLabel, 0, 0)
mainLayout.addWidget(self.formatComboBox, 0, 1)
mainLayout.addWidget(scopeLabel, 1, 0)
mainLayout.addWidget(self.scopeComboBox, 1, 1)
mainLayout.addWidget(organizationLabel, 2, 0)
mainLayout.addWidget(self.organizationComboBox, 2, 1)
mainLayout.addWidget(applicationLabel, 3, 0)
mainLayout.addWidget(self.applicationComboBox, 3, 1)
mainLayout.addWidget(self.locationsGroupBox, 4, 0, 1, 2)
mainLayout.addWidget(self.buttonBox, 5, 0, 1, 2)
self.setLayout(mainLayout)
self.updateLocationsTable()
self.setWindowTitle("Open Application Settings")
self.resize(650, 400)
def format(self):
if self.formatComboBox.currentIndex() == 0:
return QSettings.NativeFormat
else:
return QSettings.IniFormat
def scope(self):
if self.scopeComboBox.currentIndex() == 0:
return QSettings.UserScope
else:
return QSettings.SystemScope
def organization(self):
return self.organizationComboBox.currentText()
def application(self):
if self.applicationComboBox.currentText() == "Any":
return ''
return self.applicationComboBox.currentText()
def updateLocationsTable(self):
self.locationsTable.setUpdatesEnabled(False)
self.locationsTable.setRowCount(0)
for i in range(2):
if i == 0:
if self.scope() == QSettings.SystemScope:
continue
actualScope = QSettings.UserScope
else:
actualScope = QSettings.SystemScope
for j in range(2):
if j == 0:
if not self.application():
continue
actualApplication = self.application()
else:
actualApplication = ''
settings = QSettings(self.format(), actualScope,
self.organization(), actualApplication)
row = self.locationsTable.rowCount()
self.locationsTable.setRowCount(row + 1)
item0 = QTableWidgetItem()
item0.setText(settings.fileName())
item1 = QTableWidgetItem()
disable = not (settings.childKeys() or settings.childGroups())
if row == 0:
if settings.isWritable():
item1.setText("Read-write")
disable = False
else:
item1.setText("Read-only")
self.buttonBox.button(QDialogButtonBox.Ok).setDisabled(disable)
else:
item1.setText("Read-only fallback")
if disable:
item0.setFlags(item0.flags() & ~Qt.ItemIsEnabled)
item1.setFlags(item1.flags() & ~Qt.ItemIsEnabled)
self.locationsTable.setItem(row, 0, item0)
self.locationsTable.setItem(row, 1, item1)
self.locationsTable.setUpdatesEnabled(True)