-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The QML files are loaded along with the plugin now, so there is no need to place them inside the Qt folder. The plugin will be installed alongside any executables inside the proper folder, if this cmake project is inside another one. To load it at runtime use: qputenv("QT_IM_MODULE", QByteArray("cutekeyboard")); QCoreApplication::addLibraryPath(QCoreApplication::applicationDirPath()); So the application will look for any plugins in its root directory.
- Loading branch information
1 parent
fe7f347
commit adfa633
Showing
6 changed files
with
167 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
cmake_minimum_required(VERSION 3.16) | ||
project(cutekeyboardplugin VERSION 1.0 LANGUAGES C CXX) | ||
|
||
set(CMAKE_CXX_STANDARD 17) | ||
set(CMAKE_CXX_STANDARD_REQUIRED ON) | ||
|
||
set(CMAKE_AUTORCC ON) | ||
|
||
find_package(QT NAMES Qt5 Qt6 REQUIRED COMPONENTS Core) | ||
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Gui Qml Quick) | ||
|
||
set(BUILD_EXAMPLES OFF) | ||
|
||
if(QT_KNOWN_POLICY_QTP0001) | ||
qt_policy(SET QTP0001 NEW) | ||
endif() | ||
|
||
qt_standard_project_setup() | ||
|
||
add_subdirectory(src) | ||
|
||
if(BUILD_EXAMPLES) | ||
add_subdirectory(example) | ||
endif() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
qt_add_executable(example WIN32 MACOSX_BUNDLE | ||
main.cpp | ||
) | ||
target_compile_definitions(example PRIVATE | ||
QT_DEPRECATED_WARNINGS | ||
) | ||
|
||
target_link_libraries(example PRIVATE | ||
Qt::Core | ||
Qt::Gui | ||
Qt::Quick | ||
) | ||
|
||
set(qml_resource_files | ||
"main.qml" | ||
) | ||
|
||
qt_add_resources(example "qml" | ||
PREFIX | ||
"/" | ||
FILES | ||
${qml_resource_files} | ||
) | ||
|
||
install(TARGETS example | ||
BUNDLE DESTINATION . | ||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} | ||
) | ||
|
||
qt_generate_deploy_app_script( | ||
TARGET example | ||
FILENAME_VARIABLE deploy_script | ||
NO_UNSUPPORTED_PLATFORM_ERROR | ||
) | ||
install(SCRIPT ${deploy_script}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
set(HEADERS | ||
"EnterKeyAction.hpp" | ||
"EnterKeyActionAttachedType.hpp" | ||
"InputPanelIface.hpp" | ||
"VirtualKeyboardInputContextPlugin.h" | ||
"VirtualKeyboardInputContext.h" | ||
"DeclarativeInputEngine.h" | ||
) | ||
|
||
set(SOURCES | ||
"EnterKeyAction.cpp" | ||
"EnterKeyActionAttachedType.cpp" | ||
"InputPanelIface.cpp" | ||
"VirtualKeyboardInputContextPlugin.cpp" | ||
"VirtualKeyboardInputContext.cpp" | ||
"DeclarativeInputEngine.cpp" | ||
) | ||
|
||
set(QML_FILES | ||
"qml/AlternativeKeysPopup.qml" | ||
"qml/BackspaceKey.qml" | ||
"qml/CsLayout.qml" | ||
"qml/DeLayout.qml" | ||
"qml/DigitsLayout.qml" | ||
"qml/ElLayout.qml" | ||
"qml/EnLayout.qml" | ||
"qml/EnterKey.qml" | ||
"qml/EsLayout.qml" | ||
"qml/FrLayout.qml" | ||
"qml/HideKey.qml" | ||
"qml/InputPanel.qml" | ||
"qml/ItLayout.qml" | ||
"qml/KeyModel.qml" | ||
"qml/KeyPopup.qml" | ||
"qml/Key.qml" | ||
"qml/NlLayout.qml" | ||
"qml/PlLayout.qml" | ||
"qml/PtLayout.qml" | ||
"qml/QwertyLayout.qml" | ||
"qml/ShiftKey.qml" | ||
"qml/SpaceKey.qml" | ||
"qml/SymbolKey.qml" | ||
"qml/SymbolLayout.qml" | ||
) | ||
|
||
foreach(_file IN_LISTS QML_FILES) | ||
cmake_path(GET _file FILENAME _fileName) | ||
set_source_files_properties(${_file} PROPERTIES | ||
QT_RESOURCE_ALIAS ${_fileName} | ||
) | ||
endforeach() | ||
|
||
qt_add_qml_module(${PROJECT_NAME} | ||
URI | ||
"QtQuick.CuteKeyboard" | ||
VERSION | ||
1.0 | ||
PLUGIN_TARGET | ||
${PROJECT_NAME} | ||
OUTPUT_DIRECTORY | ||
"QtQuick/CuteKeyboard" | ||
RESOURCE_PREFIX | ||
"/" | ||
CLASS_NAME | ||
"VirtualKeyboardInputContextPlugin" | ||
SOURCES | ||
${HEADERS} | ||
${SOURCES} | ||
QML_FILES | ||
${QML_FILES} | ||
NO_GENERATE_PLUGIN_SOURCE | ||
) | ||
|
||
qt_add_resources(${PROJECT_NAME} "icons" | ||
PREFIX "/" | ||
FILES | ||
"resources.qrc" | ||
) | ||
|
||
target_link_libraries(${PROJECT_NAME} PRIVATE | ||
Qt::Core | ||
Qt::Gui | ||
Qt::GuiPrivate | ||
Qt::Qml | ||
Qt::Quick | ||
Qt::QuickPrivate | ||
) | ||
|
||
if(${PROJECT_NAME} STREQUAL ${CMAKE_PROJECT_NAME}) | ||
set(INSTALL_DIR ${QT_DIR}/../../../plugins/platforminputcontexts) | ||
else() | ||
set(INSTALL_DIR ${CMAKE_INSTALL_BINDIR}/platforminputcontexts) | ||
set_target_properties(${PROJECT_NAME} PROPERTIES | ||
LIBRARY_OUTPUT_DIRECTORY "$<TARGET_FILE_DIR:${CMAKE_PROJECT_NAME}>/platforminputcontexts" | ||
) | ||
endif() | ||
|
||
install(TARGETS ${PROJECT_NAME} | ||
LIBRARY DESTINATION ${INSTALL_DIR} | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters