It is necessary to use some image as the background of the widget (it is listed in the program's resources). How to solve this problem? Tried to do the following:
class WidgetLoading: public QWidget { private: QBrush *brush; QPalette *palette; public: WidgetLoading(); ~WidgetLoading(); }; WidgetLoading::WidgetLoading(): QWidget() { brush = new QBrush; palette = new QPalette; brush->setTextureImage(QImage(":/background.jpg")); palette->setBrush(QPalette::Window, *brush); this->setPalette(*palette); } WidgetLoading::~WidgetLoading() { delete brush; delete palette; }
But nothing appears. Just a window with a white background. Tell me, please, how can this be done?