Results 1 to 3 of 3

Thread: QGraphicsScene problem/bug

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Sep 2009
    Posts
    30
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default QGraphicsScene problem/bug

    Taken directly from the Qt 4.5.2 documentation, in the Detailed Description of QGraphicsGridLayout:

    Qt Code:
    1. QGraphicsWidget *textEdit = scene.addWidget(new QTextEdit);
    2. QGraphicsWidget *pushButton = scene.addWidget(new QPushButton);
    3.  
    4. QGraphicsGridLayout *layout = new QGraphicsGridLayout;
    5. layout->addItem(textEdit, 0, 0);
    6. layout->addItem(pushButton, 0, 1);
    7.  
    8. QGraphicsWidget *form = new QGraphicsWidget;
    9. form->setLayout(layout);
    10. scene.addItem(form);
    To copy to clipboard, switch view to plain text mode 

    First problem: I don't see anything if I wrap this in a simple QApplication:
    Qt Code:
    1. int main()
    2. {
    3.  
    4. QWidget *widget;
    5. //the above code, with the first line:
    6. //QGraphicsScene scene(widget);
    7. widget->show();
    8. return app.exec();
    9. }
    To copy to clipboard, switch view to plain text mode 

    This structure is really important, but when I try to implement it in my class's constructor, it won't compile. What's wrong here? Thanks!
    Last edited by rubenvb; 27th September 2009 at 16:40.

Similar Threads

  1. QGraphicsScene core dump?
    By cookie1909 in forum Newbie
    Replies: 2
    Last Post: 25th April 2009, 07:06
  2. Replies: 0
    Last Post: 5th March 2009, 06:54
  3. QPixmap display on QGraphicsScene
    By febil in forum Qt Programming
    Replies: 2
    Last Post: 26th February 2009, 09:27
  4. in QGraphicsScene matrix of other QGraphicsScene
    By Noxxik in forum Qt Programming
    Replies: 5
    Last Post: 15th February 2009, 17:27
  5. When to use QGraphicsScene or QWidget
    By fossill in forum Qt Programming
    Replies: 2
    Last Post: 9th February 2007, 23:58

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.