Usage
Build Options
Qlementine can be built as a static library, as a shared library, or as both variants in the same build tree. The default build is static, which preserves the behavior of existing consumers unless BUILD_SHARED_LIBS is enabled explicitly.
# Static library, default.
-DBUILD_SHARED_LIBS=OFF
# Shared library.
-DBUILD_SHARED_LIBS=ON
# Shared and static libraries together.
-DBUILD_SHARED_LIBS=ON -DQLEMENTINE_BUILD_STATIC=ON
When both variants are enabled, the exported CMake targets are qlementine::qlementine_shared and qlementine::qlementine_static. Otherwise, the installed target is qlementine::qlementine and matches the selected build type.
The Qt style plugin is built in all build configurations, as qlementinestyleplugin, and keeps the style key "qlementine".
Installation
Option 1: FetchContent
Add the library as a dependency using CMake FetchContent:
include(FetchContent)
FetchContent_Declare(Qlementine GIT_REPOSITORY "https://github.com/oclero/qlementine.git")
FetchContent_MakeAvailable(Qlementine)
Link with the library:
To build Qlementine as a shared library through FetchContent, set BUILD_SHARED_LIBS before FetchContent_MakeAvailable.
Option 2: Find Installed Library
If Qlementine is already installed on your system, use the installed CMake package:
find_package(qlementine REQUIRED)
target_link_libraries(your_project PRIVATE qlementine::qlementine)
If the package was installed with both shared and static variants, link the variant explicitly:
target_link_libraries(your_project PRIVATE qlementine::qlementine_shared)
# or
target_link_libraries(your_project PRIVATE qlementine::qlementine_static)
Option 3: Meson or pkg-config
On platforms where pkg-config metadata is installed, Qlementine can also be consumed from Meson or another pkg-config aware build system.
qlementine_dep = dependency('qlementine')
executable('your_project',
sources: ['main.cpp'],
dependencies: [qlementine_dep]
)
Option 4: vcpkg
Then in CMake:
find_package(qlementine CONFIG REQUIRED)
target_link_libraries(your_project PRIVATE qlementine::qlementine)
Usage in Code
Direct Style Creation
Create the QStyle and assign it to your QApplication.
#include <oclero/qlementine.hpp>
QApplication app(argc, argv);
auto* style = new oclero::qlementine::QlementineStyle(&app);
QApplication::setStyle(style);
Qt Style Plugin
Qlementine can also be used through its Qt style plugin. Install or deploy qlementinestyleplugin in Qt's styles plugin directory, then select the qlementine style key.
Themes
Qlementine embeds by default 2 themes: light.json and dark.json. They are available in :/qlementine/resources/themes.
You can get them like this:
const auto lightTheme = oclero::qlementine::Theme::makeLight();
const auto darkTheme = oclero::qlementine::Theme::makeDark();
You may want to use your own JSON theme.
Additionnally, you can also use ThemeManager to handle that for you.