Results 1 to 2 of 2

Thread: QGraphicsView

  1. #1
    Join Date
    Jul 2010
    Posts
    72
    Thanks
    35
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default QGraphicsView

    Hi

    I am trying to display graphics in my a QGraphicsView object created in the main form using Qt designer. I am using the following function paintEvent in the mainwindow.cpp


    void QGraphicsView:aintEvent(QPaintEvent *)
    {
    QPainter painter(this);
    painter.setPen(Qt::blue);
    painter.setFont(QFont("Arial", 30));
    painter.drawText(rect(), Qt::AlignCenter, "Qt");
    }

    Why do I still not get any drawings in my QGraphicsView object?

    Thank you

  2. #2
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: QGraphicsView

    Well the code looks fine. But are you aware that one normally uses as QGraphicsScene inside a graphics view? There you can add a QGraphicsTextItem.

Similar Threads

  1. QGraphicsView
    By Maluko_Da_Tola in forum Newbie
    Replies: 1
    Last Post: 20th July 2010, 18:56
  2. QGraphicsView
    By Maluko_Da_Tola in forum Newbie
    Replies: 11
    Last Post: 19th July 2010, 08:15
  3. QGraphicsView
    By Shawn in forum Qt Programming
    Replies: 11
    Last Post: 4th June 2007, 14:31
  4. help with QGraphicsView
    By Erlendhg in forum Qt Programming
    Replies: 6
    Last Post: 22nd April 2007, 20:26
  5. Regarding QGraphicsView
    By kiranraj in forum Qt Programming
    Replies: 4
    Last Post: 22nd December 2006, 04:59

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.