Home > Software design >  How fix this : error: no member named 'setBackgroundColor' in 'QTableWidgetItem'
How fix this : error: no member named 'setBackgroundColor' in 'QTableWidgetItem'

Time:12-19

ui -> tablica -> item(i, j) -> text().toInt(&f1);
               if(f1)
               {
                   ui -> tablica -> item(i, j) -> setBackgroundColor(Qt::white);
               }

Error with method setBackgroundColor.

CodePudding user response:

Use: void QTableWidgetItem::setBackground(const QBrush &brush)

See here why:

https://doc.qt.io/qt-5/qtablewidgetitem-obsolete.html#setBackgroundColor

void QTableWidgetItem::setBackgroundColor(const QColor &color) This function is obsolete. It is provided to keep old source code working. We strongly advise against using it in new code. This function is deprecated. Use setBackground() instead. See also backgroundColor().

  •  Tags:  
  • c qt
  • Related