It might be easiest to reimplement QWidget::paintEvent() and simply stretch/center the image by hand.
{
static QPixmap bg
(":/button/Resources/1.bmp");
// streched:
painter.drawPixmap(rect(), bg, bg.rect());
// or centered:
// painter.drawPixmap((width() - bg.width()) / 2, (height() - bg.height()) / 2, bg);
}
void MyWindow::paintEvent(QPaintEvent* event)
{
static QPixmap bg(":/button/Resources/1.bmp");
QPainter painter(this);
// streched:
painter.drawPixmap(rect(), bg, bg.rect());
// or centered:
// painter.drawPixmap((width() - bg.width()) / 2, (height() - bg.height()) / 2, bg);
}
To copy to clipboard, switch view to plain text mode
Bookmarks