本文整理汇总了Python中PyQt4.QtGui.QStringListModel.insertRow方法的典型用法代码示例。如果您正苦于以下问题:Python QStringListModel.insertRow方法的具体用法?Python QStringListModel.insertRow怎么用?Python QStringListModel.insertRow使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt4.QtGui.QStringListModel
的用法示例。
在下文中一共展示了QStringListModel.insertRow方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: PosiviewProperties
# 需要导入模块: from PyQt4.QtGui import QStringListModel [as 别名]
# 或者: from PyQt4.QtGui.QStringListModel import insertRow [as 别名]
#.........这里部分代码省略.........
fn = QFileDialog.getSaveFileName(None, 'Save PosiView configuration', '', 'Configuration (*.ini *.conf)')
self.project.store(fn)
@pyqtSlot(name='on_actionLoadConfiguration_triggered')
def onActionLoadConfigurationTriggered(self):
''' Load configuration from file
'''
fn = QFileDialog.getOpenFileName(None, 'Save PosiView configuration', '', 'Configuration (*.ini *.conf)')
self.projectProperties = self.project.read(fn)
self.setupModelData(self.projectProperties)
self.setupGeneralData(self.projectProperties)
@pyqtSlot(QModelIndex, name='on_mMobileListView_clicked')
def editMobile(self, index):
''' Populate the widgets with the selected mobiles properties
'''
if index.isValid():
self.populateMobileWidgets(index)
@pyqtSlot(str, name='on_comboBoxMobileType_currentIndexChanged')
def mobileTypeChanged(self, mType):
if mType == 'SHAPE':
# self.lineEditMobileShape.setText(str(mobile['shape']))
self.lineEditMobileShape.setEnabled(True)
else:
self.lineEditMobileShape.setEnabled(False)
@pyqtSlot(QModelIndex, name='on_mMobileListView_activated')
def activated(self, index):
pass
@pyqtSlot(name='on_toolButtonAddMobile_clicked')
def addMobile(self):
self.mobileListModel.insertRow(self.mobileListModel.rowCount())
index = self.mobileListModel.index(self.mobileListModel.rowCount() - 1)
self.lineEditMobileName.setText('NewMobile')
self.mobileListModel.setData(index, 'NewMobile', Qt.DisplayRole)
self.mMobileListView.setCurrentIndex(index)
self.applyMobile()
@pyqtSlot(name='on_pushButtonApplyMobile_clicked')
def applyMobile(self):
index = self.mMobileListView.currentIndex()
if index.isValid() and not self.lineEditMobileName.text() == '':
mobile = dict()
mobile['Name'] = self.lineEditMobileName.text()
mobile['type'] = self.comboBoxMobileType.currentText()
try:
t = eval(self.lineEditMobileShape.text())
if t.__class__ is tuple or t.__class__ is dict:
mobile['shape'] = t
except SyntaxError:
mobile['shape'] = ((0.0, -0.5), (0.3, 0.5), (0.0, 0.2), (-0.5, 0.5))
mobile['length'] = self.doubleSpinBoxMobileLength.value()
mobile['width'] = self.doubleSpinBoxMobileWidth.value()
mobile['zValue'] = self.spinBoxZValue.value()
mobile['color'] = self.mColorButtonMobileColor.color().rgba()
mobile['fillColor'] = self.mColorButtonMobileFillColor.color().rgba()
mobile['timeout'] = self.spinBoxMobileTimeout.value() * 1000
mobile['nofixNotify'] = self.spinBoxMobileNotification.value()
mobile['trackLength'] = self.spinBoxTrackLength.value()
mobile['trackColor'] = self.mColorButtonMobileTrackColor.color().rgba()
provs = dict()
for r in range(self.mobileProviderModel.rowCount()):
try:
fil = int(self.mobileProviderModel.item(r, 1).data(Qt.DisplayRole))