mirror of
https://github.com/zhuzichu520/FluentUI.git
synced 2024-11-23 03:10:10 +08:00
update
This commit is contained in:
parent
e631465231
commit
29f363afdd
@ -35,6 +35,7 @@ endif ()
|
||||
if (FLUENTUI_BUILD_FRAMELESSHEPLER)
|
||||
set(FRAMELESSHELPER_BUILD_STATIC ON)
|
||||
set(FRAMELESSHELPER_NO_DEBUG_OUTPUT ON)
|
||||
set(FRAMELESSHELPER_BUILD_WIDGETS OFF)
|
||||
add_subdirectory(framelesshelper)
|
||||
endif ()
|
||||
|
||||
|
@ -160,8 +160,6 @@ target_link_libraries(example PRIVATE
|
||||
Qt${QT_VERSION_MAJOR}::Svg
|
||||
Qt${QT_VERSION_MAJOR}::Network
|
||||
fluentuiplugin
|
||||
FramelessHelper::Core
|
||||
FramelessHelper::Quick
|
||||
)
|
||||
|
||||
#安装
|
||||
|
@ -1,64 +1,15 @@
|
||||
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 titleVisible: true
|
||||
property bool appBarVisible: true
|
||||
default property alias content: container.data
|
||||
FluAppBar {
|
||||
id: title_bar
|
||||
title: window.title
|
||||
visible: window.appBarVisible
|
||||
icon:"qrc:/example/res/image/favicon.ico"
|
||||
anchors {
|
||||
top: parent.top
|
||||
left: parent.left
|
||||
right: parent.right
|
||||
}
|
||||
darkText: lang.dark_mode
|
||||
}
|
||||
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)
|
||||
moveWindowToDesktopCenter()
|
||||
setHitTestVisible(title_bar.minimizeButton())
|
||||
setHitTestVisible(title_bar.maximizeButton())
|
||||
setHitTestVisible(title_bar.closeButton())
|
||||
setWindowFixedSize(fixSize)
|
||||
title_bar.maximizeButton.visible = !fixSize
|
||||
if (blurBehindWindowEnabled)
|
||||
window.background = undefined
|
||||
window.show()
|
||||
}
|
||||
}
|
||||
Connections{
|
||||
target: FluTheme
|
||||
function onDarkChanged(){
|
||||
if (FluTheme.dark)
|
||||
FramelessUtils.systemTheme = FramelessHelperConstants.Dark
|
||||
else
|
||||
FramelessUtils.systemTheme = FramelessHelperConstants.Light
|
||||
}
|
||||
}
|
||||
|
||||
function setHitTestVisible(com){
|
||||
framless_helper.setHitTestVisible(com)
|
||||
}
|
||||
function setTitleBarItem(com){
|
||||
framless_helper.setTitleBarItem(com)
|
||||
}
|
||||
}
|
||||
|
@ -4,7 +4,7 @@ import QtQuick.Layouts
|
||||
import FluentUI
|
||||
import "qrc:///example/qml/component"
|
||||
|
||||
CustomWindow {
|
||||
FluWindow {
|
||||
|
||||
id:window
|
||||
title:"关于"
|
||||
|
@ -5,7 +5,7 @@ import FluentUI
|
||||
import example
|
||||
import "qrc:///example/qml/component"
|
||||
|
||||
CustomWindow {
|
||||
FluWindow {
|
||||
|
||||
id:window
|
||||
title:"热加载"
|
||||
|
@ -4,7 +4,7 @@ import QtQuick.Controls
|
||||
import FluentUI
|
||||
import "qrc:///example/qml/component"
|
||||
|
||||
CustomWindow {
|
||||
FluWindow {
|
||||
|
||||
id:window
|
||||
title:"登录"
|
||||
|
@ -9,7 +9,7 @@ import "qrc:///example/qml/component"
|
||||
import "qrc:///example/qml/global"
|
||||
import "qrc:///example/qml/viewmodel"
|
||||
|
||||
CustomWindow {
|
||||
FluWindow {
|
||||
|
||||
id:window
|
||||
title: "FluentUI"
|
||||
@ -18,9 +18,10 @@ CustomWindow {
|
||||
closeDestory:false
|
||||
minimumWidth: 520
|
||||
minimumHeight: 200
|
||||
appBarVisible: false
|
||||
launchMode: FluWindowType.SingleTask
|
||||
|
||||
appBar: undefined
|
||||
|
||||
SettingsViewModel{
|
||||
id:viewmodel_settings
|
||||
}
|
||||
|
@ -5,7 +5,7 @@ import FluentUI
|
||||
import example
|
||||
import "qrc:///example/qml/component"
|
||||
|
||||
CustomWindow {
|
||||
FluWindow {
|
||||
|
||||
id:window
|
||||
width: 800
|
||||
|
@ -4,7 +4,7 @@ import QtQuick.Layouts
|
||||
import FluentUI
|
||||
import "qrc:///example/qml/component"
|
||||
|
||||
CustomWindow {
|
||||
FluWindow {
|
||||
|
||||
id:window
|
||||
title:"SingleInstance"
|
||||
|
@ -4,7 +4,7 @@ import QtQuick.Layouts
|
||||
import FluentUI
|
||||
import "qrc:///example/qml/component"
|
||||
|
||||
CustomWindow {
|
||||
FluWindow {
|
||||
|
||||
id:window
|
||||
title:"SingleTask"
|
||||
|
@ -4,7 +4,7 @@ import QtQuick.Layouts
|
||||
import FluentUI
|
||||
import "qrc:///example/qml/component"
|
||||
|
||||
CustomWindow {
|
||||
FluWindow {
|
||||
|
||||
id:window
|
||||
title:"Standard"
|
||||
|
@ -6,8 +6,6 @@
|
||||
#include <QNetworkProxy>
|
||||
#include <QSslConfiguration>
|
||||
#include <QProcess>
|
||||
#include <FramelessHelper/Quick/framelessquickmodule.h>
|
||||
#include <FramelessHelper/Core/private/framelessconfig_p.h>
|
||||
#include <QtQml/qqmlextensionplugin.h>
|
||||
#include <QLoggingCategory>
|
||||
#include "AppInfo.h"
|
||||
@ -23,8 +21,6 @@ Q_IMPORT_QML_PLUGIN(FluentUIPlugin)
|
||||
#include <FluentUI.h>
|
||||
#endif
|
||||
|
||||
FRAMELESSHELPER_USE_NAMESPACE
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
QNetworkProxy::setApplicationProxy(QNetworkProxy::NoProxy);
|
||||
@ -36,7 +32,6 @@ int main(int argc, char *argv[])
|
||||
#endif
|
||||
#endif
|
||||
qputenv("QT_QUICK_CONTROLS_STYLE","Basic");
|
||||
FramelessHelper::Quick::initialize();
|
||||
QGuiApplication::setOrganizationName("ZhuZiChu");
|
||||
QGuiApplication::setOrganizationDomain("https://zhuzichu520.github.io");
|
||||
QGuiApplication::setApplicationName("FluentUI");
|
||||
@ -51,22 +46,10 @@ int main(int argc, char *argv[])
|
||||
QGuiApplication app(argc, argv);
|
||||
// QLoggingCategory::setFilterRules(QStringLiteral("qt.scenegraph.general=true"));
|
||||
// qSetMessagePattern("%{category}: %{message}");
|
||||
FramelessConfig::instance()->set(Global::Option::DisableLazyInitializationForMicaMaterial);
|
||||
FramelessConfig::instance()->set(Global::Option::CenterWindowBeforeShow);
|
||||
FramelessConfig::instance()->set(Global::Option::ForceNonNativeBackgroundBlur);
|
||||
FramelessConfig::instance()->set(Global::Option::EnableBlurBehindWindow);
|
||||
#ifdef Q_OS_WIN
|
||||
FramelessConfig::instance()->set(Global::Option::ForceHideWindowFrameBorder);
|
||||
FramelessConfig::instance()->set(Global::Option::EnableBlurBehindWindow,false);
|
||||
#endif
|
||||
#ifdef Q_OS_MACOS
|
||||
FramelessConfig::instance()->set(Global::Option::ForceNonNativeBackgroundBlur,false);
|
||||
#endif
|
||||
QQmlApplicationEngine engine;
|
||||
AppInfo::getInstance()->init(&engine);
|
||||
engine.rootContext()->setContextProperty("AppInfo",AppInfo::getInstance());
|
||||
engine.rootContext()->setContextProperty("SettingsHelper",SettingsHelper::getInstance());
|
||||
FramelessHelper::Quick::registerTypes(&engine);
|
||||
#ifdef FLUENTUI_BUILD_STATIC_LIB
|
||||
FluentUI::getInstance()->registerTypes(&engine);
|
||||
#endif
|
||||
|
@ -129,6 +129,8 @@ target_link_libraries(${PROJECT_NAME} PUBLIC
|
||||
Qt${QT_VERSION_MAJOR}::QuickPrivate
|
||||
Qt${QT_VERSION_MAJOR}::QmlPrivate
|
||||
ZXing
|
||||
FramelessHelper::Core
|
||||
FramelessHelper::Quick
|
||||
)
|
||||
|
||||
#安装
|
||||
|
@ -8,6 +8,10 @@
|
||||
#include <QUuid>
|
||||
#include <QFontDatabase>
|
||||
#include <QClipboard>
|
||||
#include <FramelessHelper/Quick/framelessquickmodule.h>
|
||||
#include <FramelessHelper/Core/private/framelessconfig_p.h>
|
||||
|
||||
FRAMELESSHELPER_USE_NAMESPACE
|
||||
|
||||
FluApp::FluApp(QObject *parent):QObject{parent}{
|
||||
httpInterceptor(nullptr);
|
||||
@ -18,6 +22,21 @@ FluApp::~FluApp(){
|
||||
|
||||
void FluApp::init(QQuickWindow *window){
|
||||
this->_application = window;
|
||||
qputenv("QT_QUICK_CONTROLS_STYLE","Basic");
|
||||
FramelessHelper::Quick::initialize();
|
||||
FramelessConfig::instance()->set(Global::Option::DisableLazyInitializationForMicaMaterial);
|
||||
FramelessConfig::instance()->set(Global::Option::CenterWindowBeforeShow);
|
||||
FramelessConfig::instance()->set(Global::Option::ForceNonNativeBackgroundBlur);
|
||||
FramelessConfig::instance()->set(Global::Option::EnableBlurBehindWindow);
|
||||
#ifdef Q_OS_WIN
|
||||
FramelessConfig::instance()->set(Global::Option::ForceHideWindowFrameBorder);
|
||||
FramelessConfig::instance()->set(Global::Option::EnableBlurBehindWindow,false);
|
||||
#endif
|
||||
#ifdef Q_OS_MACOS
|
||||
FramelessConfig::instance()->set(Global::Option::ForceNonNativeBackgroundBlur,false);
|
||||
#endif
|
||||
QQmlEngine *engine = qmlEngine(_application);
|
||||
FramelessHelper::Quick::registerTypes(engine);
|
||||
}
|
||||
|
||||
void FluApp::run(){
|
||||
|
@ -2,6 +2,7 @@ import QtQuick
|
||||
import QtQuick.Controls
|
||||
import QtQuick.Layouts
|
||||
import FluentUI
|
||||
import org.wangwenx190.FramelessHelper
|
||||
|
||||
Window {
|
||||
default property alias content: container.data
|
||||
@ -9,7 +10,9 @@ Window {
|
||||
property int launchMode: FluWindowType.Standard
|
||||
property var argument:({})
|
||||
property var background : com_background
|
||||
property bool fixSize: false
|
||||
property Component loadingItem: com_loading
|
||||
property var appBar: com_app_bar
|
||||
property color backgroundColor: {
|
||||
if(active){
|
||||
return FluTheme.dark ? Qt.rgba(26/255,34/255,40/255,1) : Qt.rgba(243/255,243/255,243/255,1)
|
||||
@ -27,6 +30,7 @@ Window {
|
||||
}
|
||||
}
|
||||
signal initArgument(var argument)
|
||||
property bool showSystemAppBar: true
|
||||
id:window
|
||||
color:"transparent"
|
||||
Component.onCompleted: {
|
||||
@ -49,13 +53,33 @@ Window {
|
||||
color: window.backgroundColor
|
||||
}
|
||||
}
|
||||
Component{
|
||||
id:com_app_bar
|
||||
FluAppBar {
|
||||
title: window.title
|
||||
}
|
||||
}
|
||||
Loader{
|
||||
anchors.fill: parent
|
||||
sourceComponent: background
|
||||
}
|
||||
Loader{
|
||||
id: loader_title_bar
|
||||
anchors {
|
||||
top: parent.top
|
||||
left: parent.left
|
||||
right: parent.right
|
||||
}
|
||||
sourceComponent: window.appBar
|
||||
}
|
||||
Item{
|
||||
id:container
|
||||
anchors.fill: parent
|
||||
anchors{
|
||||
top: loader_title_bar.bottom
|
||||
left: parent.left
|
||||
right: parent.right
|
||||
bottom: parent.bottom
|
||||
}
|
||||
clip: true
|
||||
}
|
||||
Loader{
|
||||
@ -64,10 +88,6 @@ Window {
|
||||
id:loader_loading
|
||||
anchors.fill: container
|
||||
}
|
||||
FluInfoBar{
|
||||
id:infoBar
|
||||
root: window
|
||||
}
|
||||
Component{
|
||||
id:com_loading
|
||||
Popup{
|
||||
@ -131,6 +151,37 @@ Window {
|
||||
}
|
||||
}
|
||||
}
|
||||
FluInfoBar{
|
||||
id:infoBar
|
||||
root: window
|
||||
}
|
||||
Connections{
|
||||
target: FluTheme
|
||||
function onDarkChanged(){
|
||||
if (FluTheme.dark)
|
||||
FramelessUtils.systemTheme = FramelessHelperConstants.Dark
|
||||
else
|
||||
FramelessUtils.systemTheme = FramelessHelperConstants.Light
|
||||
}
|
||||
}
|
||||
FramelessHelper{
|
||||
id:framless_helper
|
||||
onReady: {
|
||||
if(appBar && !showSystemAppBar){
|
||||
var title_bar = loader_title_bar.item
|
||||
setTitleBarItem(title_bar)
|
||||
moveWindowToDesktopCenter()
|
||||
setHitTestVisible(title_bar.minimizeButton())
|
||||
setHitTestVisible(title_bar.maximizeButton())
|
||||
setHitTestVisible(title_bar.closeButton())
|
||||
setWindowFixedSize(fixSize)
|
||||
title_bar.maximizeButton.visible = !fixSize
|
||||
if (blurBehindWindowEnabled)
|
||||
window.background = undefined
|
||||
}
|
||||
window.show()
|
||||
}
|
||||
}
|
||||
WindowLifecycle{
|
||||
id:lifecycle
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user