Results 1 to 6 of 6

Thread: Q3Canvas on qt4

  1. #1
    Join Date
    Jun 2006
    Posts
    11
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Q3Canvas on qt4

    http://doc.trolltech.com/4.0/porting4.html#qcanvas
    according the reference
    "The canvas module classes have been renamed and moved to the Qt3Support library"
    canvas module classes is also support by qt4, but when i build the code , the error says
    it cant find Q3Canvas ...
    Qt Code:
    1. #include <qapplication.h>
    2. #include <q3canvas.h>
    3.  
    4. int main(int argc, char **argv)
    5. {
    6. QApplication a( argc, argv );
    7.  
    8. Q3Canvas canvas( 800, 600 );
    9. canvas.setAdvancePeriod(30);
    10.  
    11. Q3CavasView m;
    12. m.setCanvas(&canvas);
    13. a.setMainWidget(&m);
    14.  
    15. Q3CanvasLine* i = new QCanvasLine(&canvas);
    16. i->setPoints( rand()%canvas.width(), rand()%canvas.height(),
    17. rand()%canvas.width(), rand()%canvas.height() );
    18. i->setPen( QPen(QColor(rand()%32*8, rand()%32*8, rand()%32*8), 6) );
    19. i->setZ(rand()%256);
    20. i->show();
    21.  
    22. m.show();
    23.  
    24. return a.exec();
    25. }
    To copy to clipboard, switch view to plain text mode 

    Qt Code:
    1. main.cpp:2:22: q3canvas.h: No such file or directory
    2. main.cpp: In function `int qMain(int, char**)':
    3. main.cpp:8: error: `Q3Canvas' undeclared (first use this function)
    4. main.cpp:8: error: (Each undeclared identifier is reported only once for each function it appears in.)
    5. main.cpp:8: error: expected `;' before "canvas"
    6. main.cpp:9: error: `canvas' undeclared (first use this function)
    7. main.cpp:11: error: `Q3CavasView' undeclared (first use this function)
    8. main.cpp:11: error: expected `;' before "m"
    9. main.cpp:12: error: `m' undeclared (first use this function)
    10. main.cpp:13: error: 'class QApplication' has no member named 'setMainWidget'
    11. main.cpp:15: error: `Q3CanvasLine' undeclared (first use this function)
    12. main.cpp:15: error: `i' undeclared (first use this function)
    13. main.cpp:15: error: `QCanvasLine' has not been declared
    14. main.cpp:18: error: invalid use of undefined type `struct QColor'
    15. C:/Qt/4.1.2/include/QtGui/../../src/gui/kernel/qwindowdefs.h:37: error: forward declaration of `struct QColor'
    16. main.cpp:18: error: invalid use of undefined type `struct QPen'
    17. C:/Qt/4.1.2/include/QtGui/../../src/gui/kernel/qwindowdefs.h:52: error: forward declaration of `struct QPen'
    18. main.cpp:25:2: warning: no newline at end of file
    19. mingw32-make[1]: *** [tmp\obj\debug_shared\main.o] Error 1
    20. mingw32-make[1]: Leaving directory `C:/Qt/4.1.2/test/test'
    21. mingw32-make: *** [debug-all] Error 2
    To copy to clipboard, switch view to plain text mode 

  2. #2
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,518 Times in 1,388 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: Q3Canvas on qt4

    To link against Qt3Support module, add this line to your qmake .pro file:
    QT += qt3support
    J-P Nurmi

  3. #3
    Join Date
    Jan 2006
    Posts
    667
    Thanks
    10
    Thanked 80 Times in 74 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Q3Canvas on qt4

    Why dont you first include the other required header files also and then try ?

    I think the other files are

    Q3CanvasView
    Q3CanvasLine
    QColor
    QPen
    Last edited by munna; 12th June 2006 at 14:15. Reason: spelling mistake

  4. #4
    Join Date
    Jun 2006
    Posts
    11
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Q3Canvas on qt4

    Quote Originally Posted by munna
    Why dont you first include the other required header files also and then try ?

    I think the other files are

    Q3CanvasView
    Q3CanvasLine
    QColor
    QPen
    sorry i have include the file , but it has the same error

  5. #5
    Join Date
    Jan 2006
    Posts
    667
    Thanks
    10
    Thanked 80 Times in 74 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Q3Canvas on qt4

    As jpn said

    add - QT += qt3support in your .pro file and then make.

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

    Default Re: Q3Canvas on qt4

    Or download the port of QCanvas to Qt4 which is available on Trolltech's ftp site.

Similar Threads

  1. Strange error while using Q3Canvas
    By Kapil in forum Newbie
    Replies: 13
    Last Post: 15th June 2006, 19:36
  2. Facing problem with Q3Canvas
    By jnana in forum Qt Programming
    Replies: 3
    Last Post: 6th May 2006, 07:00
  3. Error in Q3Canvas Code...
    By Kapil in forum Newbie
    Replies: 10
    Last Post: 27th March 2006, 05:15
  4. About Q3Canvas
    By jnana in forum Qt Programming
    Replies: 2
    Last Post: 6th March 2006, 12:43

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.