update
parent
edd1ea90b9
commit
1491abc614
|
@ -94,8 +94,6 @@ set_target_properties(example PROPERTIES
|
||||||
#链接库
|
#链接库
|
||||||
target_link_libraries(example PRIVATE
|
target_link_libraries(example PRIVATE
|
||||||
Qt6::Quick
|
Qt6::Quick
|
||||||
FramelessHelper::Core
|
|
||||||
FramelessHelper::Quick
|
|
||||||
fluentuiplugin
|
fluentuiplugin
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -1,60 +0,0 @@
|
||||||
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
|
|
||||||
|
|
||||||
FluAppBar {
|
|
||||||
id: title_bar
|
|
||||||
title: window.title
|
|
||||||
visible: window.appBarVisible
|
|
||||||
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)
|
|
||||||
framless_helper.moveWindowToDesktopCenter()
|
|
||||||
setHitTestVisible(title_bar.minimizeButton())
|
|
||||||
setHitTestVisible(title_bar.maximizeButton())
|
|
||||||
setHitTestVisible(title_bar.closeButton())
|
|
||||||
framless_helper.setWindowFixedSize(fixSize)
|
|
||||||
title_bar.maximizeButton.visible = !fixSize
|
|
||||||
window.visible = true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function setHitTestVisible(com){
|
|
||||||
framless_helper.setHitTestVisible(com)
|
|
||||||
}
|
|
||||||
|
|
||||||
function setTitleBarItem(com){
|
|
||||||
framless_helper.setTitleBarItem(com)
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -2,9 +2,8 @@
|
||||||
import QtQuick.Controls
|
import QtQuick.Controls
|
||||||
import QtQuick.Layouts
|
import QtQuick.Layouts
|
||||||
import FluentUI
|
import FluentUI
|
||||||
import "../component"
|
|
||||||
|
|
||||||
CustomWindow {
|
FluWindow {
|
||||||
|
|
||||||
id:window
|
id:window
|
||||||
title:"关于"
|
title:"关于"
|
||||||
|
|
|
@ -2,9 +2,8 @@
|
||||||
import QtQuick.Layouts
|
import QtQuick.Layouts
|
||||||
import QtQuick.Controls
|
import QtQuick.Controls
|
||||||
import FluentUI
|
import FluentUI
|
||||||
import "../component"
|
|
||||||
|
|
||||||
CustomWindow {
|
FluWindow {
|
||||||
|
|
||||||
id:window
|
id:window
|
||||||
title:"登录"
|
title:"登录"
|
||||||
|
|
|
@ -4,10 +4,9 @@ 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/"
|
||||||
|
|
||||||
CustomWindow {
|
FluWindow {
|
||||||
|
|
||||||
id:window
|
id:window
|
||||||
title: "FluentUI"
|
title: "FluentUI"
|
||||||
|
|
|
@ -2,9 +2,8 @@
|
||||||
import QtQuick.Controls
|
import QtQuick.Controls
|
||||||
import QtQuick.Layouts
|
import QtQuick.Layouts
|
||||||
import FluentUI
|
import FluentUI
|
||||||
import "../component"
|
|
||||||
|
|
||||||
CustomWindow {
|
FluWindow {
|
||||||
|
|
||||||
title:"视频播放器"
|
title:"视频播放器"
|
||||||
width: 640
|
width: 640
|
||||||
|
|
|
@ -2,9 +2,8 @@
|
||||||
import QtQuick.Controls
|
import QtQuick.Controls
|
||||||
import QtQuick.Layouts
|
import QtQuick.Layouts
|
||||||
import FluentUI
|
import FluentUI
|
||||||
import "../component"
|
|
||||||
|
|
||||||
CustomWindow {
|
FluWindow {
|
||||||
|
|
||||||
id:window
|
id:window
|
||||||
title:"SingleInstance"
|
title:"SingleInstance"
|
||||||
|
|
|
@ -2,9 +2,8 @@
|
||||||
import QtQuick.Controls
|
import QtQuick.Controls
|
||||||
import QtQuick.Layouts
|
import QtQuick.Layouts
|
||||||
import FluentUI
|
import FluentUI
|
||||||
import "../component"
|
|
||||||
|
|
||||||
CustomWindow {
|
FluWindow {
|
||||||
|
|
||||||
id:window
|
id:window
|
||||||
title:"SingleTask"
|
title:"SingleTask"
|
||||||
|
|
|
@ -2,9 +2,8 @@
|
||||||
import QtQuick.Controls
|
import QtQuick.Controls
|
||||||
import QtQuick.Layouts
|
import QtQuick.Layouts
|
||||||
import FluentUI
|
import FluentUI
|
||||||
import "../component"
|
|
||||||
|
|
||||||
CustomWindow {
|
FluWindow {
|
||||||
|
|
||||||
id:window
|
id:window
|
||||||
title:"Standard"
|
title:"Standard"
|
||||||
|
|
|
@ -4,30 +4,20 @@
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
#include <QQuickWindow>
|
#include <QQuickWindow>
|
||||||
#include <QProcess>
|
#include <QProcess>
|
||||||
#include <FramelessHelper/Quick/framelessquickmodule.h>
|
|
||||||
#include <FramelessHelper/Core/private/framelessconfig_p.h>
|
|
||||||
#include <FluGlobal.h>
|
#include <FluGlobal.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[])
|
|
||||||
{
|
{
|
||||||
FluentUI::preInit();
|
FluentUI::preInit();
|
||||||
FramelessHelper::Quick::initialize();
|
|
||||||
//将样式设置为Basic,不然会导致组件显示异常
|
|
||||||
qputenv("QT_QUICK_CONTROLS_STYLE","Basic");
|
|
||||||
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();
|
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";
|
||||||
|
@ -45,7 +35,6 @@ FRAMELESSHELPER_USE_NAMESPACE
|
||||||
app.setQuitOnLastWindowClosed(false);
|
app.setQuitOnLastWindowClosed(false);
|
||||||
QQmlApplicationEngine engine;
|
QQmlApplicationEngine engine;
|
||||||
FluentUI::initEngine(&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);
|
||||||
|
|
|
@ -57,6 +57,8 @@ qt_add_qml_module(fluentuiplugin
|
||||||
RESOURCES ${resource_files} FluGlobal.h
|
RESOURCES ${resource_files} FluGlobal.h
|
||||||
#支持designer
|
#支持designer
|
||||||
DESIGNER_SUPPORTED
|
DESIGNER_SUPPORTED
|
||||||
|
DEPENDENCIES
|
||||||
|
org.wangwenx190.FramelessHelper/auto
|
||||||
)
|
)
|
||||||
|
|
||||||
#链接库
|
#链接库
|
||||||
|
@ -64,6 +66,8 @@ target_link_libraries(fluentuiplugin PUBLIC
|
||||||
Qt::CorePrivate
|
Qt::CorePrivate
|
||||||
Qt::QuickPrivate
|
Qt::QuickPrivate
|
||||||
Qt::QmlPrivate
|
Qt::QmlPrivate
|
||||||
|
FramelessHelper::Core
|
||||||
|
FramelessHelper::Quick
|
||||||
)
|
)
|
||||||
|
|
||||||
#链接库 win32库 不然mingw会编译错误
|
#链接库 win32库 不然mingw会编译错误
|
||||||
|
|
|
@ -1,17 +1,29 @@
|
||||||
#include "FluGlobal.h"
|
#include "FluGlobal.h"
|
||||||
|
|
||||||
#include<QDebug>
|
#include<QDebug>
|
||||||
|
#include <FramelessHelper/Quick/framelessquickmodule.h>
|
||||||
|
#include <FramelessHelper/Core/private/framelessconfig_p.h>
|
||||||
|
|
||||||
|
FRAMELESSHELPER_USE_NAMESPACE;
|
||||||
|
|
||||||
namespace FluentUI {
|
namespace FluentUI {
|
||||||
|
|
||||||
void preInit(){
|
void preInit(){
|
||||||
qDebug()<<"preInit";
|
qDebug()<<"preInit";
|
||||||
|
FramelessHelper::Quick::initialize();
|
||||||
|
//将样式设置为Basic,不然会导致组件显示异常
|
||||||
|
qputenv("QT_QUICK_CONTROLS_STYLE","Basic");
|
||||||
}
|
}
|
||||||
void postInit(){
|
void postInit(){
|
||||||
qDebug()<<"postInit";
|
qDebug()<<"postInit";
|
||||||
|
FramelessHelper::Core::setApplicationOSThemeAware();
|
||||||
|
FramelessConfig::instance()->set(Global::Option::EnableBlurBehindWindow);
|
||||||
|
FramelessConfig::instance()->set(Global::Option::DisableLazyInitializationForMicaMaterial);
|
||||||
}
|
}
|
||||||
void initEngine(QQmlApplicationEngine* engine){
|
void initEngine(QQmlApplicationEngine* engine){
|
||||||
qDebug()<<"initEngine";
|
qDebug()<<"initEngine";
|
||||||
|
FramelessHelper::Quick::registerTypes(engine);
|
||||||
|
qDebug()<<"FramelessHelper::Quick::registerTypes(engine)";
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,7 @@ 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 {
|
||||||
|
@ -11,6 +12,9 @@ Window {
|
||||||
SingleInstance
|
SingleInstance
|
||||||
}
|
}
|
||||||
default property alias content: container.data
|
default property alias content: container.data
|
||||||
|
property bool fixSize
|
||||||
|
property alias titleVisible: title_bar.titleVisible
|
||||||
|
property bool appBarVisible: true
|
||||||
property bool closeDestory: true
|
property bool closeDestory: true
|
||||||
property int launchMode: FluWindow.Standard
|
property int launchMode: FluWindow.Standard
|
||||||
property string route
|
property string route
|
||||||
|
@ -47,15 +51,43 @@ Window {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
FluAppBar {
|
||||||
|
id: title_bar
|
||||||
|
title: window.title
|
||||||
|
visible: window.appBarVisible
|
||||||
|
anchors {
|
||||||
|
top: parent.top
|
||||||
|
left: parent.left
|
||||||
|
right: parent.right
|
||||||
|
}
|
||||||
|
}
|
||||||
Item{
|
Item{
|
||||||
id:container
|
id:container
|
||||||
anchors.fill: parent
|
anchors{
|
||||||
|
top: title_bar.bottom
|
||||||
|
left: parent.left
|
||||||
|
right: parent.right
|
||||||
|
bottom: parent.bottom
|
||||||
|
}
|
||||||
clip: true
|
clip: true
|
||||||
}
|
}
|
||||||
FluInfoBar{
|
FluInfoBar{
|
||||||
id:infoBar
|
id:infoBar
|
||||||
root: window
|
root: window
|
||||||
}
|
}
|
||||||
|
FramelessHelper{
|
||||||
|
id:framless_helper
|
||||||
|
onReady: {
|
||||||
|
setTitleBarItem(title_bar)
|
||||||
|
framless_helper.moveWindowToDesktopCenter()
|
||||||
|
setHitTestVisible(title_bar.minimizeButton())
|
||||||
|
setHitTestVisible(title_bar.maximizeButton())
|
||||||
|
setHitTestVisible(title_bar.closeButton())
|
||||||
|
framless_helper.setWindowFixedSize(fixSize)
|
||||||
|
title_bar.maximizeButton.visible = !fixSize
|
||||||
|
window.visible = true
|
||||||
|
}
|
||||||
|
}
|
||||||
WindowHelper{
|
WindowHelper{
|
||||||
id:helper
|
id:helper
|
||||||
}
|
}
|
||||||
|
@ -77,6 +109,12 @@ Window {
|
||||||
function deleteWindow(){
|
function deleteWindow(){
|
||||||
helper.deleteWindow()
|
helper.deleteWindow()
|
||||||
}
|
}
|
||||||
|
function setHitTestVisible(com){
|
||||||
|
framless_helper.setHitTestVisible(com)
|
||||||
|
}
|
||||||
|
function setTitleBarItem(com){
|
||||||
|
framless_helper.setTitleBarItem(com)
|
||||||
|
}
|
||||||
function onResult(data){
|
function onResult(data){
|
||||||
if(pageRegister){
|
if(pageRegister){
|
||||||
pageRegister.onResult(data)
|
pageRegister.onResult(data)
|
||||||
|
|
Loading…
Reference in New Issue