Skip to content

Instantly share code, notes, and snippets.

View stephenquan's full-sized avatar

Stephen Quan stephenquan

View GitHub Profile
import QtQuick 2.7
import ArcGIS.AppFramework 1.0
import ArcGIS.AppFramework.Sql 1.0
Item {
width: 640
height: 480
FileFolder {
id: fileFolder
@stephenquan
stephenquan / SQLiteSpatialSnippet.sql
Created September 11, 2017 00:01
AppStudio SQLite spatial functions example
SELECT ST_Distance(ST_Point(144.965819, -37.830658, 4326),
ST_Point(144.954433, -37.832262, 4326)) as distance;
-- 1015.7444936798523
SELECT ST_Azimuth(ST_Point(144.965819, -37.830658, 4326),
ST_Point(144.954433, -37.832262, 4326)) as radians;
-- 4.535820702776582
@stephenquan
stephenquan / appstudio-copy-and-open-resource.qml
Last active March 4, 2018 21:42
AppStudio copy and open and embedded resource
// This sample demonstrates how to copy out a resource from your app to your file system.
//
// This AppStudio works around the issue that you cannot give the operating system links
// to resources embedded in your application. To achieve this, we copy the resources out
// which causes their URL to change from a qrc:/ to file:/ URI. After copying, we can
// easily open the file with Qt.openUrlExternally.
import QtQuick 2.7
import QtQuick.Controls 2.1
import ArcGIS.AppFramework 1.0
@stephenquan
stephenquan / appstudio-detect-internet.qml
Last active May 3, 2018 03:51
AppStudio detect active internet connection
// appstudio-detect-internet.qml
//
// Detects an active internet connection (LAN, WiFI or MobileData)
// For use with AppStudio for ArcGIS
//
// Notes:
// This uses AppStudio's Networking plugin which is a wrapper for
// Qt's QNetworkConfigurationManager and QNetworkConfiguration classes.
//
// This application works by using BearerType for all platforms except for iOS.
@stephenquan
stephenquan / appstudio-shortcuts.qml
Last active March 9, 2018 10:49
AppStudio return shortcuts to standard locations
import QtQuick 2.7
import QtQuick.Layouts 1.3
import QtQuick.Controls 2.1
import QtQuick.Dialogs 1.0
import ArcGIS.AppFramework 1.0
App {
id: app
width: 640 * AppFramework.displayScaleFactor
@stephenquan
stephenquan / appstudio-sqlaggregatefunction-sample.qml
Last active March 19, 2018 20:28
appstudio-sqlaggregatefunction-sample.qml
// appstudio-sqlaggregatefunction-sample.qml
//
// Sample demonstrating how to use SqlAggregateFunction.
import QtQuick 2.8
import QtQuick.Layouts 1.3
import QtQuick.Controls 1.4
import QtQuick.Controls 2.1
import QtGraphicalEffects 1.0
import ArcGIS.AppFramework 1.0
@stephenquan
stephenquan / appstudio-sqltablemodel-sample.qml
Last active April 4, 2018 01:47
appstudio-sqltablemodel-sample.qml
// This sample demonstrates creation, populating and querying a SQLite database.
// When run the TableView component is populated with a data from the Cities table.
//
// Melbourne, Australia, -37.9716929, 144.7729583
// London, UK, 51.5287718, -0.2416804
// Paris, France, 48.8589507, 2.2770205
// New York City, USA, 40.6976637, -74.1197639
// Tokyo, Japan, 35.6735408, 139.5703047
import QtQuick 2.9
@stephenquan
stephenquan / qml-image-filedialog-sample.qml
Last active April 4, 2018 03:52
qml-image-filedialog-sample.qml
// This sample allows you to pick and view an image from your pictures folder
import QtQuick 2.7
import QtQuick.Controls 2.1
import QtQuick.Dialogs 1.2
import QtQuick.Layouts 1.3
Item {
ColumnLayout {
anchors.fill: parent
@stephenquan
stephenquan / qt-tableview.qml
Last active April 9, 2018 04:05
qt-tableview.qml
// This sample shows how you can make a QtQuick 1 table have the a QtQuick 2 look and feel
// - Uses custom headerDelegate, rowDelegate, itemDelegate
// - Also shows:
// - how to dynamically create columns
// - make the table "flickable" on Android devices
// - simple "3D" styling with LinearGradient
import QtQuick 2.8
import QtQuick.Controls 1.4
import QtQuick.Controls 2.1
@stephenquan
stephenquan / appstudio-messagehandler-loader-sample.qml
Last active March 21, 2018 04:57
appstudio-messagehandler-loader-sample.qml
import QtQuick 2.7
import QtQuick.Controls 2.1
import QtQuick.Layouts 1.3
import ArcGIS.AppFramework 1.0
import ArcGIS.AppFramework.Controls 1.0
Item {
property string errorString: ""