Solved QDockWidget::toggleViewAction() does not hide/show
-
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
-
m_customerDock->hide(); // and m_customerDock->show();
Works as expected. Sorry for the noise.