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. QDockWidget::toggleViewAction() does not hide/show
Qt 6.11 is out! See what's new in the release blog

QDockWidget::toggleViewAction() does not hide/show

Scheduled Pinned Locked Moved Solved General and Desktop
2 Posts 1 Posters 1.0k Views
  • 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 Offline
    H Offline
    huseyinkozan
    wrote on last edited by
    #1

    Hi,
    I have tried below to show/hide dock widget, but no luck. Am I doing wrong, or found a bug ?

    • Open Dock Widget Example at Qt 5.12.3 on Ubuntu 16.04 x64.
    • Save pointers to further use:
        // header
        QAction * m_customerAction = nullptr;
        QAction * m_paragraphAction = nullptr;
        QDockWidget * m_customerDock = nullptr;
        QDockWidget * m_paragraphDock = nullptr;
        // source
        m_customerDock = dock;
        m_customerAction = dock->toggleViewAction();
        m_paragraphDock = dock;
        m_paragraphAction = dock->toggleViewAction();
      
    • Add toggle code to a function:
      void MainWindow::about()
      {
        // try this
        if ( ! m_customerAction->isChecked())
             m_customerAction->toggle();
        // or try this
        m_customerDock->toggleViewAction()->toggle();
        // or try this
        m_paragraphAction->setChecked(true);
      
    • Menu ticks changing, but dock widget does not show/hide
    1 Reply Last reply
    0
    • H Offline
      H Offline
      huseyinkozan
      wrote on last edited by
      #2
      m_customerDock->hide();
      // and
      m_customerDock->show();
      

      Works as expected. Sorry for the noise.

      1 Reply Last reply
      1

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved