Results 1 to 2 of 2

Thread: 2 Form in the project

  1. #1
    Join Date
    Mar 2013
    Posts
    9
    Qt products
    Qt4
    Platforms
    Windows

    Default 2 Form in the project

    Hello! I work with Qt in Win7.

    My question is how to manage two forms in one project. I've already did two forms and I can open and close the second form (Form2) with the button click on the first form (Form1). But I also need to open and close Form1 with the button on Form2. How can I do this?
    I already have several reccomendations, like that:
    1) In Form2 class:

    signals:
    void closeFirstForm();

    2) In some method:
    connect(frm2, SIGNAL(closeFirstForm()), frm1, SLOT(close()));


    But I do not understand, how should I define variables frm1 and frm2 and what is exactly the method (button click on Form2 ?)

    Thank's a lot for any help!
    Last edited by Victor007; 18th March 2013 at 12:12.

  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: 2 Form in the project

    Either use a QStackedWidget or pass a pointer to the first form to the second form when you create it so that you can later invoke show() on it.
    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. Replies: 7
    Last Post: 23rd May 2012, 13:00
  2. Creating a new form in an existing project
    By raghav in forum Newbie
    Replies: 2
    Last Post: 17th May 2012, 12:06
  3. How to hide from taskbar a form showed form mainwindow
    By tonnot in forum Qt Programming
    Replies: 1
    Last Post: 10th February 2011, 15:36
  4. Replies: 5
    Last Post: 12th March 2010, 22:43
  5. .h file for each form in QT 3.3.5 project??
    By darpan in forum Qt Programming
    Replies: 1
    Last Post: 23rd March 2006, 12:59

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.