You are not logged in.

1

Monday, July 2nd 2012, 12:57pm

Opening an .ui form form another .ui form on button click ????????

hie all,

I have form1 which is designed using designer with button in the form , and have another ui form2 which is also designed using designer,so now i want to open form2 on button clicking in form1?????

i am able to open a new dialog window and desing the dialog window on button click while hard coding...but unable to open while using desinger .ui file???

This post has been edited 1 times, last edit by "sai_3289" (Jul 2nd 2012, 1:13pm)


2

Monday, July 2nd 2012, 1:00pm

As I already said, look at some basic examples. http://doc.qt.nokia.com/qt-maemo/designe…-a-ui-file.html

by the way, you dont open any ui files in Qt apps. ui files are used by qt designer. Qt creator does not use them when compiling or running apps.


You should have something like this (following from single inheritance approach from the link above)
form1.ui -> ui_form1.h
form1.h, .cpp

form2.ui -> ui_form2.h
form2.h, .cpp

and then you just open a new form2 from a form1.
If you have a problem, CUT and PASTE your code. Do not retype or simplify it. Give a COMPLETE and COMPILABLE example of your problem. Otherwise we are all guessing the problem from a fabrication where relevant details are often missing.

This post has been edited 2 times, last edit by "Amleto" (Jul 2nd 2012, 1:07pm)


3

Monday, July 2nd 2012, 1:08pm

thankx for reply amleto.......yah same files i to have.......in form1.cpp i have called a slot in that i created instance of form2.cpp???

4

Monday, July 2nd 2012, 1:20pm

form1.cpp
{

connect("calling slot here")
}
slot defination{
form2 *instance=new form2(this);
instance->show();

}
form2.cpp


form2::form2(QWidget *parent) :QWidget(parent),ui_form2(new Ui::form2)

{



ui_form2->setupUi(this);





}

5

Monday, July 2nd 2012, 5:18pm

yes, now just make it proper qt/c++ and it will work.
If you have a problem, CUT and PASTE your code. Do not retype or simplify it. Give a COMPLETE and COMPILABLE example of your problem. Otherwise we are all guessing the problem from a fabrication where relevant details are often missing.

Similar threads

Used tags

Ui changing, ui file