Results 1 to 3 of 3

Thread: [WIN XP]installed corectly (?) but cant compile tutorial programs

  1. #1
    Join Date
    Aug 2007
    Posts
    1
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Unhappy [WIN XP]installed corectly (?) but cant compile tutorial programs

    I'm new to QT, i wanted to try it in WinXP, SP 1
    i think i installed it correctly (configure.exe and mingw32-make finished without any errors -how i installed everything at the end of post).

    then i created a simple file like in tutorial 1 in C:\QT\PRO\ to test QT out:

    #include <qapplication.h>
    #include <qpushbutton.h>
    int main( int argc, char **argv ) {
    QApplication a( argc, argv );
    QPushButton hello( "Hello world!", 0 );
    hello.resize( 100, 30 );
    a.setMainWidget( &hello );
    hello.show();
    return a.exec();
    }

    what i got was error like:
    main.cpp: error: class QApplication has no member named 'setMainWidget'.
    when i erased the line with setMainWidget program WAS compiled and working corectly.
    another problem appeared with program from tutorial 3:

    error: qvbox.h no such file or directory.

    Looks like not whole QT was installed on my PC, or something with libraries was wrong. Have i installed something not like i should? Here's how i did it:

    1. enviromental variables PATH and QMAKESPEC set (added C:QT\4.3.0\bin, win32-g++)
    2. before installing i unset the varibles lib and include (set inlude = , set lib=)
    3.i used the opensource windows QT 4.3.0 binary and installed (C:\QT\4.3.0\ )
    4. downloaded newest MinGW via troltech downloader and installed it (C:\QT\MinGW\ )
    5. in command line typed: configure -debug-and-release
    compilation finished WITHOUT any errors
    6. mingw32-make
    took ages but finished without errors
    7. i compiled programs from tutorial using
    qmake -project
    qmake
    make

    i will appriciate any help i can get here. How can i fix my qt installation?
    Today i tried it on the other PC, but i got even more errors while configuring and using mingw32-make on winxp...

  2. #2
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Thanks
    8
    Thanked 541 Times in 521 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: [WIN XP]installed corectly (?) but cant compile tutorial programs

    QApplication::setMainWidget is deprecated in Qt 4. It is part of the Qt3 support API.
    So, if you wish to use it you will have to compile Qt with Qt 3 support enabled, although you don't have any reason to do that, unless you're porting to some application for Qt 3 to Qt 4.

    Here's how it is defined:
    Qt Code:
    1. #ifdef QT3_SUPPORT
    2. static QT3_SUPPORT QWidget *mainWidget();
    3. static QT3_SUPPORT void setMainWidget(QWidget *);
    4. #endif
    To copy to clipboard, switch view to plain text mode 
    So, in Qt 4, just show the main widget. It will be enough.

    Also, QVBox has been replaced in Qt4 by QVBoxLayout.
    Note that all deprecated functions are documented, so if you open Assistant and you type in the function name, it will tell you whether it is obsolete or not.

    Regards

  3. The following 2 users say thank you to marcel for this useful post:

    freegod (9th September 2007), ppn (26th August 2007)

  4. #3
    Join Date
    Sep 2007
    Posts
    1
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: [WIN XP]installed corectly (?) but cant compile tutorial programs

    Quote Originally Posted by marcel View Post
    QApplication::setMainWidget is deprecated in Qt 4. It is part of the Qt3 support API.
    So, if you wish to use it you will have to compile Qt with Qt 3 support enabled, although you don't have any reason to do that, unless you're porting to some application for Qt 3 to Qt 4.

    Here's how it is defined:
    Qt Code:
    1. #ifdef QT3_SUPPORT
    2. static QT3_SUPPORT QWidget *mainWidget();
    3. static QT3_SUPPORT void setMainWidget(QWidget *);
    4. #endif
    To copy to clipboard, switch view to plain text mode 
    So, in Qt 4, just show the main widget. It will be enough.

    Also, QVBox has been replaced in Qt4 by QVBoxLayout.
    Note that all deprecated functions are documented, so if you open Assistant and you type in the function name, it will tell you whether it is obsolete or not.

    Regards
    thanks,good answer for me

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.