Details
-
Bug
-
Resolution: Fixed
-
P2: Important
-
6.8.0
-
None
-
CPU: AMD Ryzen 7 5700G
GPU: CPU inbuild
Graphic resolution: 4K
Graphic scaling: 200%
OS: Windows 11 23H2 Build 22631.4317
-
-
b587e7143 (dev), a012e558d (6.8)
Description
In Qt 6.7.2 and below QPainter:drawText(x, y, w, h, ...) in combination with Qt::TextDontClip flag zero values for width and height parameters work:
#include <QApplication> #include <QWidget> #include <QPainter> class Widget : public QWidget { protected: void paintEvent(QPaintEvent *) { QPainter painter(this); painter.setRenderHints(QPainter::Antialiasing, true); auto Width = width(); auto Height = height(); auto Side = qMin(Width, Height); painter.scale(Side / 600.0, Side / 600.0); QFont font("arial",20); painter.setFont(font); // works in Qt 6.7.2 and below, but doesn't work since Qt 6.8.0 painter.drawText(50, 50, 0, 0, Qt::TextDontClip | Qt::TextSingleLine, QString("Hallo")); // works in Qt 6.8.0 if values for width and height are at least 1 painter.drawText(50, 50, 1, 1, Qt::TextDontClip | Qt::TextSingleLine, QString("Hallo")); } }; int main(int argc, char *argv[]) { QApplication a(argc, argv); Widget w; w.show(); return a.exec(); }