+ Reply to Thread
Results 1 to 1 of 1

Thread: DrawText with stylesheet

  1. #1
    Join Date
    Dec 2007
    Qt products
    Qt4 Qt5 Qt/Embedded
    Unix/X11 Windows Android

    Default Re: DrawText with stylesheet


    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..

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

+ Reply to Thread

Similar Threads

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

Tags for this Thread


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts