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

QPen setCosmetic does not work in high QGraphicsView scale

    XMLWordPrintable

Details

    • Bug
    • Resolution: Out of scope
    • P3: Somewhat important
    • None
    • 5.11.1
    • None
    • MSVC 2017, QtCreator 5.8
    • Windows

    Description

      I have a QGraphicsView and a QGraphicsItem that added to graphicsView's scene. I override QGraphicsView wheelEvent to do scale view, but i want my graphics item width does not change.

      For this purpose i set cosmetic true for pen in graphics item paint function. it is work fine but after some scale in (zoom), cosmetic feature does not work and graphics item width begins to grow up for more zoom (like cosmetic set to false) when i setup setViewport(new QGLWidget) in MyGraphicsView.

      Scale code is like so:

      void MyGraphicsView::WheelEvent(QWheelEvent* e)
      {
          auto z = pow(2, e->delta() / 120 / 4);
          scale(z, z);
      }

      Graphics item override paint function is like so:

      void MyGraphicsItem::paint(QPainter* p, ...)
      {
          QPen pen;
          pen.setColor(Qt::Black);
          pen.setCosmetics(true);
          painter.setPen(pen);
          painter.drawLine(somePoint1, somePoint2);
      }
      

       

      Attachments

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

        Activity

          People

            vgt Eirik Aavitsland
            drspam Mohsen Sh
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes