Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Merge pull request #6865 from PeterPetrik/qgsquick_1_canvas_merge
[FEATURE] Introduction of QGIS Quick library
- Loading branch information
Showing
with
3,295 additions
and 3 deletions.
- +1 −0 .ci/travis/linux/docker-build-test.sh
- +8 −0 .docker/qgis3-build-deps.dockerfile
- +2 −0 .gitignore
- +22 −0 CMakeLists.txt
- +47 −0 cmake/FindQtQmlTools.cmake
- +3 −0 cmake_templates/qgsconfig.h.in
- +2 −0 doc/CMakeLists.txt
- +1 −0 doc/CONTRIBUTORS
- +4 −0 doc/index.dox
- +5 −0 doc/modules.dox
- +61 −0 doc/qgsquick.dox
- +8 −0 python/core/qgsapplication.sip.in
- +3 −0 src/CMakeLists.txt
- +12 −0 src/core/qgsapplication.cpp
- +9 −0 src/core/qgsapplication.h
- +6 −3 src/core/qgsrelationmanager.cpp
- +121 −0 src/quickgui/CMakeLists.txt
- +121 −0 src/quickgui/plugin/CMakeLists.txt
- +165 −0 src/quickgui/plugin/qgsquickmapcanvas.qml
- +65 −0 src/quickgui/plugin/qgsquickplugin.cpp
- +42 −0 src/quickgui/plugin/qgsquickplugin.h
- +18 −0 src/quickgui/plugin/qmldir
- +382 −0 src/quickgui/qgsquickmapcanvasmap.cpp
- +204 −0 src/quickgui/qgsquickmapcanvasmap.h
- +214 −0 src/quickgui/qgsquickmapsettings.cpp
- +237 −0 src/quickgui/qgsquickmapsettings.h
- +66 −0 src/quickgui/qgsquickutils.cpp
- +74 −0 src/quickgui/qgsquickutils.h
- +3 −0 tests/src/CMakeLists.txt
- +86 −0 tests/src/quickgui/CMakeLists.txt
- +80 −0 tests/src/quickgui/app/CMakeLists.txt
- +92 −0 tests/src/quickgui/app/main.cpp
- +40 −0 tests/src/quickgui/app/main.qml
- +5 −0 tests/src/quickgui/app/qml.qrc
- +15 −0 tests/src/quickgui/app/qtquickcontrols2.conf
- +53 −0 tests/src/quickgui/testqgsquickutils.cpp
- +1,018 −0 tests/testdata/quickapp_project.qgs
@@ -0,0 +1,47 @@ | ||
# Qt QML Tools | ||
# ~~~~~~~~~~~~ | ||
# | ||
# To generate qmltypes files required by Qt Creator to allow QML code inspection | ||
# (http://doc.qt.io/qtcreator/creator-qml-modules-with-plugins.html#generating-qmltypes-files) | ||
# we need to have installed qmlplugindump unity (shipped with Qt 4.8 and later) | ||
# http://doc.qt.io/qtcreator/creator-qml-modules-with-plugins.html#dumping-plugins-automatically | ||
# | ||
# Find the installed version of qmlplugindump utility. | ||
# FindQtQmlTools should be called after Qt5 has been found | ||
# | ||
# This file defines the following variables: | ||
# | ||
# QMLPLUGINDUMP_FOUND - system has qmlplugindump | ||
# QMLPLUGINDUMP_EXECUTABLE - Path to qmlplugindump executable | ||
# | ||
# Also defines MACRO to create qmltypes file, when QML directory is supplied | ||
# | ||
# Copyright (c) 2017, Peter Petrik <zilolv at gmail dot com> | ||
# Redistribution and use is allowed according to the terms of the BSD license. | ||
# For details see the accompanying COPYING-CMAKE-SCRIPTS file. | ||
|
||
MACRO(FIND_QMLPLUGINDUMP) | ||
IF(NOT QMLPLUGINDUMP_EXECUTABLE) | ||
IF (MSVC) | ||
FIND_PROGRAM(QMLPLUGINDUMP_EXECUTABLE qmlplugindump.exe) | ||
ELSE (MSVC) | ||
FIND_PROGRAM(QMLPLUGINDUMP_EXECUTABLE qmlplugindump) | ||
ENDIF (MSVC) | ||
ENDIF(NOT QMLPLUGINDUMP_EXECUTABLE) | ||
|
||
IF (QMLPLUGINDUMP_EXECUTABLE) | ||
SET(QMLPLUGINDUMP_FOUND TRUE) | ||
MESSAGE(STATUS "Found qmlplugindump: ${QMLPLUGINDUMP_EXECUTABLE}") | ||
ELSE() | ||
SET(QMLPLUGINDUMP_FOUND FALSE) | ||
IF (QMLPLUGINDUMP_FIND_REQUIRED) | ||
MESSAGE(FATAL_ERROR "Could not find qmlplugindump") | ||
ELSE (QMLPLUGINDUMP_FIND_REQUIRED) | ||
MESSAGE(WARNING "Could not find qmlplugindump") | ||
ENDIF (QMLPLUGINDUMP_FIND_REQUIRED) | ||
ENDIF (QMLPLUGINDUMP_EXECUTABLE) | ||
ENDMACRO(FIND_QMLPLUGINDUMP) | ||
|
||
IF (NOT QMLPLUGINDUMP_FOUND) | ||
FIND_QMLPLUGINDUMP() | ||
ENDIF (NOT QMLPLUGINDUMP_FOUND) |
@@ -0,0 +1,61 @@ | ||
/*! \page qgsquick QGIS Quick Documentation | ||
|
||
\tableofcontents | ||
|
||
\section qgsquick_overview Overview | ||
|
||
QGIS Quick is a QT Quick based GUI library primarily for mobile/tablet devices. Covering basic GIS components (e.g. MapCanvas, Scalebar), | ||
it simplifies creation of a mobile applications for surveys, data gathering or other on-site work. Qt Quick provides tools | ||
to create a rich application with a fluid and dynamic user interface. Additionally, Qt Quick Controls 2 provides highly | ||
optimized controls for embedded/mobile devices with limited resources. | ||
|
||
QGIS Quick consists of a Qt plugin that provides the QML components and of a shared library that can be used from C++ code. | ||
|
||
\subsection qgsquick_overview_widgets QML Classes | ||
\subsubsection qgsquick_overview_widgets_mapcanvas MapCanvas | ||
|
||
\section qgsquick_styling Styling | ||
|
||
Since the QGIS Quick library is meant to be reusable for a wide variety of applications with different styles/themes of the user | ||
interface, some effort has been done to allow developers customize the colors and layouts of the components. Individual | ||
components either have attributes for customization (e.g. ScaleBar has "barColor", "barBackgroundColor" properties) or more complex | ||
components accept a custom styling object (e.g. FeatureForm has "style" property of type FeatureFormStyling with a hierarchy of color | ||
and layout properties). | ||
|
||
\section qgsquick_versioning_api Versioning and API stability | ||
|
||
QML engine supports versioning of individual components with libraries - a single component may be available in multiple versions | ||
with slightly different set of features. This is allows QML libraries to keep API compatibility with older code. | ||
|
||
QGIS Quick library is currently in version 0.1 and since it is still a very new library, there are no API stability guarantees: | ||
the following releases of QGIS may ship updates to components while keeping the same version or even remove some components. | ||
Over time we expect that as the library will become stable, we will deliver stable API just like with the other QGIS libraries. | ||
|
||
\section qgsquick_gui Designing scalable applications | ||
|
||
Qt Quick uses pixel sizes for the visual items. When building applications that may run on devices with varying screen DPI, | ||
this is a problem as the absolute pixel values make the application look different depending on the screen pixel density. | ||
We recommend to use values device independent pixels ("dp"). It is a concept used on mobile devices, where an item of width of 10dp | ||
will have always the same physical size (e.g. in millimeters) regardless of the screen density. To set width of an item to 10dp | ||
in QML, one would write: "width: 10 * QgsQuick.Utils.dp". | ||
|
||
\section qgsquick_lib Building the library | ||
|
||
The QGIS Quick library is not built by default because QGIS application currently does not use it. In order to build the library | ||
please make sure that WITH_QUICK variable in CMake configuration is set to ON. | ||
|
||
It is recommended to build with CMake variable ENABLE_TESTS set to ON because that will also build a small example application | ||
that uses Qt Quick components. In the generated project you should see target "qgis_quickapp". | ||
|
||
The built QML plugin is installed to a dedicated directory - see QgsApplication::qmlImportPath(). When using QGIS Quick components, | ||
it is necessary to either use QQmlEngine::addImportPath() to add that directory or to specify QML2_IMPORT_PATH environment variable. | ||
|
||
\section qgsquick_demo_app Demo application | ||
|
||
A demo application with some basic componets and functionality is available on https://github.com/lutraconsulting/qgis-quick-demo-app | ||
|
||
The demo application repository contains also instructions on how to build the application, QGIS Quick and other dependencies on Android. | ||
|
||
*/ | ||
|
||
|
Oops, something went wrong.