PDA

View Full Version : Designer Forms



srohit24
20th July 2009, 07:04
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?

wagmare
20th July 2009, 07:26
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();

srohit24
20th July 2009, 07:34
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???

wagmare
20th July 2009, 07:40
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

srohit24
20th July 2009, 08:11
I have declared it like this


namespace Ui
{
class DialogClass;
class newdevice;
}
private:
Ui::DialogClass *ui;
Ui::newdevice *newui;


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?

nish
20th July 2009, 08:58
i think you need to #include the header where Ui::newdevice was defined.

wagmare
20th July 2009, 09:06
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

srohit24
20th July 2009, 10:21
I have included the file

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

I am still facing the same problems.

srohit24
20th July 2009, 12:28
Fixed it. Some small mistake while declaring the class :o

Now


desktop::desktop(QWidget *parent)
: QDialog(parent) ,ui(new Ui::DialogClass)

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

this is the code where i want form 1 to run


int desktop::serialnumberacceptance()
{
QDialog *dlg = new QDialog( this );
newui->setupUi(dlg);
dlg->exec();
dlg->deleteLater();
}

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?