Results 1 to 5 of 5

Thread: move parent window to the front.

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Mar 2006
    Posts
    74
    Thanks
    1
    Qt products
    Qt3
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: move parent window to the front.

    I can't figure out how to use activateWindow() in QT 3 for this. This is not a member of the QDialog class which is what my windows are. In fact in QT 3 it appears that activateWindow() is part of the QWorkspace class. QWorkspace appears to be for doing MDI stuff. My app is not an MDI app and I have no objects that are of QWorkspace class. So I was not even able to figure out how to get this to build when I call activateWindow(). In QT 4 it appears that activateWindow() is part of the QDialog class.

    I have figured out that this is a modality issue that had to do with the way I was instantiating the child dialog. What I was doing was creating the child dialog if a certain button was pushed on the main window and then destroying the dialog when returning control to the main window. What I have learned is that when a dialog is created this way there is no way to make it modeless (IE. it is always modal). What I ended up doing was to instantiate the child dialog during the application startup like this:

    Qt Code:
    1. int main( int argc, char **argv )
    2. {
    3. QApplication a( argc, argv );
    4.  
    5. // create child dialog
    6. ProfileParms profParms;
    7. profParms.setModal(FALSE);
    8. profParms.show();
    9. // hide dialog until needed
    10. profParms.hide();
    11.  
    12. // create main window
    13. lprofMain w;
    14. w.show();
    15.  
    16. // Setup signals and slots connections so that
    17. // main window and child dialog can interact as needed
    18. QObject::connect(&profParms, SIGNAL(signalPickRGB()), &w, SLOT(slotPickRGBPatch()));
    19. QObject::connect(&profParms, SIGNAL(profileParmsOK()), &w, SLOT(slotUpdateProfileParmsText()));
    20. QObject::connect(&w, SIGNAL(showProfileParms()), &profParms, SLOT(slotShow()));
    21.  
    22.  
    23. a.connect( &a, SIGNAL( lastWindowClosed() ), &a, SLOT( quit() ) );
    24.  
    25. // Start everything running
    26. return a.exec();
    27. }
    To copy to clipboard, switch view to plain text mode 

    It took me a while to figure this out but it is working.

  2. #2
    Join Date
    Oct 2006
    Location
    New Delhi, India
    Posts
    2,467
    Thanks
    8
    Thanked 334 Times in 317 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: move parent window to the front.

    good u solved the problem

    activateWindow is a function of QWidget in Qt 4.2.0 onwards. I am not sure about Qt 3

Similar Threads

  1. ToolWidgets disappear when window inactive
    By Moppel in forum Qt Programming
    Replies: 7
    Last Post: 5th January 2007, 21:50
  2. Replies: 3
    Last Post: 23rd July 2006, 18:02
  3. Move window in Clone Mode
    By ultrabrite in forum Qt Programming
    Replies: 1
    Last Post: 14th June 2006, 18:22
  4. Move child widget along with the parent widget
    By sreedhar in forum Qt Programming
    Replies: 2
    Last Post: 15th May 2006, 12:00
  5. cannot make a main window modal
    By Dark_Tower in forum Qt Programming
    Replies: 12
    Last Post: 23rd March 2006, 10:21

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.