Qt开发人员,我需要一些帮助。我想在QMdiArea的背景上添加图像,我写了一些东西。 它工作但不正确,因为背景上的图像没有出现。 谢谢!
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();
}