diff --git a/examples/staticcmake/CMakeLists.txt b/examples/staticcmake/CMakeLists.txt index 3eadddce..4f362f2f 100644 --- a/examples/staticcmake/CMakeLists.txt +++ b/examples/staticcmake/CMakeLists.txt @@ -1,27 +1,24 @@ project(minimal) cmake_minimum_required(VERSION 3.2) if (POLICY CMP0063) cmake_policy(SET CMP0063 NEW) endif() find_package(ECM REQUIRED CONFIG) set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/ ${CMAKE_MODULE_PATH} ${ECM_MODULE_PATH}) set(BREEZEICONS_DIR ${CMAKE_SOURCE_DIR}/3rdparty/breeze-icons/) find_package(Qt5 REQUIRED Core Quick Multimedia Test Widgets QuickControls2) include(KDEInstallDirs) include(KDECompilerSettings) include(KDECMakeSettings) set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_EXTENSIONS OFF) -#FIXME: any way to avoid to have to explicitly set this in every project? -add_definitions(-DKIRIGAMI_BUILD_TYPE_STATIC) - add_subdirectory(3rdparty) add_subdirectory(src) diff --git a/examples/staticcmake/src/CMakeLists.txt b/examples/staticcmake/src/CMakeLists.txt index 5fe49ca3..4423d567 100644 --- a/examples/staticcmake/src/CMakeLists.txt +++ b/examples/staticcmake/src/CMakeLists.txt @@ -1,26 +1,27 @@ include_directories(${CMAKE_SOURCE_DIR}/3rdparty/kirigami/src) include(${CMAKE_SOURCE_DIR}/3rdparty/kirigami/KF5Kirigami2Macros.cmake) set(minimal_SRCS main.cpp ) qt5_add_resources(RESOURCES kirigami-icons.qrc resources.qrc) if (CMAKE_SYSTEM_NAME STREQUAL "Android") set(minimal_EXTRA_LIBS Qt5::AndroidExtras #FIXME: we shouldn't have to link to it but otherwise the lib won't be packaged on Android Qt5::QuickControls2) else () #qstyle-based qqc2 style needs a QApplication set(minimal_EXTRA_LIBS Qt5::Widgets) endif() add_executable(minimal ${minimal_SRCS} ${RESOURCES}) -target_link_libraries(minimal ${CMAKE_BINARY_DIR}/lib/libkirigamiplugin.a Qt5::Core Qt5::Qml Qt5::Quick Qt5::QuickControls2 ${minimal_EXTRA_LIBS}) +#kirigamiplugin is the static library built by us +target_link_libraries(minimal kirigamiplugin Qt5::Core Qt5::Qml Qt5::Quick Qt5::QuickControls2 ${minimal_EXTRA_LIBS}) #install(TARGETS minimal ${KF5_INSTALL_TARGETS_DEFAULT_ARGS}) kirigami_package_breeze_icons(ICONS application-menu document-decrypt folder-sync go-next go-previous go-up handle-left handle-right view-list-icons applications-graphics media-record-symbolic) diff --git a/examples/staticcmake/src/main.cpp b/examples/staticcmake/src/main.cpp index c4486e4c..57ac9d90 100644 --- a/examples/staticcmake/src/main.cpp +++ b/examples/staticcmake/src/main.cpp @@ -1,81 +1,78 @@ /* * Copyright 2017 Marco Martin * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library General Public License as * published by the Free Software Foundation; either version 2, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library General Public License for more details * * You should have received a copy of the GNU Library General Public * License along with this program; if not, write to the * Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifdef Q_OS_ANDROID #include #else #include #endif #include #include #include #include #ifdef Q_OS_ANDROID #include // WindowManager.LayoutParams #define FLAG_TRANSLUCENT_STATUS 0x04000000 #define FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS 0x80000000 // View #define SYSTEM_UI_FLAG_LIGHT_STATUS_BAR 0x00002000 #endif -//FIXME: remove -#include "../3rdparty/kirigami/src/kirigamiplugin.h" + Q_IMPORT_PLUGIN(KirigamiPlugin) Q_DECL_EXPORT int main(int argc, char *argv[]) { QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling); //The desktop QQC2 style needs it to be a QApplication #ifdef Q_OS_ANDROID QGuiApplication app(argc, argv); #else QApplication app(argc, argv); #endif - //FIXME: this workaround shouldn't be necessary in the final version - KirigamiPlugin::registerTypes(); //qputenv("QML_IMPORT_TRACE", "1"); QQmlApplicationEngine engine; engine.load(QUrl(QStringLiteral("qrc:///main.qml"))); if (engine.rootObjects().isEmpty()) { return -1; } //HACK to color the system bar on Android, use qtandroidextras and call the appropriate Java methods #ifdef Q_OS_ANDROID QtAndroid::runOnAndroidThread([=]() { QAndroidJniObject window = QtAndroid::androidActivity().callObjectMethod("getWindow", "()Landroid/view/Window;"); window.callMethod("addFlags", "(I)V", FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS); window.callMethod("clearFlags", "(I)V", FLAG_TRANSLUCENT_STATUS); window.callMethod("setStatusBarColor", "(I)V", QColor("#2196f3").rgba()); window.callMethod("setNavigationBarColor", "(I)V", QColor("#2196f3").rgba()); }); #endif return app.exec(); } diff --git a/src/controls/qmldir b/src/controls/qmldir index b629921d..15792b5f 100644 --- a/src/controls/qmldir +++ b/src/controls/qmldir @@ -1,9 +1,9 @@ module org.kde.kirigami -#plugin kirigamiplugin +plugin kirigamiplugin classname KirigamiPlugin depends QtQuick.Controls 1.4 depends QtQuick.Controls.Private 1.0 depends QtQuick.Controls 2.0 depends QtGraphicalEffects 1.0 designersupported