Results 1 to 9 of 9

Thread: Strange situation

  1. #1
    Join Date
    Nov 2010
    Posts
    14
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Strange situation

    I have three widgets as on the picture:



    -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;



    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.
    L'État, c'est la grande fiction à travers laquelle tout le monde s’efforce de vivre aux dépens de tout le monde. -Frédéric Bastiat

  2. #2
    Join Date
    Jul 2009
    Location
    Enschede, Netherlands
    Posts
    462
    Thanked 69 Times in 67 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Strange situation

    Could you provide a working example project reproducing this exact problem?
    Horse sense is the thing that keeps horses from betting on people. --W.C. Fields

    Ask Smart Questions

  3. #3
    Join Date
    Nov 2010
    Posts
    14
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Strange situation

    I wante to put my project code here and when i erased some not important parts.. i realized that:

    Qt Code:
    1. /*
    2. void MainWindow::on_dockWidget_2_visibilityChanged(bool visible)
    3. {
    4.   //it changes menu view's check box sdatus when the widget is hidden/shown
    5.   ui->actionOptions->setChecked(visible);
    6.  
    7. }
    8.  
    9. void MainWindow::on_dockWidget_visibilityChanged(bool visible)
    10. {
    11.   //in main menu i wanted to check and unchecked buttons
    12.   ui->actionGraph_Options->setChecked(visible);
    13.  
    14. }
    15. */
    To copy to clipboard, switch view to plain text mode 

    So this is the code resposible for this. Without this code above, program works fine.
    Last edited by Molier; 1st December 2010 at 05:52.
    L'État, c'est la grande fiction à travers laquelle tout le monde s’efforce de vivre aux dépens de tout le monde. -Frédéric Bastiat

  4. #4
    Join Date
    Nov 2010
    Posts
    14
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Strange situation

    If i put anything else in place which i showed upper, it will be ok, but..

    In fact, two menu options:



    have these two signals defined:

    Qt Code:
    1. void MainWindow::on_actionOptions_changed()
    2. {
    3. if(ui->actionOptions->isChecked()) // hiding or showing widgets by menu
    4. ui->dockWidget_2->show();
    5. else ui->dockWidget_2->hide();
    6. }
    7.  
    8. void MainWindow::on_actionGraph_Options_changed()
    9. {
    10. if(ui->actionGraph_Options->isChecked()) // hiding or showing widgets by menu
    11. ui->dockWidget->show();
    12. else ui->dockWidget->hide();
    13. }
    To copy to clipboard, switch view to plain text mode 

    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.
    Last edited by Molier; 1st December 2010 at 13:26.
    L'État, c'est la grande fiction à travers laquelle tout le monde s’efforce de vivre aux dépens de tout le monde. -Frédéric Bastiat

  5. #5
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Strange situation

    Why aren't you using QDockWidget::toggleViewAction()?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  6. #6
    Join Date
    Nov 2010
    Posts
    14
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Strange situation

    If i even move code and finalize it by this way:


    Qt Code:
    1. void MainWindow::on_actionOptions_toggled(bool n)
    2. {
    3. if(n) // hiding or showing widgets by menu
    4. ui->dockWidget_2->show();
    5. else ui->dockWidget_2->hide();
    6. }
    7.  
    8. void MainWindow::on_actionGraph_Options_toggled(bool n)
    9. {
    10. if(n) // hiding or showing widgets by menu
    11. ui->dockWidget->show();
    12. else ui->dockWidget->hide();
    13. }
    To copy to clipboard, switch view to plain text mode 

    It does not change anything. Still the same problems.
    L'État, c'est la grande fiction à travers laquelle tout le monde s’efforce de vivre aux dépens de tout le monde. -Frédéric Bastiat

  7. #7
    Join Date
    Dec 2009
    Posts
    128
    Thanks
    7
    Thanked 14 Times in 14 Posts
    Platforms
    Unix/X11 Windows

    Default Re: Strange situation

    what suggested wizota is the best way to do what you want

  8. #8
    Join Date
    Nov 2010
    Posts
    14
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Strange situation

    Ok. Finally i removed this option, cause it is useless in this case. But thanx for advice. It will be useful for the future.
    L'État, c'est la grande fiction à travers laquelle tout le monde s’efforce de vivre aux dépens de tout le monde. -Frédéric Bastiat

  9. #9
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Strange situation

    Why do you think it's useless? I consider toggling the visibility of a dock widget a very nice commodity in a program.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. Qt Strange size!
    By Peppy in forum Qt Programming
    Replies: 3
    Last Post: 7th October 2010, 20:02
  2. What design fits my situation?
    By caelestis in forum Newbie
    Replies: 1
    Last Post: 2nd February 2010, 04:20
  3. Strange problem
    By wirasto in forum Qt Programming
    Replies: 3
    Last Post: 27th December 2009, 11:24
  4. Strange errors
    By prykHetQuo in forum Qt Programming
    Replies: 2
    Last Post: 14th March 2009, 18:13
  5. Strange error
    By joseph in forum General Programming
    Replies: 3
    Last Post: 8th February 2008, 13:32

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.