PDA

View Full Version : QDockWidget flicker



fellobo
28th April 2006, 20:01
So, I create a QDockWidget and then I have two different Widgets that I change depending on a view in the QDockWidget.



if(show_widget1)
{
p_dockwidget->addWidget(widget1);
widget1->setParent(p_dockwidget);
widget2->setParent(p_mainwindow);
}
else
{
p_dockwidget->addWidget(widget2);
widget2->setParent(p_dockwidget);
widget1->setParent(p_mainwindow);
}


The problem is that since the QDockWidget is already visible it loads the widget up on the toolbar then moves it to snap into a nice location. Is there a way to get rid of the flicker by making it snap into the nice location first?

fellobo
28th April 2006, 20:42
This seems like a silly solution but I found out how to do it.....


if(show_widget1)
{
widget1->setVisible(false);
p_dockwidget->addWidget(widget1);
widget1->setParent(p_dockwidget);
widget2->setParent(p_mainwindow);
widget1->setVisible(true);
}
else
{
widget2->setVisible(false);
p_dockwidget->addWidget(widget2);
widget2->setParent(p_dockwidget);
widget1->setParent(p_mainwindow);
widget2->setVisible(true);
}