本文整理汇总了Python中PyQt4.QtGui.QStringListModel.removeRows方法的典型用法代码示例。如果您正苦于以下问题:Python QStringListModel.removeRows方法的具体用法?Python QStringListModel.removeRows怎么用?Python QStringListModel.removeRows使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt4.QtGui.QStringListModel
的用法示例。
在下文中一共展示了QStringListModel.removeRows方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: PosiviewProperties
# 需要导入模块: from PyQt4.QtGui import QStringListModel [as 别名]
# 或者: from PyQt4.QtGui.QStringListModel import removeRows [as 别名]
#.........这里部分代码省略.........
except:
fil = self.mobileProviderModel.item(r, 1).data(Qt.DisplayRole)
if not fil:
fil = None
provs[self.mobileProviderModel.item(r, 0).data(Qt.DisplayRole)] = fil
mobile['provider'] = provs
currName = self.mobileListModel.data(index, Qt.DisplayRole)
if not currName == mobile['Name']:
del self.projectProperties['Mobiles'][currName]
self.mobileListModel.setData(index, mobile['Name'], Qt.DisplayRole)
self.projectProperties['Mobiles'][mobile['Name']] = mobile
def populateMobileWidgets(self, index):
mobile = self.projectProperties['Mobiles'][self.mobileListModel.data(index, Qt.DisplayRole)]
self.lineEditMobileName.setText(mobile.get('Name'))
self.comboBoxMobileType.setCurrentIndex(self.comboBoxMobileType.findText(mobile.setdefault('type', 'BOX').upper()))
if mobile['type'] == 'SHAPE':
self.lineEditMobileShape.setText(str(mobile['shape']))
self.lineEditMobileShape.setEnabled(True)
else:
self.lineEditMobileShape.setEnabled(False)
self.lineEditMobileShape.clear()
self.doubleSpinBoxMobileLength.setValue(mobile.get('length', 20.0))
self.doubleSpinBoxMobileWidth.setValue(mobile.get('width', 5.0))
self.spinBoxZValue.setValue(mobile.get('zValue', 100))
self.mColorButtonMobileColor.setColor(self.getColor(mobile.get('color', 'black')))
self.mColorButtonMobileFillColor.setColor(self.getColor(mobile.get('fillColor', 'green')))
self.spinBoxMobileTimeout.setValue(mobile.get('timeout', 3000) / 1000)
self.spinBoxMobileNotification.setValue(mobile.get('nofixNotify', 0))
self.spinBoxTrackLength.setValue(mobile.get('trackLength', 100))
self.mColorButtonMobileTrackColor.setColor(self.getColor(mobile.get('trackColor', 'green')))
r = 0
self.mobileProviderModel.removeRows(0, self.mobileProviderModel.rowCount())
if 'provider' in mobile:
for k, v in mobile['provider'].items():
prov = QStandardItem(k)
val = QStandardItem(str(v))
self.mobileProviderModel.setItem(r, 0, prov)
self.mobileProviderModel.setItem(r, 1, val)
r += 1
@pyqtSlot(name='on_toolButtonRemoveMobile_clicked')
def removeMobile(self):
idx = self.mMobileListView.currentIndex()
if idx.isValid():
self.projectProperties['Mobiles'].pop(self.mobileListModel.data(idx, Qt.DisplayRole))
self.mobileListModel.removeRows(idx.row(), 1)
idx = self.mMobileListView.currentIndex()
if idx.isValid():
self.populateMobileWidgets(idx)
@pyqtSlot(name='on_toolButtonRefreshMobileProvider_clicked')
def refreshMobileProvider(self):
prov = self.comboBoxProviders.currentText()
if prov == '':
return
fil = None
if self.lineEditProviderFilter.text() != '':
fil = self.lineEditProviderFilter.text()
items = self.mobileProviderModel.findItems(prov, Qt.MatchExactly, 0)
if items:
for item in items:
self.mobileProviderModel.setItem(item.row(), 1, QStandardItem(fil))
else:
self.mobileProviderModel.appendRow([QStandardItem(prov), QStandardItem(fil)])