Results 1 to 2 of 2

Thread: How to change font size in QLabel(QLabel created from Qdesigner)

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jun 2006
    Location
    San Diego, USA
    Posts
    95
    Thanks
    9
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default How to change font size in QLabel(QLabel created from Qdesigner)

    Hi All,

    How to change font size for a QLabel? Qlabel was created fron QDesigner.
    Before querying to you all I tried changing code as explained in previous posts.
    http://www.qtcentre.org/forum/f-qt-p...size-5508.html
    http://www.qtcentre.org/forum/f-qt-p...view-8597.html

    snippet of code:
    Method 1:
    Qt Code:
    1. label1->setText("Qt Label1");
    2. //set font
    3. QFont font = label1->font();
    4. font.setPointSize(72);
    5. font.setBold(true);
    6. label1->setFont(font);
    To copy to clipboard, switch view to plain text mode 
    Method 2:
    Qt Code:
    1. QString ritchText("<html><head><meta name=\"qrichtext\" content=\"1\" /></head>"
    2. "<body style=\" white-space: pre-wrap; font-family:Sans Serif; "
    3. "font-size:9pt; font-weight:400; font-style:normal; text-decoration:none;\">"
    4. "<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; "
    5. "margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:70pt;\">
    6. Qt Label1 </p>" "</body></html>");
    7. label1->setText(ritchText);
    To copy to clipboard, switch view to plain text mode 
    Even after the changes applied from above posts, it not increasing the font size for a QLabel.

    The only difference I can see is my QLabel was created from QDesigner and in the posts it was created manually. Is this(creating qlabel from designer) causing me difficulty in changing the font size for a qlabel? Please help.

    Thanks & Regards,
    Arun.
    Last edited by jpn; 1st August 2008 at 22:51. Reason: missing [code] tags

Similar Threads

  1. Font size calculation when painting in a QImage
    By Ishark in forum Qt Programming
    Replies: 3
    Last Post: 15th July 2007, 22:22
  2. change font size and button size of QMessageBox
    By nass in forum Qt Programming
    Replies: 6
    Last Post: 13th September 2006, 19:16

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.