Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 5

Qt-interest Archive, April 2007
Style Sheets and Classes in Namespaces


Message 1 in thread

Hi

How can I set a Style Sheet for my class in a namespace. Without the
namespace its working but with a namespace its maybe colliding with the sub
controls.

regards and thanks

Marco

Message 2 in thread

Marco Bubke wrote:
> Hi
> 
> How can I set a Style Sheet for my class in a namespace. Without the 
> namespace its working but with a namespace its maybe colliding with the 
> sub controls.
> 

In the constructor of you class, set the "class" dynamic property.

namespace goo {
     class MyPushButton : public QPushButton {
     public:
         MyPushButton() { setProperty("class", "goo-MyPushButton"); }
     };
}

You can now style it as, .goo-MyPushButton { } (4.2 and 4.3) or 
goo-MyPushButton { } (only in 4.3)

Girish

--
 [ signature omitted ]