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. How to implement a custom featured dockwidget from QDockWidget?
Forum Updated to NodeBB v4.3 + New Features

How to implement a custom featured dockwidget from QDockWidget?

Scheduled Pinned Locked Moved General and Desktop
2 Posts 2 Posters 2.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
    JohnYork
    wrote on last edited by
    #1

    Hello! I want to implement a dock-widget window, but there is some problem that can not meet my requirements in default QDockWidget:

    The default double-click feature on title bar of QDockwidget is:
    When floating,double-click on the title bar will cause the widget to dock into the main window.

    What I wanted is:
    When floating,double-click on the title bar cause the widget to be maximized, and click on the minimize-button cause the widget to dock into main window.

    I tried to connect the signal "topLevelChanged" to my own slot function, and in the slot function I change the window flags by calling setWindowFlags and passing the Qt::Window|Qt::WindowMinMaxButtonsHint flags to it's parameter.But when I test it,it dosen't work properly:

    In floating state,double-click the widget's title bar cause it becomes maximised first,and be docked into mainwindow quickly follow it.

    So,I don't know what to do next now. Can you give me some instruments?Thx a lot!


    reply to ceora(I can't reply the post by clicking reply button on this forum,so I can only reply you on this way,sorry! and I hate this weak forum!):

    thanks ceora.

    How do I know the mouse double click event is occured on the title bar?

    1 Reply Last reply
    0
    • C Offline
      C Offline
      ceora
      wrote on last edited by
      #2

      you should reimplement mouse press event (QDockWidget::mouseDoubleClickEvent), then do the resize;

      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