Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. reimplement paintEngine() to return 0

reimplement paintEngine() to return 0

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 884 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • WoGiW Offline
    WoGiW Offline
    WoGi
    wrote on last edited by
    #1

    Hello,

    I'm trying to port an widget written for Qt4 over to Qt5 (PyQt, I'm sorry if I'm posting in the wrong area of the forums). So far everything is going very smooth except for one thing.

    The widget has areas that are supposed to be transparent. I've been using the attributes Qt.WA_NoSystemBackground and Qt.WA_TranslucentBackground in order to make this work.

    Whenver a compositing manager is running this totally work fine (so Mac and Windows have no problems), but I found that (depending on the type of installation) Linux sometimes has trouble with this.
    Therefore I added a line to the code, setting the WA_PaintOnScreen attribute whenever the code is run on Linux. Instead of a solid background, it will then paint on top of the application.

    This used to work fine in Qt4, however, Qt5 starts throwing errors:

    QWidget::paintEngine: Should no longer be called
    QPainter::begin: Paint device returned engine == 0, type: 1
    QPainter::save: Painter not active
    QPainter::translate: Painter not active
    QPainter::setClipRect: Painter not active
    QPainter::pen: Painter not active
    QPainter::setPen: Painter not active
    QPainter::restore: Unbalanced save/restore

    When removing the WA_PaintOnScreen attribute, the errors go away.

    After some googling I think what I have to do is to 'reimplement paintEngine() to return 0'. However, I'm not sure how to do this.

    Any help would be much appreciated.

    As you might have figured, I'm not a profressional programmer.

    Thanks in advance

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      Can you reproduce that with a minimal runnable code ?

      What version of PyQt and Qt are you using ?
      What Linux distribution ?
      What desktop environment ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved