Results 1 to 1 of 1

Thread: Qt 4.4 PaintContext palette

  1. #1
    Join Date
    Jan 2007
    Location
    Paris
    Posts
    459
    Thanks
    98
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4 Qt5

    Default Qt 4.4 PaintContext palette

    Qt Code:
    1. void ZeTextComponent::DrawParagraph(QPainter * painter, const QRect & rect) const
    2. {
    3. painter->save();
    4.  
    5. QTextDocument document;
    6. document.setDefaultFont(mFont);
    7. document.setHtml(getText());
    8. document.setPageSize(QSize(rect.width(), rect.height()));
    9.  
    10. QAbstractTextDocumentLayout::PaintContext context;
    11. context.clip = QRect(0, 0, rect.width(), rect.height());
    12. painter->translate(rect.x(), rect.y());
    13. document.documentLayout()->draw(painter, context);
    14.  
    15. painter->restore();
    16. }
    To copy to clipboard, switch view to plain text mode 

    This is a function drawing a text document. In Qt documentation it says that :

    QPalette PaintContext::palette
    This variable holds the default color that is used for the text, when no color is specified in the text.
    The default value of this variable uses the application's default palette.
    I'm not sure how I'm supposed to set the text document's font text ?
    Last edited by jpn; 14th May 2008 at 13:54. Reason: disabled smilies

Similar Threads

  1. Palette Frame
    By csvivek in forum Qt Programming
    Replies: 2
    Last Post: 14th April 2008, 05:34
  2. Getting default "system" palette[solved]
    By maverick_pol in forum Qt Programming
    Replies: 0
    Last Post: 2nd April 2008, 17:34
  3. Changing application palette [solved]
    By maverick_pol in forum Qt Programming
    Replies: 1
    Last Post: 2nd April 2008, 16:02
  4. palette setColor QPushButton
    By TheKedge in forum Qt Programming
    Replies: 3
    Last Post: 3rd November 2006, 10:14
  5. Palette definition
    By Roberto Sciascia in forum Qt Tools
    Replies: 3
    Last Post: 21st March 2006, 15:29

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.