Skip to content

Sample use for milsymbol javascript library in C++/QML

License

Notifications You must be signed in to change notification settings

cneben/milsymbol-qml

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Milsymbol sample in Qt QML

Demonstration of milsymbol javascript library integration in a Qt/QML application (will eventually grow to an ORBAT editor).

Using

Include src/milsymbol-qml.pri in your main .pro project file:

# your project.pro QMake configuration
QT      += quick
include(../src/milsymbol-qml.pri)
// yourmain.qml
import QtQuick 2.11
import QtQuick.Controls 2.4

import 'qrc:/Milsymbol' 1.0

// Then use Ms. module as you would with regular milsymbol library:

Window {
    id: window
    visible: true
    width: 900; height: 550
    title: qsTr("Milsymbol.js QML Demo")

    property var symbol: new Ms.Symbol('sfgpewrh--mt', {
            size: 35,
            quantity: 200,
            staffComments: "for reinforcements".toUpperCase(),
            additionalInformation: "added support for JJ".toUpperCase(),
            direction: (750*360/6400),
            type: "machine gun".toUpperCase(),
            dtg: "30140000ZSEP97",
            location: "0900000.0E570306.0N"})

    Image {
        anchors.fill: parent
        source: 'data:image/svg+xml;utf8,' + window.symbol.asSVG();
        // Do not forget to configure sourceSize: "400x400"
        fillMode: Image.PreserveAspectFit   
    }
}

Building

milsymbol-qml is distributed with pre-built Milsymbol javascript library 'milsymbol.developement.js' and 'milstd.js'. Theses files could be regenerated with the following commands:

# Building milsymbol.js
$ git clone https://github.com/spatialillusions/milsymbol
$ cd milsymbol
$ npm install
$ npm run bundle
# target milsymbol.development.js is in ./dist directory, replace the file in milsymbol-qml/src

# Building milstd.js
$ git clone https://github.com/spatialillusions/milstd
$ cd milstd
$ npm install
$ npm run build
# target milstd.js is in current directory, replace the file in milsymbol-qml/src

Refer to sample/milsymbol-qml-sample.pro for an example of integration with QMake.

Milsymbol is (c) 2017 spatialillusions.com

Inspiration for UI components: https://spatialillusions.com/unitgenerator/

Licence: MIT

About

Sample use for milsymbol javascript library in C++/QML

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages