custom progress threading
-
Python changes the progress to setstylesheet, so how do I do it in c++? I changed the values one by one through the thread, but I can't tell if the screen is not updated.
Has anyone experienced anything similar to me? It's the style attribute of the qframe.
QFrame
{
background-color: qconicalgradient(cx:0.5, cy:0.5, angle:90, stop:0.749 rgba(54, 74, 118, 0), stop:0.750 rgba(4, 174, 151, 255));
border-radius:150px;
}In Python, you only need to change the value of the stop. How can you do it in a c++ environment?
-
Python changes the progress to setstylesheet, so how do I do it in c++? I changed the values one by one through the thread, but I can't tell if the screen is not updated.
Has anyone experienced anything similar to me? It's the style attribute of the qframe.
QFrame
{
background-color: qconicalgradient(cx:0.5, cy:0.5, angle:90, stop:0.749 rgba(54, 74, 118, 0), stop:0.750 rgba(4, 174, 151, 255));
border-radius:150px;
}In Python, you only need to change the value of the stop. How can you do it in a c++ environment?
@IknowQT said in custom progress threading:
How can you do it in a c++ environment?
In the same way you do it in Python. Style-sheets have nothing to do with Python or C++. You should show your current C++ code.
"I changed the values one by one through the thread" - do you mean from another thread? If so, then this is NOT supported! Only GUI thread is allowed to change the UI. -
Thanks for the answers. I drew it on the back using the drawPie function.
But after drawing it in the back, I think I'm a little short of a pixel.
And since I drew it on the back of the shadow, it looks a little dark even if it's the same color.
The bright one on the top is applied as a style sheet. The dark one is drawn as a paint function. Is there a way to make it look as neat as the style sheet? -
What did you do?
Do I have to define the paintEvent(QPaintEvent*e) function and put redraw code in it?@IknowQT said in custom progress threading:
What did you do?
Do I have to define the paintEvent(QPaintEvent*e) function and put redraw code in it?Why paint event? You were talking about setting style-sheet? So, do the same you did in Python in C++.
"I think I'm a little short of a pixel" - not sure what you mean, if you want anti-aliasing then set QPainter::Antialiasing via https://doc.qt.io/qt-5/qpainter.html#setRenderHint -
Thank you. It's all worked out!
Let me ask you one more question. There's a translucent background in QFrame.
QFrame
{
border-radius:150px;
background-color: rgb(54, 74, 128, 120);
}If I do drawpie, I want to put it on a translucent layout. Now I'm drawing in the back, so it's darker than th