Results 1 to 4 of 4

Thread: Substitution of MainWindow with user ui-Form (Linux/Kdevelop)

  1. #1
    Join Date
    Nov 2007
    Posts
    27
    Thanks
    5
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Thumbs down Substitution of MainWindow with user ui-Form (Linux/Kdevelop)

    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

  2. #2
    Join Date
    Oct 2007
    Location
    Munich, Bavaria
    Posts
    144
    Thanks
    1
    Thanked 19 Times in 19 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Substitution of MainWindow with user ui-Form (Linux/Kdevelop)

    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

  3. The following user says thank you to DeepDiver for this useful post:

    wallyqt (15th November 2007)

  4. #3
    Join Date
    Nov 2007
    Posts
    27
    Thanks
    5
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Thumbs up Re: Substitution of MainWindow with user ui-Form (Linux/Kdevelop)

    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

  5. #4
    Join Date
    Oct 2007
    Location
    Munich, Bavaria
    Posts
    144
    Thanks
    1
    Thanked 19 Times in 19 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Substitution of MainWindow with user ui-Form (Linux/Kdevelop)

    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:
    Qt Code:
    1. Q_INIT_RESOURCE(app_images)
    2. Q_INIT_RESOURCE(app_trans)
    To copy to clipboard, switch view to plain text mode 

    Look here for more details: http://doc.trolltech.com/4.3/resources.html
    Last edited by DeepDiver; 15th November 2007 at 13:11. Reason: Remove stupid statement and add link ....

  6. The following user says thank you to DeepDiver for this useful post:

    wallyqt (15th November 2007)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.