TaoQuick Installation Instructions

Get code

git clone https://github.com/jaredtao/TaoQuick.git
cd TaoQuick 
git submodule update --init

qmake

You just need to import '.pri' file to project and add import Path to QmlEngine, TaoQuick will be used as local file or qrc resource.

Compared with 'Qml module' and 'Qml C++ plugin', this usage has the following advantages:

  • After importing '.pri', no additional compile, generation of dll or plugin are required

  • No additional copy resources are required to deploy the program

  • After importing '.pri', Qt Creater can support TaoQuick Qml code highlighting and double-clicking the Follow symbol

  • After importing the module 'import TaoQuick 1.0' in Qml, you can use the TaoQuick component in The Designer mode of Qt Creator by dragging or with  visual property editor. (Rule: generate metainfo required by Designer via some script)

Detailed steps:

  1. copy src/TaoQuick to your project, in any location

  2. Import 'pri' files in the corresponding TaoQuick folder in your project 'pro' file

For example:

include(TaoQuick/TaoQuick.pri)

or

include(src/TaoQuick/imports/imports.pri)

TaoQuick.pri will define two MACROs: TaoQuickImportPath and TaoQuickImagePath.

Debug mode will use TaoQuick as a local file, and release mode for qrc resource.

  1. add import path in cpp

    Before loading source qml, TaoQuick needs to add import path to QmlEngine and set imagePath to context.

    if QQuickView is used, TaoQuick can be used as:

    view.engine()->addImportPath(TaoQuickImportPath);
    view.rootContext()->setContextProperty("taoQuickImagePath", TaoQuickImagePath);

if QmlEngine is used, TaoQuick can be used as:

    engine.addImportPath(TaoQuickImportPath);
    engine.rootContext()->setContextProperty("taoQuickImagePath", TaoQuickImagePath);

cmake

TaoQuick started supporting cmake after version 0.5.0, it's the same as qmake.

Detailed steps:

  1. copy src/TaoQuick to your project, in any location

  2. copy cmake/taoQuick.cmake to your project, in any location

and make sure the first line of taoQuick.cmake location points to correct TaoQuick path

  1. add cmake extern path in your CMakeLists.txt

add extern path:

  SET(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)

then load taoQuick with 'include'

include(taoQuick)

taoQuick.cmake will define two MACROs: TaoQuickImportPath and TaoQuickImagePath.

Debug mode will use TaoQuick as a local file, and release mode for qrc resource.

Release mode taoQuick.cmake also define a MACRO TaoQuickRes, that location to qrc file.

your project should add TaoQuickRes to executable, like this:

if (CMAKE_BUILD_TYPE MATCHES "Release")
    add_executable(MyApp ${someSource} ${TaoQuickRes})
else()
    add_executable(MyApp ${someSource})
endif()
  1. add import path in cpp

    Before loading source qml, TaoQuick needs to add import path to QmlEngine and set imagePath to context.

    if QQuickView, TaoQuick can be used as:

    view.engine()->addImportPath(TaoQuickImportPath);
    view.rootContext()->setContextProperty("taoQuickImagePath", TaoQuickImagePath);

if QmlEngine, TaoQuick can be used as:

    engine.addImportPath(TaoQuickImportPath);
    engine.rootContext()->setContextProperty("taoQuickImagePath", TaoQuickImagePath);

 

Back to Qt Marketplace