[SOLVED] QDockWidget::setVisible() doesn't work
Hi all. I have a problem with hiding/showing QDockWidget.
So, I have a QDockWidget
Code:
DiskInfoWidget
->setFeatures
( QDockWidget::NoDockWidgetFeatures );
DiskInfoWidget->setContextMenuPolicy ( Qt::PreventContextMenu );
addDockWidget ( Qt::TopDockWidgetArea, DiskInfoWidget );
DiskInfoWidget->hide();
a QAction to control it
Code:
DiskInfoAction
= new QAction ( QIcon ( ":/toolbar/information" ), tr
( "Disk Information" ),
this );
DiskInfoAction->setCheckable ( true );
DiskInfoAction->connect ( DiskInfoAction, SIGNAL ( triggered ( bool ) ), this, SLOT ( showDiskInfoWidget ( bool ) ) );
and here is a slot for triggered()
Code:
void cwFMWindow::showDiskInfoWidget ( bool checked )
{
DiskInfoWidget->setVisible ( checked );
}
And all this code does absolutely nothing. I can't guess why... It seems that I miss some stupid reason.
Thanks for help :)
Re: QDockWidget::setVisible() doesn't work
A wild guess - missing Q_OBJECT macro or showDiskInfoWidget not declared as a slot? Check if Qt gives you any warnings in the console.
Re: QDockWidget::setVisible() doesn't work
OMG. It was a really stupid bug. It seems I'm too tired. There were two different QDockObject *DiskInfoWidget in class and in the function. Sorry for posting. Unfortunately I couldn't find a way to delete my thread. :(