Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

[Solved] Initial "DockWidget->toggleViewAction()" value



  • Hi all,

    How can I set the initial visibility from a DockWidget??? I know I can toggle the view with:

    DockWidget->toggleViewAction()->toggle();
    

    But I want it hidden on the start-up, and also be able to switch it via some function, not only with buttons.

    Thanks in advance,
    avmg



  • Hi again,

    I could finally make it! I created a new action and I have connected it with the "toggleViewAction" from the DockWidget:

    triggerAction = new QAction(this);
    connect(triggerAction, &QAction::triggered, DockWidget->toggleViewAction(), &QAction::triggered);
    

    ...
    Then later I can trigger the new action:

    triggerAction->trigger();
    

    Thanks anyway!


Log in to reply