Results 1 to 2 of 2

Thread: How to use QGraphicsView?

  1. #1
    Join Date
    Feb 2012
    Posts
    13
    Qt products
    Qt4

    Default Re: How to use QGraphicsView?

    I'm trying to get QGraphicsView and QGraphicsScene work (in one file), but it doesnt. Dont laugh, im beginner

    Qt Code:
    1. #include <QApplication>
    2. #include <QFont>
    3. #include <QPushButton>
    4. #include <QWidget>
    5. #include <QGraphicsView>
    6.  
    7. class graphics : QGraphicsScene {
    8. Q_OBJECT;
    9. public:
    10. graphics(QWidget* parent = 0);
    11. };
    12.  
    13. graphics::graphics(QWidget * parent) : QGraphicsScene {
    14. QGraphicsView view(this);
    15. }
    16.  
    17. int main(int argc, char *argv[])
    18. {
    19. QApplication app(argc, argv);
    20. graphics Graphics;
    21. Graphics.show();
    22. return app.exec();
    23. }
    To copy to clipboard, switch view to plain text mode 

    Oh and if you have a tutorial it would be great.. I googled for 15 min.


    Added after 11 minutes:


    Np fixed it!!
    Last edited by xleniz; 7th June 2012 at 18:25.

  2. #2
    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: How to use QGraphicsView?

    The problem is solvable by adding #include "main.moc" before the main function and reruning qmake.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. Replies: 7
    Last Post: 1st December 2011, 16:24
  2. QGraphicsView transparent over another QGraphicsView
    By evergreen in forum Qt Programming
    Replies: 0
    Last Post: 30th May 2011, 10:22
  3. Replies: 0
    Last Post: 10th January 2011, 09:42
  4. QML or QGraphicsView?
    By been_1990 in forum General Programming
    Replies: 7
    Last Post: 27th October 2010, 18:58
  5. QGraphicsView
    By Maluko_Da_Tola in forum Newbie
    Replies: 1
    Last Post: 24th July 2010, 05:40

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.