QPushButton is automatically selected (highlighted) when opening GUI
-
Hey,
I have created a GUI in Qt on Linux and when I open it, there is always one QPushButton selected. When I use arrow keys I can switch between all my buttons. How can I disable the auto-selection of one button?
I already tried this in my MainWindow.cpp but it doesn't change anything.
QWidget::setFocusPolicy(Qt::NoFocus);
Does anyone have an idea?
Thanks!
-
@Beatsteak Try setting autoDefault and default to false or whatever relevant.
-
said in QPushButton is automatically selected (highlighted) when opening GUI:
Does anyone have an idea?
Qt finds the first focus able widget.
ReimplementQWidget::focusNextPrev()
(by simply returning true) for the top most widget (MainWindow/central widget).