Results 1 to 4 of 4

Thread: Display antialiased rotated text or widget via QGraphicsScene

  1. #1
    Join Date
    Apr 2011
    Posts
    3
    Platforms
    Unix/X11 Windows

    Post Display antialiased rotated text or widget via QGraphicsScene

    Hello!

    I have created a window that I make rotate by 0° to 45° via a QGraphicsScene.
    The problem is that I've got a big "stair stepping" effect on the text.
    I used QGraphicsView::setRenderHints(QPainter::SmoothPixm apTransform | QPainter::TextAntialiasing | QPainter::Antialiasing), but I'm not sure it really changes something, or the result is really bad.
    Is it possible to have a good antialiasing in a QGraphicsScene?

    Or, is it possible to rotate a widget and have it interact correctly with the mouse, and the keyboard?

  2. #2
    Join Date
    Nov 2010
    Posts
    315
    Thanked 53 Times in 51 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: Display antialiased rotated text or widget via QGraphicsScene

    I must say that something is broken in text rendering in Qt, when transformations are used. "stair stepping" is the less annoying problem.
    I think I've seen bug report about this.

  3. #3
    Join Date
    Apr 2011
    Posts
    3
    Platforms
    Unix/X11 Windows

    Default Re: Display antialiased rotated text or widget via QGraphicsScene

    Okay, thanks for your answer.
    Any idea about what I could do?

    I don't know if I can get both feel and look work for now, but at least I want to have a good looking interface.
    On various posts, I've seen that you reimplement QPainter, but is it possible to store the original QPixmap rendered (without show it), modify it and then draw it to the screen?
    Because I don't see the way to catch the pixmap

  4. #4
    Join Date
    Apr 2011
    Posts
    3
    Platforms
    Unix/X11 Windows

    Default Re: Display antialiased rotated text or widget via QGraphicsScene

    I managed to enable the antialiasing without having the interaction (for people who have problems to do it : create the widget you want to turn, and a second widget. Instanciate the first widget, but do not show it. Then, when the second must be displayed, it asks the first to render (Qwidget::render(...)), it rotates the obtained pixmap and displays it.

    I've got a big idea!
    Do you think this could work ? :

    1) Make a QGraphicsScene and a view for my widget
    2) make the view or the proxy rotate to guarantee the interaction is correct
    3) call 'render' on the widget to have the not-rotated pixmap
    4) reimplement the view paintEvent to display the rotated antialiased pixmap

    in fact, the graphicsScence would be the model, while we display it with a better looking. But I must have the model and the display exactly at the same position

Similar Threads

  1. QGraphicsView, OpenGL & rotated text
    By anthon in forum Qt Programming
    Replies: 8
    Last Post: 5th December 2009, 17:05
  2. QPixmap display on QGraphicsScene
    By febil in forum Qt Programming
    Replies: 2
    Last Post: 26th February 2009, 09:27
  3. How draw a rotated text in a QPainterPath?
    By iw2nhl in forum Qt Programming
    Replies: 6
    Last Post: 17th August 2007, 18:55
  4. Drawing antialiased text on Windows very slow
    By Rawk in forum Qt Programming
    Replies: 13
    Last Post: 14th May 2007, 14:13
  5. Widget to display images and text ?
    By probine in forum Qt Tools
    Replies: 4
    Last Post: 9th October 2006, 20:49

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.