Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

custom progress threading



  • 1d22c455-0d2b-47b4-90c8-a06e18ec3519-image.png

    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?


  • Lifetime Qt Champion

    @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.



  • What did you do?
    Do I have to define the paintEvent(QPaintEvent*e) function and put redraw code in it?



  • c1ec7c61-1dbf-4803-a5ad-72dfcb6a4d10-image.png

    68b3b542-0434-42b3-a59c-c37942dd01bd-image.png

    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?


  • Lifetime Qt Champion

    @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


Log in to reply