From 9f24cdaebd39f9a2f9b763e427bcb29c4aef639e Mon Sep 17 00:00:00 2001 From: Mentalflow <312902918@qq.com> Date: Mon, 10 Jul 2023 19:07:54 +0800 Subject: [PATCH] Fix the bug of static resources didn't imported by engine. --- example/CMakeLists.txt | 5 ++ example/src/main.cpp | 3 + src/CMakeLists.txt | 2 +- src/imports/FluentUI/qmldir | 147 ++++++++++++++++++++---------------- 4 files changed, 90 insertions(+), 67 deletions(-) diff --git a/example/CMakeLists.txt b/example/CMakeLists.txt index 4bd0ba3b..46f6b365 100644 --- a/example/CMakeLists.txt +++ b/example/CMakeLists.txt @@ -8,6 +8,11 @@ if(APPLE) set(CMAKE_OSX_ARCHITECTURES "arm64;x86_64" CACHE STRING "" FORCE) endif() +#判断FluentUI库类型 +if(FLUENTUI_BUILD_STATIC_LIB) + add_definitions(-DFLUENTUI_BUILD_STATIC_LIB) +endif() + #设置可执行文件输出目录 if(CMAKE_BUILD_TYPE STREQUAL "Debug") set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin/debug) diff --git a/example/src/main.cpp b/example/src/main.cpp index 5bd63650..8c4a09b7 100644 --- a/example/src/main.cpp +++ b/example/src/main.cpp @@ -38,6 +38,9 @@ int main(int argc, char *argv[]) app.setQuitOnLastWindowClosed(false); QQmlApplicationEngine engine; FramelessHelper::Quick::registerTypes(&engine); +#ifdef FLUENTUI_BUILD_STATIC_LIB + engine.addImportPath("qrc:/"); // 让静态资源可以被QML引擎搜索到 +#endif qmlRegisterType("example", 1, 0, "CircularReveal"); appInfo->init(&engine); const QUrl url(QStringLiteral("qrc:/example/qml/App.qml")); diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 36c61543..cc9fe329 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -42,7 +42,7 @@ foreach(filepath ${QML_PATHS}) endforeach(filepath) #遍历所有资源文件 -file(GLOB_RECURSE RES_PATHS *.png *.jpg *.svg *.ico *.ttf *.webp) +file(GLOB_RECURSE RES_PATHS *.png *.jpg *.svg *.ico *.ttf *.webp qmldir) foreach(filepath ${RES_PATHS}) string(REPLACE "${CMAKE_CURRENT_SOURCE_DIR}/" "" filename ${filepath}) list(APPEND resource_files ${filename}) diff --git a/src/imports/FluentUI/qmldir b/src/imports/FluentUI/qmldir index 791ae3e9..fb6ae019 100644 --- a/src/imports/FluentUI/qmldir +++ b/src/imports/FluentUI/qmldir @@ -1,68 +1,83 @@ module FluentUI -FluAppBar 1.0 FluAppBar.qml -FluArea 1.0 FluArea.qml -FluAutoSuggestBox 1.0 FluAutoSuggestBox.qml -FluBadge 1.0 FluBadge.qml -FluBreadcrumbBar 1.0 FluBreadcrumbBar.qml -FluButton 1.0 FluButton.qml -FluCalendarPicker 1.0 FluCalendarPicker.qml -FluCalendarView 1.0 FluCalendarView.qml -FluCarousel 1.0 FluCarousel.qml -FluCheckBox 1.0 FluCheckBox.qml -FluColorPicker 1.0 FluColorPicker.qml -FluColorView 1.0 FluColorView.qml -FluComboBox 1.0 FluComboBox.qml -FluContentDialog 1.0 FluContentDialog.qml -FluContentPage 1.0 FluContentPage.qml -FluDatePicker 1.0 FluDatePicker.qml -FluDivider 1.0 FluDivider.qml -FluDropDownButton 1.0 FluDropDownButton.qml -FluExpander 1.0 FluExpander.qml -FluFilledButton 1.0 FluFilledButton.qml -FluFlipView 1.0 FluFlipView.qml -FluFocusRectangle 1.0 FluFocusRectangle.qml -FluIcon 1.0 FluIcon.qml -FluIconButton 1.0 FluIconButton.qml -FluInfoBar 1.0 FluInfoBar.qml -FluItem 1.0 FluItem.qml -FluMediaPlayer 1.0 FluMediaPlayer.qml -FluMenu 1.0 FluMenu.qml -FluMenuItem 1.0 FluMenuItem.qml -FluMultilineTextBox 1.0 FluMultilineTextBox.qml -FluNavigationView 1.0 FluNavigationView.qml -FluObject 1.0 FluObject.qml -FluPagination 1.0 FluPagination.qml -FluPaneItem 1.0 FluPaneItem.qml -FluPaneItemEmpty 1.0 FluPaneItemEmpty.qml -FluPaneItemExpander 1.0 FluPaneItemExpander.qml -FluPaneItemHeader 1.0 FluPaneItemHeader.qml -FluPaneItemSeparator 1.0 FluPaneItemSeparator.qml -FluPasswordBox 1.0 FluPasswordBox.qml -FluPivot 1.0 FluPivot.qml -FluPivotItem 1.0 FluPivotItem.qml -FluProgressBar 1.0 FluProgressBar.qml -FluProgressRing 1.0 FluProgressRing.qml -FluRadioButton 1.0 FluRadioButton.qml -FluRatingControl 1.0 FluRatingControl.qml -FluRectangle 1.0 FluRectangle.qml -FluScrollablePage 1.0 FluScrollablePage.qml -FluScrollBar 1.0 FluScrollBar.qml -FluShadow 1.0 FluShadow.qml -FluSlider 1.0 FluSlider.qml -FluStatusView 1.0 FluStatusView.qml -FluTableView 1.0 FluTableView.qml -FluTabView 1.0 FluTabView.qml -FluText 1.0 FluText.qml -FluTextBox 1.0 FluTextBox.qml -FluTextBoxBackground 1.0 FluTextBoxBackground.qml -FluTextBoxMenu 1.0 FluTextBoxMenu.qml -FluTextButton 1.0 FluTextButton.qml -FluTimePicker 1.0 FluTimePicker.qml -FluToggleButton 1.0 FluToggleButton.qml -FluToggleSwitch 1.0 FluToggleSwitch.qml -FluTooltip 1.0 FluTooltip.qml -FluTreeView 1.0 FluTreeView.qml -FluWindow 1.0 FluWindow.qml -FluWindowResize 1.0 FluWindowResize.qml -FluSingleton 1.0 FluSingleton.qml +classname FluentUIPlugin +designersupported +typeinfo plugins.qmltypes + +FluAppBar 1.0 Controls/FluAppBar.qml +FluArea 1.0 Controls/FluArea.qml +FluAcrylic 1.0 Controls/FluAcrylic.qml +FluAutoSuggestBox 1.0 Controls/FluAutoSuggestBox.qml +FluBadge 1.0 Controls/FluBadge.qml +FluBreadcrumbBar 1.0 Controls/FluBreadcrumbBar.qml +FluButton 1.0 Controls/FluButton.qml +FluCalendarPicker 1.0 Controls/FluCalendarPicker.qml +FluCalendarView 1.0 Controls/FluCalendarView.qml +FluCarousel 1.0 Controls/FluCarousel.qml +FluCheckBox 1.0 Controls/FluCheckBox.qml +FluColorPicker 1.0 Controls/FluColorPicker.qml +FluColorView 1.0 Controls/FluColorView.qml +FluComboBox 1.0 Controls/FluComboBox.qml +FluControl 1.0 Controls/FluControl.qml +FluContentDialog 1.0 Controls/FluContentDialog.qml +FluContentPage 1.0 Controls/FluContentPage.qml +FluCopyableText 1.0 Controls/FluCopyableText.qml +FluDatePicker 1.0 Controls/FluDatePicker.qml +FluDivider 1.0 Controls/FluDivider.qml +FluDropDownButton 1.0 Controls/FluDropDownButton.qml +FluExpander 1.0 Controls/FluExpander.qml +FluFilledButton 1.0 Controls/FluFilledButton.qml +FluFlipView 1.0 Controls/FluFlipView.qml +FluFocusRectangle 1.0 Controls/FluFocusRectangle.qml +FluIcon 1.0 Controls/FluIcon.qml +FluIconButton 1.0 Controls/FluIconButton.qml +FluInfoBar 1.0 Controls/FluInfoBar.qml +FluItem 1.0 Controls/FluItem.qml +FluImage 1.0 Controls/FluImage.qml +FluMediaPlayer 1.0 Controls/FluMediaPlayer.qml +FluMenu 1.0 Controls/FluMenu.qml +FluMenuItem 1.0 Controls/FluMenuItem.qml +FluMenuSeparator 1.0 Controls/FluMenuSeparator.qml +FluMenuBar 1.0 Controls/FluMenuBar.qml +FluMenuBarItem 1.0 Controls/FluMenuBarItem.qml +FluMultilineTextBox 1.0 Controls/FluMultilineTextBox.qml +FluNavigationView 1.0 Controls/FluNavigationView.qml +FluObject 1.0 Controls/FluObject.qml +FluPage 1.0 Controls/FluPage.qml +FluPagination 1.0 Controls/FluPagination.qml +FluPaneItem 1.0 Controls/FluPaneItem.qml +FluPaneItemEmpty 1.0 Controls/FluPaneItemEmpty.qml +FluPaneItemExpander 1.0 Controls/FluPaneItemExpander.qml +FluPaneItemHeader 1.0 Controls/FluPaneItemHeader.qml +FluPaneItemSeparator 1.0 Controls/FluPaneItemSeparator.qml +FluPasswordBox 1.0 Controls/FluPasswordBox.qml +FluPivot 1.0 Controls/FluPivot.qml +FluPivotItem 1.0 Controls/FluPivotItem.qml +FluPopup 1.0 Controls/FluPopup.qml +FluProgressBar 1.0 Controls/FluProgressBar.qml +FluProgressRing 1.0 Controls/FluProgressRing.qml +FluRadioButton 1.0 Controls/FluRadioButton.qml +FluRadioButtons 1.0 Controls/FluRadioButtons.qml +FluRatingControl 1.0 Controls/FluRatingControl.qml +FluRectangle 1.0 Controls/FluRectangle.qml +FluRemoteLoader 1.0 Controls/FluRemoteLoader.qml +FluScrollablePage 1.0 Controls/FluScrollablePage.qml +FluScrollBar 1.0 Controls/FluScrollBar.qml +FluShadow 1.0 Controls/FluShadow.qml +FluSlider 1.0 Controls/FluSlider.qml +FluSpinBox 1.0 Controls/FluSpinBox.qml +FluStatusView 1.0 Controls/FluStatusView.qml +FluTableView 1.0 Controls/FluTableView.qml +FluTabView 1.0 Controls/FluTabView.qml +FluText 1.0 Controls/FluText.qml +FluTextBox 1.0 Controls/FluTextBox.qml +FluTextBoxBackground 1.0 Controls/FluTextBoxBackground.qml +FluTextBoxMenu 1.0 Controls/FluTextBoxMenu.qml +FluTextButton 1.0 Controls/FluTextButton.qml +FluTimePicker 1.0 Controls/FluTimePicker.qml +FluToggleButton 1.0 Controls/FluToggleButton.qml +FluToggleSwitch 1.0 Controls/FluToggleSwitch.qml +FluTooltip 1.0 Controls/FluTooltip.qml +FluTreeView 1.0 Controls/FluTreeView.qml +FluWindow 1.0 Controls/FluWindow.qml +FluSingleton 1.0 Controls/FluSingleton.qml plugin fluentuiplugin