Ok, the proper answer can be found here, or alternatively by reading the documentation. I need to implement paintEvent for my test class:
class test : public QWidget
{
Q_OBJECT // remove this
public:
QLabel *label;
test(QWidget *parent = 0) {
resize(400, 300);
label = new QLabel(this);
label->setText("Test");
};
void paintEvent(QPaintEvent *)
{
QStyleOption opt;
opt.init(this);
QPainter p(this);
style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this);
}
};
Also many thanks to 1+1=2 who read the manual for me at the Qt project forum.