Results 1 to 14 of 14

Thread: Graphics View Queries

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Dec 2008
    Posts
    31
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Graphics View Queries

    Hi,

    Trying to understand the basics of Graphics View,
    I have written a simple code snippet to do so,

    Qt Code:
    1. int main(int argc, char *argv[])
    2. {
    3. qDebug("In Main");
    4. QApplication a(argc, argv);
    5.  
    6.  
    7. QGraphicsView *viewGv = new QGraphicsView();
    8. viewGv->setScene(scene);
    9.  
    10. scene->setSceneRect(QRectF(0, 0 , 10, 10));
    11. QGraphicsTextItem * item1 = scene->addText("Hello World");
    12.  
    13. scene->setBackgroundBrush(Qt::blue);
    14. QPen pen1;
    15. pen1.setColor(Qt::red);
    16. scene->addLine(0,0, 10,10, pen1);
    17.  
    18. viewGv->show();
    19. return a.exec();
    20.  
    21. }
    To copy to clipboard, switch view to plain text mode 
    Here i have set the scene rect as (0,0,10,10), and have set its background to blue color.
    When i run the application a small window appears as intended when i maximise it the entire window is filled with blue color....

    I expected only the area (0,0,10,10) which represents the scene to be filled as blue..
    whats happening here can anyone help me understand this???
    Last edited by jpn; 23rd December 2008 at 14:21. Reason: missing [code] tags

Similar Threads

  1. Qt Coordinate System and the Graphics View Framework
    By djurodrljaca in forum Qt Programming
    Replies: 14
    Last Post: 17th February 2012, 11:19
  2. Replies: 4
    Last Post: 5th August 2008, 19:55
  3. Graphics View Event Propagation
    By pherthyl in forum Qt Programming
    Replies: 10
    Last Post: 3rd July 2008, 10:39
  4. Graphics view display problem.
    By kiranraj in forum Qt Programming
    Replies: 3
    Last Post: 20th July 2007, 07:08
  5. Adding Rectangular overlay on graphics view
    By forrestfsu in forum Qt Programming
    Replies: 10
    Last Post: 21st November 2006, 19:42

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
  •  
Qt is a trademark of The Qt Company.