I just applied setStyleSheet to one label in mainwindow... it effected all other labels in other files also...which i don want
-
can any one help me
-
Perhaps you have mistakenly applied it to the MainWindow itself? It woould then propagate the style to all it's children.
-
no actually i created a QLabel(named Activethumb) and i applied setStylesheet in code .i am creating new QLables when ever i want by "=new Activethumb" like that...but the style was effecting to others also
-
i am creatind new Activethumbs from mainwindow
-
I'm not sure I fully understand you, but it looks like you are doing it correctly.
-
then y it is effecting other ui's also...is there any option?
-
There are many ways to apply a stylesheet. You can apply it to QApplication (it will be used by all widgets), or to QWidget (it will be used by that widget, and all it's children). You can also specify class selectors inside the stylesheet, so that the style is applied only to a certain class name, or even certain object name. I don't know exactly how you are doing this, so it's difficult to tell you anything more helpful.
-
i am using the second one u mentioned.....it is effecting to children... can u pls tell me third one in detail
-
Please take a look at "the documentation":http://qt-project.org/doc/qt-5/stylesheet-syntax.html.
Also, "this":http://qt-project.org/doc/qt-5/stylesheet-reference.html, and "this":http://qt-project.org/doc/qt-5/stylesheet-customizing.html.
-
Have you tried using the object name, one of the options suggested by sierdzio?
That would restrict the style to that particular label, I believe.
@QLabel#Activethumb@
Have a look here http://qt-project.org/doc/qt-5/stylesheet-syntax.html
The part 'Selector Types' is what you are after.
As he says, it is hard to help without seeing your code.
-
I wrote this code in Activethumb.cpp(which is a QLabel)
@
this->setStyleSheet("border: 4px solid rgb(189,189,189)");
@And this lable activethumb is created with resp to the number of items(images)to display
@
productThumbs[index] =
new ActiveThumb(this->ui>scrollAreaWidgetContents_Puzzle,
QRect(x, y, thumbWidth, thumbHeight),
finalPuzzle.at(index).toObject(),"P");
@
this code i wrote in mainwindow.cpp[code tags added by sierdzio]