Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QGraphicsScene Zooming problem with text
Forum Updated to NodeBB v4.3 + New Features

QGraphicsScene Zooming problem with text

Scheduled Pinned Locked Moved Unsolved General and Desktop
3 Posts 2 Posters 1.1k Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • keksi venksiK Offline
    keksi venksiK Offline
    keksi venksi
    wrote on last edited by
    #1

    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

    1 Reply Last reply
    0
    • keksi venksiK Offline
      keksi venksiK Offline
      keksi venksi
      wrote on last edited by
      #2

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

      1 Reply Last reply
      0
      • mrjjM Offline
        mrjjM Offline
        mrjj
        Lifetime Qt Champion
        wrote on last edited by mrjj
        #3

        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?

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved