Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Help designing "drag-out" tabs?
Qt 6.11 is out! See what's new in the release blog

Help designing "drag-out" tabs?

Scheduled Pinned Locked Moved General and Desktop
6 Posts 2 Posters 2.4k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    dcortesi
    wrote on last edited by
    #1

    I have a working app that presents a Main Window whose central widget is a QTabSet with a variable number of "panels" (QWidgets with various different layouts and contents).

    I would like to upgrade this as follows: the user can click-down on a Tab and drag that panel out of the tab set, where it will become an independent window (I suppose, become a QDialog, but that's not the issue). Or, the user can grab the border of an independent panel and drop it on the Tab Bar and it will again become a Tab in the Tab Set.

    Modern browsers like Firefox and Chrome have just this behavior. But I am at a loss where to start researching this in Qt. At a general level, how would you approach this starting from QTabSet populated with QWidgets? General suggestions welcome. Perhaps someone has done this kind of thing already? Pointers to example code that does similar things would be VERY helpful!

    Thanks.

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      I would subclass QTabBar and set this custom version on the QTabWidget you use as central widget.

      For the drag and drop part you can start "here":http://qt-project.org/doc/qt-4.8/dnd.html

      Hope it helps

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • D Offline
        D Offline
        dcortesi
        wrote on last edited by
        #3

        I am making good progress on this, have mastered much of drag'n'drop, also found a valuable tip via StackOverflow: see the "delayed encoding example":http://qt-project.org/doc/qt-4.8/draganddrop-delayedencoding.html for a clever hack to get control during a drop.

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          Good !

          Note that you might get into trouble on OS X, the delay does not happen see this "report":https://bugreports.qt-project.org/browse/QTBUG-31301

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0
          • D Offline
            D Offline
            dcortesi
            wrote on last edited by
            #5

            Thanks for the pointer, that surely saved me some work. Another fine hack down the drain...

            1 Reply Last reply
            0
            • D Offline
              D Offline
              dcortesi
              wrote on last edited by
              #6

              I learned a lot about drag-and-drop and have now put everything I know into the following blog: http://thispageintentionally.blogspot.com/2014/01/ts-drag-and-drop-architecture-for.html

              Unfortunately the answer appears to be, what I want to do is not possible.

              1 Reply Last reply
              0

              • Login

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • Users
              • Groups
              • Search
              • Get Qt Extensions
              • Unsolved