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

Qt Design Studio Arc



  • I'm attempting to design a widget which operates as an azimuth dial. This means that it essentially needs to start at zero and increase in both the positive, clockwise (0=>360), and possibly negative, counterclockwise (0=>-360), directions. Before embarking on making a truly custom widget, I looked to the tutorials. Using the arc provided in the Design Studio, is there any way to reverse directions such that it begins at 0 and, as the frames decrease, the stroke is drawn in the counterclockwise direction?

    Concisely, I am trying to expand the widgets provided in the Cluster Tutorial to encompass 360 degrees of rotation, with the arc meter extending from 0=>360 in frames 0 to 3600 and from 0=>-360 in frames 0 to -3600.

    Thanks for any help.



  • So although you can't create a timeline with frames in the negative value range, animating the Arc as you want to is not a problem. What i would do is create a timeline for 7200 frames and set the end and start points to 0 in the center, then animate the end point to 360 in the second half of the timeline and the start point to -360 in the first half of the timeline. How you choose to then control this timeline is possible in a variety of ways. You could create two animations from this timeline, one for each direction, where they start at the same frame with one playing backwards and one playing forwards. Or perhaps a better way is to expose the current frame of the timeline as an alias property and then create a backend value to covert the input value range you want (-360 to 360) to the frame values (0 - 7200). If you're using the Cluster tutorial as a starting point you should have all the pieces you need in the backend there to achieve this.

    Hope that helps : )

    B

    ArcTest.gif



  • Brook,

    That was absolutely brilliant. I had no idea that the "begin" could go negative as I had one hell of a time getting the arc to cooperate and had all but given up on the idea.

    Also, it occurred to me to shift the midpoint by a wrap distance, thus placing us in the middle of the animation rather than worrying about negative time. I was able to create a timeline with negative times, but I'm well aware that my backend will have to do conversions and manipulations to the incoming data to present it correctly.

    Thank you so much for your help. Really.

    Edit: As a bonus, do you have any recommendations on material to read regarding writing a backend in C++ for widget? Currently Javascript is employed in the tutorial.

    -Alex



  • @Alex-sw30 Glad i could help. Unfortunately as a UX designer i don't know anything about c++, i'm sure there would be someone else on the forums who could help with that if you write another question in a more relevant topic.

    Best,

    Brook.


Log in to reply