mirror of
https://github.com/zhuzichu520/FluentUI.git
synced 2024-11-29 22:55:56 +08:00
update
This commit is contained in:
parent
1464e647d9
commit
0e0a385f2d
@ -307,7 +307,7 @@ void FluFramelessHelper::componentComplete(){
|
|||||||
#endif
|
#endif
|
||||||
int w = _realWidth.read().toInt();
|
int w = _realWidth.read().toInt();
|
||||||
int h = _realHeight.read().toInt()+_appBarHeight.read().toInt();
|
int h = _realHeight.read().toInt()+_appBarHeight.read().toInt();
|
||||||
if(_fixSize.read().toBool()){
|
if(!resizeable()){
|
||||||
window->setMaximumSize(QSize(w,h));
|
window->setMaximumSize(QSize(w,h));
|
||||||
window->setMinimumSize(QSize(w,h));
|
window->setMinimumSize(QSize(w,h));
|
||||||
}
|
}
|
||||||
@ -414,7 +414,7 @@ void FluFramelessHelper::setOriginalPos(QVariant pos){
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool FluFramelessHelper::resizeable(){
|
bool FluFramelessHelper::resizeable(){
|
||||||
return !(window->width() == window->maximumWidth() && window->width() == window->minimumWidth() && window->height() == window->maximumHeight() && window->height() == window->minimumHeight());
|
return !_fixSize.read().toBool();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FluFramelessHelper::_maximized(){
|
bool FluFramelessHelper::_maximized(){
|
||||||
|
@ -240,3 +240,7 @@ bool FluTools::isWindows10OrGreater(){
|
|||||||
return var.toBool();
|
return var.toBool();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int FluTools::getTaskBarHeight(QQuickWindow* window){
|
||||||
|
return window->screen()->geometry().height() - window->screen()->availableGeometry().height();
|
||||||
|
}
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
#include <QFile>
|
#include <QFile>
|
||||||
#include <QColor>
|
#include <QColor>
|
||||||
#include <QtQml/qqml.h>
|
#include <QtQml/qqml.h>
|
||||||
|
#include <QQuickWindow>
|
||||||
#include "singleton.h"
|
#include "singleton.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -54,6 +55,7 @@ public:
|
|||||||
Q_INVOKABLE int windowBuildNumber();
|
Q_INVOKABLE int windowBuildNumber();
|
||||||
Q_INVOKABLE bool isWindows11OrGreater();
|
Q_INVOKABLE bool isWindows11OrGreater();
|
||||||
Q_INVOKABLE bool isWindows10OrGreater();
|
Q_INVOKABLE bool isWindows10OrGreater();
|
||||||
|
Q_INVOKABLE int getTaskBarHeight(QQuickWindow* window);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // FLUTOOLS_H
|
#endif // FLUTOOLS_H
|
||||||
|
@ -69,14 +69,14 @@ Window {
|
|||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
_realHeight = height
|
_realHeight = height
|
||||||
_realWidth = width
|
_realWidth = width
|
||||||
|
lifecycle.onCompleted(window)
|
||||||
|
initArgument(argument)
|
||||||
moveWindowToDesktopCenter()
|
moveWindowToDesktopCenter()
|
||||||
fixWindowSize()
|
fixWindowSize()
|
||||||
useSystemAppBar = FluApp.useSystemAppBar
|
useSystemAppBar = FluApp.useSystemAppBar
|
||||||
if(!useSystemAppBar){
|
if(!useSystemAppBar){
|
||||||
loader_frameless_helper.sourceComponent = com_frameless
|
loader_frameless_helper.sourceComponent = com_frameless_helper
|
||||||
}
|
}
|
||||||
lifecycle.onCompleted(window)
|
|
||||||
initArgument(argument)
|
|
||||||
if(window.autoMaximize){
|
if(window.autoMaximize){
|
||||||
window.showMaximized()
|
window.showMaximized()
|
||||||
}else{
|
}else{
|
||||||
@ -120,7 +120,7 @@ Window {
|
|||||||
function onClosing(event){closeListener(event)}
|
function onClosing(event){closeListener(event)}
|
||||||
}
|
}
|
||||||
Component{
|
Component{
|
||||||
id:com_frameless
|
id:com_frameless_helper
|
||||||
FluFramelessHelper{
|
FluFramelessHelper{
|
||||||
onLoadCompleted:{
|
onLoadCompleted:{
|
||||||
window.moveWindowToDesktopCenter()
|
window.moveWindowToDesktopCenter()
|
||||||
@ -305,7 +305,8 @@ Window {
|
|||||||
}
|
}
|
||||||
function moveWindowToDesktopCenter(){
|
function moveWindowToDesktopCenter(){
|
||||||
screen = Qt.application.screens[FluTools.cursorScreenIndex()]
|
screen = Qt.application.screens[FluTools.cursorScreenIndex()]
|
||||||
window.setGeometry((Screen.width-window.width)/2+Screen.virtualX,(Screen.height-window.height)/2+Screen.virtualY,window.width,window.height)
|
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)
|
||||||
}
|
}
|
||||||
function fixWindowSize(){
|
function fixWindowSize(){
|
||||||
if(fixSize){
|
if(fixSize){
|
||||||
|
@ -68,14 +68,14 @@ Window {
|
|||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
_realHeight = height
|
_realHeight = height
|
||||||
_realWidth = width
|
_realWidth = width
|
||||||
|
lifecycle.onCompleted(window)
|
||||||
|
initArgument(argument)
|
||||||
moveWindowToDesktopCenter()
|
moveWindowToDesktopCenter()
|
||||||
fixWindowSize()
|
fixWindowSize()
|
||||||
useSystemAppBar = FluApp.useSystemAppBar
|
useSystemAppBar = FluApp.useSystemAppBar
|
||||||
if(!useSystemAppBar){
|
if(!useSystemAppBar){
|
||||||
loader_frameless_helper.sourceComponent = com_frameless
|
loader_frameless_helper.sourceComponent = com_frameless_helper
|
||||||
}
|
}
|
||||||
lifecycle.onCompleted(window)
|
|
||||||
initArgument(argument)
|
|
||||||
if(window.autoMaximize){
|
if(window.autoMaximize){
|
||||||
window.showMaximized()
|
window.showMaximized()
|
||||||
}else{
|
}else{
|
||||||
@ -119,7 +119,7 @@ Window {
|
|||||||
function onClosing(event){closeListener(event)}
|
function onClosing(event){closeListener(event)}
|
||||||
}
|
}
|
||||||
Component{
|
Component{
|
||||||
id:com_frameless
|
id:com_frameless_helper
|
||||||
FluFramelessHelper{
|
FluFramelessHelper{
|
||||||
onLoadCompleted:{
|
onLoadCompleted:{
|
||||||
window.moveWindowToDesktopCenter()
|
window.moveWindowToDesktopCenter()
|
||||||
@ -304,7 +304,8 @@ Window {
|
|||||||
}
|
}
|
||||||
function moveWindowToDesktopCenter(){
|
function moveWindowToDesktopCenter(){
|
||||||
screen = Qt.application.screens[FluTools.cursorScreenIndex()]
|
screen = Qt.application.screens[FluTools.cursorScreenIndex()]
|
||||||
window.setGeometry((Screen.width-window.width)/2+Screen.virtualX,(Screen.height-window.height)/2+Screen.virtualY,window.width,window.height)
|
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)
|
||||||
}
|
}
|
||||||
function fixWindowSize(){
|
function fixWindowSize(){
|
||||||
if(fixSize){
|
if(fixSize){
|
||||||
|
Loading…
Reference in New Issue
Block a user