Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-65035

QGraphicsEffect on QGraphicsItem causes devicePixelRatio to be ignored

    XMLWordPrintable

Details

    • 73698cb3401b9445ba0ad6b0a6cc3e125e50a745

    Description

      Setting a QGraphicsEffect on a QGraphicsItem in a QGraphicsScene causes that item to be rendered with target device pixel ratio ignored.

      #include <QGraphicsScene>
      #include <QGraphicsView>
      #include <QGraphicsItem>
      #include <QGraphicsDropShadowEffect>
      #include <QPainter>
      #include <QApplication>
      #include <QtGlobal>
      
      int main(int argc, char *argv[])
      {
          // large scale factor to make the difference clear
          qputenv("QT_SCALE_FACTOR", QByteArray("2"));
          QApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
          QApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
          QApplication a(argc, argv);
          QGraphicsScene scene;
          QGraphicsView view(&scene);
          view.setRenderHints(QPainter::Antialiasing);
          // item with a drop shadow effect
          QGraphicsItem *item = scene.addEllipse(0, 0, 60, 60, QPen(Qt::NoPen), QBrush(Qt::red));
          item->setGraphicsEffect(new QGraphicsDropShadowEffect());
          // item without
          scene.addEllipse(100, 0, 60, 60, QPen(Qt::NoPen), QBrush(Qt::red));
          view.show();
          return a.exec();
      }
      

      Attachments

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              bibr Andreas Aardal Hanssen
              aleserjavec Ales Erjavec
              Votes:
              2 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes