Details
-
Bug
-
Resolution: Done
-
P2: Important
-
5.7.1, 5.10.0 Alpha
-
None
-
I'm using Qt 5.7.1 on windows 10 with MinGW 5.3.0.
Description
Hello,
I think I have the same problem.
I am drawing dashed QGraphicsLineItems, and in some rare [line position, zoom factor] configurations, I get a square at the end of the dashed line (see attachment).
Here is a minimal example:
#include <QApplication> #include <QMainWindow> #include <QGraphicsScene> #include <QGraphicsView> #include <QGraphicsLineItem> int main(int argc, char *argv[]) { QApplication a(argc, argv); QMainWindow w; QGraphicsScene* scene = new QGraphicsScene(&w); QGraphicsView* view = new QGraphicsView(scene); w.setCentralWidget(view); QGraphicsLineItem* line = new QGraphicsLineItem(0, 0, 120, 90); QPen pen; pen.setStyle(Qt::DashLine); line->setPen(pen); scene->addItem(line); // The problem occurs only with some scaling factors // 3.160913184460621305760241739335469901561737060546875 is one of them // Many others can be found, for example by successively // calling view->scale(1.01, 1.01) qreal f = 3.160913184460621305760241739335469901561737060546875; view->scale(f, f); w.setMinimumSize(700, 700); w.show(); return a.exec(); }
Here are some miscellaneous observations that may - or not - be useful:
- the bug seems to occur preferentially for some line angles. dx / dy = 4/3 (or 3/4) seems to be especially bug-prone
- changing the widget size affects the size of the square artifact
- for some custom dash patterns, the bug seems to disappear completely (at least I can't reproduce it), but for others, it seems to be more frequent. For example pen.setDashPattern({8, 3}) seems fine, but pen.setDashPattern({8, 2}) seems bug-prone
Attachments
For Gerrit Dashboard: QTBUG-56969 | ||||||
---|---|---|---|---|---|---|
# | Subject | Branch | Project | Status | CR | V |
202900,2 | Fix huge painting artefact of certain dashed lines | 5.9 | qt/qtbase | Status: MERGED | +2 | 0 |
203023,2 | Fix huge painting artefact of certain dashed lines | 5.6 | qt/qtbase | Status: MERGED | +2 | 0 |