Hi folks,
I'm having a strange problem. I have a grid of QLineEdits, QSpinBoxs, and other controls in a QTableView (see attached image). When I first create the page, every QLineEdit and QSpinBox item is selected.
Selected.jpg
I have tried things like:
def createEditor(self, parent, option, index):
self.lineEdit.textChanged.connect(self.emitCommitData)
self.lineEdit.setText(self.getValue().toString())
self.lineEdit.setAlignment(Qt.AlignVCenter|Qt.AlignRight)
self.lineEdit.selectAll()
self.lineEdit.setSelection(0, 0)
return self.lineEdit
def createEditor(self, parent, option, index):
self.lineEdit = QLineEdit(parent)
self.lineEdit.setValidator(QDoubleValidator(self.lineEdit))
self.lineEdit.textChanged.connect(self.emitCommitData)
self.lineEdit.setText(self.getValue().toString())
self.lineEdit.setAlignment(Qt.AlignVCenter|Qt.AlignRight)
self.lineEdit.selectAll()
self.lineEdit.setSelection(0, 0)
return self.lineEdit
To copy to clipboard, switch view to plain text mode
and
def createEditor(self, parent, option, index):
self.lineEdit.textChanged.connect(self.emitCommitData)
self.lineEdit.setText(self.getValue().toString())
self.lineEdit.setAlignment(Qt.AlignVCenter|Qt.AlignRight)
self.lineEdit.deselect()
return self.lineEdit
def createEditor(self, parent, option, index):
self.lineEdit = QLineEdit(parent)
self.lineEdit.setValidator(QDoubleValidator(self.lineEdit))
self.lineEdit.textChanged.connect(self.emitCommitData)
self.lineEdit.setText(self.getValue().toString())
self.lineEdit.setAlignment(Qt.AlignVCenter|Qt.AlignRight)
self.lineEdit.deselect()
return self.lineEdit
To copy to clipboard, switch view to plain text mode
to no avail. Also, I considered that it might be something in the QTableView, and have tried even deselecting the items in it too.
If I switch away from the window (alt-tab) and come back, all the text is deselected.
Can anybody point me in the right direction?
Developing on Windows
ActivePython 2.6.2.2
Qt 4.5.1
TIA
Mike
Bookmarks