Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-138119

setFocusProxy can cause asymmetric tab and shift+tab

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • None
    • 6.9.0, 6.9.1
    • None
    • Linux/Wayland, Linux/X11

    Description

      1. create f.c++

      f.c++
      #include <QApplication>
      #include <QFrame>
      #include <QPushButton>
      #include <QVBoxLayout>
      
      using namespace Qt::Literals::StringLiterals;
      
      int main(int argc,char **argv){
      	QApplication app(argc,argv);
      	QWidget window;
      	QVBoxLayout window_layout(&window);
      
      	QFrame frame_1(&window);
      	window_layout.addWidget(&frame_1);
      	frame_1.setFrameStyle(QFrame::Box);
      	QVBoxLayout frame_1_layout(&frame_1);
      
      	QFrame frame_2(&frame_1);
      	frame_1_layout.addWidget(&frame_2);
      	frame_2.setFrameStyle(QFrame::Box);
      	QVBoxLayout frame_2_layout(&frame_2);
      
      	QPushButton button_1(u"button_1"_s,&window);
      	window_layout.addWidget(&button_1);
      
      	QPushButton button_2(u"button_2"_s,&frame_1);
      	frame_1_layout.addWidget(&button_2);
      
      	QPushButton button_3(u"button_3"_s,&window);
      	window_layout.addWidget(&button_3);
      
      	frame_1.setFocusProxy(&button_2);
      
      	window.setVisible(true);
      	return app.exec();
      }
      

      2. run

      g++ f.c++ -o f -fno-plt -lQt6Core -lQt6Widgets -isystem /usr/include/x86_64-linux-gnu/qt6 -isystem /usr/include/x86_64-linux-gnu/qt6/QtWidgets
      

      (include paths might be different if not using kde neon)

      3. run

      ./f
      

      4. press tab

      button_2 is focused

      5. press tab

      button_3 is focused

      6. press tab

      button_2 is focused

      7. press shift+tab

      button_1 is focused, shift+tab is not opposite of tab!

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            qt.team.quick.subscriptions Qt Quick and Widgets Team
            bzzzz BZZZZ DZZZZ
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes