superteny
25th May 2009, 12:50
hi,
I have a problem when i try to load a background image in a QMainWindow.
i override the paintevent method with the next code:
void MainWindow::paintEvent(QPaintEvent *pe)
{
QPainter* pPainter = new QPainter(this);
pPainter->drawPixmap(rect(), QPixmap(":/images/metal.png"));
delete pPainter;
QWidget::paintEvent(pe);
}
I think the code is ok, but i am not sure!!! It doesnt load any bg image.
the image size has to match with mainwindow size?
any ideas??
thank you.
I have a problem when i try to load a background image in a QMainWindow.
i override the paintevent method with the next code:
void MainWindow::paintEvent(QPaintEvent *pe)
{
QPainter* pPainter = new QPainter(this);
pPainter->drawPixmap(rect(), QPixmap(":/images/metal.png"));
delete pPainter;
QWidget::paintEvent(pe);
}
I think the code is ok, but i am not sure!!! It doesnt load any bg image.
the image size has to match with mainwindow size?
any ideas??
thank you.