Background image not appears on QMdiArea

173 views Asked by At

Qt developers, I need some help. I want to add image on QMdiArea's background, I wrote something. It works but not correctly, because image on the background not appearing. Thanks!

int main(int argc, char *argv[])
{

    QVBoxLayout* VLayout;
    QHBoxLayout* HLayout;

    QPushButton* Button1;
    QPushButton* Button2;

    QMdiSubWindow* SubWindow1;
    QMdiSubWindow* SubWindow2;

    QMdiArea* Area;

    QApplication a(argc, argv);
    QWidget* w=new QWidget;

    QImage img("Logo.jpg");

    HLayout = new QHBoxLayout;
        VLayout = new QVBoxLayout;

    Button1 = new QPushButton("Add");
        Button2 = new QPushButton("Delete");

    Area = new QMdiArea();
        SubWindow1 = new QMdiSubWindow();
        SubWindow2 = new QMdiSubWindow();

    Area->addSubWindow(SubWindow1);
        Area->addSubWindow(SubWindow2);

    HLayout->addWidget(Button1);
        HLayout->addWidget(Button2);
        VLayout->addLayout(HLayout);
        VLayout->addWidget(Area);

    Area->setBackground(img);

    w->show();
    w->setLayout(VLayout);
    return a.exec();
}
0

There are 0 answers