Results 1 to 2 of 2

Thread: Font size increase in QtableWidget

  1. #1
    Join Date
    Jul 2009
    Posts
    36
    Thanks
    6
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Default Font size increase in QtableWidget

    Hi,

    I want to increase the font size of the QTableWidget.

    Qt Code:
    1. QFont fnt;
    2. fnt.setPointSize(30);
    3. fnt.setFamily("Arial");
    4. ui->tableWidget->setFont(fnt);
    To copy to clipboard, switch view to plain text mode 


    Can anyone suggest me Why it is not working?

    Is setPointSize(30) is correct for font size or any other options.
    Last edited by sosanjay; 19th November 2009 at 11:56.

  2. #2
    Join Date
    Nov 2007
    Posts
    31
    Thanks
    2
    Thanked 4 Times in 4 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Font size increase in QtableWidget

    If you specified item's font already, QTableWidget's font is ignored.

    You can change the font size as follows.

    Qt Code:
    1. QFont fnt;
    2. fnt.setPointSize(30);
    3. fnt.setFamily("Arial");
    4. const int rowCount = tableWidget->rowCount();
    5. const int columnCount = tableWidget->columnCount();
    6.  
    7. for(int i = 0; i < rowCount; ++i) {
    8. for(int j = 0; j < columnCount; ++j) {
    9. QTableWidgetItem* selectedItem = tableWidget->item(i, j);
    10. selectedItem->setFont(fnt);
    11. }
    12. }
    To copy to clipboard, switch view to plain text mode 

    I'm sorry in poor English.
    kichi

  3. The following user says thank you to kichi for this useful post:

    sosanjay (21st November 2009)

Similar Threads

  1. How to increase font size in arm target
    By soumya in forum Qt for Embedded and Mobile
    Replies: 1
    Last Post: 2nd September 2009, 05:58
  2. Replies: 1
    Last Post: 2nd August 2008, 15:46
  3. How to find best size for QTableWidget?
    By plamkata in forum Qt Programming
    Replies: 3
    Last Post: 24th July 2008, 19:07
  4. Font size of a spinbox
    By SailinShoes in forum Qt Programming
    Replies: 6
    Last Post: 5th May 2008, 14:29
  5. Font size calculation when painting in a QImage
    By Ishark in forum Qt Programming
    Replies: 3
    Last Post: 15th July 2007, 22:22

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.