|
|
|
@ -7,6 +7,9 @@ Item { |
|
|
|
property bool render: true // init to false, then set true if render needs delay |
|
|
|
property bool render: true // init to false, then set true if render needs delay |
|
|
|
property var qrprops: QRIP.getDimensions(qrdata) |
|
|
|
property var qrprops: QRIP.getDimensions(qrdata) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
property bool enable_toggle_text: false // if true, clicking the QR code shows the encoded text |
|
|
|
|
|
|
|
property bool is_in_text_state: false // internal state, if the above is enabled |
|
|
|
|
|
|
|
|
|
|
|
width: r.width |
|
|
|
width: r.width |
|
|
|
height: r.height |
|
|
|
height: r.height |
|
|
|
|
|
|
|
|
|
|
|
@ -19,6 +22,7 @@ Item { |
|
|
|
|
|
|
|
|
|
|
|
Image { |
|
|
|
Image { |
|
|
|
source: qrdata && render ? 'image://qrgen/' + qrdata : '' |
|
|
|
source: qrdata && render ? 'image://qrgen/' + qrdata : '' |
|
|
|
|
|
|
|
visible: !is_in_text_state |
|
|
|
|
|
|
|
|
|
|
|
Rectangle { |
|
|
|
Rectangle { |
|
|
|
visible: root.render && qrprops.valid |
|
|
|
visible: root.render && qrprops.valid |
|
|
|
@ -44,4 +48,27 @@ Item { |
|
|
|
anchors.centerIn: parent |
|
|
|
anchors.centerIn: parent |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Label { |
|
|
|
|
|
|
|
visible: is_in_text_state |
|
|
|
|
|
|
|
text: qrdata |
|
|
|
|
|
|
|
wrapMode: Text.WrapAnywhere |
|
|
|
|
|
|
|
elide: Text.ElideRight |
|
|
|
|
|
|
|
anchors.centerIn: parent |
|
|
|
|
|
|
|
horizontalAlignment: Qt.AlignHCenter |
|
|
|
|
|
|
|
verticalAlignment: Qt.AlignVCenter |
|
|
|
|
|
|
|
color: 'black' |
|
|
|
|
|
|
|
width: r.width |
|
|
|
|
|
|
|
height: r.height |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
MouseArea { |
|
|
|
|
|
|
|
anchors.fill: parent |
|
|
|
|
|
|
|
onClicked: { |
|
|
|
|
|
|
|
if (enable_toggle_text) { |
|
|
|
|
|
|
|
root.is_in_text_state = !root.is_in_text_state |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|