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. QPainter set render hits globally

QPainter set render hits globally

Scheduled Pinned Locked Moved General and Desktop
qpainterrendering
4 Posts 2 Posters 1.9k Views 2 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.
  • M Offline
    M Offline
    Milovidov
    wrote on last edited by
    #1

    Can I set render hits flags globaly, for entire qt application? I want next flags to set for all painting widgets:

    pPainter->setRenderHints(QPainter::SmoothPixmapTransform | QPainter::Antialiasing, false);
    pPainter->setRenderHints(QPainter::TextAntialiasing , true);
    

    Is it possible?

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

      Hi,

      AFAIK, no, but you could create a small subclass of QPainter that sets them and re-use it through your application.

      Hope it helps

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

      M 1 Reply Last reply
      1
      • SGaistS SGaist

        Hi,

        AFAIK, no, but you could create a small subclass of QPainter that sets them and re-use it through your application.

        Hope it helps

        M Offline
        M Offline
        Milovidov
        wrote on last edited by
        #3

        @SGaist Thank you! But I not uderstand, how to change render hits in QTextBrowser for example.
        I tried next code:

        QPainter* pPainter = m_pTextBrowser->paintEngine().painter();
        pPainter->setRenderHints(QPainter::SmoothPixmapTransform | QPainter::Antialiasing, false);
        pPainter->setRenderHints(QPainter::TextAntialiasing , true);
        

        I recieved segmentation failt, because pPainter not valid. From other side, QTextBrowser also have viewport widget, but the same situation with him, I don't can get valid painter.

        Once way, that I see, reimplement paintEvent and paint widget from zero. Because in other case, if I will use paintEvent from inherits class, he can use QPainter with custom render hits.

        Is exist way for changing render hits for widget?

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

          I am not aware of a setting like that.

          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