Did you correct that paint() call?
You have:
QTableItem::paint (p, cg, cr, selected);
QTableItem::paint (p, cg, cr, selected);
To copy to clipboard, switch view to plain text mode
and it should be:
QTableItem::paint (p, g, cr, selected);
QTableItem::paint (p, g, cr, selected);
To copy to clipboard, switch view to plain text mode
This works for me:
#include <qapplication.h>
#include <qtable.h>
class MyTableItem : public QTableItem {
public:
MyTableItem(QTable *table) : QTableItem(table, QTableItem::OnTyping){}
void paint
(QPainter *p,
const QColorGroup
&cg,
const QRect &cr,
bool selected
){ QColorGroup g(cg);
g.setColor(QColorGroup::Base, Qt::red);
QTableItem::paint(p, g, cr, selected);
}
};
int main(int argc, char **argv){
QTable tab(1,1);
tab.setItem(0,0, new MyTableItem(&tab));
app.setMainWidget(&tab);
tab.show();
return app.exec();
}
#include <qapplication.h>
#include <qtable.h>
class MyTableItem : public QTableItem {
public:
MyTableItem(QTable *table) : QTableItem(table, QTableItem::OnTyping){}
void paint(QPainter *p, const QColorGroup &cg, const QRect &cr, bool selected){
QColorGroup g(cg);
g.setColor(QColorGroup::Base, Qt::red);
QTableItem::paint(p, g, cr, selected);
}
};
int main(int argc, char **argv){
QApplication app(argc, argv);
QTable tab(1,1);
tab.setItem(0,0, new MyTableItem(&tab));
app.setMainWidget(&tab);
tab.show();
return app.exec();
}
To copy to clipboard, switch view to plain text mode
Bookmarks