Results 1 to 2 of 2

Thread: How is it easier to change font properties?

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jul 2008
    Posts
    14
    Thanks
    5
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default How is it easier to change font properties?

    Hi,
    I'm trying to find the easiest way to change font parameters for different text in widgets. Using html code would be fine, but it seems to not work everywhere for me... For example to write a string in italic in the ListWidget I do the following:

    Qt Code:
    1. QListWidgetItem *item = new QListWidgetItem("Text...");
    2. QFont *font = new QFont;
    3. font->setItalic(true);
    4. item->setFont(*font);
    5. listWidget->insertItem(0,item);
    To copy to clipboard, switch view to plain text mode 

    ...which is a quite long way. How to do it simpler?
    If I write "<i>Text...</i>" instead of "Text..." this doesn't work.

    Thanks!!
    Last edited by jpn; 11th July 2008 at 08:15. Reason: missing [code] tags

Similar Threads

  1. How to prevent table header from font change.
    By kenny_isles in forum Qt Tools
    Replies: 1
    Last Post: 14th February 2007, 19:01
  2. How do I change the font color in QTextBrowser?
    By probine in forum Qt Programming
    Replies: 2
    Last Post: 29th November 2006, 12:08
  3. change font size and button size of QMessageBox
    By nass in forum Qt Programming
    Replies: 6
    Last Post: 13th September 2006, 19:16
  4. Change Font Color of Label and CheckBox
    By mahe2310 in forum Qt for Embedded and Mobile
    Replies: 3
    Last Post: 15th June 2006, 10:24
  5. Change font in QPainter::drawText
    By Morea in forum Qt Programming
    Replies: 1
    Last Post: 19th May 2006, 16:21

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
  •  
Qt is a trademark of The Qt Company.