Results 1 to 20 of 52

Thread: QImage inserted into QGraphicsTextItem looks fuzzy, when scaling QGraphicsTextItem

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Nov 2010
    Posts
    26
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default QImage inserted into QGraphicsTextItem looks fuzzy, when scaling QGraphicsTextItem

    Hello,

    Look into the attachment: screenshot.png

    There is a problem with the "asdf" (QImage) in the QGraphicsTextItem: it is fuzzy. And that's because the QGraphicsTextItem is scaled with setScale(...).

    I scale the QGraphicTextItem, because I want zoom the text in/out later in the programm. And yet I zoom it because the text should have the correct size in millimeters.

    The text scaling works fine, but the "asdf" QImage will zoomed, too.

    How to insert a QImage with high resolution, and make it smaller with scaling that the QImage doesn't looks fuzzy?
    Or there other ways to solve this?

    (An idea is to get the HTML of the TextItem and multiplicate all font sizes with the zoom level. But is there a better way?)

    Thanks

    Stefan Koch
    Attached Images Attached Images

  2. #2
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: QImage inserted into QGraphicsTextItem looks fuzzy, when scaling QGraphicsTextIte

    How to insert a QImage with high resolution, and make it smaller with scaling that the QImage doesn't looks fuzzy?
    Just the same as you did, just make the QImage size larger, and scale it to the result size you need.

    But why don't you use QGraphicsTextItem?
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

  3. #3
    Join Date
    Nov 2010
    Posts
    26
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: QImage inserted into QGraphicsTextItem looks fuzzy, when scaling QGraphicsTextIte

    I don't understand your question:
    But why don't you use QGraphicsTextItem?
    I use QGraphicsTextItem.

    ... make the QImage size larger, and scale it to the result size you need.
    How make a QImage size larger? Or: How to scale a QImage?

    In my situation I set the scale of the QGraphicsTextItem a. e. to 1.5 (I make it greater, not smaller)

    Thanks

  4. #4
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: QImage inserted into QGraphicsTextItem looks fuzzy, when scaling QGraphicsTextIte

    I use QGraphicsTextItem.
    But you are using QImage for the 'asd' text as well - why?
    I guess I don't understand what it is you are trying to do...

    How make a QImage size larger?
    QImage ( const QSize & size, Format format )
    QImage ( int width, int height, Format format )
    QImage scaled(...)
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

  5. #5
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QImage inserted into QGraphicsTextItem looks fuzzy, when scaling QGraphicsTextIte

    Did you enable smooth image transformations for your view?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  6. #6
    Join Date
    Nov 2010
    Posts
    26
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: QImage inserted into QGraphicsTextItem looks fuzzy, when scaling QGraphicsTextIte

    @wysota
    Do you mean this: setRenderHint(QPainter::SmoothPixmapTransform)
    it was enabled in QGraphicsView in post #7 (see screenshot for details)

  7. #7
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QImage inserted into QGraphicsTextItem looks fuzzy, when scaling QGraphicsTextIte

    In general your image is of a very poor quality. The Nyquist law is merciless here.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. QGraphicsTextItem - setHTML()
    By Claymore in forum Qt Programming
    Replies: 7
    Last Post: 17th September 2009, 10:34
  2. QGraphicsRectItem and QGraphicsTextItem.
    By cydside in forum Qt Programming
    Replies: 13
    Last Post: 20th July 2009, 13:11
  3. QGraphicsTextItem in a Widget ,Is it Possible ??
    By salmanmanekia in forum Qt Programming
    Replies: 10
    Last Post: 28th July 2008, 14:45
  4. QValidator for QGraphicsTextItem
    By arjunasd in forum Qt Programming
    Replies: 4
    Last Post: 8th August 2007, 16:34
  5. QGraphicsTextItem - is it a bug there?
    By Tair in forum Qt Programming
    Replies: 5
    Last Post: 18th October 2006, 09:48

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.