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. Dragging QDockWidget between two main windows
Forum Updated to NodeBB v4.3 + New Features

Dragging QDockWidget between two main windows

Scheduled Pinned Locked Moved General and Desktop
2 Posts 1 Posters 3.0k 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.
  • J Offline
    J Offline
    johny665
    wrote on last edited by
    #1

    I am implementing system with two main windows and I need QDockWidget to be able to dock in both windows.

    I am implementing this feature by using two QDockWidgets (one for each window) and moving contents of one dock into another (showing new one, hiding the old one), when it's been dragged above second main window.

    Problem is that this reparenting turns off widget dragging and I need to click to the dock's title bar and start dragging again.

    What is the proper way to init QDockWidget dragging programmatically?

    1 Reply Last reply
    0
    • J Offline
      J Offline
      johny665
      wrote on last edited by
      #2

      Here is more info:
      @
      dock->setVisible( false );
      dock->setFloating( mCurrentDockWidget->isFloating() );
      dock->resize( mCurrentDockWidget->size() );
      dock->move( mCurrentDockWidget->pos() );
      mCurrentMainWindow->removeDockWidget( mCurrentDockWidget );
      mCurrentDockWidget = dock;
      mCurrentMainWindow = win;
      dock->setVisible( true );
      QMouseEvent *event = new QMouseEvent( QEvent::MouseButtonPress, locPos, globPos, Qt::LeftButton, Qt::LeftButton, Qt::NoModifier );
      QCoreApplication::postEvent ( dock->titleBarWidget(), event ); //IS NOT WORKING
      @

      I use special title bar for docks, so dock->titleBarWidget() doesn't return NULL.

      Posting mouse down event to the title bar doesn't get me in the dragging mode again.

      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