Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
朱子楚\zhuzi committed Mar 12, 2024
1 parent 80f8f5f commit e11f1a1
Show file tree
Hide file tree
Showing 12 changed files with 78 additions and 40 deletions.
2 changes: 1 addition & 1 deletion example/qml-Qt6/page/T_Theme.qml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ FluScrollablePage{
height: 42
radius: 4
color: mouse_item.containsMouse ? Qt.lighter(modelData.normal,1.1) : modelData.normal
border.color: modelData.darkest
border.color: modelData.darker
FluIcon {
anchors.centerIn: parent
iconSource: FluentIcons.AcceptMedium
Expand Down
1 change: 0 additions & 1 deletion example/qml-Qt6/window/MainWindow.qml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ FluWindow {
fitsAppBarWindows: true
appBar: FluAppBar {
height: 30
darkText: qsTr("Dark Mode")
showDark: true
darkClickListener:(button)=>handleDarkChanged(button)
closeClickListener: ()=>{dialog_close.open()}
Expand Down
2 changes: 1 addition & 1 deletion example/qml/page/T_Theme.qml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ FluScrollablePage{
height: 42
radius: 4
color: mouse_item.containsMouse ? Qt.lighter(modelData.normal,1.1) : modelData.normal
border.color: modelData.darkest
border.color: modelData.darker
FluIcon {
anchors.centerIn: parent
iconSource: FluentIcons.AcceptMedium
Expand Down
1 change: 0 additions & 1 deletion example/qml/window/MainWindow.qml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ FluWindow {
fitsAppBarWindows: true
appBar: FluAppBar {
height: 30
darkText: qsTr("Dark Mode")
showDark: true
darkClickListener:(button)=>handleDarkChanged(button)
closeClickListener: ()=>{dialog_close.open()}
Expand Down
1 change: 1 addition & 0 deletions src/FluFramelessHelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@ bool FramelessEventFilter::nativeEventFilter(const QByteArray &eventType, void *
minmaxInfo->ptMaxSize.x = geometry.width()*pixelRatio + offsetXY.x() * 2;
minmaxInfo->ptMaxSize.y = geometry.height()*pixelRatio + offsetXY.y() * 2;
#endif
return false;
}else if(uMsg == WM_NCRBUTTONDOWN){
if (wParam == HTCAPTION) {
_helper->showSystemMenu(QCursor::pos());
Expand Down
4 changes: 2 additions & 2 deletions src/FluTools.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,6 @@ bool FluTools::isWindows10OrGreater(){
}
}

int FluTools::getTaskBarHeight(QQuickWindow* window){
return window->screen()->geometry().height() - window->screen()->availableGeometry().height();
QRect FluTools::desktopAvailableGeometry(QQuickWindow* window){
return window->screen()->availableGeometry();
}
2 changes: 1 addition & 1 deletion src/FluTools.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class FluTools : public QObject
Q_INVOKABLE int windowBuildNumber();
Q_INVOKABLE bool isWindows11OrGreater();
Q_INVOKABLE bool isWindows10OrGreater();
Q_INVOKABLE int getTaskBarHeight(QQuickWindow* window);
Q_INVOKABLE QRect desktopAvailableGeometry(QQuickWindow* window);
};

#endif // FLUTOOLS_H
41 changes: 30 additions & 11 deletions src/Qt5/imports/FluentUI/Controls/FluAppBar.qml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ import FluentUI 1.0

Rectangle{
property string title: ""
property string darkText : "夜间模式"
property string darkText : "深色"
property string lightText : "浅色"
property string minimizeText : "最小化"
property string restoreText : "向下还原"
property string maximizeText : "最大化"
Expand Down Expand Up @@ -199,24 +200,33 @@ Rectangle{
Component.onCompleted: {
setHitTestVisible(layout_row)
}
FluToggleSwitch{
FluIconButton{
id:btn_dark
Layout.preferredWidth: 40
Layout.preferredHeight: 30
padding: 0
verticalPadding: 0
horizontalPadding: 0
rightPadding: 2
iconSource: FluTheme.dark ? FluentIcons.Brightness : FluentIcons.QuietHours
Layout.alignment: Qt.AlignVCenter
Layout.rightMargin: 5
iconSize: 15
visible: showDark
text:darkText
textColor:control.textColor
checked: FluTheme.dark
textRight: false
clickListener:()=> darkClickListener(btn_dark)
text: FluTheme.dark ? control.lightText : control.darkText
radius: 0
iconColor:control.textColor
onClicked:()=> darkClickListener(btn_dark)
}
FluIconButton{
id:btn_stay_top
Layout.preferredWidth: 40
Layout.preferredHeight: 30
padding: 0
verticalPadding: 0
horizontalPadding: 0
iconSource : FluentIcons.Pinned
Layout.alignment: Qt.AlignVCenter
iconSize: 13
iconSize: 14
visible: {
if(!(d.win instanceof FluWindow)){
return false
Expand All @@ -232,6 +242,9 @@ Rectangle{
id:btn_minimize
Layout.preferredWidth: 40
Layout.preferredHeight: 30
padding: 0
verticalPadding: 0
horizontalPadding: 0
iconSource : FluentIcons.ChromeMinimize
Layout.alignment: Qt.AlignVCenter
iconSize: 11
Expand All @@ -251,6 +264,9 @@ Rectangle{
id:btn_maximize
Layout.preferredWidth: 40
Layout.preferredHeight: 30
padding: 0
verticalPadding: 0
horizontalPadding: 0
iconSource : d.isRestore ? FluentIcons.ChromeRestore : FluentIcons.ChromeMaximize
color: {
if(down){
Expand All @@ -271,11 +287,14 @@ Rectangle{
}
FluIconButton{
id:btn_close
Layout.preferredWidth: 40
Layout.preferredHeight: 30
padding: 0
verticalPadding: 0
horizontalPadding: 0
iconSource : FluentIcons.ChromeClose
Layout.alignment: Qt.AlignVCenter
text:closeText
Layout.preferredWidth: 40
Layout.preferredHeight: 30
visible: !isMac && showClose
radius: 0
iconSize: 10
Expand Down
6 changes: 3 additions & 3 deletions src/Qt5/imports/FluentUI/Controls/FluWindow.qml
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ Window {
clip: true
}
FluLoader{
property string loadingText: "加载中..."
property string loadingText
property bool cancel: false
id:loader_loading
anchors.fill: parent
Expand Down Expand Up @@ -290,8 +290,8 @@ Window {
}
function moveWindowToDesktopCenter(){
screen = Qt.application.screens[FluTools.cursorScreenIndex()]
var taskBarHeight = FluTools.getTaskBarHeight(window)
window.setGeometry((Screen.width-window.width)/2+Screen.virtualX,(Screen.height-window.height-taskBarHeight)/2+Screen.virtualY,window.width,window.height)
var availableGeometry = FluTools.desktopAvailableGeometry(window)
window.setGeometry((availableGeometry.width-window.width)/2+Screen.virtualX,(availableGeometry.height-window.height)/2+Screen.virtualY,window.width,window.height)
}
function fixWindowSize(){
if(fixSize){
Expand Down
11 changes: 6 additions & 5 deletions src/Qt5/imports/FluentUI/plugins.qmltypes
Original file line number Diff line number Diff line change
Expand Up @@ -2322,6 +2322,7 @@ Module {
defaultProperty: "data"
Property { name: "title"; type: "string" }
Property { name: "darkText"; type: "string" }
Property { name: "lightText"; type: "string" }
Property { name: "minimizeText"; type: "string" }
Property { name: "restoreText"; type: "string" }
Property { name: "maximizeText"; type: "string" }
Expand Down Expand Up @@ -2381,7 +2382,7 @@ Module {
}
Property {
name: "buttonDark"
type: "FluToggleSwitch_QMLTYPE_22"
type: "FluIconButton_QMLTYPE_17"
isReadonly: true
isPointer: true
}
Expand Down Expand Up @@ -3052,15 +3053,15 @@ Module {
defaultProperty: "data"
Property { name: "logo"; type: "QUrl" }
Property { name: "title"; type: "string" }
Property { name: "items"; type: "FluObject_QMLTYPE_157"; isPointer: true }
Property { name: "footerItems"; type: "FluObject_QMLTYPE_157"; isPointer: true }
Property { name: "items"; type: "FluObject_QMLTYPE_129"; isPointer: true }
Property { name: "footerItems"; type: "FluObject_QMLTYPE_129"; isPointer: true }
Property { name: "displayMode"; type: "int" }
Property { name: "autoSuggestBox"; type: "QQmlComponent"; isPointer: true }
Property { name: "actionItem"; type: "QQmlComponent"; isPointer: true }
Property { name: "topPadding"; type: "int" }
Property { name: "pageMode"; type: "int" }
Property { name: "navItemRightMenu"; type: "FluMenu_QMLTYPE_47"; isPointer: true }
Property { name: "navItemExpanderRightMenu"; type: "FluMenu_QMLTYPE_47"; isPointer: true }
Property { name: "navItemRightMenu"; type: "FluMenu_QMLTYPE_31"; isPointer: true }
Property { name: "navItemExpanderRightMenu"; type: "FluMenu_QMLTYPE_31"; isPointer: true }
Property { name: "navCompactWidth"; type: "int" }
Property { name: "navTopMargin"; type: "int" }
Property { name: "cellHeight"; type: "int" }
Expand Down
41 changes: 30 additions & 11 deletions src/Qt6/imports/FluentUI/Controls/FluAppBar.qml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ import FluentUI

Rectangle{
property string title: ""
property string darkText : "夜间模式"
property string darkText : "深色"
property string lightText : "浅色"
property string minimizeText : "最小化"
property string restoreText : "向下还原"
property string maximizeText : "最大化"
Expand Down Expand Up @@ -199,24 +200,33 @@ Rectangle{
Component.onCompleted: {
setHitTestVisible(layout_row)
}
FluToggleSwitch{
FluIconButton{
id:btn_dark
Layout.preferredWidth: 40
Layout.preferredHeight: 30
padding: 0
verticalPadding: 0
horizontalPadding: 0
rightPadding: 2
iconSource: FluTheme.dark ? FluentIcons.Brightness : FluentIcons.QuietHours
Layout.alignment: Qt.AlignVCenter
Layout.rightMargin: 5
iconSize: 15
visible: showDark
text:darkText
textColor:control.textColor
checked: FluTheme.dark
textRight: false
clickListener:()=> darkClickListener(btn_dark)
text: FluTheme.dark ? control.lightText : control.darkText
radius: 0
iconColor:control.textColor
onClicked:()=> darkClickListener(btn_dark)
}
FluIconButton{
id:btn_stay_top
Layout.preferredWidth: 40
Layout.preferredHeight: 30
padding: 0
verticalPadding: 0
horizontalPadding: 0
iconSource : FluentIcons.Pinned
Layout.alignment: Qt.AlignVCenter
iconSize: 13
iconSize: 14
visible: {
if(!(d.win instanceof FluWindow)){
return false
Expand All @@ -232,6 +242,9 @@ Rectangle{
id:btn_minimize
Layout.preferredWidth: 40
Layout.preferredHeight: 30
padding: 0
verticalPadding: 0
horizontalPadding: 0
iconSource : FluentIcons.ChromeMinimize
Layout.alignment: Qt.AlignVCenter
iconSize: 11
Expand All @@ -251,6 +264,9 @@ Rectangle{
id:btn_maximize
Layout.preferredWidth: 40
Layout.preferredHeight: 30
padding: 0
verticalPadding: 0
horizontalPadding: 0
iconSource : d.isRestore ? FluentIcons.ChromeRestore : FluentIcons.ChromeMaximize
color: {
if(down){
Expand All @@ -271,11 +287,14 @@ Rectangle{
}
FluIconButton{
id:btn_close
Layout.preferredWidth: 40
Layout.preferredHeight: 30
padding: 0
verticalPadding: 0
horizontalPadding: 0
iconSource : FluentIcons.ChromeClose
Layout.alignment: Qt.AlignVCenter
text:closeText
Layout.preferredWidth: 40
Layout.preferredHeight: 30
visible: !isMac && showClose
radius: 0
iconSize: 10
Expand Down
6 changes: 3 additions & 3 deletions src/Qt6/imports/FluentUI/Controls/FluWindow.qml
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ Window {
clip: true
}
FluLoader{
property string loadingText: "加载中..."
property string loadingText
property bool cancel: false
id:loader_loading
anchors.fill: parent
Expand Down Expand Up @@ -289,8 +289,8 @@ Window {
}
function moveWindowToDesktopCenter(){
screen = Qt.application.screens[FluTools.cursorScreenIndex()]
var taskBarHeight = FluTools.getTaskBarHeight(window)
window.setGeometry((Screen.width-window.width)/2+Screen.virtualX,(Screen.height-window.height-taskBarHeight)/2+Screen.virtualY,window.width,window.height)
var availableGeometry = FluTools.desktopAvailableGeometry(window)
window.setGeometry((availableGeometry.width-window.width)/2+Screen.virtualX,(availableGeometry.height-window.height)/2+Screen.virtualY,window.width,window.height)
}
function fixWindowSize(){
if(fixSize){
Expand Down

0 comments on commit e11f1a1

Please sign in to comment.