Hi,
I want to put a background image in mt QWidget, can anyone help me on this.
how to Ovveride, the paintevent of the Qwidget and draw a image there
Hi,
I want to put a background image in mt QWidget, can anyone help me on this.
how to Ovveride, the paintevent of the Qwidget and draw a image there
Hi. Here is what you need:
#include <QApplication>
#include <QGridLayout>
#include <QWidget>
int main(int argc, char ** argv)
{
QApplication app( argc, argv );
QWidget widget(0);
widget.setStyleSheet("background-image: url(1.PNG)");
QGridLayout *leftLayout = new QGridLayout();
leftLayout->setSpacing (0);
widget.setLayout(leftLayout);
widget.show();
return app.exec();
}
Where 1.PNG is the image located in the same directory with the app.