Details
-
Bug
-
Resolution: Done
-
P2: Important
-
4.8.5
-
Windows 7
Description
Text is scaled to tiny with example below (scale 0.02) in Qt 4.8 Even worldmatrix and viewtransform are disabled. Correct behavior is that should not scale. Case occurs when Font pixels size is over 63. Works fine in Qt 4.7 and Qt5.
#include <QApplication> #include <QGraphicsView> class View : public QGraphicsView { public: View() : QGraphicsView() { QGraphicsScene *scene = new QGraphicsScene(this); setScene(scene); scale(0.02,0.02); scene->setSceneRect(0,0, 10000, 8000); } void drawBackground(QPainter * p, const QRectF&) { p->setWorldMatrixEnabled(false); p->setViewTransformEnabled(false); QFont f("Arial"); f.setPixelSize(64); p->setFont(f); p->drawText(QPoint(10,100),"Hello"); p->setWorldMatrixEnabled(true); p->setViewTransformEnabled(true); } }; int main(int argc, char** argv) { QApplication app(argc,argv); View *v = new View(); v->show(); app.exec(); return 0; }
Copying some lines from Qt 4.7 PaintEngine fixes the issue. Patch attached. Can't guarantee if patch cause some side-effects in Qt 4.8.