Solved Is it possible for a QPushButton to be invoked only with mouse click and not with the keyboard?
-
Hi forum!
Is it possible for a QPushButton to be invoked only with mouse click and not with the keyboard?
It's about a QTableView column with buttons.
Minas
-
Derive from QPushButton and disallow keyboard inputs by overwriting keyPressEvent()
-
Hi,
In addition to the suggestion of @Christian-Ehrlicher, you can also implement an event filter to "eat" the keyboard related events of the push button you don’t want to be keyboard activated.
Out of curiosity, why do you want that behavior ? That’s going to be a bit counter-intuitive for your users.
-
@SGaist Thank you for your answers!
I've done the first, i'll try for the second!
I have a subclass of QStyledItemDelegate for a QTableView button column and the way I have implemented it, if the user invokes a button by pressing a key (spacebar or return), I'm not able to know in which row was that button.
Minas
-
@SGaist With your solution, I don't have to subclass QPushButton, thank's!