Skip to content

Instantly share code, notes, and snippets.

View stephenquan's full-sized avatar

Stephen Quan stephenquan

View GitHub Profile
@stephenquan
stephenquan / AppStudio_20190717_ForOf.qml
Created July 17, 2019 04:10
AppStudio_20190717_ForOf.qml
import QtQuick 2.12
import QtQuick.Controls 2.5
Item {
Button {
text: qsTr("Run For Of Sample")
onClicked: {
let census = [
{ country: "France", population: 66.99 },
{ country: "Australia", population: 24.6 },
@stephenquan
stephenquan / AppStudio_20190717_ForWithIndex.qml
Created July 17, 2019 04:07
AppStudio_20190717_ForWithIndex.qml
import QtQuick 2.12
import QtQuick.Controls 2.5
Item {
Button {
text: qsTr("Run For Sample")
onClicked: {
var census = [
{ country: "France", population: 66.99 },
{ country: "Australia", population: 24.6 },
@stephenquan
stephenquan / AppStudio_20190703_RegExpValidatorTest.qml
Created July 1, 2019 05:12
AppStudio_20190703_RegExpValidatorTest.qml
import QtQuick 2.12
import QtQuick.Controls 2.5
TextField {
validator: RegExpValidator {
regExp: /[0-9]{3}-[A-Za-z]{3}/
}
placeholderText: qsTr("Type in a license plate of the pattern 999-AAA")
text: "123-XYZ"
color: acceptableInput ? "green" : "red"
@stephenquan
stephenquan / AppStudio_20190703_DoubleValidatorTest.qml
Last active November 9, 2022 04:52
AppStudio_20190703_DoubleValidatorTest.qml
import QtQuick 2.12
import QtQuick.Controls 2.15
import QtQuick.Layouts 1.15
Page {
Frame {
width: parent.width
ColumnLayout {
width: parent.width
@stephenquan
stephenquan / AppStudio_20190703_IntValidatorTest.qml
Created July 1, 2019 05:03
AppStudio_20190703_IntValidatorTest.qml
import QtQuick 2.12
import QtQuick.Controls 2.5
TextField {
validator: IntValidator {
bottom: 25
top: 75
}
placeholderText: qsTr("Type in an integer between 25 and 75")
text: "34"
@stephenquan
stephenquan / AppStudio_20190703_InputMaskTest.qml
Last active July 1, 2019 04:43
AppStudio_20190703_InputMaskTest.qml
import QtQuick 2.12
import QtQuick.Controls 2.5
TextField {
inputMask: "999-AAA"
placeholderText: qsTr("Type in a license plate of the pattern 999-AAA")
text: "123-XYZ"
color: acceptableInput ? "green" : "red"
selectByMouse: true
}
@stephenquan
stephenquan / AppStudio_20190703_InputValidatorTest.qml
Last active July 1, 2019 04:35
AppStudio_20190703_InputValidatorTest.qml
import QtQuick 2.12
import QtQuick.Controls 2.5
import ArcGIS.AppFramework 1.0
Item {
TextField {
width: parent.width
validator: InputValidator {
validate: function (input, position) {
if (input.match(/unicorn/)) {
@stephenquan
stephenquan / AppStudio_20190605_PromiseBabel.qml
Last active July 28, 2019 22:46
AppStudio_20190605_PromiseBabel.qml
import QtQuick 2.12
import QtQuick.Controls 2.5
import ArcGIS.AppFramework 1.0
Item {
Button {
text: qsTr( "Test Promise async/await (Babel)" )
onClicked: testPromise()
}
@stephenquan
stephenquan / AppStudio_20190605_PromiseAsyncAwait.qml
Last active July 11, 2019 04:21
AppStudio_20190605_PromiseAsyncAwait.qml
import QtQuick 2.12
import QtQuick.Controls 2.5
import ArcGIS.AppFramework 1.0
Item {
Button {
text: qsTr( "Test Promise async/await" )
onClicked: {
(async () => {
try {
@stephenquan
stephenquan / AppStudio_20190605_PromiseNesting.qml
Last active July 13, 2019 22:19
AppStudio_20190605_PromiseNesting.qml
import QtQuick 2.12
import QtQuick.Controls 2.5
import ArcGIS.AppFramework 1.0
Item {
Button {
text: qsTr("Test Promise nesting")
onClicked: {
download( "GET", "https://community.esri.com/groups/appstudio" )
.then( (data) => {