[Qt-creator] using more than 1 form for a qt app

Thorbjørn Lindeijer thorbjorn.lindeijer at nokia.com
Tue Jun 30 16:10:08 CEST 2009


Dear Mario,

If you want to add a new .ui form to your application without writing 
the glue code yourself, you need to use the appropriate wizard. There is 
a "Qt Designer Form Class" wizard that will generate a header and source 
pair along with your .ui file that integrates the form as a widget class 
that is part of your application.

Writing the code yourself allows for more flexibility, but is rarely 
needed. In any case, you can read more about his it all works here:

http://doc.trolltech.com/4.5/designer-using-a-ui-file.html

Regards,
Bjørn

-- 
Thorbjørn Lindeijer
Software Engineer
Nokia, Qt Software


ext Mario Gnad wrote:
> Hi all,
> 
> first a brief description about the enviroment:
> 
> 1.) qt creator: master branch checked out at 2009-26-06
> 2.) arch linux with qt 4.5.1
> 
> now a short description what leads to my post:
> 
> 1.) created a new qt gui app
> 2.) add a new designer form in a subdir called 
> {projectdir}/ui-widgets/about/about.ui
> 
> -----
> 
> at this point my project files looks something like this (without any 
> modification done by myself)
> 
> # -------------------------------------------------
> # Project created by QtCreator 2009-06-26T23:29:10
> # -------------------------------------------------
> QT += network \
>     sql \
>     svg \
>     webkit \
>     xml \
>     xmlpatterns \
>     phonon \
>     testlib
> TARGET = qt-test-gui
> TEMPLATE = app
> SOURCES += main.cpp \
>     mainwindow.cpp
> HEADERS += mainwindow.h
> FORMS += mainwindow.ui \
>     ui-widgets/about/about.ui
> OTHER_FILES += doc/README
> 
> --> what did i expect at this point ?
> ui-widgets/about/ui-about.h and probally a ui-about.cpp for adding own code
> --> instead
> it is {projectdir}/ui-about.h and beside the about.ui file there is no 
> other file in the project view
> 
> this is ok as long as all might use qtcreator but if some people might 
> use another editor it might confuse them.
> 
> After adding #include "ui-about.h" to mainwindow.cpp i tried to add a 
> signal to the form (just for testing).
> Here are the next steps:
> 
> 3.) right click on the about form -> change signals / slots ... -> added 
> a signal called test_signal()
> 4.) right click on the about form -> show slots .. -> doubleclick on any 
> of the slots / signal leads to a error message.
> 
> original error message:
> Die Definition der Klasse 'Ui::Dialog' konnte in 
> {Projektdir}/mainwindow.cpp nicht gefunden werden.
> 
> translated:
> The definition of the class 'UI::Dialog' could not be found in 
> {Projektdir}/mainwindow.cpp
> 
> I realy like the work you guys doing so i hope this helps to improve 
> qtcreator.
> 
> sincerly mario




More information about the Qt-creator-old mailing list