Results 1 to 2 of 2

Thread: Customizig QTableWidget

  1. #1
    Join Date
    Feb 2016
    Posts
    1
    Qt products
    Qt5 Qt/Embedded
    Platforms
    MacOS X Windows Android

    Default Customizig QTableWidget

    Hello Everyone,
    I am trying customize the QTableWidget. I need to do the following :

    1. Change headings or the QHeaderview with background color, font size.
    2. and for the column, the Column size, font size , back ground color

    I try to subclass the headerview, but not much of luck. If someone can guide me on this, or point me to a sample, that would be of great help. Also tried CSS , it worked in some cases , but not much luck so far

  2. #2
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,230
    Thanks
    302
    Thanked 864 Times in 851 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: Customizig QTableWidget

    If you are using QTableWidget and not QTableView, then you retrieve the QTableWidgetItem for your widget's header using QTableWidget::horizontalHeaderItem(). You can customize the item to your heart's content.

    QTableWidget is derived from QTableView. In that base class you can find the methods to customize the column width.

    If you want the entire table to have the same font, you can set that using QWidget::setFont(). If you want individual cells to have their own font and background colors, then you do that as you add the individual QTableWidgetItem instances to the table.

Similar Threads

  1. Replies: 3
    Last Post: 10th August 2015, 23:26
  2. Replies: 1
    Last Post: 6th January 2011, 04:19
  3. QTableWidget
    By martial_arts_drummer in forum Newbie
    Replies: 4
    Last Post: 28th December 2010, 16:18
  4. QTableWidget
    By pippo42 in forum Qt Programming
    Replies: 1
    Last Post: 12th November 2009, 13:42
  5. Customizig widgets ... ¿skins?
    By hipogrito in forum Newbie
    Replies: 6
    Last Post: 19th April 2007, 00:30

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.