summaryrefslogtreecommitdiffstats
path: root/howto.txt
blob: 8f42ff171b06528bad15e0a699c86f7365c42c94 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
The name of this style will be <i>@styleName@</I>, and the import path will be <I>@importPath@</i>.

You can use the style in your project in several ways:

1. You can add the style folder to your CMake project and add the following to your project's CMakeLists.txt

<code>add_subdirectory(@styleName@)</code>

Make sure to also link the style library to your project, e.g:
<code>target_link_libraries(yourproject @styleName@)</code>

Then you can use compile time selection of the style by importing the style from QML using:

<code>import @styleName@</code>

or set the style at run-time using the QQuickStyle API:

<code>QQuickStyle::setStyle("@styleName@");</code>

2. If you assign the import path to the environment variable <i>QML_IMPORT_PATH</i>, an application can use this style by for example launching it with the name of the style as argument:

<code>export QML_IMPORT_PATH=@importPath@
./yourapp -style=@styleName@</code>

3. Another alternative is to build the style into an application as a resource. The style folder contains a resource file for this, <I>@styleName@.qrc</i>, that you can add to your CMake project, e.g:

<code>qt_add_executable(application main.cpp @importPath@/@styleName@/@styleName@.qrc)</code>

If you want to use compile time selection of the style, import the style directly from QML:

<code>import "qrc:/qt/qml/@styleName@"</code>

The style also contain icons. You can access them directly from the resource file, e.g
"qrc:/icons/Fuzzy/icons/DefaultIcon.png", or access them using an icon theme, e.g:

<code>QIcon::setThemeName("@styleName@"); // main.cpp</code>
<code>Button { icon.name: "DefaultIcon" } // main.qml</code>