View Full Version : Validator: force keeping cursor back in widget

8th June 2009, 15:11
Hi !

Is it possible to implement the following requirement in a simple way:

Exampe Window: QDialog (two QLineEdit and Ok/Close/Help QPushButton).

As long as the input in the lineedit is not correct, and the user try to select
e.g. the second lineedit or the Ok Button, an Error Message pops up and after
closing the error box, the cursor is AGAIN in the same Label.
But clicking Close of Help is allowed and possible.

The same feature will be necessary for QTreeView and QTableView.

Note: Please don't tell me this isn't a useful requirement (It's stupid, but I have to implement it EXACTLY in that way.)


8th June 2009, 15:15
I would really be annoyed when I was given such an application. How about instead disabling all other widgets so that this one is the only one you can interact with?

BTW. There is always QWidget::setFocus().