Results 1 to 2 of 2

Thread: How to check the background color of a certain QTableWidget cell

  1. #1
    Join Date
    Mar 2009
    Posts
    1
    Qt products
    Qt4
    Platforms
    MacOS X

    Default How to check the background color of a certain QTableWidget cell

    Hi,

    I have a litte trouble reading the background color of a QTableWidget cell.

    everytime I use this:
    Qt Code:
    1. this->myqtablewidget->itemAt(10, 3)->background().color()
    To copy to clipboard, switch view to plain text mode 

    it just reads the data from cell 0,0, and not 10,3 or anything else.

    So whats the right way to check the background color of a cell? What do I wrong?

    I thought of something like:
    Qt Code:
    1. if(this->qtablewidget->itemAt( anyx(), anyy() )->background().color() == Qt::green)
    2. dusomething();
    To copy to clipboard, switch view to plain text mode 

  2. #2
    Join Date
    Mar 2008
    Posts
    141
    Thanks
    10
    Thanked 9 Times in 9 Posts

    Default Re: How to check the background color of a certain QTableWidget cell

    Hi,

    isn't it item(row, col) instead of itemAt()?

Similar Threads

  1. Background Image in QTableWidget
    By mclark in forum Qt Programming
    Replies: 11
    Last Post: 6th June 2012, 17:06
  2. QTableWidget Background Color
    By mbrusati in forum Qt Programming
    Replies: 2
    Last Post: 23rd September 2008, 18:38
  3. Replies: 0
    Last Post: 2nd May 2008, 07:57
  4. Word wrapping in a QTableWidget cell
    By jcooperddtd in forum Qt Programming
    Replies: 3
    Last Post: 1st May 2007, 03:57
  5. Replies: 3
    Last Post: 8th September 2006, 18:54

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.