Unsolved How to change selection in QTableWidget on keypress
-
I'm looking for a documentation that would explain how the QTableWidget reacts on keystrokes.
I have a 5x5 Table where I set the selection behaviour toQAbstractItemView::SelectRows
. However, as soon I have one row selected, I can change the row by pressing keys on the keyboard. In my case for selection it is the first character in the cells of the second column, which is taking into account.
How I can get the first or the third column getting crucial for the selection.
Would someone please be so kind and point me to the place in doc, there I can find some notes how this implementation works and how to change it?Thank you in advance.
Greg -
@GregPhil
Have you readQItemSelectionModel
http://doc.qt.io/qt-5/qitemselectionmodel.html#details ?current selected items are part of the current interactive selection (for example with rubber-band selection or keyboard-shift selections).
And http://doc.qt.io/qt-5/model-view-programming.html#handling-selections-in-item-views.
-
@GregPhil said in How to change selection in QTableView on keypress:
I'm looking for a documentation that would explain how the QTableWindow reacts on keystrokes.
BTW:
QTableWindow
isQTableView
, orQTableWidget
, or ...? -
@JNBarchan
oh yes I'm sorry, I mixed up the terms. It's always QTableWidget.
I think your ansers apply to QTableView but not to QTableWidget? -
@GregPhil
QTableWidget
inherits fromQTableView
so stuff still applies.I am a newcomer, but unless I am mistaken they do not offer any kind of inbuilt:
can change the row by pressing keys on the keyboard. In my case for selection it is the first character in the cells of the second column
, just mouse selection support. So that implies it is your code which has the logic for whatever it is doing for "selection by second column", and that is where you would put code to change this behaviour to whatever you desire?
-
@JNBarchan
ok thank you very much.
Strange, even if I got the same impression that only mouse selection support is provided by reading the documentation, keystrokes working as well. One can easy verify this. It's only the fact that I can't find any documentation how to adjust this behaviour it to my needs. However, the only idea I have for now (without having a look into it) seems to be an addaption by implementing/overwriting events.cheers