Results 1 to 1 of 1

Thread: DrawText with stylesheet

  1. #1
    Join Date
    Dec 2007
    Location
    London
    Posts
    206
    Thanks
    40
    Qt products
    Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android

    Default Re: DrawText with stylesheet

    Hello,

    I need to draw some text on a QGraphicsPixmapItem with stylesheet. Drawing text is straight forward by using the paintevent. But I couldnt find a way to apply a stylesheet on the text to be written.

    I also considered using a QLabel inside a QGraphicsProxywidget and applying the stylesheet on QLabel; but i need to create hundreds of this type of items on GraphicsScene and since QGraphicsProxyWidget has performance problems, i dont want to use this approach.

    Does anybody have any idea how can i apply a stylesheet to a text on QGraphicsPixmapItem?

    Thanks in advance...


    Added after 1 2 minutes:


    I figured it out.
    QTextDocumen's setDefaultStyleSheet and drawContens did the job..

    Regards..
    Last edited by yagabey; 17th February 2017 at 03:22.

Similar Threads

  1. drawText over a QPixmap
    By kaml.mish in forum Qt Programming
    Replies: 2
    Last Post: 20th January 2015, 12:30
  2. DrawText ?
    By whitefurrows in forum Qt Programming
    Replies: 2
    Last Post: 14th February 2007, 22:08
  3. drawText
    By pwqiang in forum Qt Programming
    Replies: 1
    Last Post: 19th December 2006, 09:52
  4. QRectF and drawText
    By aronsson in forum Qt Programming
    Replies: 1
    Last Post: 4th July 2006, 17:05
  5. drawText (QT/E 2.3.10)
    By agaf in forum Qt for Embedded and Mobile
    Replies: 1
    Last Post: 4th February 2006, 12:48

Tags for this Thread

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.