Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[QgsQuick] Improvements patch (#42804)
* [QgsQuick] Improvements - several GUI fixes - support for attaching extra handler to a text widget to set data (qr scanner, sensors) - updating feature attributes with default value and "onUpdate" checked when any attribute has been edited (real-time form update) - updated docs Co-authored-by: vsklencar <viktor.sklencar@lutraconsulting.co.uk>
- Loading branch information
Showing
29 changed files
with
432 additions
and
184 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import QtQuick 2.0 | ||
import QtQuick.Templates 2.0 as T | ||
import QgsQuick 0.1 as QgsQuick | ||
|
||
T.Switch { | ||
id: control | ||
|
||
property color bgndColorActive: "green" | ||
property color bgndColorInactive: "grey" | ||
property color handleColor: "white" | ||
property bool isReadOnly: false | ||
|
||
signal switchChecked( bool isChecked ) | ||
|
||
implicitHeight: 60 * QgsQuick.Utils.dp | ||
implicitWidth: 2 * height | ||
|
||
indicator: Rectangle { | ||
x: { | ||
let actualPosition = control.visualPosition * (control.width - width) | ||
|
||
if ( control.checked ) // limit maximum position | ||
return Math.min( actualPosition, control.width * 0.55 ) | ||
else // limit minimum position | ||
return Math.max( actualPosition, control.width * 0.13 ) | ||
} | ||
y: (control.height - height) / 2 | ||
height: parent.height * 0.66 | ||
width: height | ||
|
||
radius: 20 * QgsQuick.Utils.dp | ||
color: control.handleColor | ||
|
||
Behavior on x { | ||
enabled: !control.pressed | ||
SmoothedAnimation { velocity: 200 } | ||
} | ||
} | ||
|
||
background: Rectangle { | ||
radius: 20 * QgsQuick.Utils.dp | ||
color: control.isReadOnly || !control.checked ? control.bgndColorInactive : control.bgndColorActive | ||
} | ||
|
||
onCheckedChanged: control.switchChecked( checked ) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.