QGraphicsScene Zooming problem with text



  • I have a QGrpahicsScene in my test peoject . I have added some QgrpahicsItem in it . Also I drawn a watermark text in my QGraphicsscene in drawBackground method using QPainterPath . But the problem is Initially the text are shrinked in the scene when i start to zoomIn Deeply i can able to see the text clearly .

    I want the text to be in the standard width Initially (we should see it clearly ) and also when zoomIn the text width should fixed according to the zooming size . Please can any one help on it



  • Any help will be highly appreciated . Im currently out of options


  • Qt Champions 2016

    hi
    the 40000 sample uses
    http://doc.qt.io/qt-5/qtwidgets-graphicsview-chip-example.html

     const qreal lod = option->levelOfDetailFromTransform(painter->worldTransform());
    ...
        // Draw text
        if (lod >= 2) {
            QFont font("Times", 10);
            font.setStyleStrategy(QFont::ForceOutline);
            painter->setFont(font);
            painter->save();
            painter->scale(0.1, 0.1);
            painter->drawText(170, 220, QString("Manufacturer: Chip Manufacturer"));
            painter->restore();
        }
    

    to draw it really small
    So you should play around with painter->scale to make text bigger i think.
    Did u try just to alter the font size?


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.