Thank you!
I've tried to do it but it doesn't work. Row color doesn't change What's wrong?!?
This is the declaration
class EnableTableItem : public QCheckTableItem {
public:
EnableTableItem
(QTable
* table,
const QString & txt
);
~EnableTableItem();
protected:
virtual void paint
(QPainter *p,
const QColorGroup
&cg,
const QRect &cr,
bool selected
);
};
class EnableTableItem : public QCheckTableItem {
public:
EnableTableItem(QTable * table, const QString & txt);
~EnableTableItem();
protected:
virtual void paint (QPainter *p, const QColorGroup &cg,
const QRect &cr, bool selected);
};
To copy to clipboard, switch view to plain text mode
And this is my paint reimplementation
void EnableTableItem
::paint( QPainter * p,
const QColorGroup
& cg,
const QRect & cr,
bool selected
) {
QColorGroup color(cg);
if (isChecked())
color.setColor(QColorGroup::Background, Qt::green);
else
color.setColor(QColorGroup::Background, Qt::red);
QCheckTableItem::paint(p, color, cr, selected);
}
void EnableTableItem::paint( QPainter * p, const QColorGroup & cg,
const QRect & cr, bool selected )
{
QColorGroup color(cg);
if (isChecked())
color.setColor(QColorGroup::Background, Qt::green);
else
color.setColor(QColorGroup::Background, Qt::red);
QCheckTableItem::paint(p, color, cr, selected);
}
To copy to clipboard, switch view to plain text mode
Bookmarks