diff --git a/example/example_en_US.ts b/example/example_en_US.ts index 8eb7b8d9..109d1894 100644 --- a/example/example_en_US.ts +++ b/example/example_en_US.ts @@ -2043,108 +2043,108 @@ Some contents... - + Modify the column name - + Cancel - + OK - + Search - - + + Name - + Delete - + Edit - + Select All - + Age - + Clear All - + Delete Selection - + Add a row of Data - + Insert a Row - + Focus not acquired: Please click any item in the form as the target for insertion! - + Avatar - + Address - + Nickname - + Long String - + Options - + <Previous - + Next> diff --git a/example/example_zh_CN.ts b/example/example_zh_CN.ts index bd23e4ad..3776583c 100644 --- a/example/example_zh_CN.ts +++ b/example/example_zh_CN.ts @@ -2193,108 +2193,108 @@ Some contents... 表格 - + Modify the column name 修改列名 - + Cancel 取消 - + OK 确定 - + Search 搜索 - - + + Name 名称 - + Delete 删除 - + Edit 编辑 - + Select All 全选 - + Age 年龄 - + Clear All 清除所有 - + Insert a Row 插入一行 - + Focus not acquired: Please click any item in the form as the target for insertion! 焦点未获取:请点击表格中的任意一项,作为插入的靶点! - + Avatar 头像 - + Address 地址 - + Nickname 昵称 - + Long String 长字符串 - + Options 操作 - + <Previous <上一页 - + Next> 下一页> - + Delete Selection 删除选中 - + Add a row of Data 添加一行数据 diff --git a/example/qml/page/T_ShortcutPicker.qml b/example/qml/page/T_ShortcutPicker.qml index 8e5f8f0a..fce03284 100644 --- a/example/qml/page/T_ShortcutPicker.qml +++ b/example/qml/page/T_ShortcutPicker.qml @@ -40,5 +40,3 @@ FluScrollablePage{ } } - - diff --git a/example/qml/page/T_TableView.qml b/example/qml/page/T_TableView.qml index 9f696693..dc4ae88a 100644 --- a/example/qml/page/T_TableView.qml +++ b/example/qml/page/T_TableView.qml @@ -11,7 +11,6 @@ FluContentPage{ title: qsTr("TableView") signal checkBoxChanged - property var dataSource : [] property int sortType: 0 property bool selectedAll: true property string nameKeyword: "" @@ -621,7 +620,6 @@ FluContentPage{ for(var i=0;isetMaximumSize(QSize(w, h)); window()->setMinimumSize(QSize(w, h)); - }else{ - window()->setMinimumHeight(window()->minimumHeight()+appBarHeight); - window()->setMaximumHeight(window()->maximumHeight()+appBarHeight); + } else { + window()->setMinimumHeight(window()->minimumHeight() + appBarHeight); + window()->setMaximumHeight(window()->maximumHeight() + appBarHeight); } window()->resize(QSize(w, h)); connect(this, &FluFrameless::topmostChanged, this, [this] { @@ -192,8 +192,8 @@ void FluFrameless::componentComplete() { bool isMaximum = ::IsZoomed(hwnd); if (isMaximum) { auto geometry = window()->screen()->geometry(); - auto offsetX = qAbs(geometry.left()-originalLeft); - auto offsetY = qAbs(geometry.top()-originalTop); + auto offsetX = qAbs(geometry.left() - originalLeft); + auto offsetY = qAbs(geometry.top() - originalTop); clientRect->top = originalTop + offsetY; clientRect->bottom = originalBottom - offsetY; clientRect->left = originalLeft + offsetX; @@ -273,16 +273,8 @@ void FluFrameless::componentComplete() { return true; #endif } else if (uMsg == WM_NCACTIVATE) { -#if (QT_VERSION == QT_VERSION_CHECK(6, 5, 3) || QT_VERSION == QT_VERSION_CHECK(6, 6, 0)) *result = TRUE; return true; -#else - if (isCompositionEnabled()) { - return false; - } - *result = TRUE; - return true; -#endif } else if (uMsg == WM_GETMINMAXINFO) { #if (QT_VERSION == QT_VERSION_CHECK(6, 5, 3) || QT_VERSION == QT_VERSION_CHECK(6, 6, 0)) auto *minmaxInfo = reinterpret_cast(lParam); @@ -406,13 +398,13 @@ bool FluFrameless::_hitMaximizeButton() { } void FluFrameless::_setMaximizePressed(bool val) { - if(_maximizeButton){ + if (_maximizeButton) { _maximizeButton->setProperty("down", val); } } void FluFrameless::_setMaximizeHovered(bool val) { - if(_maximizeButton){ + if (_maximizeButton) { _maximizeButton->setProperty("hover", val); } } diff --git a/src/FluentUI.cpp b/src/FluentUI.cpp index 7646fbe4..aa0842a2 100644 --- a/src/FluentUI.cpp +++ b/src/FluentUI.cpp @@ -150,20 +150,35 @@ void FluentUI::registerTypes(const char *uri) const { qmlRegisterUncreatableMetaObject(FluTimelineType::staticMetaObject, uri, major, minor, "FluTimelineType", "Access to enums & flags only"); qmlRegisterUncreatableMetaObject(FluSheetType::staticMetaObject, uri, major, minor, "FluSheetType", "Access to enums & flags only"); + qmlRegisterSingletonType(uri, major, minor, "FluApp", [](QQmlEngine *engine, QJSEngine *scriptEngine) -> QJSValue { + Q_UNUSED(engine) + return scriptEngine->newQObject(FluApp::getInstance()); + }); + qmlRegisterSingletonType(uri, major, minor, "FluColors", [](QQmlEngine *engine, QJSEngine *scriptEngine) -> QJSValue { + Q_UNUSED(engine) + return scriptEngine->newQObject(FluColors::getInstance()); + }); + qmlRegisterSingletonType(uri, major, minor, "FluTheme", [](QQmlEngine *engine, QJSEngine *scriptEngine) -> QJSValue { + Q_UNUSED(engine) + return scriptEngine->newQObject(FluTheme::getInstance()); + }); + qmlRegisterSingletonType(uri, major, minor, "FluTools", [](QQmlEngine *engine, QJSEngine *scriptEngine) -> QJSValue { + Q_UNUSED(engine) + return scriptEngine->newQObject(FluTools::getInstance()); + }); + qmlRegisterSingletonType(uri, major, minor, "FluTextStyle", [](QQmlEngine *engine, QJSEngine *scriptEngine) -> QJSValue { + Q_UNUSED(engine) + return scriptEngine->newQObject(FluTextStyle::getInstance()); + }); // qmlRegisterSingletonInstance(uri, major, minor, "FluApp", FluApp::getInstance()); // qmlRegisterSingletonInstance(uri, major, minor, "FluColors", FluColors::getInstance()); // qmlRegisterSingletonInstance(uri, major, minor, "FluTheme", FluTheme::getInstance()); // qmlRegisterSingletonInstance(uri, major, minor, "FluTools", FluTools::getInstance()); // qmlRegisterSingletonInstance(uri, major, minor, "FluTextStyle", FluTextStyle::getInstance()); - qmlRegisterModule(uri, major, minor); #endif } void FluentUI::initializeEngine(QQmlEngine *engine, [[maybe_unused]] const char *uri) { - engine->rootContext()->setContextProperty("FluApp", FluApp::getInstance()); - engine->rootContext()->setContextProperty("FluColors", FluColors::getInstance()); - engine->rootContext()->setContextProperty("FluTheme", FluTheme::getInstance()); - engine->rootContext()->setContextProperty("FluTools", FluTools::getInstance()); - engine->rootContext()->setContextProperty("FluTextStyle", FluTextStyle::getInstance()); + Q_UNUSED(engine) } diff --git a/src/Qt5/imports/FluentUI/Controls/FluRouter.qml b/src/Qt5/imports/FluentUI/Controls/FluRouter.qml index 1687fd98..7ed2e551 100644 --- a/src/Qt5/imports/FluentUI/Controls/FluRouter.qml +++ b/src/Qt5/imports/FluentUI/Controls/FluRouter.qml @@ -10,19 +10,19 @@ QtObject { windows.push(window) } } - function removeWindow(window) { - if(!window.transientParent){ - var index = windows.indexOf(window) + function removeWindow(win) { + if(!win.transientParent){ + var index = windows.indexOf(win) if (index !== -1) { windows.splice(index, 1) - FluTools.deleteLater(window) + win.deleteLater() } } } function exit(retCode){ for(var i =0 ;i< windows.length; i++){ - var item = windows[i] - FluTools.deleteLater(item) + var win = windows[i] + win.deleteLater() } windows = [] Qt.exit(retCode) diff --git a/src/Qt5/imports/FluentUI/Controls/FluWindow.qml b/src/Qt5/imports/FluentUI/Controls/FluWindow.qml index 036e82e2..1905e5d3 100644 --- a/src/Qt5/imports/FluentUI/Controls/FluWindow.qml +++ b/src/Qt5/imports/FluentUI/Controls/FluWindow.qml @@ -353,4 +353,7 @@ Window { function setHitTestVisible(val){ frameless.setHitTestVisible(val) } + function deleteLater(){ + FluTools.deleteLater(window) + } } diff --git a/src/Qt6/imports/FluentUI/Controls/FluRouter.qml b/src/Qt6/imports/FluentUI/Controls/FluRouter.qml index a9be78fb..f1e0ee86 100644 --- a/src/Qt6/imports/FluentUI/Controls/FluRouter.qml +++ b/src/Qt6/imports/FluentUI/Controls/FluRouter.qml @@ -11,19 +11,19 @@ QtObject { windows.push(window) } } - function removeWindow(window) { - if(!window.transientParent){ - var index = windows.indexOf(window) + function removeWindow(win) { + if(!win.transientParent){ + var index = windows.indexOf(win) if (index !== -1) { windows.splice(index, 1) - FluTools.deleteLater(window) + win.deleteLater() } } } function exit(retCode){ for(var i =0 ;i< windows.length; i++){ - var item = windows[i] - FluTools.deleteLater(item) + var win = windows[i] + win.deleteLater() } windows = [] Qt.exit(retCode) @@ -56,9 +56,7 @@ QtObject { var launchMode = win.launchMode if(launchMode === 1){ win.argument = argument - if(!win.visible){ - win.visible = true - } + win.show() win.raise() win.requestActivate() return diff --git a/src/Qt6/imports/FluentUI/Controls/FluWindow.qml b/src/Qt6/imports/FluentUI/Controls/FluWindow.qml index d2c8fa90..a760cb21 100644 --- a/src/Qt6/imports/FluentUI/Controls/FluWindow.qml +++ b/src/Qt6/imports/FluentUI/Controls/FluWindow.qml @@ -352,4 +352,7 @@ Window { function setHitTestVisible(val){ frameless.setHitTestVisible(val) } + function deleteLater(){ + FluTools.deleteLater(window) + } }