Qss in widget
-
Hellow!
I have widget and widget set color, for example red, and when this widget include in other widget, for example window, there is no color, but if widget is separate window that all right
I use following qss code
@ RSeveralElements
{
border: 1 solid rgb(136, 136, 136);
border-radius: 6px;
min-height: 20px;
min-width: 40px;
background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,
stop: 0 #cccccc, stop: 1 #eeeeee);
}@
RSeveralElements heir of QWidget
Advance many thanks for your help! -
Have a look at "this thread.":http://developer.qt.nokia.com/forums/viewthread/7470/
I think your situation is similar.
In what widget to you include RSeveralElements?
-
I include it in main layout(QVBoxLayout) in QMainWindow
-
Many thanks for your help, it is work!
-
I'm glad for you.
Please add [Solved] in front of your title
-
I was a little hasty with the findings, it work, but it work wrong
This is full qss code after fixed
@ RSeveralElements, RSeveralElements *
{
border: 1 solid rgb(136, 136, 136);
border-radius: 6px;
min-height: 20px;
min-width: 40px;
background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,
stop: 0 #cccccc, stop: 1 #eeeeee);
}
RSeveralWidget, RSeveralWidget *{
background-color: transparent;
}
RSeveralWidget:hover, RSeveralWidget *:hover{
border: 1 solid #55aaff;
}@
RSeveralElements(parent: QWidget) is widget-panel, where situate QSeveralWidget(parent: QToolButton)
After that create border in RSeveralWidget, but if i remove this
@RSeveralWidget:hover, RSeveralWidget *:hover{
border: 1 solid #55aaff;
}@
There are no to create
But i need to create border in RSeveralElements -
if I understand you well, your initial problem is solved.
Additionally you want a border when hovering over RSeveralWidget. The qss works here. ( it works in my case, I get a blue border when I hover it.)
But for RSeveralElements you don't get a border when you hover over it? I don't see the hover part for that one in your example.You could add RSeveralElements:hover too.
-
I wish that would border RSeveralElements cover all elements onto RSeveralWidgets
http://hostingkartinok.com/show-image.php?id=29b3ce1c5f18b9ce6fd0329626aad3a8 -
I see, one picture tells more than 1000 words ;)
You can put RSeveralWidgets in a QFrame and let that one highlight.
-
Many thanks, it is work as could!
Tell me, please, why is this happening? -
I don't understand what you are saying.
-
Sorry for my bad english
I want to ask: Why is the variant with QWidget dont work, and why is it work with QFrame? -
Because you want 2 widgets highlight as one.
Normally 2widgets will highlight as 2 different rectangles.
If you want 1 highlighted rectangle you have to use 1widget. Putting the widgets in a QFrame does the trick.
I hope you understand it now.