Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Solved QDockWidget visibility problem

    General and Desktop
    2
    2
    104
    Loading More Posts
    • 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.
    • H
      HB76 last edited by

      Hi everyone !

      I am develloping an app that use a dock widget and I would like to sync the dock visibility with an action in my menubar. What I want is to be able to show/hide my dock when clicking in the action in the menubar, or to do it manually by clicking on the close button of the dock and update the dock status in the menubar.

      The problem is that when I detach my dock and then I re-dock it, my app crash. Also, if I minimise my window, the dock desapear and I need to make it visible again manually. I know the problem come to the signal visibilityChanged but there is no closed signal for dock widget to check if the close button have been pushed..
      Here is my code :

      actionShowDock = dock->toggleViewAction();
      connect(actionShowDock, SIGNAL(toggled(bool)), dock, SLOT(setVisible(bool)));
      connect(dock, SIGNAL(visibilityChanged(bool)), actionShowDock, SLOT(setChecked(bool)));
      

      Do you have any idea of how I should do to avoid these problems ?
      Thanks !

      1 Reply Last reply Reply Quote 0
      • SGaist
        SGaist Lifetime Qt Champion last edited by

        Hi,

        Remove these two connections, they are not needed as the action already handles the visibility.

        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 Reply Quote 3
        • First post
          Last post