Setting focus in text box
-
I have a text box and when I hover the mouse over it, it accepts keyboard focus. I want the text box to only accept keyboard focus when it is clicked, and not when it is hovered over. How do I do this? I am using: widget->setFocusPolicy(Qt::ClickFocus) but it doesn't seem to be affecting anything.
-
By default it is click focus only. Do you have sample code ? I tried with 3 different text boxes. TextBoxes get focus when I click on them.
-
QWidget* widget = (QWidget*)field->id;
widget->setFocusPolicy(Qt::ClickFocus);id is a handle to the text box
-
@joeydonovan4 "ui " - it is pointer to auto-generated UI from UI-designer ( If you using UI-designer )
Can you post some more code ?