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

There's no way to programmatically make a QToolBar become floating

    XMLWordPrintable

Details

    • Suggestion
    • Resolution: Unresolved
    • P3: Somewhat important
    • None
    • 6.9.0
    • Widgets: Main Window
    • None
    • All

    Description

      For QMainWindow, developer can make QToolBars dock to the docking area by calling QMainWindow::addToolBar, however, there's no way to make a docked tool bar become floating again programmatically. Calling QMainWindow::removeToolBar seems to break the tool bar's layout. Developer can create a new tool bar without calling QMainWindow::addToolBar, the tool bar will indeed looks floating visually, but dragging such tool bars (floating tool bars that aren't caused by user dragging, including the ones caused by calling QMainWindow::removeToolBar) will always cause assertion failure. I have checked QToolBar's source code, I saw when user try to drag the tool bar, it will always try to undock from QMainWindow's internal layout first, that's where the assertion failure come from. I just don't understand why QToolBar must be docked into the docking area first to be able to become floating. I think adding some API like "QToolBar::setFloating" would be much more convenient.

      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
            wangwenx190 赵 宇航
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes