Results 1 to 6 of 6

Thread: problem in QPainter::begin

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jul 2009
    Location
    China,Shanghai
    Posts
    3
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: problem in QPainter::begin

    Did you call the paintEvent, you need that to paint somthing on the widget. If you just write code like paintXXX and not call in the paintEvent, it`ll not work at all.
    Qt Code:
    1. void MyWidget::paintEvent(QPaintEvent *)
    2. {
    3.  
    4. QPainter painter(this);
    5. paintXXXX(QPainter *);
    To copy to clipboard, switch view to plain text mode 

  2. #2
    Join Date
    Sep 2008
    Location
    Bangalore
    Posts
    659
    Thanks
    116
    Thanked 42 Times in 41 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: problem in QPainter::begin

    =xtfllbl;109807]Did you call the paintEvent, you need that to paint somthing on the widget. If you just write code like paintXXX and not call in the paintEvent, it`ll not work at all.
    actually its a bug in Qt ... we cant add a new widget to a widget that is embedded to graphicsView()

    see this code
    Qt Code:
    1. ProxyBug::ProxyBug(QWidget *parent) : QDialog(parent)
    2. {
    3. QVBoxLayout *l = new QVBoxLayout( this );
    4.  
    5. group->setScene(scene);
    6.  
    7. QGraphicsView * group2 = new QGraphicsView;
    8. group2->setScene(scene2);
    9.  
    10. group->scene()->addWidget(group2);
    11. QLineEdit * lineEdit = new QLineEdit;
    12. group2->scene()->addWidget(lineEdit); // this one crashing *
    13.  
    14. l->addWidget(group);
    15. setLayout( l );
    16.  
    17. }
    To copy to clipboard, switch view to plain text mode 

    the group2 is try to embed another widget where group2 itself is embedded by group ...
    Last edited by wagmare; 17th July 2009 at 10:40.
    "Behind every great fortune lies a crime" - Balzac

Similar Threads

  1. Replies: 1
    Last Post: 23rd April 2009, 09:05
  2. Replies: 19
    Last Post: 3rd April 2009, 23:17
  3. deployment problem: msvc++ 2008 Express, Qt 4.4.3
    By vonCZ in forum Qt Programming
    Replies: 7
    Last Post: 10th November 2008, 14:38
  4. Grid Layout Problem
    By Seema Rao in forum Qt Programming
    Replies: 2
    Last Post: 4th May 2006, 12:45
  5. fftw problem
    By lordy in forum General Programming
    Replies: 1
    Last Post: 16th March 2006, 21:36

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.