Results 1 to 8 of 8

Thread: QWidget::paintEngine() should no longer be called

  1. #1
    Join Date
    Feb 2007
    Posts
    4
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    Unix/X11

    Default QWidget::paintEngine() should no longer be called

    In Qt 4.1 I get the following error when trying to use QPainter in a function in a QLineEdit derived class:


    QWidget::paintEngine() should no longer be called
    QPainter::begin(), paintdevice returned engine == 0, type: 1



    This is on Linux and I have tried to set:

    Qt Code:
    1. setAttribute( Qt::WA_PaintOutsidePaintEvent, true );
    To copy to clipboard, switch view to plain text mode 

    as this painting is not happening in the paintEvent() function.

    The line that triggers the message is:

    Qt Code:
    1. QPainter painter(this);
    To copy to clipboard, switch view to plain text mode 

    Nothing is painted using the painter. Is this not possible to do or how could I paint in this function ?

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QWidget::paintEngine() should no longer be called

    Does "this" point to a widget?

  3. #3
    Join Date
    Oct 2006
    Location
    New Delhi, India
    Posts
    2,467
    Thanks
    8
    Thanked 334 Times in 317 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QWidget::paintEngine() should no longer be called

    Where are u using the line
    QPainter painter(this) ??

  4. #4
    Join Date
    Feb 2007
    Posts
    4
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    Unix/X11

    Default Re: QWidget::paintEngine() should no longer be called

    The line is in the ::event(QEvent*) function of a class that is derived from a QLineEdit.

  5. #5
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QWidget::paintEngine() should no longer be called

    Hmm.... Why not do it the regular way - using paintEvent? Everything you draw in event will right away get discarded because the paintEvent will be called and it'll draw a regular line edit.

  6. #6
    Join Date
    Feb 2007
    Posts
    4
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    Unix/X11

    Default Re: QWidget::paintEngine() should no longer be called

    Sure it could be rewritten, but the code works fine in Qt < Qt4 and I was kind of curious if it could be done in the same way to ease the porting.

  7. #7
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QWidget::paintEngine() should no longer be called

    The gap between Qt3 and Qt4 is very big, some concepts have changed, painting included.

  8. #8
    Join Date
    Feb 2007
    Posts
    4
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    Unix/X11

    Default Re: QWidget::paintEngine() should no longer be called

    Well if there are no shortcuts I have to walk the long way, thanks anyway.

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.