mirror of
https://github.com/zhuzichu520/FluentUI.git
synced 2024-12-02 07:43:00 +08:00
update
This commit is contained in:
parent
0b7358af41
commit
1c67f2a41b
@ -179,3 +179,18 @@ qint64 FluTools::currentTimestamp(){
|
|||||||
QIcon FluTools::windowIcon(){
|
QIcon FluTools::windowIcon(){
|
||||||
return QGuiApplication::windowIcon();
|
return QGuiApplication::windowIcon();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int FluTools::cursorScreenIndex(){
|
||||||
|
int screenIndex = 0;
|
||||||
|
int screenCount = qApp->screens().count();
|
||||||
|
if (screenCount > 1) {
|
||||||
|
QPoint pos = QCursor::pos();
|
||||||
|
for (int i = 0; i < screenCount; ++i) {
|
||||||
|
if (qApp->screens().at(i)->geometry().contains(pos)) {
|
||||||
|
screenIndex = i;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return screenIndex;
|
||||||
|
}
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
#include <QFile>
|
#include <QFile>
|
||||||
#include <QColor>
|
#include <QColor>
|
||||||
#include <QtQml/qqml.h>
|
#include <QtQml/qqml.h>
|
||||||
|
#include <QScreen>
|
||||||
#include "singleton.h"
|
#include "singleton.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -50,6 +51,7 @@ public:
|
|||||||
Q_INVOKABLE qint64 currentTimestamp();
|
Q_INVOKABLE qint64 currentTimestamp();
|
||||||
Q_INVOKABLE QPoint cursorPos();
|
Q_INVOKABLE QPoint cursorPos();
|
||||||
Q_INVOKABLE QIcon windowIcon();
|
Q_INVOKABLE QIcon windowIcon();
|
||||||
|
Q_INVOKABLE int cursorScreenIndex();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // FLUTOOLS_H
|
#endif // FLUTOOLS_H
|
||||||
|
@ -53,19 +53,15 @@ Window {
|
|||||||
signal initArgument(var argument)
|
signal initArgument(var argument)
|
||||||
signal firstVisible()
|
signal firstVisible()
|
||||||
id:window
|
id:window
|
||||||
maximumWidth: fixSize ? width : 16777215
|
|
||||||
maximumHeight: fixSize ? height : 16777215
|
|
||||||
minimumWidth: fixSize ? width : 0
|
|
||||||
minimumHeight: fixSize ? height : 0
|
|
||||||
color:"transparent"
|
color:"transparent"
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
|
moveWindowToDesktopCenter()
|
||||||
useSystemAppBar = FluApp.useSystemAppBar
|
useSystemAppBar = FluApp.useSystemAppBar
|
||||||
if(!useSystemAppBar){
|
if(!useSystemAppBar){
|
||||||
loader_frameless.sourceComponent = com_frameless
|
loader_frameless.sourceComponent = com_frameless
|
||||||
}
|
}
|
||||||
lifecycle.onCompleted(window)
|
lifecycle.onCompleted(window)
|
||||||
initArgument(argument)
|
initArgument(argument)
|
||||||
moveWindowToDesktopCenter()
|
|
||||||
if(window.autoMaximize){
|
if(window.autoMaximize){
|
||||||
window.showMaximized()
|
window.showMaximized()
|
||||||
}else{
|
}else{
|
||||||
@ -286,7 +282,12 @@ Window {
|
|||||||
return lifecycle.createRegister(window,path)
|
return lifecycle.createRegister(window,path)
|
||||||
}
|
}
|
||||||
function moveWindowToDesktopCenter(){
|
function moveWindowToDesktopCenter(){
|
||||||
|
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)
|
window.setGeometry((Screen.width-window.width)/2+Screen.virtualX,(Screen.height-window.height)/2+Screen.virtualY,window.width,window.height)
|
||||||
|
maximumWidth = fixSize ? width : 16777215
|
||||||
|
maximumHeight = fixSize ? height : 16777215
|
||||||
|
minimumWidth = fixSize ? width : 0
|
||||||
|
minimumHeight = fixSize ? height : 0
|
||||||
}
|
}
|
||||||
function onResult(data){
|
function onResult(data){
|
||||||
if(_pageRegister){
|
if(_pageRegister){
|
||||||
|
@ -52,19 +52,15 @@ Window {
|
|||||||
signal initArgument(var argument)
|
signal initArgument(var argument)
|
||||||
signal firstVisible()
|
signal firstVisible()
|
||||||
id:window
|
id:window
|
||||||
maximumWidth: fixSize ? width : 16777215
|
|
||||||
maximumHeight: fixSize ? height : 16777215
|
|
||||||
minimumWidth: fixSize ? width : 0
|
|
||||||
minimumHeight: fixSize ? height : 0
|
|
||||||
color:"transparent"
|
color:"transparent"
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
|
moveWindowToDesktopCenter()
|
||||||
useSystemAppBar = FluApp.useSystemAppBar
|
useSystemAppBar = FluApp.useSystemAppBar
|
||||||
if(!useSystemAppBar){
|
if(!useSystemAppBar){
|
||||||
loader_frameless.sourceComponent = com_frameless
|
loader_frameless.sourceComponent = com_frameless
|
||||||
}
|
}
|
||||||
lifecycle.onCompleted(window)
|
lifecycle.onCompleted(window)
|
||||||
initArgument(argument)
|
initArgument(argument)
|
||||||
moveWindowToDesktopCenter()
|
|
||||||
if(window.autoMaximize){
|
if(window.autoMaximize){
|
||||||
window.showMaximized()
|
window.showMaximized()
|
||||||
}else{
|
}else{
|
||||||
@ -285,7 +281,12 @@ Window {
|
|||||||
return lifecycle.createRegister(window,path)
|
return lifecycle.createRegister(window,path)
|
||||||
}
|
}
|
||||||
function moveWindowToDesktopCenter(){
|
function moveWindowToDesktopCenter(){
|
||||||
|
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)
|
window.setGeometry((Screen.width-window.width)/2+Screen.virtualX,(Screen.height-window.height)/2+Screen.virtualY,window.width,window.height)
|
||||||
|
maximumWidth = fixSize ? width : 16777215
|
||||||
|
maximumHeight = fixSize ? height : 16777215
|
||||||
|
minimumWidth = fixSize ? width : 0
|
||||||
|
minimumHeight = fixSize ? height : 0
|
||||||
}
|
}
|
||||||
function onResult(data){
|
function onResult(data){
|
||||||
if(_pageRegister){
|
if(_pageRegister){
|
||||||
|
Loading…
Reference in New Issue
Block a user