Results 1 to 9 of 9

Thread: Events of floating QDockWidget

  1. #1
    Join Date
    Feb 2011
    Posts
    16
    Qt products
    Qt4
    Platforms
    Windows

    Default Events of floating QDockWidget

    Hi,

    Is there any way in MainWindow to receive events of a floating QDockWidget?

    Thank you in advance.

  2. #2
    Join Date
    Apr 2009
    Location
    Italy
    Posts
    70
    Thanks
    23
    Thanked 15 Times in 11 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Events of floating QDockWidget

    QDockWidget already emits a few useful signals, is that what you are looking for?
    http://doc.qt.nokia.com/4.7/qdockwidget.html#signals

  3. #3
    Join Date
    Feb 2011
    Posts
    16
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Events of floating QDockWidget

    Thanks mattc, but, none gives me information about intermediate events happening.
    For example
    Qt Code:
    1. void dockLocationChanged ( Qt::DockWidgetArea area )
    To copy to clipboard, switch view to plain text mode 
    is emitted once the drag/drop of the dockwidget has finished. I need to follow the movement itself.

  4. #4
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Events of floating QDockWidget

    I think you will have to subclass and override the mouseMoveEvent().
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

  5. #5
    Join Date
    Feb 2011
    Posts
    16
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Events of floating QDockWidget

    And how could MainWindow have information about that, high_flyer?
    Should I create signals in my subclassed dockWidget and connect to MainWindow's slots?
    Wouldn't that be quite inefficient?

  6. #6
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Events of floating QDockWidget

    Lets take a step back.
    What is it that you are trying to achieve?
    Not in terms of implementation, but functionality - what should happen from a user point of view?
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

  7. #7
    Join Date
    Feb 2011
    Posts
    16
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Events of floating QDockWidget

    My aim is to control the QDockWidget drag/drop.
    When a user starts to drag a dockWidget, the MainWindow shows several arrows (four general arrows and four arrows + tab relative to other dockwidgets).
    When the mouse is released over one of these arrows, the dockwidget is docked in that position.

    By now, my solution works while the dockWidgets remain docked. If a dockWidget is not released over an arrow, it becomes floating. But then, if I want to start drag/dropping it again, the MainWindow has lost the control.

  8. #8
    Join Date
    Feb 2013
    Posts
    1
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Default Re: Events of floating QDockWidget

    Quote Originally Posted by harregui View Post
    My aim is to control the QDockWidget drag/drop.
    When a user starts to drag a dockWidget, the MainWindow shows several arrows (four general arrows and four arrows + tab relative to other dockwidgets).
    When the mouse is released over one of these arrows, the dockwidget is docked in that position.

    By now, my solution works while the dockWidgets remain docked. If a dockWidget is not released over an arrow, it becomes floating. But then, if I want to start drag/dropping it again, the MainWindow has lost the control.
    You can overrite mousemove event or move function of qdockwidget.
    It will serve your problem

  9. #9
    Join Date
    May 2015
    Posts
    22
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Events of floating QDockWidget

    Use QEvent::move for this!

Similar Threads

  1. Floating QDockWidget not re-docked by QMainWindow::restoreState
    By stefanadelbert in forum Qt Programming
    Replies: 14
    Last Post: 20th October 2016, 22:16
  2. QDockWidget floating at the beginning
    By Caius Aérobus in forum Qt Programming
    Replies: 0
    Last Post: 2nd March 2011, 14:15
  3. Replies: 1
    Last Post: 7th December 2010, 22:46
  4. QMainWindow ignores dynamically created, floating QDockWidget
    By stefanadelbert in forum Qt Programming
    Replies: 1
    Last Post: 2nd March 2010, 02:06
  5. QDockWidget : No floating
    By prashant in forum Qt Programming
    Replies: 1
    Last Post: 5th October 2009, 19:42

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.