Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import QtQuick 2.1;
- import QtQuick.Window 2.1;
- Window {
- id: window;
- width: 800;
- height: 600;
- visible: true;
- readonly property var centerLetterMove : { "0-left" : ["a", "m", "y"],
- "0-right" : ["b", "n", "z"],
- "60-left" : ["c", "o", "."],
- "60-right" : ["d", "p", "?"],
- "120-left" : ["e", "q", "!"],
- "120-right" : ["f", "r", ","],
- "180-left" : ["g", "s", ";"],
- "180-right" : ["h", "t", ":"],
- "240-left" : ["i", "u", "'"],
- "240-right" : ["j", "v", "("],
- "300-left" : ["k", "w", ")"],
- "300-right" : ["l", "x", "$"],
- };
- Rectangle {
- id: centerDot;
- color: "blue";
- width: 50;
- height: width;
- radius: (width * 0.5);
- opacity: 0.5;
- anchors.centerIn: parent;
- }
- Repeater {
- model: Object.keys (centerLetterMove);
- delegate: Item {
- id: branch;
- anchors.centerIn: centerDot;
- readonly property string key : modelData;
- readonly property real angle : (parseInt (key.split ("-") [0].toString ()) * Math.PI / 180);
- readonly property real sin : Math.sin (angle);
- readonly property real cos : Math.cos (angle);
- readonly property int side : (key.indexOf ("left") !== -1 ? -1 : 1);
- Repeater {
- model: centerLetterMove [key];
- delegate: Item {
- anchors {
- centerIn: parent;
- verticalCenterOffset: (branch.sin * radius) + (charText.height * 0.4 * branch.side * branch.cos);
- horizontalCenterOffset: (branch.cos * radius) - (charText.height * 0.4 * branch.side * branch.sin);
- }
- readonly property real radius : (centerDot.radius + (model.index + 1) * charText.height * 0.8);
- Text {
- id: charText;
- text: modelData;
- font.pixelSize: 15;
- anchors.verticalCenter: parent.top;
- anchors.horizontalCenter: parent.left;
- }
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement