[Qt-interest] QTableView and read-only column
Joel B. Mohler
joel at kiwistrawberry.us
Fri Aug 20 03:54:27 CEST 2010
I have an editable QTableView with four columns 0-3, but column 1 only
provides read-only feedback to the user. I can get this implemented to be
read-only correctly in that there is no widget given for column 1, but there's
a usability annoyance with edit focus.
If I edit column 0 and press tab, I'd like to skip directly to column 2 which
is the next editable column. Instead the table flips out of edit mode and
selects the cell in column 1. Worse yet, when I tab to column 2 I stay out of
edit mode which I find to be rather jarring visually. I do realize that I can
just begin typing in column 2 and it will toggle back to edit mode, but the
visual cues for that are lacking.
What can I do to attain the following goals?
Ideal: I'd like to skip column 1 and go directly to column 2 on tab.
Acceptable: Maintain edit mode when I get focus back to column 2.
Here's the code for my model's flag method (actually PyQt, but I doubt that
matters to the answer):
def flags(self,index):
result = QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled
c = self.columns[index.column()]
if not self.readonly or getattr(self.cls,c).readonly:
result |= QtCore.Qt.ItemIsEditable
return result
Thanks
Joel
More information about the Qt-interest-old
mailing list