Hi, i'm trying to set a background image on a combined QWidget using stylesheets.
For combined QWidget i mean a qwidget A in which there is a layout containing some widgets, for example:
I have the class A that extends QWidget, in te constructor i have the following code to create a combined widget:
labelGroup->adjustSize();
labelIco->adjustSize();
labelIcoReceived->adjustSize();
labelTxt->adjustSize();
labelTime->adjustSize();
hLayout->addWidget(labelIcoReceived);
hLayout->addWidget(labelGroup);
hLayout->addWidget(labelIco);
hLayout->addWidget(labelService);
hLayout->addWidget(labelTime);
vLayout->addLayout(hLayout);
vLayout->addWidget(labelTxt);
setLayout(vLayout);
adjustSize();
hLayout = new QHBoxLayout;
vLayout = new QVBoxLayout;
labelGroup->adjustSize();
labelIco->adjustSize();
labelIcoReceived->adjustSize();
labelTxt->adjustSize();
labelTime->adjustSize();
hLayout->addWidget(labelIcoReceived);
hLayout->addWidget(labelGroup);
hLayout->addWidget(labelIco);
hLayout->addWidget(labelService);
hLayout->addWidget(labelTime);
vLayout->addLayout(hLayout);
vLayout->addWidget(labelTxt);
setLayout(vLayout);
setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Minimum);
adjustSize();
To copy to clipboard, switch view to plain text mode
If i try to append
setStyleSheet("background-color: yellow");
The result is the following:
widgets.JPG
And obviously i don't want this, i wan't to spread the color all over the widget.
I would like to use stylesheets because i wan't to add a scalable border image to the background like the one explained here and showed here:
How can i do this?
Thanks!
Bookmarks