PDA

View Full Version : QSS and namespaces



wiz29
19th July 2013, 11:58
Hi.

I try to customize some widget that contains in a namespace. I use the QSS. But it doesn't work.



class SomeWidget
:public QWidget
{
public:
class TargetToCustomize;
.................................
};

class SomeWidget::TargetToCustomize
: public QWidget
{
................................
};





SomeWidget
{
background: green;
}

SomeWidget-TargetToCustomize
{
background: red;
};

it doesn't work for the TargetToCustomize widget.

Santosh Reddy
19th July 2013, 12:39
Make sure to add Q_OBJECT macros


class SomeWidget
:public QWidget
{
Q_OBJECT
public:
class TargetToCustomize;
};

class SomeWidget::TargetToCustomize
: public QWidget
{
Q_OBJECT
};


And the use this stylesheet


SomeWidget
{
background: green;
}

SomeWidget--TargetToCustomize
{
background: red;
};

Note the double hypens (--)