QML Scrolling Digits

From Qt Wiki
Revision as of 16:34, 14 January 2015 by Maintenance script (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

English Български

How to create scrolling digits component

Here is one way to easily create a scrolling digits component.

Code

First we create a component for digits:

Digit.qml

The component is just a Rectangle with gradient. In its center we place a PathView and set clipping to true, so only the selected digit will be visible.

Than we create the ScrollingDigits component:

ScrollingDigits.qml

We add two properties to Row: number and positions . number contains the number we want to display and positions is the number of digits we want.

Example

main.qml

Categories: