Results 1 to 5 of 5

Thread: changing the background for a tablewidget

  1. #1
    Join Date
    Feb 2010
    Posts
    61
    Thanks
    3
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default changing the background for a tablewidget

    hi,

    can anyone guide me , in changing the background color for a required entire row in a table widget?


    Thanks in advance

    @qtlinuxnewbie

  2. #2
    Join Date
    Aug 2008
    Posts
    134
    Thanks
    10
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: changing the background for a tablewidget

    Each Item is an instance of QTableWidgetItem. Hence you can apply the color for instance of QTableWidgetItem using void setBackground ( const QBrush & brush ). and set this item to appropriate column.

  3. #3
    Join Date
    Sep 2008
    Location
    Bangalore
    Posts
    659
    Thanks
    116
    Thanked 42 Times in 41 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: changing the background for a tablewidget

    "Behind every great fortune lies a crime" - Balzac

  4. #4
    Join Date
    Feb 2010
    Posts
    61
    Thanks
    3
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: changing the background for a tablewidget

    @QTableWidgetItem *ValueItem;
    ValueItem->setBackgroundColor(QColor(Qt::red));


    hope this helps for any one.


    @qtlinuxnewbie.

  5. #5
    Join Date
    Feb 2010
    Posts
    96
    Thanks
    4
    Thanked 5 Times in 5 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: changing the background for a tablewidget


Similar Threads

  1. Replies: 2
    Last Post: 29th September 2009, 07:40
  2. Changing the background of QTabWidget
    By ike in forum Qt Tools
    Replies: 2
    Last Post: 7th November 2008, 13:43
  3. prob with changing QLineEdit background color
    By Ahmad in forum Qt Programming
    Replies: 2
    Last Post: 30th April 2007, 12:44
  4. Dynamically changing QLabel background colour
    By T4ng10r in forum Qt Programming
    Replies: 19
    Last Post: 19th April 2007, 12:47
  5. Replies: 10
    Last Post: 17th August 2006, 15:12

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.