Results 1 to 8 of 8

Thread: new Form(QWidget) don't show when passing parent

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Dec 2008
    Location
    Poland
    Posts
    383
    Thanks
    52
    Thanked 42 Times in 42 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Android

    Default new Form(QWidget) don't show when passing parent

    Hello.
    I stumble upon (very easy problem, but can't figure it out) problem with showing another Form.
    I created application with "main" form, then I want show "About/Info" form but when I pass as parent (this) another form don't show.
    Qt Code:
    1. Form fr = new Form(this);
    2. fr->setWindowTitle(tr("Form Info/About"));
    3. fr->show();
    To copy to clipboard, switch view to plain text mode 
    Form is "standard" form generated with QtCreator (class Form : public QWidget {...)

    I studied examples and my code is practically identical.
    Also when I pass no argument form show but is a independent window (shows in task bar) and after closing "main" window form window stays open.
    Any suggestion are more then welcome.
    Qt 4.6 Win
    PS. same situation with qt4.6.1 on Win/Lin x64

    PS2. ok I SOLVED my problem by doing :

    Qt Code:
    1. fr = new Form(this);
    2. fr->setWindowFlags( Qt::Window);
    3. fr->setWindowModality( Qt::ApplicationModal );
    4. fr->show();
    5. fr->setFocus();
    To copy to clipboard, switch view to plain text mode 
    and from what I see the "problem" is "this" in Form. It seams that this not points to parent Form but i.e MainWindow.
    What helps is "fr->setWindowFlags( Qt::Window);" that probably change parent.
    I would like to know why is that happening.

    Best regards
    Last edited by Talei; 22nd January 2010 at 03:18.

Similar Threads

  1. Promoting the parent QWidget of a QWidget form
    By extrakun in forum Qt Tools
    Replies: 6
    Last Post: 16th April 2010, 14:19
  2. Passing an object from one form to the other.
    By cbarmpar in forum Qt Programming
    Replies: 10
    Last Post: 3rd September 2008, 14:12
  3. QWidget::exec() and QWidget::show()
    By MarkoSan in forum Qt Programming
    Replies: 6
    Last Post: 18th October 2007, 21:39
  4. Replies: 2
    Last Post: 17th October 2006, 19:25
  5. Passing event to parent
    By QPissedOff in forum Newbie
    Replies: 1
    Last Post: 26th April 2006, 16:37

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.