Results 1 to 13 of 13

Thread: Toggle dialog visibility on application switch

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jun 2012
    Posts
    14
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Re: Toggle dialog visibility on application switch

    Quote Originally Posted by wysota View Post
    Maybe you are using it wrong. Try the window flags example (or demo) that comes with Qt and see if that works.
    I might be using it wrongly, but in that case someone will undoubtedly find what's wrong in this minimal code sample that reproduces the problem:
    Qt Code:
    1. int main(int argc, char *argv[])
    2. {
    3. QApplication a(argc, argv);
    4.  
    5. QMainWindow * theDocumentWindow = new QMainWindow();
    6. theDocumentWindow->setWindowTitle( "Document Window" );
    7. theDocumentWindow->setCentralWidget( new QLabel( "Document" ) );
    8. theDocumentWindow->show();
    9.  
    10. QWidget * theToolsPalette = new QWidget( NULL, Qt::Tool | Qt::WindowTitleHint | Qt::CustomizeWindowHint | Qt::WindowCloseButtonHint );
    11. theToolsPalette->setWindowTitle( "Tools Palette" );
    12. QHBoxLayout * thePaletteLayout = new QHBoxLayout( theToolsPalette );
    13. thePaletteLayout->addWidget( new QLabel( "Tools" ) );
    14. theToolsPalette->show();
    15.  
    16. return a.exec();
    17. }
    To copy to clipboard, switch view to plain text mode 

    In the real program window creation is done in the application of course.

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

    Default Re: Toggle dialog visibility on application switch

    Why don't you just try the example I pointed you to?
    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.


  3. #3
    Join Date
    Jun 2012
    Posts
    14
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Re: Toggle dialog visibility on application switch

    Quote Originally Posted by wysota View Post
    Why don't you just try the example I pointed you to?
    I did, but couldn't find a combination of flags that resulted in the desired behavior. Am I doing something wrong or just expecting too much? The only solution I see at this point is to write a class that raises the tool palettes every time a (document) window has been activated.

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

    Default Re: Toggle dialog visibility on application switch

    So this doesn't work?

    Qt Code:
    1. cat main.cpp
    2. #include <QtGui>
    3.  
    4. int main(int argc, char **argv) {
    5. QApplication app(argc, argv);
    6. QWidget d(&w);
    7. d.setWindowFlags(Qt::Tool);
    8. w.show();
    9. d.show();
    10. return app.exec();
    11. }
    To copy to clipboard, switch view to plain text mode 
    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.


  5. #5
    Join Date
    Jun 2012
    Posts
    14
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Re: Toggle dialog visibility on application switch

    Quote Originally Posted by wysota View Post
    So this doesn't work?

    Qt Code:
    1. cat main.cpp
    2. #include <QtGui>
    3.  
    4. int main(int argc, char **argv) {
    5. QApplication app(argc, argv);
    6. QWidget d(&w);
    7. d.setWindowFlags(Qt::Tool);
    8. w.show();
    9. d.show();
    10. return app.exec();
    11. }
    To copy to clipboard, switch view to plain text mode 
    This probably works, but as I have more than one Document Window and the tools need to stay on top of all of them I can't use that :-(

Similar Threads

  1. Replies: 1
    Last Post: 13th June 2013, 09:43
  2. How to get toggle action text?
    By sudhansu in forum Qt Programming
    Replies: 4
    Last Post: 29th May 2012, 11:57
  3. Toggle text for context menu.
    By phillip_Qt in forum Qt Programming
    Replies: 6
    Last Post: 15th February 2010, 12:29
  4. How to Switch the dialog Form
    By Smiler in forum Qt Programming
    Replies: 1
    Last Post: 28th August 2009, 11:36
  5. How to toggle between 2 forms
    By safknw in forum Qt Programming
    Replies: 2
    Last Post: 13th May 2006, 10:34

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
  •  
Qt is a trademark of The Qt Company.