PDA

View Full Version : Substitution of MainWindow with user ui-Form (Linux/Kdevelop)



wallyqt
15th November 2007, 13:06
I tried one of the two available qt4-qmake-project-templates from kdevelop.

Unfortunately they are not ui based so that i have to add/substitute
the "startup-Form" by my own.

Here is my main.cpp:
(test is the projects name)

#include <QApplication>
#include "ui_mydialog.h"
#include "test.h"

int main(int argc, char *argv[])

{
Q_INIT_RESOURCE(application);
QApplication app(argc, argv);
QDialog *window=new QDialog;
Ui::MyDialog ui;
ui.setupUi(window);
window->show();
return app.exec();
}

this creates the following errot:

main.cpp:(.text+0x1d): undefined reference to `qInitResources_application()'

I have not enough experience to figure it out myself, so i ask here.
Any ides what i should change or what i can check ?

Opensuse 10.2./ Qt4 / Kdevelop 3.5

cheers wally

DeepDiver
15th November 2007, 13:26
Do you have qt resource file(s) in our project?
If so: the base-name of the resource file must be within the macro
Q_INIT_RESOURCE().
You have one call for each resource file.

If not: delete the line with the macro.

Good luck

wallyqt
15th November 2007, 13:56
DeepDiver,

thank you very much!

I removed the line: Q_INIT_RESOURCE(application);

I did not found a resource-file in my project
allthough there has been one in the not-modified
template project. No idea how i lost it.

It was "application.qrc" and contained the following:

<!DOCTYPE RCC><RCC version="1.0">
<qresource>
<file>editcopy.xpm</file>
<file>editcut.xpm</file>
<file>filenew.xpm</file>
<file>fileopen.xpm</file>
<file>editpaste.xpm</file>
<file>filesave.xpm</file>
</qresource>
</RCC>

Just for learning and curiosity:

«If so: the base-name of the resource file must be within the macro
Q_INIT_RESOURCE().
You have one call for each resource file.»

How it might looks after correcting ?

cheers wally

DeepDiver
15th November 2007, 14:09
you can have multiple resource files in a qt project.
Lets say you have following resource files: app_images.qrc and app_trans.qrc.
In this case you have two macro calls:


Q_INIT_RESOURCE(app_images)
Q_INIT_RESOURCE(app_trans)


Look here for more details: http://doc.trolltech.com/4.3/resources.html