PDA

View Full Version : problem with the back ground image



Seema Rao
17th April 2006, 17:02
I have problem adding background image to window. Here is the code I have used to draw back ground image for my sample,
MainWindow::MainWindow()
{


first= new QWidget;
second= new QWidget;
third= new QWidget;

QHBoxLayout *mainLayout= new QHBoxLayout;
mainLayout->addWidget(first);
mainLayout->addWidget(second);
mainLayout->addWidget(third);

//code to add background image
QPalette palette;
QPixmap pixmap = QPixmap("images/first2.bmp");
palette.setBrush((this)->backgroundRole(), QBrush(pixmap));
(this)->setPalette(palette);

setMinimumSize(400, 200);
resize(480, 320);
}

Background image comes up but it covers the whole window by tailing one and half times. How to set back ground image so that one instance of image covers the whole window?

Thanks in advance,
Seema Rao

Chicken Blood Machine
17th April 2006, 21:34
Resize the window to the size of the image.