Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. [Solved]Color a QTableWidget cell

[Solved]Color a QTableWidget cell

Scheduled Pinned Locked Moved General and Desktop
2 Posts 1 Posters 10.9k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    Sorin
    wrote on 11 Oct 2010, 13:44 last edited by
    #1

    I'm trying to color a cell from a QTableWidget but it seams that I'm doing something wrong because is not working( fails silently ), what is my mistake?

    @QTableWidget* tableWidget = new QTableWidget( parent );
    tableWidget->setRowCount( 8 );
    tableWidget->setColumnCount( 10 );

    QColor color( Qt::red );
    tableWidget->item( 0, 0 )->setBackgroundColor( color );@

    There are only 10 types of people in the world: Those who understand binary, and those who don't

    1 Reply Last reply
    0
    • S Offline
      S Offline
      Sorin
      wrote on 11 Oct 2010, 13:55 last edited by
      #2

      Found the problem, it was needed to cal tableWidget->setItem( 0,0, tableItem ) to add an item to tableWidget

      There are only 10 types of people in the world: Those who understand binary, and those who don't

      1 Reply Last reply
      0

      1/2

      11 Oct 2010, 13:44

      • Login

      • Login or register to search.
      1 out of 2
      • First post
        1/2
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved