I have a QLineEdit on a Widget. when the QLineEdit lost focus, I want to ensure the content of QLineEdit is not null . If it is null, it prompts "you should input something" and then renturns the focus to QLineEdit. How ?
thanks!
I have a QLineEdit on a Widget. when the QLineEdit lost focus, I want to ensure the content of QLineEdit is not null . If it is null, it prompts "you should input something" and then renturns the focus to QLineEdit. How ?
thanks!
Please do not try to force focus anywhere. It is considered as bad UI design. Just disable the button to proceed (or whatever is suitable in your case).
J-P Nurmi
ok, I understand.
but I still want to know how?
thanks!
Probably it is very often bad UI design. But what do you think of this possibly rare use case:
You have to enter:
data 1
data 2
data 3
data 4
Suppose data 2 is optional and for most users not necessary. Perhaps some address appendage. I would jump from data 1 directly to data 3. Some sort of 80/20 solution. For 80% it saves a mouse click to skip this unnecessary field, for 20% it means a click more to actively set the cursor back into data 2.
Of course, I could always reorder data 1 - 4, but this might look funny for addresses.
Acceptable?
Bookmarks