[Qt-interest] Re : Using more than one .ui files in a project

yogesh upreti yogesh.upreti at gmail.com
Thu Jul 15 08:08:02 CEST 2010


Hi Jaff,
I am not sure if this is the correct answer you are looking for. This is how
I do when I have more than one ui file.

1. You can't start both the ui togather from int main(...), you have to have
one main Gui and then, call from that Gui the second one.  (Somehow you can
start them togather by calling the new GUI in constructor of the first
class: I will not recommand this)
2. I start the next gui in some slot, Like after clicking a button, or a
menu etc etc
3. You have to make newUi.cpp (class definition) and newUi.h (header
declaration) file corrosponding to your newUi.ui file(exactly in the way you
do it in a single .ui file application) ( Don't forget to include cpp, h, ui
file in your .pro definition)
4. Then you have to include the header (newUi.h) in your first .ui file's
definition (.cpp) file. and then make a instance of your new ui
like
newUi *abc = new newUi(this);
5. After this depending on you requirement you can show the newUi uising
abc->show() or better abc->exec() (When your newUi inherits
QMainWindow)function.

Hope this helps.

Regds,
Yogesh Upreti

 Date: Wed, 14 Jul 2010 23:34:20 +0100
> From: jaff at student.dei.uc.pt
> Subject: [Qt-interest] Using more than one .ui files in a project
> To: qt-interest at trolltech.com
> Message-ID: <20100714233420.jbhp5wc6xw0gs8ws at mail.dei.uc.pt>
> Content-Type: text/plain; charset="iso-8859-1"
>
> Hi all,
>
> I made a simple login dialog and the app is running just fine, but now
> I'm facing a new problem: I want to add another .ui file to the project
> and I don't know how to use it. I'll be more specific: I want to use a
> .ui file that is already created. I imported it to my project
> (File->Open File Or Project...) and I thought it was mandatory to
> create a new class (both .h and .cpp file) to instantiate it, but the
> little code I did just brought confusion and errors to the project, so
> I deleted both files (header and source).
>
> The real question here is, now that I have 2 .ui files in my project,
> how can I use the second one (I don't know if this is useful but I
> already have a login window and the new one is the main window, so I
> want to go from the login to the main window)?
>
> I don't know if I'm being confusing explaining my issue, but I'm new to
> this. I send the files in attachment (is little and simple).
>
> If anyone knows what I'm looking for please say something, it will be
> much appreciated :]
>
> Thanks in advance,
> Jo?o
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20100715/656a3de3/attachment.html 


More information about the Qt-interest-old mailing list