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...
-
+
-
+
-
+
-
+
-
-
+
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
-
+
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...
表格
-
+
修改列名
-
+
取消
-
+
确定
-
+
搜索
-
-
+
+
名称
-
+
删除
-
+
编辑
-
+
全选
-
+
年龄
-
+
清除所有
-
+
插入一行
-
+
焦点未获取:请点击表格中的任意一项,作为插入的靶点!
-
+
头像
-
+
地址
-
+
昵称
-
+
长字符串
-
+
操作
-
+
<上一页
-
+
下一页>
-
+
删除选中
-
+
添加一行数据
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)
+ }
}