I'm not sure if this is the best place for this thread, but it's the best I could come up with. I'm using a QT Style Sheet to style a radio button like this:

QRadioButton{
	background:#5F7536;
	color:#CBF57D;
	font:bold;
}

It works fine except that in addition to changing the color of the text to #CBF57D, it also changes the color of the indicator to #CBF57D. I don't want this. I want the indicator to stay black as if I hadn't styled the indicator at all. Does anyone know how to do this? I tried this, but it didn't work:

QRadioButton::indicator{
	color:black;
}

Neither did:

QRadioButton::indicator{
background:black;
}

Anyone have any ideas?

I have never played directly with Qt stylesheets... but it appears that you need to provide an image for the indicator with the color you want. Here's what I found about it:
http://lists.trolltech.com/qt-interest/2006-11/thread00074-0.html
The OP wants to manage different colors for different states, but the underlying problem is the same. There's also a nice link in there to the Qt examples.

While annoying, it shouldn't be too much to create little images that will do the job. Qt makes it particularly easy to include image resources in your project.

The only other way is to completely paint the radiobutton yourself.

Sorry there isn't a simpler answer.

Yea, I'd come across the same stuff Duoas. I was just hoping there might be a way to do it without having to make my own radio button images. But I guess not. Thanks anyway!

Cheers.

Hii friends,

In my QT code am using style sheet for radio button as below

"QRadioButton::indicator:checked {image: url(" + strCheckedRadioButtonImagePath + ");}"\

It works fine and image is loaded but the problem is when i select the radio button a rectangle shaped dotted lines are appearing around radio button.Its the same case even for checkbox

"QCheckBox::indicator:checked {image: url(" + strCheckImagePath + ");width: 13px; height: 13px; border:0px solid #606460; }"\

Can any one help me?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.