From 876b2301418476a81e4a91b14f4c4066f57da230 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=B1=E5=AD=90=E6=A5=9A=5Czhuzi?= Date: Mon, 13 May 2024 18:28:28 +0800 Subject: [PATCH] update --- example/qml/window/MainWindow.qml | 6 +++--- example/src/component/OpenGLItem.cpp | 4 +++- src/CMakeLists.txt | 15 +++++++-------- src/FluFrameless.cpp | 6 +++++- .../imports/FluentUI/Controls/FluTableView.qml | 4 ++-- .../imports/FluentUI/Controls/FluTableView.qml | 4 ++-- 6 files changed, 22 insertions(+), 17 deletions(-) diff --git a/example/qml/window/MainWindow.qml b/example/qml/window/MainWindow.qml index a34f1ffe..9e2fa681 100644 --- a/example/qml/window/MainWindow.qml +++ b/example/qml/window/MainWindow.qml @@ -14,9 +14,9 @@ FluWindow { id:window title: "FluentUI" width: 1000 - height: 680 - minimumWidth: 800 - minimumHeight: 200 + height: 668 + minimumWidth: 668 + minimumHeight: 320 launchMode: FluWindowType.SingleTask fitsAppBarWindows: true appBar: FluAppBar { diff --git a/example/src/component/OpenGLItem.cpp b/example/src/component/OpenGLItem.cpp index 58e86d78..4e0f687a 100644 --- a/example/src/component/OpenGLItem.cpp +++ b/example/src/component/OpenGLItem.cpp @@ -2,6 +2,7 @@ #include #include +#include class FBORenderer : public QQuickFramebufferObject::Renderer, protected QOpenGLFunctions { public: @@ -47,6 +48,7 @@ QOpenGLFramebufferObject *FBORenderer::createFramebufferObject(const QSize &size } void FBORenderer::render() { + auto pixelRatio = item->window()->devicePixelRatio(); glClearColor(0.0f, 0.0f, 0.0f, 0.0f); glEnable(GL_DEPTH_TEST); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); @@ -61,7 +63,7 @@ void FBORenderer::render() { glBindBuffer(GL_ARRAY_BUFFER, 0); program.setAttributeArray(0, GL_FLOAT, values, 2); program.setUniformValue("t", (float) item->t()); - glViewport(0, 0, qRound(item->width()), qRound(item->height())); + glViewport(0, 0, qRound(item->width()*pixelRatio), qRound(item->height()*pixelRatio)); glDisable(GL_DEPTH_TEST); glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE); diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 9ae5ad36..c4c40357 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -11,6 +11,13 @@ list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/.cmake/) #配置通用编译 set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED ON) +if (QT_VERSION VERSION_GREATER_EQUAL "6.3") + qt_standard_project_setup() +else () + set(CMAKE_AUTOMOC ON) + set(CMAKE_AUTORCC ON) + set(CMAKE_INCLUDE_CURRENT_DIR ON) +endif () #设置版本号 add_definitions(-DFLUENTUI_VERSION=1,7,5,0) @@ -35,14 +42,6 @@ if (NOT FLUENTUI_QML_PLUGIN_DIRECTORY) set(FLUENTUI_QML_PLUGIN_DIRECTORY ${QT_SDK_DIR}/qml/FluentUI) endif () -if (QT_VERSION VERSION_GREATER_EQUAL "6.3") - qt_standard_project_setup() -else () - set(CMAKE_AUTOMOC ON) - set(CMAKE_AUTORCC ON) - set(CMAKE_INCLUDE_CURRENT_DIR ON) -endif () - #国际化 find_program(QT_LUPDATE NAMES lupdate) find_program(QT_LRELEASE NAMES lrelease) diff --git a/src/FluFrameless.cpp b/src/FluFrameless.cpp index 0cd986f4..64d07563 100644 --- a/src/FluFrameless.cpp +++ b/src/FluFrameless.cpp @@ -131,10 +131,14 @@ void FluFrameless::componentComplete() { setShadow(hwnd); } #endif - h = qRound(h + _appbar->height()); + auto appBarHeight = _appbar->height(); + h = qRound(h + appBarHeight); if (_fixSize) { window()->setMaximumSize(QSize(w, h)); window()->setMinimumSize(QSize(w, h)); + }else{ + window()->setMinimumHeight(window()->minimumHeight()+appBarHeight); + window()->setMaximumHeight(window()->maximumHeight()+appBarHeight); } window()->resize(QSize(w, h)); connect(this, &FluFrameless::topmostChanged, this, [this] { diff --git a/src/Qt5/imports/FluentUI/Controls/FluTableView.qml b/src/Qt5/imports/FluentUI/Controls/FluTableView.qml index 7843fc6f..681200aa 100644 --- a/src/Qt5/imports/FluentUI/Controls/FluTableView.qml +++ b/src/Qt5/imports/FluentUI/Controls/FluTableView.qml @@ -499,8 +499,8 @@ Rectangle { } readonly property bool isHeaderHorizontal: TableView.view == header_horizontal readonly property bool isHide: { - if(isHeaderHorizontal && columnModel.frozen){ - return true + if(isHeaderHorizontal){ + return false } if(!isHeaderHorizontal){ if(currentTableView.dataIndex !== columnModel.dataIndex) diff --git a/src/Qt6/imports/FluentUI/Controls/FluTableView.qml b/src/Qt6/imports/FluentUI/Controls/FluTableView.qml index 01ae9f0a..7efea849 100644 --- a/src/Qt6/imports/FluentUI/Controls/FluTableView.qml +++ b/src/Qt6/imports/FluentUI/Controls/FluTableView.qml @@ -499,8 +499,8 @@ Rectangle { } readonly property bool isHeaderHorizontal: TableView.view == header_horizontal readonly property bool isHide: { - if(isHeaderHorizontal && columnModel.frozen){ - return true + if(isHeaderHorizontal){ + return false } if(!isHeaderHorizontal){ if(currentTableView.dataIndex !== columnModel.dataIndex)