Details
-
Bug
-
Resolution: Out of scope
-
P3: Somewhat important
-
None
-
5.11.1
-
None
-
MSVC 2017, QtCreator 5.8
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);
}