PDA

View Full Version : stylesheet not working correctly



melody:p
29th August 2012, 10:23
hello guys
I was make custom frame and I have to decorate them using stylesheet.
my custom frame has title bar and main widget.
and I hope paint to blue only title bar not main widget.
but is not working...........

first, my custom frame is organized like this :


Frame::Frame()
{
m_titleBar = new TitleBar(this);
m_content = new QWidget(this);

QVBoxLayout *vbox = new QVBoxLayout(this);
vbox->addWidget(m_titleBar);

QVBoxLayout *layout = new QVBoxLayout(this);
layout->addWidget(m_content);

vbox->addLayout(layout);
}

TitleBar::TitleBar(QWidget* parent)
: QWidget(parent)
{
QLabel *label = new QLabel(this);
label->setText("mylabel");

QHBoxLayout *hbox = new QHBoxLayout(this);

hbox->addWidget(label);
}



and I was try some method this :


titlebar->setobjectname("titlebar");
customframe->setstylesheet(tr("QWidget#titlebar{background : red;}"));


and this :


titlebar->setstylesheet(tr("QWidget{background : red;"}))


It's so hard... please help me ... :confused:

sonulohani
29th August 2012, 13:40
try this--->


label->setStyleSheet("QLabel{background : red;}");

melody:p
30th August 2012, 02:40
I was also try that..
but I don't want colored label.
I want paint whole title bar..
how?..:confused:

sonulohani
30th August 2012, 13:14
what it means :-


paint whole title bar

I didnt understand your ques.

melody:p
31st August 2012, 07:31
I'm going to explain you..

My custom frame is like this :

8164

and your answer is this.
8165

but I want to method to paint this..
8166

sonulohani
3rd September 2012, 06:38
See this example:--->
8175