PDA

View Full Version : Strange situation



Molier
30th November 2010, 20:06
I have three widgets as on the picture:

http://www.easy-upload.net/fichiers/lecran.20101127231714.jpeg

-Options
-Graph
-the main part with place to show a graph

The point is:
On linux when i switch deskopts (virtual of course) and i come back to see my window;

http://www.easy-upload.net/fichiers/lecran1.2010113020584.jpeg

Why? Only one widget left.
The other question is, why when i put widgets (Options and Graph) on each other, they r supposed to be "tabbed" but they r not! Always one disappear when i try!
I wanna note that i set an option "allow tabbed docks" as a window's property.

franz
30th November 2010, 21:26
Could you provide a working example project reproducing this exact problem?

Molier
1st December 2010, 05:28
I wante to put my project code here and when i erased some not important parts.. i realized that:


/*
void MainWindow::on_dockWidget_2_visibilityChanged(bool visible)
{
//it changes menu view's check box sdatus when the widget is hidden/shown
ui->actionOptions->setChecked(visible);

}

void MainWindow::on_dockWidget_visibilityChanged(bool visible)
{
//in main menu i wanted to check and unchecked buttons
ui->actionGraph_Options->setChecked(visible);

}
*/

So this is the code resposible for this. Without this code above, program works fine.

Molier
1st December 2010, 12:47
If i put anything else in place which i showed upper, it will be ok, but..

In fact, two menu options:

http://www.easy-upload.net/fichiers/lecran2.2010121133854.jpeg

have these two signals defined:



void MainWindow::on_actionOptions_changed()
{
if(ui->actionOptions->isChecked()) // hiding or showing widgets by menu
ui->dockWidget_2->show();
else ui->dockWidget_2->hide();
}

void MainWindow::on_actionGraph_Options_changed()
{
if(ui->actionGraph_Options->isChecked()) // hiding or showing widgets by menu
ui->dockWidget->show();
else ui->dockWidget->hide();
}




This two parts of code work like kind of feedback. They cooperate with each other, but on bad way. I want to have synchronization between check boxes in menu and displaying the widgets. I found sth on forum, but it does not look similar to my example.

wysota
1st December 2010, 16:39
Why aren't you using QDockWidget::toggleViewAction()?

Molier
1st December 2010, 17:25
If i even move code and finalize it by this way:



void MainWindow::on_actionOptions_toggled(bool n)
{
if(n) // hiding or showing widgets by menu
ui->dockWidget_2->show();
else ui->dockWidget_2->hide();
}

void MainWindow::on_actionGraph_Options_toggled(bool n)
{
if(n) // hiding or showing widgets by menu
ui->dockWidget->show();
else ui->dockWidget->hide();
}

It does not change anything. Still the same problems.

totem
1st December 2010, 20:02
what suggested wizota is the best way to do what you want

Molier
1st December 2010, 21:57
Ok. Finally i removed this option, cause it is useless in this case. But thanx for advice. It will be useful for the future.

wysota
1st December 2010, 22:00
Why do you think it's useless? I consider toggling the visibility of a dock widget a very nice commodity in a program.