Results 1 to 9 of 9

Thread: Designer Forms

  1. #1
    Join Date
    Feb 2009
    Posts
    143
    Thanks
    8

    Default Designer Forms

    Hi

    I have two designer forms, Form 1 and Form 2. Both take some inputs from line edit.

    In my application, I want Form 1 to be displayed first, take some input from the user and close. After form 1 is closed, form2 has to pop-up.

    I have having difficulties achieving this.

    How can i accomplish what I need?

  2. #2
    Join Date
    Sep 2008
    Location
    Bangalore
    Posts
    659
    Thanks
    116
    Thanked 42 Times in 41 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Designer Forms

    Quote Originally Posted by srohit24 View Post
    Hi

    I have two designer forms, Form 1 and Form 2. Both take some inputs from line edit.

    In my application, I want Form 1 to be displayed first, take some input from the user and close. After form 1 is closed, form2 has to pop-up.

    I have having difficulties achieving this.

    How can i accomplish what I need?
    code as one base class having
    two forms as two separate dialogs ..

    show form1 first using form1->show();
    http://doc.trolltech.com/4.0/qwidget.html#show

    and use
    QDialog::rejected().

    if it returns true then show form2 using form2->show();
    "Behind every great fortune lies a crime" - Balzac

  3. #3
    Join Date
    Feb 2009
    Posts
    143
    Thanks
    8

    Default Re: Designer Forms

    I have a base class as desktop and 2 forms as coreui and newdevice

    How should i declare them as 2 seperate forms in the single base class???

  4. #4
    Join Date
    Sep 2008
    Location
    Bangalore
    Posts
    659
    Thanks
    116
    Thanked 42 Times in 41 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Designer Forms

    create a own custom dialogs for both and include the dialogs in base class
    just try to show() them one after other between
    QDialog::rejected() in the baseClass
    rejected() will return if one dialog is closed ... show the next one ... simple
    "Behind every great fortune lies a crime" - Balzac

  5. #5
    Join Date
    Feb 2009
    Posts
    143
    Thanks
    8

    Default Re: Designer Forms

    I have declared it like this

    Qt Code:
    1. namespace Ui
    2. {
    3. class DialogClass;
    4. class newdevice;
    5. }
    6. private:
    7. Ui::DialogClass *ui;
    8. Ui::newdevice *newui;
    To copy to clipboard, switch view to plain text mode 

    ui is form 2. newui is form 1.

    but i am not able to declare newui->show();

    I am getting this error.

    error: invalid use of undefined type `struct Ui::newdevice'
    error: forward declaration of `struct Ui::newdevice'
    What am i doing wrong?

  6. #6
    Join Date
    Jun 2007
    Location
    India
    Posts
    1,042
    Thanks
    8
    Thanked 133 Times in 128 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Designer Forms

    i think you need to #include the header where Ui::newdevice was defined.

  7. #7
    Join Date
    Sep 2008
    Location
    Bangalore
    Posts
    659
    Thanks
    116
    Thanked 42 Times in 41 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Designer Forms

    right the problem is on the .h file inclusion
    or check in Ui::newdevice that u named both designer and here a same name ..
    also include ui_newdevice.h and
    check whether it is available after qmake in your folder
    "Behind every great fortune lies a crime" - Balzac

  8. #8
    Join Date
    Feb 2009
    Posts
    143
    Thanks
    8

    Default Re: Designer Forms

    I have included the file

    #include "ui_coreui.h"
    #include "ui_newdevice.h"

    I am still facing the same problems.

  9. #9
    Join Date
    Feb 2009
    Posts
    143
    Thanks
    8

    Default Re: Designer Forms

    Fixed it. Some small mistake while declaring the class

    Now

    Qt Code:
    1. desktop::desktop(QWidget *parent)
    2. : QDialog(parent) ,ui(new Ui::DialogClass)
    To copy to clipboard, switch view to plain text mode 

    this is my base class. it has form 2 associated with it.

    this is the code where i want form 1 to run

    Qt Code:
    1. int desktop::serialnumberacceptance()
    2. {
    3. QDialog *dlg = new QDialog( this );
    4. newui->setupUi(dlg);
    5. dlg->exec();
    6. dlg->deleteLater();
    7. }
    To copy to clipboard, switch view to plain text mode 

    I am getting weird error now.

    A message box pops up saysing

    Runtime Error!

    Program: ..... /../../.. app.exe
    This application has requested the runtime to terminate it in a unusual way. Please contact the application support team for more information.

    It also says QList: Out of memory in the application output screen.

    How can i solve this?

Similar Threads

  1. Replies: 5
    Last Post: 7th May 2009, 14:29
  2. Threads in Designer plugins
    By hvengel in forum Qt Tools
    Replies: 2
    Last Post: 3rd January 2009, 19:19
  3. Replies: 13
    Last Post: 15th December 2006, 11:52
  4. Designer crashes when selecting some widgets
    By gwendal in forum Qt Tools
    Replies: 4
    Last Post: 21st July 2006, 13:18
  5. Replies: 2
    Last Post: 14th February 2006, 15:28

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.