Results 1 to 7 of 7

Thread: Compilation error creating a project on QT4.0.1??

  1. #1
    Join Date
    Mar 2006
    Posts
    47
    Thanks
    2
    Qt products
    Qt3 Qt4
    Platforms
    MacOS X Unix/X11

    Default Compilation error creating a project on QT4.0.1??

    Hi

    I had created a form named imagedialog.ui and then added the following code in Main.cpp

    #include <qdialog.h>
    #include "ui_imagedialog.h"
    #include <QApplication>

    int main(int argc, char *argv[])
    {
    QApplication app(argc, argv);
    QDialog *window = new QDialog;
    Ui::ImageDialog ui;
    ui.setupUi(window);

    window->show();
    return app.exec();
    }



    Then i used the
    qmake -project
    qmake
    make

    it creates the "ui_imagedialog.h" file but there is some error in main.cpp :-
    main.cpp: In function `int main(int, char**)':
    main.cpp:21: error: 'ImageDialog' is not a member of 'Ui'
    main.cpp:21: error: expected `;' before "ui"
    main.cpp:22: error: 'ui' was not declared in this scope
    make: *** [main.o] Error 1

    Where i am wrong plz assist me.

    Best Regards

  2. #2
    Join Date
    Jan 2006
    Location
    Ukraine,Lviv
    Posts
    454
    Thanks
    9
    Thanked 27 Times in 27 Posts
    Qt products
    Qt3
    Platforms
    Unix/X11 Windows

    Default Re: Compilation error creating a project on QT4.0.1??

    are you sure that your form has ImageDialog name?
    a life without programming is like an empty bottle

  3. #3
    Join Date
    Jan 2006
    Location
    Bremen, Germany
    Posts
    554
    Thanked 86 Times in 81 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Compilation error creating a project on QT4.0.1??

    Quote Originally Posted by darpan
    main.cpp:21: error: 'ImageDialog' is not a member of 'Ui'
    What's the problem here? Take a look into ui_imagedialog.h and see if ImageDialog is available in the namespace Ui.

  4. #4
    Join Date
    Mar 2006
    Posts
    47
    Thanks
    2
    Qt products
    Qt3 Qt4
    Platforms
    MacOS X Unix/X11

    Default Re: Compilation error creating a project on QT4.0.1??

    Hi
    Following code snippet is written in ui_imagedialog.h


    namespace Ui {
    class Dialog: public Ui_Dialog {};
    } // namespace Ui



    Thanks

  5. #5
    Join Date
    Jan 2006
    Location
    Ukraine,Lviv
    Posts
    454
    Thanks
    9
    Thanked 27 Times in 27 Posts
    Qt products
    Qt3
    Platforms
    Unix/X11 Windows

    Default Re: Compilation error creating a project on QT4.0.1??

    so you must use Dialog instead ImageDialog
    a life without programming is like an empty bottle

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

    darpan (7th March 2006)

  7. #6
    Join Date
    Mar 2006
    Posts
    47
    Thanks
    2
    Qt products
    Qt3 Qt4
    Platforms
    MacOS X Unix/X11

    Default Re: Compilation error creating a project on QT4.0.1??

    Hi
    How can i connect a Button to a user defined slot(). In qt 4.0.1 we can easily connect two object just by draging. but how i can connect a Button to a user difned slot in qt 4.0.1.

    So that i can code what i want to do on the click of any button.



    Thanks and regards

  8. #7
    Join Date
    Feb 2006
    Location
    New Delhi,India
    Posts
    226
    Thanks
    14
    Thanked 4 Times in 4 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Compilation error creating a project on QT4.0.1??

    hi,

    You can do so by the use of signal and slots... there is a proper documentation on it.. Just follow that and you would be able to do the same...
    the function for it would be..

    connect(pushButton,SIGNAL(clicked()),objectname,SL OT(functionname()));

Similar Threads

  1. Possible Qt 4.4.0 bug - project compilation
    By MarkoSan in forum Qt Programming
    Replies: 12
    Last Post: 14th May 2008, 08:38
  2. QT Project compilation with Dev-Cpp
    By manojmka in forum Qt Programming
    Replies: 0
    Last Post: 7th May 2007, 11:07

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.