mirror of
https://github.com/zhuzichu520/FluentUI.git
synced 2024-11-26 21:37:04 +08:00
update
This commit is contained in:
parent
7d7cd4144c
commit
a89d36fd14
@ -94,6 +94,8 @@ set_target_properties(example PROPERTIES
|
|||||||
target_link_libraries(example PRIVATE
|
target_link_libraries(example PRIVATE
|
||||||
Qt6::Quick
|
Qt6::Quick
|
||||||
fluentuiplugin
|
fluentuiplugin
|
||||||
|
FramelessHelper::Core
|
||||||
|
FramelessHelper::Quick
|
||||||
)
|
)
|
||||||
|
|
||||||
#安装
|
#安装
|
||||||
|
62
example/qml/component/CustomWindow.qml
Normal file
62
example/qml/component/CustomWindow.qml
Normal file
@ -0,0 +1,62 @@
|
|||||||
|
import QtQuick
|
||||||
|
import QtQuick.Layouts
|
||||||
|
import FluentUI
|
||||||
|
import org.wangwenx190.FramelessHelper
|
||||||
|
|
||||||
|
FluWindow {
|
||||||
|
|
||||||
|
id:window
|
||||||
|
|
||||||
|
property bool fixSize
|
||||||
|
property alias titleVisible: title_bar.titleVisible
|
||||||
|
property bool appBarVisible: true
|
||||||
|
default property alias content: container.data
|
||||||
|
|
||||||
|
onFixSizeChanged: {
|
||||||
|
framless_helper.setWindowFixedSize(fixSize)
|
||||||
|
title_bar.maximizeButton.visible = !fixSize
|
||||||
|
}
|
||||||
|
|
||||||
|
FluAppBar {
|
||||||
|
id: title_bar
|
||||||
|
title: window.title
|
||||||
|
visible: window.appBarVisible
|
||||||
|
anchors {
|
||||||
|
top: parent.top
|
||||||
|
left: parent.left
|
||||||
|
right: parent.right
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Item{
|
||||||
|
id:container
|
||||||
|
anchors{
|
||||||
|
top: title_bar.bottom
|
||||||
|
left: parent.left
|
||||||
|
right: parent.right
|
||||||
|
bottom: parent.bottom
|
||||||
|
}
|
||||||
|
clip: true
|
||||||
|
}
|
||||||
|
|
||||||
|
FramelessHelper{
|
||||||
|
id:framless_helper
|
||||||
|
onReady: {
|
||||||
|
setTitleBarItem(title_bar)
|
||||||
|
framless_helper.moveWindowToDesktopCenter()
|
||||||
|
setHitTestVisible(title_bar.minimizeButton())
|
||||||
|
setHitTestVisible(title_bar.maximizeButton())
|
||||||
|
setHitTestVisible(title_bar.closeButton())
|
||||||
|
window.visible = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function setHitTestVisible(com){
|
||||||
|
framless_helper.setHitTestVisible(com)
|
||||||
|
}
|
||||||
|
|
||||||
|
function setTitleBarItem(com){
|
||||||
|
framless_helper.setTitleBarItem(com)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -2,17 +2,15 @@
|
|||||||
import QtQuick.Controls
|
import QtQuick.Controls
|
||||||
import QtQuick.Layouts
|
import QtQuick.Layouts
|
||||||
import FluentUI
|
import FluentUI
|
||||||
|
import "../component"
|
||||||
|
|
||||||
FluWindow {
|
CustomWindow {
|
||||||
|
|
||||||
id:window
|
id:window
|
||||||
title:"关于"
|
title:"关于"
|
||||||
width: 600
|
width: 600
|
||||||
height: 600
|
height: 600
|
||||||
minimumWidth: 600
|
fixSize: true
|
||||||
minimumHeight: 600
|
|
||||||
maximumWidth: 600
|
|
||||||
maximumHeight: 600
|
|
||||||
launchMode: FluWindow.SingleTask
|
launchMode: FluWindow.SingleTask
|
||||||
|
|
||||||
ColumnLayout{
|
ColumnLayout{
|
||||||
|
@ -2,17 +2,15 @@
|
|||||||
import QtQuick.Layouts
|
import QtQuick.Layouts
|
||||||
import QtQuick.Controls
|
import QtQuick.Controls
|
||||||
import FluentUI
|
import FluentUI
|
||||||
|
import "../component"
|
||||||
|
|
||||||
FluWindow {
|
CustomWindow {
|
||||||
|
|
||||||
id:window
|
id:window
|
||||||
title:"登录"
|
title:"登录"
|
||||||
width: 400
|
width: 400
|
||||||
height: 400
|
height: 400
|
||||||
minimumWidth: 400
|
fixSize: true
|
||||||
minimumHeight: 400
|
|
||||||
maximumWidth: 400
|
|
||||||
maximumHeight: 400
|
|
||||||
|
|
||||||
onInitArgument:
|
onInitArgument:
|
||||||
(argument)=>{
|
(argument)=>{
|
||||||
|
@ -4,9 +4,10 @@ import QtQuick.Controls
|
|||||||
import QtQuick.Layouts
|
import QtQuick.Layouts
|
||||||
import Qt.labs.platform
|
import Qt.labs.platform
|
||||||
import FluentUI
|
import FluentUI
|
||||||
|
import "../component"
|
||||||
import "qrc:///example/qml/global/"
|
import "qrc:///example/qml/global/"
|
||||||
|
|
||||||
FluWindow {
|
CustomWindow {
|
||||||
|
|
||||||
id:window
|
id:window
|
||||||
title: "FluentUI"
|
title: "FluentUI"
|
||||||
@ -15,6 +16,7 @@ FluWindow {
|
|||||||
closeDestory:false
|
closeDestory:false
|
||||||
minimumWidth: 520
|
minimumWidth: 520
|
||||||
minimumHeight: 460
|
minimumHeight: 460
|
||||||
|
appBarVisible: false
|
||||||
launchMode: FluWindow.SingleTask
|
launchMode: FluWindow.SingleTask
|
||||||
|
|
||||||
closeFunc:function(event){
|
closeFunc:function(event){
|
||||||
@ -71,12 +73,33 @@ FluWindow {
|
|||||||
window.deleteWindow()
|
window.deleteWindow()
|
||||||
FluApp.closeApp()
|
FluApp.closeApp()
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
FluAppBar {
|
||||||
|
id: title_bar
|
||||||
|
anchors {
|
||||||
|
top: parent.top
|
||||||
|
left: parent.left
|
||||||
|
right: parent.right
|
||||||
|
}
|
||||||
|
showDark: true
|
||||||
|
Component.onCompleted: {
|
||||||
|
setTitleBarItem(title_bar)
|
||||||
|
setHitTestVisible(title_bar.minimizeButton())
|
||||||
|
setHitTestVisible(title_bar.maximizeButton())
|
||||||
|
setHitTestVisible(title_bar.closeButton())
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
FluNavigationView{
|
FluNavigationView{
|
||||||
id:nav_view
|
id:nav_view
|
||||||
anchors.fill: parent
|
anchors{
|
||||||
|
top: title_bar.bottom
|
||||||
|
topMargin: -20
|
||||||
|
left: parent.left
|
||||||
|
right: parent.right
|
||||||
|
bottom: parent.bottom
|
||||||
|
}
|
||||||
items: ItemsOriginal
|
items: ItemsOriginal
|
||||||
footerItems:ItemsFooter
|
footerItems:ItemsFooter
|
||||||
z:11
|
z:11
|
||||||
@ -94,32 +117,10 @@ FluWindow {
|
|||||||
ItemsOriginal.startPageByItem(data)
|
ItemsOriginal.startPageByItem(data)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
actionItem:Item{
|
|
||||||
height: 40
|
|
||||||
width: 148
|
|
||||||
RowLayout{
|
|
||||||
anchors.centerIn: parent
|
|
||||||
spacing: 5
|
|
||||||
FluText{
|
|
||||||
text:lang.dark_mode
|
|
||||||
}
|
|
||||||
FluToggleSwitch{
|
|
||||||
selected: FluTheme.dark
|
|
||||||
clickFunc:function(){
|
|
||||||
if(FluTheme.dark){
|
|
||||||
FluTheme.darkMode = FluDarkMode.Light
|
|
||||||
}else{
|
|
||||||
FluTheme.darkMode = FluDarkMode.Dark
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
ItemsOriginal.navigationView = nav_view
|
ItemsOriginal.navigationView = nav_view
|
||||||
ItemsFooter.navigationView = nav_view
|
ItemsFooter.navigationView = nav_view
|
||||||
nav_view.setCurrentIndex(0)
|
nav_view.setCurrentIndex(0)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -2,8 +2,9 @@
|
|||||||
import QtQuick.Controls
|
import QtQuick.Controls
|
||||||
import QtQuick.Layouts
|
import QtQuick.Layouts
|
||||||
import FluentUI
|
import FluentUI
|
||||||
|
import "../component"
|
||||||
|
|
||||||
FluWindow {
|
CustomWindow {
|
||||||
|
|
||||||
title:"视频播放器"
|
title:"视频播放器"
|
||||||
width: 640
|
width: 640
|
||||||
|
@ -2,17 +2,15 @@
|
|||||||
import QtQuick.Controls
|
import QtQuick.Controls
|
||||||
import QtQuick.Layouts
|
import QtQuick.Layouts
|
||||||
import FluentUI
|
import FluentUI
|
||||||
|
import "../component"
|
||||||
|
|
||||||
FluWindow {
|
CustomWindow {
|
||||||
|
|
||||||
id:window
|
id:window
|
||||||
title:"SingleInstance"
|
title:"SingleInstance"
|
||||||
width: 500
|
width: 500
|
||||||
height: 600
|
height: 600
|
||||||
minimumWidth: 500
|
fixSize: true
|
||||||
minimumHeight: 600
|
|
||||||
maximumWidth: 500
|
|
||||||
maximumHeight: 600
|
|
||||||
launchMode: FluWindow.SingleInstance
|
launchMode: FluWindow.SingleInstance
|
||||||
|
|
||||||
FluTextBox{
|
FluTextBox{
|
||||||
@ -35,4 +33,9 @@ FluWindow {
|
|||||||
text:"我是一个SingleInstance模式的窗口,如果我存在,我会销毁之前的窗口,并创建一个新窗口"
|
text:"我是一个SingleInstance模式的窗口,如果我存在,我会销毁之前的窗口,并创建一个新窗口"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FluAppBar{
|
||||||
|
id:appbar
|
||||||
|
width: parent.width
|
||||||
|
height: 30
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,17 +2,15 @@
|
|||||||
import QtQuick.Controls
|
import QtQuick.Controls
|
||||||
import QtQuick.Layouts
|
import QtQuick.Layouts
|
||||||
import FluentUI
|
import FluentUI
|
||||||
|
import "../component"
|
||||||
|
|
||||||
FluWindow {
|
CustomWindow {
|
||||||
|
|
||||||
id:window
|
id:window
|
||||||
title:"SingleTask"
|
title:"SingleTask"
|
||||||
width: 500
|
width: 500
|
||||||
height: 600
|
height: 600
|
||||||
minimumWidth: 500
|
fixSize: true
|
||||||
minimumHeight: 600
|
|
||||||
maximumWidth: 500
|
|
||||||
maximumHeight: 600
|
|
||||||
launchMode: FluWindow.SingleTask
|
launchMode: FluWindow.SingleTask
|
||||||
|
|
||||||
FluText{
|
FluText{
|
||||||
|
@ -2,17 +2,15 @@
|
|||||||
import QtQuick.Controls
|
import QtQuick.Controls
|
||||||
import QtQuick.Layouts
|
import QtQuick.Layouts
|
||||||
import FluentUI
|
import FluentUI
|
||||||
|
import "../component"
|
||||||
|
|
||||||
FluWindow {
|
CustomWindow {
|
||||||
|
|
||||||
id:window
|
id:window
|
||||||
title:"Standard"
|
title:"Standard"
|
||||||
width: 500
|
width: 500
|
||||||
height: 600
|
height: 600
|
||||||
minimumWidth: 500
|
fixSize: true
|
||||||
minimumHeight: 600
|
|
||||||
maximumWidth: 500
|
|
||||||
maximumHeight: 600
|
|
||||||
launchMode: FluWindow.Standard
|
launchMode: FluWindow.Standard
|
||||||
|
|
||||||
FluText{
|
FluText{
|
||||||
|
@ -4,21 +4,31 @@
|
|||||||
#include <QDir>
|
#include <QDir>
|
||||||
#include <QQuickWindow>
|
#include <QQuickWindow>
|
||||||
#include <QProcess>
|
#include <QProcess>
|
||||||
#include <FluentUI/FluentUI.h>
|
#include <FramelessHelper/Quick/framelessquickmodule.h>
|
||||||
|
#include <FramelessHelper/Core/private/framelessconfig_p.h>
|
||||||
#include "lang/Lang.h"
|
#include "lang/Lang.h"
|
||||||
#include "AppInfo.h"
|
#include "AppInfo.h"
|
||||||
#include "tool/IPC.h"
|
#include "tool/IPC.h"
|
||||||
|
|
||||||
|
FRAMELESSHELPER_USE_NAMESPACE;
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
|
FramelessHelper::Quick::initialize();
|
||||||
|
qputenv("QT_QUICK_CONTROLS_STYLE","Basic");
|
||||||
|
//6.4及以下监听系统深色模式变化
|
||||||
|
#ifdef Q_OS_WIN
|
||||||
|
qputenv("QT_QPA_PLATFORM","windows:darkmode=2");
|
||||||
|
#endif
|
||||||
//将样式设置为Basic,不然会导致组件显示异常
|
//将样式设置为Basic,不然会导致组件显示异常
|
||||||
FluentUI::preInit();
|
|
||||||
QGuiApplication::setOrganizationName("ZhuZiChu");
|
QGuiApplication::setOrganizationName("ZhuZiChu");
|
||||||
QGuiApplication::setOrganizationDomain("https://zhuzichu520.github.io");
|
QGuiApplication::setOrganizationDomain("https://zhuzichu520.github.io");
|
||||||
QGuiApplication::setApplicationName("FluentUI");
|
QGuiApplication::setApplicationName("FluentUI");
|
||||||
// QQuickWindow::setGraphicsApi(QSGRendererInterface::Software);
|
// QQuickWindow::setGraphicsApi(QSGRendererInterface::Software);
|
||||||
QGuiApplication app(argc, argv);
|
QGuiApplication app(argc, argv);
|
||||||
FluentUI::postInit();
|
FramelessHelper::Core::setApplicationOSThemeAware();
|
||||||
|
// FramelessConfig::instance()->set(Global::Option::EnableBlurBehindWindow);
|
||||||
|
// FramelessConfig::instance()->set(Global::Option::DisableLazyInitializationForMicaMaterial);
|
||||||
AppInfo* appInfo = new AppInfo();
|
AppInfo* appInfo = new AppInfo();
|
||||||
IPC ipc(0);
|
IPC ipc(0);
|
||||||
QString activeWindowEvent = "activeWindow";
|
QString activeWindowEvent = "activeWindow";
|
||||||
@ -35,7 +45,7 @@ int main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
app.setQuitOnLastWindowClosed(false);
|
app.setQuitOnLastWindowClosed(false);
|
||||||
QQmlApplicationEngine engine;
|
QQmlApplicationEngine engine;
|
||||||
FluentUI::initEngine(&engine);
|
FramelessHelper::Quick::registerTypes(&engine);
|
||||||
QQmlContext * context = engine.rootContext();
|
QQmlContext * context = engine.rootContext();
|
||||||
Lang* lang = appInfo->lang();
|
Lang* lang = appInfo->lang();
|
||||||
context->setContextProperty("lang",lang);
|
context->setContextProperty("lang",lang);
|
||||||
|
@ -44,8 +44,6 @@ foreach(filepath IN LISTS qml_files resource_files)
|
|||||||
set_source_files_properties(${filepath} PROPERTIES QT_RESOURCE_ALIAS ${filename})
|
set_source_files_properties(${filepath} PROPERTIES QT_RESOURCE_ALIAS ${filename})
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
set_source_files_properties(FluentUI.h PROPERTIES QT_RESOURCE_ALIAS "../../include/FluentUI/FluentUI.h")
|
|
||||||
|
|
||||||
#添加qml模块
|
#添加qml模块
|
||||||
qt_add_library(fluentuiplugin SHARED)
|
qt_add_library(fluentuiplugin SHARED)
|
||||||
qt_add_qml_module(fluentuiplugin
|
qt_add_qml_module(fluentuiplugin
|
||||||
@ -56,7 +54,7 @@ qt_add_qml_module(fluentuiplugin
|
|||||||
URI "FluentUI"
|
URI "FluentUI"
|
||||||
SOURCES ${sources_files} fluentui.rc
|
SOURCES ${sources_files} fluentui.rc
|
||||||
QML_FILES ${qml_files}
|
QML_FILES ${qml_files}
|
||||||
RESOURCES ${resource_files} FluentUI.h
|
RESOURCES ${resource_files}
|
||||||
#支持designer
|
#支持designer
|
||||||
DESIGNER_SUPPORTED
|
DESIGNER_SUPPORTED
|
||||||
)
|
)
|
||||||
@ -66,8 +64,6 @@ target_link_libraries(fluentuiplugin PUBLIC
|
|||||||
Qt::Core
|
Qt::Core
|
||||||
Qt::Quick
|
Qt::Quick
|
||||||
Qt::Qml
|
Qt::Qml
|
||||||
FramelessHelper::Core
|
|
||||||
FramelessHelper::Quick
|
|
||||||
)
|
)
|
||||||
|
|
||||||
#链接库 win32库 不然mingw会编译错误
|
#链接库 win32库 不然mingw会编译错误
|
||||||
|
@ -1,25 +0,0 @@
|
|||||||
#include "FluentUI.h"
|
|
||||||
#include <FramelessHelper/Quick/framelessquickmodule.h>
|
|
||||||
#include <FramelessHelper/Core/private/framelessconfig_p.h>
|
|
||||||
|
|
||||||
FRAMELESSHELPER_USE_NAMESPACE;
|
|
||||||
|
|
||||||
void FluentUI::preInit(){
|
|
||||||
qDebug()<<"FluentUI init";
|
|
||||||
FramelessHelper::Quick::initialize();
|
|
||||||
qputenv("QT_QUICK_CONTROLS_STYLE","Basic");
|
|
||||||
//6.4及以下监听系统深色模式变化
|
|
||||||
#ifdef Q_OS_WIN
|
|
||||||
qputenv("QT_QPA_PLATFORM","windows:darkmode=2");
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
void FluentUI::postInit(){
|
|
||||||
FramelessHelper::Core::setApplicationOSThemeAware();
|
|
||||||
FramelessConfig::instance()->set(Global::Option::EnableBlurBehindWindow);
|
|
||||||
FramelessConfig::instance()->set(Global::Option::DisableLazyInitializationForMicaMaterial);
|
|
||||||
}
|
|
||||||
|
|
||||||
void FluentUI::initEngine(QQmlApplicationEngine *engine){
|
|
||||||
FramelessHelper::Quick::registerTypes(engine);
|
|
||||||
}
|
|
@ -1,17 +0,0 @@
|
|||||||
#ifndef FLUENTUI_H
|
|
||||||
#define FLUENTUI_H
|
|
||||||
|
|
||||||
#include <QObject>
|
|
||||||
#include <QQmlApplicationEngine>
|
|
||||||
#include <QDebug>
|
|
||||||
|
|
||||||
class Q_DECL_EXPORT FluentUI
|
|
||||||
{
|
|
||||||
|
|
||||||
public:
|
|
||||||
static void preInit();
|
|
||||||
static void postInit();
|
|
||||||
static void initEngine(QQmlApplicationEngine *engine);
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif // FLUENTUI_H
|
|
@ -19,10 +19,10 @@ Rectangle{
|
|||||||
property color closeNormalColor: Qt.rgba(0,0,0,0)
|
property color closeNormalColor: Qt.rgba(0,0,0,0)
|
||||||
property color closeHoverColor: Qt.rgba(251/255,115/255,115/255,1)
|
property color closeHoverColor: Qt.rgba(251/255,115/255,115/255,1)
|
||||||
property bool showDark: false
|
property bool showDark: false
|
||||||
|
property bool titleVisible: true
|
||||||
property color borerlessColor : FluTheme.dark ? FluTheme.primaryColor.lighter : FluTheme.primaryColor.dark
|
property color borerlessColor : FluTheme.dark ? FluTheme.primaryColor.lighter : FluTheme.primaryColor.dark
|
||||||
id:root
|
id:root
|
||||||
color: Qt.rgba(0,0,0,0)
|
color: Qt.rgba(0,0,0,0)
|
||||||
visible: false
|
|
||||||
height: visible ? 30 : 0
|
height: visible ? 30 : 0
|
||||||
opacity: visible
|
opacity: visible
|
||||||
z: 65535
|
z: 65535
|
||||||
@ -33,7 +33,7 @@ Rectangle{
|
|||||||
property bool resizable: win && !(win.minimumHeight === win.maximumHeight && win.maximumWidth === win.minimumWidth)
|
property bool resizable: win && !(win.minimumHeight === win.maximumHeight && win.maximumWidth === win.minimumWidth)
|
||||||
}
|
}
|
||||||
TapHandler {
|
TapHandler {
|
||||||
onTapped: if (tapCount === 2) toggleMaximized()
|
onTapped: if (tapCount === 2) btn_maximize.clicked()
|
||||||
gesturePolicy: TapHandler.DragThreshold
|
gesturePolicy: TapHandler.DragThreshold
|
||||||
}
|
}
|
||||||
DragHandler {
|
DragHandler {
|
||||||
@ -48,6 +48,7 @@ Rectangle{
|
|||||||
left: parent.left
|
left: parent.left
|
||||||
leftMargin: 10
|
leftMargin: 10
|
||||||
}
|
}
|
||||||
|
visible: root.titleVisible
|
||||||
color:root.textColor
|
color:root.textColor
|
||||||
}
|
}
|
||||||
RowLayout{
|
RowLayout{
|
||||||
@ -75,6 +76,7 @@ Rectangle{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
FluIconButton{
|
FluIconButton{
|
||||||
|
id:btn_minimize
|
||||||
width: 40
|
width: 40
|
||||||
height: 30
|
height: 30
|
||||||
iconSource : FluentIcons.ChromeMinimize
|
iconSource : FluentIcons.ChromeMinimize
|
||||||
@ -85,10 +87,11 @@ Rectangle{
|
|||||||
iconColor: root.textColor
|
iconColor: root.textColor
|
||||||
color: hovered ? minimizeHoverColor : minimizeNormalColor
|
color: hovered ? minimizeHoverColor : minimizeNormalColor
|
||||||
onClicked: {
|
onClicked: {
|
||||||
d.win.showMinimized()
|
d.win.visibility = Window.Minimized
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FluIconButton{
|
FluIconButton{
|
||||||
|
id:btn_maximize
|
||||||
width: 40
|
width: 40
|
||||||
height: 30
|
height: 30
|
||||||
iconSource : d.isRestore ? FluentIcons.ChromeRestore : FluentIcons.ChromeMaximize
|
iconSource : d.isRestore ? FluentIcons.ChromeRestore : FluentIcons.ChromeMaximize
|
||||||
@ -100,10 +103,14 @@ Rectangle{
|
|||||||
text:d.isRestore?restoreText:maximizeText
|
text:d.isRestore?restoreText:maximizeText
|
||||||
iconSize: 11
|
iconSize: 11
|
||||||
onClicked: {
|
onClicked: {
|
||||||
toggleMaximized()
|
if (d.win.visibility === Window.Maximized)
|
||||||
|
d.win.visibility = Window.Windowed
|
||||||
|
else
|
||||||
|
d.win.visibility = Window.Maximized
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
FluIconButton{
|
FluIconButton{
|
||||||
|
id:btn_close
|
||||||
iconSource : FluentIcons.ChromeClose
|
iconSource : FluentIcons.ChromeClose
|
||||||
Layout.alignment: Qt.AlignVCenter
|
Layout.alignment: Qt.AlignVCenter
|
||||||
text:closeText
|
text:closeText
|
||||||
@ -118,13 +125,17 @@ Rectangle{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function toggleMaximized() {
|
|
||||||
if(!d.resizable)
|
function minimizeButton(){
|
||||||
return
|
return btn_minimize
|
||||||
if (d.win.visibility === Window.Maximized) {
|
|
||||||
d.win.showNormal();
|
|
||||||
} else {
|
|
||||||
d.win.showMaximized();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function maximizeButton(){
|
||||||
|
return btn_maximize
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function closeButton(){
|
||||||
|
return btn_close
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,6 @@ import QtQuick.Window
|
|||||||
import QtQuick.Controls
|
import QtQuick.Controls
|
||||||
import QtQuick.Layouts
|
import QtQuick.Layouts
|
||||||
import FluentUI
|
import FluentUI
|
||||||
import org.wangwenx190.FramelessHelper
|
|
||||||
|
|
||||||
Window {
|
Window {
|
||||||
enum LaunchMode {
|
enum LaunchMode {
|
||||||
@ -25,7 +24,6 @@ Window {
|
|||||||
event.accepted = false
|
event.accepted = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
visible: true
|
|
||||||
property color backgroundColor: {
|
property color backgroundColor: {
|
||||||
if(active){
|
if(active){
|
||||||
return FluTheme.dark ? Qt.rgba(26/255,34/255,40/255,1) : Qt.rgba(238/255,244/255,249/255,1)
|
return FluTheme.dark ? Qt.rgba(26/255,34/255,40/255,1) : Qt.rgba(238/255,244/255,249/255,1)
|
||||||
@ -49,26 +47,9 @@ Window {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// StandardTitleBar {
|
|
||||||
// id: title_bar
|
|
||||||
// z:999
|
|
||||||
// anchors {
|
|
||||||
// top: parent.top
|
|
||||||
// topMargin: window.visibility === Window.Windowed ? 1 : 0
|
|
||||||
// left: parent.left
|
|
||||||
// right: parent.right
|
|
||||||
// }
|
|
||||||
// // windowIcon: "qrc:///images/microsoft.svg"
|
|
||||||
// windowIconVisible: false
|
|
||||||
// }
|
|
||||||
Item{
|
Item{
|
||||||
id:container
|
id:container
|
||||||
anchors{
|
anchors.fill: parent
|
||||||
top: parent.top
|
|
||||||
left: parent.left
|
|
||||||
right: parent.right
|
|
||||||
bottom: parent.bottom
|
|
||||||
}
|
|
||||||
clip: true
|
clip: true
|
||||||
}
|
}
|
||||||
FluInfoBar{
|
FluInfoBar{
|
||||||
@ -78,16 +59,6 @@ Window {
|
|||||||
WindowHelper{
|
WindowHelper{
|
||||||
id:helper
|
id:helper
|
||||||
}
|
}
|
||||||
// FramelessHelper.onReady: {
|
|
||||||
// FramelessHelper.titleBarItem = title_bar
|
|
||||||
// FramelessHelper.moveWindowToDesktopCenter()
|
|
||||||
// if (Qt.platform.os !== "macos") {
|
|
||||||
// FramelessHelper.setSystemButton(title_bar.minimizeButton, FramelessHelperConstants.Minimize);
|
|
||||||
// FramelessHelper.setSystemButton(title_bar.maximizeButton, FramelessHelperConstants.Maximize);
|
|
||||||
// FramelessHelper.setSystemButton(title_bar.closeButton, FramelessHelperConstants.Close);
|
|
||||||
// }
|
|
||||||
// window.visible = true
|
|
||||||
// }
|
|
||||||
function showSuccess(text,duration,moremsg){
|
function showSuccess(text,duration,moremsg){
|
||||||
infoBar.showSuccess(text,duration,moremsg)
|
infoBar.showSuccess(text,duration,moremsg)
|
||||||
}
|
}
|
||||||
@ -111,5 +82,4 @@ Window {
|
|||||||
pageRegister.onResult(data)
|
pageRegister.onResult(data)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user