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

jaff at student.dei.uc.pt jaff at student.dei.uc.pt
Sun Jul 18 00:13:16 CEST 2010


Hi all,

Thanks for all your answers and tips, both Yogesh and John. I was going 
towards the direction you both pointed out, but somehow something was 
going wrong. Now it's working :]

John, I only deleted the files because I felt the code was starting to 
look more like patchwork then proper, decente code, since I was trying 
and changing things to get it working, I still don't know what was 
missing... I know it's not a good habit to do that in a regular basis ;]

So, thanks again! []
João

Quoting yogesh upreti <yogesh.upreti at gmail.com>:

> 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
>>
>>
>



----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.





More information about the Qt-interest-old mailing list