Results 1 to 5 of 5

Thread: setMainWidget

  1. #1
    Join Date
    Mar 2008
    Location
    Morocco
    Posts
    47
    Thanks
    7
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default setMainWidget

    Peace..
    hey ..
    I try to compile a simple qt programm whch I found in a tuto .. but I get the following error >> 'class QApplication' has no member named 'setMainWidget'
    Qt Code:
    1. #include <QApplication.h>
    2. #include <qpainter.h>
    3. #include <qlabel.h>
    4. #include <qpixmap.h>
    5. #include <qpaintdevice.h>
    6. void Dessiner(QPaintDevice * dev)
    7. { }
    8. int main (int argc, char* argv[])
    9. {
    10. QApplication app(argc, argv) ;
    11. QPixmap pix(300, 200) ;
    12. Dessiner(&pix) ;
    13. QLabel label(0) ;
    14. label.setPixmap(pix) ;
    15. app.setMainWidget(&label) ;
    16. label.show() ;
    17. return app.exec() ;
    18. }
    To copy to clipboard, switch view to plain text mode 
    so is setMainWidget a member of QApplication class ??
    plz help
    Last edited by wysota; 10th March 2008 at 21:51. Reason: missing [code] tags

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: setMainWidget

    QApplication::setMainWidget() is a method from Qt3 whereas you seem to be using Qt4.

  3. #3
    Join Date
    Mar 2008
    Location
    Morocco
    Posts
    47
    Thanks
    7
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: setMainWidget

    Yea Im using Qt4 ..so wht should I put instead ?

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: setMainWidget

    Nothing, you can remove that line.

  5. #5
    Join Date
    Mar 2008
    Location
    Morocco
    Posts
    47
    Thanks
    7
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: setMainWidget

    So by default it is taken as a main widget !!
    thanks for help

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.