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:

Qt Code:
  1. def createEditor(self, parent, option, index):
  2. self.lineEdit = QLineEdit(parent)
  3. self.lineEdit.setValidator(QDoubleValidator(self.lineEdit))
  4. self.lineEdit.textChanged.connect(self.emitCommitData)
  5. self.lineEdit.setText(self.getValue().toString())
  6. self.lineEdit.setAlignment(Qt.AlignVCenter|Qt.AlignRight)
  7. self.lineEdit.selectAll()
  8. self.lineEdit.setSelection(0, 0)
  9. return self.lineEdit
To copy to clipboard, switch view to plain text mode 

and

Qt Code:
  1. def createEditor(self, parent, option, index):
  2. self.lineEdit = QLineEdit(parent)
  3. self.lineEdit.setValidator(QDoubleValidator(self.lineEdit))
  4. self.lineEdit.textChanged.connect(self.emitCommitData)
  5. self.lineEdit.setText(self.getValue().toString())
  6. self.lineEdit.setAlignment(Qt.AlignVCenter|Qt.AlignRight)
  7. self.lineEdit.deselect()
  8. 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