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

Moving a tab in a QTabWidget with QTabBar::moveTab can send the focus to an unrelated widget

    XMLWordPrintable

Details

    Description

      QTabWidgetPrivate::_q_tabMoved does removeWidget+insertWidget on the widgetstack, which makes the focus jump to whichever the "next focus widget" is, could even be outside the tabwidget.

      This prevented me from using QTabBar::moveTab in order to fix https://bugs.kde.org/show_bug.cgi?id=159295 because both pieces of code (the code in KTabWidget and the code in QTabWidget) have the same problem: removing and re-inserting into the stackwidget lead to hide(), which leads to focusNextPrevChild, which moves the focus to the unrelated locationbar combobox.

      I suggest taking inspiration from the ktabwidget_unittest.cpp testMoveTabs(), and from the fix: http://websvn.kde.org/trunk/KDE/kdelibs/kdeui/widgets/ktabwidget.cpp?r1=1110400&r2=1110399&pathrev=1110400
      (ignore the last hunk of that patch).

      Attachments

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

        Activity

          People

            Unassigned Unassigned
            dfaure David Faure (Private)
            Votes:
            2 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes