Details
-
Bug
-
Resolution: Unresolved
-
P3: Somewhat important
-
None
-
5.12.6, 5.14.0
-
None
-
OS X 10.13, OS X 10.14, OS X 10.15
Description
Create 2 line edits and buttons. Set each line edit as focus proxy for a button.
Minimal sample code:
#include <QApplication> #include <QHBoxLayout> #include <QLineEdit> #include <QPushButton> #include <QMainWindow> #include <QVBoxLayout> class TestWindow : public QMainWindow { public: TestWindow(QWidget *parent = nullptr) : QMainWindow(parent) { QLineEdit* le1 = new QLineEdit; QLineEdit* le2 = new QLineEdit; QPushButton* pb1 = new QPushButton("One"); QPushButton* pb2 = new QPushButton("Two"); pb1->setFocusProxy( le1 ); pb2->setFocusProxy( le2 ); QHBoxLayout* l1 = new QHBoxLayout; l1->addWidget(le1); l1->addWidget(pb1); QHBoxLayout* l2 = new QHBoxLayout; l2->addWidget(le2); l2->addWidget(pb2); QVBoxLayout* l3 = new QVBoxLayout; l3->addLayout(l1); l3->addLayout(l2); QWidget* w = new QWidget; w->setLayout(l3); setCentralWidget(w); } }; int main(int argc, char *argv[]) { QApplication a(argc, argv); TestWindow w; w.show(); return a.exec(); }
Steps to reproduce:
- Launch the application
- (Button "One" has a blue focus rectangle around it)
- Click on the second line edit
- Click on the second button
- (Button "One" and "Two" have a blue focus rectangle around it, only 1 button should have focus at any given time)
See attached Capture.png for an example of the wrong focus state on both buttons.