Hello

I added a tableWidget, and want to have 1st column with name and 2nd column with status icon.
But I don't want the user to highlight the cell. (no interaction at all.)
I tried to use Qt::ItemIsEnabled, but it made my icon gray.
Is there any better approach I can try?
Thanks a lot.


Qt Code:
  1. int rowCount = ui->tableWidget->rowCount();
  2. ui->tableWidget->insertRow(rowCount);
  3.  
  4. QTableWidgetItem* item = new QTableWidgetItem(user_name);
  5. ui->tableWidget->setItem(rowCount, 0, item);
  6.  
  7. // Connection status.
  8. item = new QTableWidgetItem;
  9. QIcon icon_connection(":/images/connected.png");
  10. item->setIcon(icon_connection);
  11. item->setFlags(item->flags() ^ Qt::ItemIsEnabled);
  12. ui->tableWidget->setItem(rowCount, 1, item);
  13. item->setToolTip(CONNECTION_STATUS);
To copy to clipboard, switch view to plain text mode