buffer
17th November 2010, 22:03
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:
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();
If i try to append
setStyleSheet("background-color: yellow");
The result is the following:
5477
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 (http://doc.trolltech.com/qq/qq20-qss.html) and showed here:
http://doc.trolltech.com/qq/qq20-borderimage.png
How can i do this?
Thanks!
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:
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();
If i try to append
setStyleSheet("background-color: yellow");
The result is the following:
5477
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 (http://doc.trolltech.com/qq/qq20-qss.html) and showed here:
http://doc.trolltech.com/qq/qq20-borderimage.png
How can i do this?
Thanks!