Today's example shows how to reuse the statechart from the flippin' widgets example to create a widget that spins. The idea is to create a
spin state that repeatedly enters a
flip state until the speed is sufficiently slow (i.e. the widget should stop spinning). The
spin state doesn't know the internals of the
flip state; the only thing it needs to do is enter the
flip state, and have a state transition that's triggered by the
flip state's finished() signal (at which point a single flip has been performed). In other words, the
SpinWidget "embeds" the
FlipWidget's statechart in its own and builds more behavior on top. The
spin state emits the finished() signal when its work is done, so now we can build new behavior on top of that state, and so on; indeed, the top-level states of the
SpinWidget's statechart are simply an
idle state and a
spin state. Also worth noting is that all states are composed of standard QState objects (no subclassing needed).
For fun I threw in a "pulse" effect for the item under the cursor. Video:
Download the latest release here: www.qt.io/download.
Qt 5.12 was developed with a strong focus on quality and is a long-term-supported (LTS) release that will be supported for 3 years.
Check out all our open positions here and follow us on Instagram to see what it's like to be #QtPeople.
Näytä tämä julkaisu Instagramissa.
Want to build something for tomorrow, join #QtPeople today! We have loads of cool jobs you don’t want to miss! http://qt.io/careers #builtwithQt #software #developers #coding #framework #tool #tooling #C++ #QML #engineers #sales #tech #technology #UI #UX #CX #Qt #Qtdev #global #openpositions #careers #job
Henkilön Qt (@theqtcompany) jakama julkaisu