Reputation: 64266
I'm trying to rewrite method paintEvent
in my programm and change it.
void MainWindow::paintEvent(QPaintEvent *event)
{
QRegion reg = this->bgPixmapHandle->rect();
QPainter painter(this);
painter.setClipRegion(reg);
painter.drawImage(bgPixmapHandle->rect(), bgPixmapHandle);
painter.end();
}
Here I try to change my bg
image. But I got an error on line: QPainter painter(this);
Error: Variable 'QPainter painter' is initialized, though the type is incomplete
Upvotes: 0
Views: 2499
Reputation: 14341
Include QPainter header file. QPainter class is only forward declared in one of the Qt headers you're including in that translation unit.
Upvotes: 7
Reputation: 14185
Are you including ? Qt is a big fan of forward declaration of classes, which causes such cryptic errors.
Upvotes: 1