update
@ -9,13 +9,16 @@ if(APPLE)
|
||||
set(CMAKE_OSX_ARCHITECTURES "arm64;x86_64" CACHE STRING "" FORCE)
|
||||
endif()
|
||||
|
||||
#设置可执行文件输出目录
|
||||
##设置可执行文件输出目录
|
||||
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin/debug)
|
||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_PREFIX_PATH}/bin)
|
||||
else()
|
||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin/release)
|
||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_PREFIX_PATH}/bin)
|
||||
endif()
|
||||
|
||||
#设置QML路径
|
||||
set(QT_QML_OUTPUT_DIRECTORY ${CMAKE_PREFIX_PATH}/qml)
|
||||
|
||||
#设置版本号
|
||||
add_definitions(-DVERSION=1,2,9,0)
|
||||
|
||||
@ -36,7 +39,7 @@ foreach(filepath ${QML_PATHS})
|
||||
endforeach(filepath)
|
||||
|
||||
#遍历所有资源文件
|
||||
file(GLOB_RECURSE RES_PATHS *.png *.jpg *.svg *.ico *.ttf *.webp)
|
||||
file(GLOB_RECURSE RES_PATHS *.png *.jpg *.svg *.ico *.ttf *.webp *.metainfo)
|
||||
foreach(filepath ${RES_PATHS})
|
||||
string(REPLACE "${CMAKE_CURRENT_SOURCE_DIR}/" "" filename ${filepath})
|
||||
list(APPEND resource_files ${filename})
|
||||
@ -49,8 +52,8 @@ foreach(filepath IN LISTS qml_files resource_files)
|
||||
endforeach()
|
||||
|
||||
#添加qml模块
|
||||
qt_add_library(fluentui SHARED)
|
||||
qt_add_qml_module(fluentui
|
||||
OUTPUT_DIRECTORY ${CMAKE_PREFIX_PATH}/qml/FluentUI
|
||||
VERSION 1.0
|
||||
URI "FluentUI"
|
||||
SOURCES ${sources_files} fluentui.rc
|
||||
|
18
src/Def.h
@ -6,13 +6,13 @@
|
||||
|
||||
namespace Fluent_DarkMode {
|
||||
Q_NAMESPACE
|
||||
enum Fluent_DarkModeType {
|
||||
System = 0x0,
|
||||
Light = 0x1,
|
||||
Dark = 0x2,
|
||||
};
|
||||
QML_NAMED_ELEMENT(FluDarkMode)
|
||||
Q_ENUMS(Fluent_DarkModeType);
|
||||
enum Fluent_DarkModeType {
|
||||
System = 0x0,
|
||||
Light = 0x1,
|
||||
Dark = 0x2,
|
||||
};
|
||||
Q_ENUM_NS(Fluent_DarkModeType)
|
||||
QML_NAMED_ELEMENT(FluDarkMode)
|
||||
}
|
||||
|
||||
namespace Fluent_Awesome {
|
||||
@ -1422,8 +1422,8 @@ enum class Fluent_AwesomeType {
|
||||
SpeechSolidBold=0xf8b2,
|
||||
ClickedOutLoudSolidBold=0xf8b3,
|
||||
};
|
||||
QML_NAMED_ELEMENT(FluentIcons)
|
||||
Q_ENUMS(Fluent_AwesomeType)
|
||||
Q_ENUM_NS(Fluent_AwesomeType)
|
||||
QML_NAMED_ELEMENT(FluentIcons)
|
||||
}
|
||||
|
||||
#endif // DEF_H
|
||||
|
@ -9,27 +9,16 @@
|
||||
#include <QFontDatabase>
|
||||
#include <QClipboard>
|
||||
#include "Def.h"
|
||||
#ifdef Q_OS_WIN
|
||||
#pragma comment(lib, "Dwmapi.lib")
|
||||
#pragma comment(lib, "User32.lib")
|
||||
#include <dwmapi.h>
|
||||
#include <Windows.h>
|
||||
#include <windowsx.h>
|
||||
static bool isCompositionEnabled()
|
||||
|
||||
FluApp* FluApp::m_instance = nullptr;
|
||||
|
||||
FluApp *FluApp::getInstance()
|
||||
{
|
||||
BOOL composition_enabled = FALSE;
|
||||
bool success = ::DwmIsCompositionEnabled(&composition_enabled) == S_OK;
|
||||
return composition_enabled && success;
|
||||
if(FluApp::m_instance == nullptr){
|
||||
FluApp::m_instance = new FluApp;
|
||||
}
|
||||
return FluApp::m_instance;
|
||||
}
|
||||
#endif
|
||||
|
||||
FluApp* FluApp::fluApp = nullptr;
|
||||
|
||||
FluTheme* FluApp::fluTheme = nullptr;
|
||||
|
||||
FluColors* FluApp::fluColors = nullptr;
|
||||
|
||||
FluTools* FluApp::fluTools = nullptr;
|
||||
|
||||
FluApp::FluApp(QObject *parent)
|
||||
: QObject{parent}
|
||||
@ -38,43 +27,14 @@ FluApp::FluApp(QObject *parent)
|
||||
}
|
||||
|
||||
FluApp::~FluApp(){
|
||||
if (nativeEvent != Q_NULLPTR) {
|
||||
delete nativeEvent;
|
||||
nativeEvent = Q_NULLPTR;
|
||||
}
|
||||
}
|
||||
|
||||
void FluApp::setFluApp(FluApp* val){
|
||||
FluApp::fluApp = val;
|
||||
}
|
||||
|
||||
void FluApp::setFluTheme(FluTheme* val){
|
||||
FluApp::fluTheme = val;
|
||||
}
|
||||
|
||||
void FluApp::setFluColors(FluColors* val){
|
||||
FluApp::fluColors = val;
|
||||
}
|
||||
|
||||
void FluApp::setFluTools(FluTools* val){
|
||||
FluApp::fluTools = val;
|
||||
}
|
||||
|
||||
void FluApp::init(QQuickWindow *window){
|
||||
this->appWindow = window;
|
||||
QQmlEngine *engine = qmlEngine(appWindow);
|
||||
QQmlComponent component(engine, ":/FluentUI/Controls/FluSingleton.qml");
|
||||
component.create();
|
||||
nativeEvent = new NativeEventFilter();
|
||||
qApp->installNativeEventFilter(nativeEvent);
|
||||
}
|
||||
|
||||
void FluApp::run(){
|
||||
#ifdef Q_OS_WIN
|
||||
if(!isCompositionEnabled()){
|
||||
fluTheme->frameless(false);
|
||||
}
|
||||
#endif
|
||||
navigate(initialRoute());
|
||||
}
|
||||
|
||||
@ -113,9 +73,6 @@ void FluApp::navigate(const QString& route,const QJsonObject& argument,FluRegist
|
||||
}
|
||||
}
|
||||
view = qobject_cast<QQuickWindow*>(component.createWithInitialProperties(properties));
|
||||
if(fluTheme->frameless()){
|
||||
view->setFlag(Qt::FramelessWindowHint,true);
|
||||
}
|
||||
wnds.insert(view->winId(),view);
|
||||
if(fluRegister){
|
||||
fluRegister->to(view);
|
||||
|
65
src/FluApp.h
@ -11,7 +11,6 @@
|
||||
#include "FluTheme.h"
|
||||
#include "FluTools.h"
|
||||
#include "FluColors.h"
|
||||
#include "NativeEventFilter.h"
|
||||
#include "FluRegister.h"
|
||||
#include "stdafx.h"
|
||||
|
||||
@ -33,11 +32,19 @@ class FluApp : public QObject
|
||||
|
||||
QML_NAMED_ELEMENT(FluApp)
|
||||
QML_SINGLETON
|
||||
|
||||
public:
|
||||
private:
|
||||
/**
|
||||
* @brief FluApp 将默认构造函数设置为私有,则qml创建单例就会走create工厂方法创建单例
|
||||
* @param parent
|
||||
*/
|
||||
explicit FluApp(QObject *parent = nullptr);
|
||||
public:
|
||||
~FluApp();
|
||||
|
||||
static FluApp *create(QQmlEngine *qmlEngine, QJSEngine *jsEngine)
|
||||
{
|
||||
return getInstance();
|
||||
}
|
||||
static FluApp *getInstance();
|
||||
/**
|
||||
* @brief run
|
||||
*/
|
||||
@ -69,62 +76,14 @@ public:
|
||||
*/
|
||||
Q_INVOKABLE void closeApp();
|
||||
|
||||
/**
|
||||
* @brief setFluApp 在FluSingleton.qml调用,拿到QML中FluApp的单例
|
||||
* @param val
|
||||
*/
|
||||
Q_INVOKABLE void setFluApp(FluApp* val);
|
||||
|
||||
/**
|
||||
* @brief setFluTheme 在FluSingleton.qml调用,拿到QML中FluTheme的单例
|
||||
* @param val
|
||||
*/
|
||||
Q_INVOKABLE void setFluTheme(FluTheme* val);
|
||||
|
||||
/**
|
||||
* @brief setFluColors 在FluSingleton.qml调用,拿到QML中FluColors的单例
|
||||
* @param val
|
||||
*/
|
||||
Q_INVOKABLE void setFluColors(FluColors* val);
|
||||
|
||||
/**
|
||||
* @brief setFluColors 在FluSingleton.qml调用,拿到QML中FluTools的单例
|
||||
* @param val
|
||||
*/
|
||||
Q_INVOKABLE void setFluTools(FluTools* val);
|
||||
|
||||
public:
|
||||
/**
|
||||
* @brief wnds
|
||||
*/
|
||||
QMap<quint64, QQuickWindow*> wnds;
|
||||
|
||||
/**
|
||||
* @brief fluApp
|
||||
*/
|
||||
static FluApp* fluApp;
|
||||
|
||||
/**
|
||||
* @brief fluTheme
|
||||
*/
|
||||
static FluTheme* fluTheme;
|
||||
|
||||
/**
|
||||
* @brief fluColors
|
||||
*/
|
||||
static FluColors* fluColors;
|
||||
|
||||
/**
|
||||
* @brief fluTools
|
||||
*/
|
||||
static FluTools* fluTools;
|
||||
|
||||
private:
|
||||
/**
|
||||
* @brief nativeEvent
|
||||
*/
|
||||
NativeEventFilter *nativeEvent = Q_NULLPTR;
|
||||
|
||||
static FluApp* m_instance;
|
||||
/**
|
||||
* @brief appWindow
|
||||
*/
|
||||
|
@ -1,5 +1,15 @@
|
||||
#include "FluColors.h"
|
||||
|
||||
FluColors* FluColors::m_instance = nullptr;
|
||||
|
||||
FluColors *FluColors::getInstance()
|
||||
{
|
||||
if(FluColors::m_instance == nullptr){
|
||||
FluColors::m_instance = new FluColors;
|
||||
}
|
||||
return FluColors::m_instance;
|
||||
}
|
||||
|
||||
FluColors::FluColors(QObject *parent)
|
||||
: QObject{parent}
|
||||
{
|
||||
|
@ -46,8 +46,15 @@ class FluColors : public QObject
|
||||
Q_PROPERTY_AUTO(FluColorSet*,Green);
|
||||
QML_NAMED_ELEMENT(FluColors)
|
||||
QML_SINGLETON
|
||||
public:
|
||||
private:
|
||||
explicit FluColors(QObject *parent = nullptr);
|
||||
static FluColors* m_instance;
|
||||
public:
|
||||
static FluColors *getInstance();
|
||||
static FluColors *create(QQmlEngine *qmlEngine, QJSEngine *jsEngine)
|
||||
{
|
||||
return getInstance();
|
||||
}
|
||||
};
|
||||
|
||||
#endif // FLUCOLORS_H
|
||||
|
@ -12,7 +12,7 @@ FluRegister::FluRegister(QObject *parent)
|
||||
}
|
||||
|
||||
void FluRegister::launch(const QJsonObject& argument){
|
||||
FluApp::fluApp->navigate(path(),argument,this);
|
||||
FluApp::getInstance()->navigate(path(),argument,this);
|
||||
}
|
||||
|
||||
void FluRegister::onResult(const QJsonObject& data){
|
||||
|
@ -5,15 +5,24 @@
|
||||
#include "FluApp.h"
|
||||
#include <QGuiApplication>
|
||||
|
||||
FluTheme* FluTheme::m_instance = nullptr;
|
||||
|
||||
FluTheme *FluTheme::getInstance()
|
||||
{
|
||||
if(FluTheme::m_instance == nullptr){
|
||||
FluTheme::m_instance = new FluTheme;
|
||||
}
|
||||
return FluTheme::m_instance;
|
||||
}
|
||||
|
||||
FluTheme::FluTheme(QObject *parent)
|
||||
: QObject{parent}
|
||||
{
|
||||
connect(this,&FluTheme::darkModeChanged,this,[=]{
|
||||
Q_EMIT darkChanged();
|
||||
});
|
||||
primaryColor(FluApp::fluColors->Blue());
|
||||
primaryColor(FluColors::getInstance()->Blue());
|
||||
nativeText(false);
|
||||
frameless(true);
|
||||
darkMode(Fluent_DarkMode::Fluent_DarkModeType::Light);
|
||||
qApp->installEventFilter(this);
|
||||
}
|
||||
|
@ -22,11 +22,6 @@ class FluTheme : public QObject
|
||||
*/
|
||||
Q_PROPERTY_AUTO(FluColorSet*,primaryColor)
|
||||
|
||||
/**
|
||||
* @brief frameless 是否是无边框窗口,只支持windows部分电脑
|
||||
*/
|
||||
Q_PROPERTY_AUTO(bool,frameless);
|
||||
|
||||
/**
|
||||
* @brief darkMode 夜间模式,支持System=0、Light=1、Dark=2
|
||||
*/
|
||||
@ -39,8 +34,15 @@ class FluTheme : public QObject
|
||||
|
||||
QML_NAMED_ELEMENT(FluTheme)
|
||||
QML_SINGLETON
|
||||
public:
|
||||
private:
|
||||
static FluTheme* m_instance;
|
||||
explicit FluTheme(QObject *parent = nullptr);
|
||||
public:
|
||||
static FluTheme *getInstance();
|
||||
static FluTheme *create(QQmlEngine *qmlEngine, QJSEngine *jsEngine)
|
||||
{
|
||||
return getInstance();
|
||||
}
|
||||
bool dark();
|
||||
Q_SIGNAL void darkChanged();
|
||||
private:
|
||||
|
@ -3,6 +3,17 @@
|
||||
#include <QClipboard>
|
||||
#include <QUuid>
|
||||
|
||||
FluTools* FluTools::m_instance = nullptr;
|
||||
|
||||
FluTools *FluTools::getInstance()
|
||||
{
|
||||
if(FluTools::m_instance == nullptr){
|
||||
FluTools::m_instance = new FluTools;
|
||||
}
|
||||
return FluTools::m_instance;
|
||||
}
|
||||
|
||||
|
||||
FluTools::FluTools(QObject *parent)
|
||||
: QObject{parent}
|
||||
{
|
||||
|
@ -13,10 +13,15 @@ class FluTools : public QObject
|
||||
|
||||
QML_NAMED_ELEMENT(FluTools)
|
||||
QML_SINGLETON
|
||||
|
||||
public:
|
||||
private:
|
||||
explicit FluTools(QObject *parent = nullptr);
|
||||
|
||||
static FluTools* m_instance;
|
||||
public:
|
||||
static FluTools *create(QQmlEngine *qmlEngine, QJSEngine *jsEngine)
|
||||
{
|
||||
return getInstance();
|
||||
}
|
||||
static FluTools *getInstance();
|
||||
/**
|
||||
* @brief clipText 将字符串添加到剪切板
|
||||
* @param text
|
||||
|
@ -1,81 +0,0 @@
|
||||
#include "NativeEventFilter.h"
|
||||
#include "FluTheme.h"
|
||||
#include "FluApp.h"
|
||||
#ifdef Q_OS_WIN
|
||||
#pragma comment(lib, "Dwmapi.lib")
|
||||
#pragma comment(lib, "User32.lib")
|
||||
#include <Windows.h>
|
||||
#include <windowsx.h>
|
||||
#endif
|
||||
|
||||
bool NativeEventFilter::nativeEventFilter(const QByteArray &eventType, void *message, qintptr *result)
|
||||
{
|
||||
#ifdef Q_OS_WIN
|
||||
if (eventType == "windows_generic_MSG" && FluApp::fluTheme->frameless()) {
|
||||
MSG* msg = static_cast<MSG *>(message);
|
||||
if (msg == Q_NULLPTR)
|
||||
return false;
|
||||
if(!FluApp::fluApp->wnds.contains((WId)msg->hwnd)){
|
||||
return false;
|
||||
}
|
||||
switch(msg->message) {
|
||||
case WM_NCCALCSIZE:{
|
||||
NCCALCSIZE_PARAMS& params = *reinterpret_cast<NCCALCSIZE_PARAMS*>(msg->lParam);
|
||||
if (params.rgrc[0].top != 0)
|
||||
params.rgrc[0].top -= 1;
|
||||
*result = WVR_REDRAW;
|
||||
return true;
|
||||
}
|
||||
case WM_NCHITTEST: {
|
||||
auto view = FluApp::fluApp->wnds[(WId)msg->hwnd];
|
||||
bool isResize = !(view->maximumWidth()==view->minimumWidth()&&view->maximumHeight()==view->minimumHeight());
|
||||
const LONG borderWidth = 8;
|
||||
RECT winrect;
|
||||
GetWindowRect(msg->hwnd, &winrect);
|
||||
long x = GET_X_LPARAM(msg->lParam);
|
||||
long y = GET_Y_LPARAM(msg->lParam);
|
||||
if (x >= winrect.left && x < winrect.left + borderWidth &&
|
||||
y < winrect.bottom && y >= winrect.bottom - borderWidth && isResize) {
|
||||
*result = HTBOTTOMLEFT;
|
||||
return true;
|
||||
}
|
||||
if (x < winrect.right && x >= winrect.right - borderWidth &&
|
||||
y < winrect.bottom && y >= winrect.bottom - borderWidth && isResize) {
|
||||
*result = HTBOTTOMRIGHT;
|
||||
return true;
|
||||
}
|
||||
if (x >= winrect.left && x < winrect.left + borderWidth &&
|
||||
y >= winrect.top && y < winrect.top + borderWidth && isResize) {
|
||||
*result = HTTOPLEFT;
|
||||
return true;
|
||||
}
|
||||
if (x < winrect.right && x >= winrect.right - borderWidth &&
|
||||
y >= winrect.top && y < winrect.top + borderWidth && isResize) {
|
||||
*result = HTTOPRIGHT;
|
||||
return true;
|
||||
}
|
||||
if (x >= winrect.left && x < winrect.left + borderWidth && isResize) {
|
||||
*result = HTLEFT;
|
||||
return true;
|
||||
}
|
||||
if (x < winrect.right && x >= winrect.right - borderWidth && isResize) {
|
||||
*result = HTRIGHT;
|
||||
return true;
|
||||
}
|
||||
if (y < winrect.bottom && y >= winrect.bottom - borderWidth && isResize) {
|
||||
*result = HTBOTTOM;
|
||||
return true;
|
||||
}
|
||||
if (y >= winrect.top && y < winrect.top + borderWidth && isResize) {
|
||||
*result = HTTOP;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return false;
|
||||
}
|
@ -1,17 +0,0 @@
|
||||
#ifndef NATIVEEVENTFILTER_H
|
||||
#define NATIVEEVENTFILTER_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QAbstractNativeEventFilter>
|
||||
|
||||
/**
|
||||
* @brief The NativeEventFilter class
|
||||
*/
|
||||
class NativeEventFilter : public QAbstractNativeEventFilter
|
||||
{
|
||||
|
||||
public:
|
||||
bool nativeEventFilter(const QByteArray &eventType, void *message, qintptr *result) override;
|
||||
};
|
||||
|
||||
#endif // NATIVEEVENTFILTER_H
|
@ -2,20 +2,6 @@
|
||||
|
||||
#include "FluRegister.h"
|
||||
#include "FluApp.h"
|
||||
#include "FluTheme.h"
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
#pragma comment(lib, "Dwmapi.lib")
|
||||
#pragma comment(lib, "User32.lib")
|
||||
#include <dwmapi.h>
|
||||
#include <Windows.h>
|
||||
#include <windowsx.h>
|
||||
enum class Style : DWORD
|
||||
{
|
||||
windowed = (WS_OVERLAPPEDWINDOW | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_THICKFRAME | WS_CLIPCHILDREN),
|
||||
aero_borderless = (WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_THICKFRAME | WS_CLIPCHILDREN)
|
||||
};
|
||||
#endif
|
||||
|
||||
WindowHelper::WindowHelper(QObject *parent)
|
||||
: QObject{parent}
|
||||
@ -27,20 +13,6 @@ void WindowHelper::initWindow(QQuickWindow* window){
|
||||
this->window = window;
|
||||
}
|
||||
|
||||
void WindowHelper::firstUpdate(){
|
||||
#ifdef Q_OS_WIN
|
||||
if(FluApp::fluTheme->frameless()){
|
||||
HWND wnd = (HWND)window->winId();
|
||||
SetWindowLongPtr(wnd, GWL_STYLE, static_cast<LONG>(Style::aero_borderless));
|
||||
const MARGINS shadow_on = { 1, 1, 1, 1 };
|
||||
DwmExtendFrameIntoClientArea(wnd, &shadow_on);
|
||||
SetWindowPos(wnd, Q_NULLPTR, 0, 0, 0, 0, SWP_FRAMECHANGED | SWP_NOMOVE | SWP_NOSIZE);
|
||||
ShowWindow(wnd, SW_SHOW);
|
||||
window->setFlag(Qt::FramelessWindowHint,false);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
QVariant WindowHelper::createRegister(QQuickWindow* window,const QString& path){
|
||||
FluRegister *p = new FluRegister(window);
|
||||
p->from(window);
|
||||
@ -48,9 +20,9 @@ QVariant WindowHelper::createRegister(QQuickWindow* window,const QString& path){
|
||||
return QVariant::fromValue(p);
|
||||
}
|
||||
|
||||
void WindowHelper::destoryWindow(){
|
||||
void WindowHelper::deleteWindow(){
|
||||
if(this->window){
|
||||
FluApp::fluApp->wnds.remove(this->window->winId());
|
||||
FluApp::getInstance()->wnds.remove(this->window->winId());
|
||||
this->window->deleteLater();
|
||||
}
|
||||
}
|
||||
|
@ -25,9 +25,9 @@ public:
|
||||
Q_INVOKABLE void initWindow(QQuickWindow* window);
|
||||
|
||||
/**
|
||||
* @brief destoryWindow 销毁窗口,释放资源,QML中的Window close并不会销毁窗口,只是把窗口隐藏了
|
||||
* @brief deleteWindow 销毁窗口,释放资源,QML中的Window close并不会销毁窗口,只是把窗口隐藏了
|
||||
*/
|
||||
Q_INVOKABLE void destoryWindow();
|
||||
Q_INVOKABLE void deleteWindow();
|
||||
|
||||
/**
|
||||
* @brief createRegister 创建一个FluRegsiter对象,在FluWindow中registerForWindowResult方法调用
|
||||
@ -37,11 +37,6 @@ public:
|
||||
*/
|
||||
Q_INVOKABLE QVariant createRegister(QQuickWindow* window,const QString& path);
|
||||
|
||||
/**
|
||||
* @brief firstUpdate 窗口创建成功后调用,只调用一次
|
||||
*/
|
||||
Q_INVOKABLE void firstUpdate();
|
||||
|
||||
private:
|
||||
QQuickWindow* window;
|
||||
};
|
||||
|
@ -31,7 +31,7 @@ Rectangle{
|
||||
|
||||
id:root
|
||||
color: Qt.rgba(0,0,0,0)
|
||||
visible: FluTheme.frameless
|
||||
visible: false
|
||||
height: visible ? 30 : 0
|
||||
opacity: visible
|
||||
z: 65535
|
||||
|
@ -19,12 +19,8 @@ Item {
|
||||
property FluObject items
|
||||
property FluObject footerItems
|
||||
property int displayMode: FluNavigationView.Auto
|
||||
property Component autoSuggestBox
|
||||
property var window : {
|
||||
if(Window.window == null)
|
||||
return null
|
||||
return Window.window
|
||||
}
|
||||
property Component autoSuggestBox
|
||||
property Component actionItem
|
||||
|
||||
id:control
|
||||
|
||||
@ -471,7 +467,7 @@ Item {
|
||||
Item {
|
||||
id:nav_app_bar
|
||||
width: parent.width
|
||||
height: 50
|
||||
height: 40
|
||||
z:999
|
||||
RowLayout{
|
||||
height:parent.height
|
||||
@ -479,8 +475,8 @@ Item {
|
||||
FluIconButton{
|
||||
iconSource: FluentIcons.ChromeBack
|
||||
Layout.leftMargin: 5
|
||||
Layout.preferredWidth: 40
|
||||
Layout.preferredHeight: 40
|
||||
Layout.preferredWidth: 30
|
||||
Layout.preferredHeight: 30
|
||||
Layout.alignment: Qt.AlignVCenter
|
||||
disabled: nav_swipe.depth === 1
|
||||
iconSize: 13
|
||||
@ -503,8 +499,8 @@ Item {
|
||||
id:btn_nav
|
||||
iconSource: FluentIcons.GlobalNavButton
|
||||
iconSize: 15
|
||||
Layout.preferredWidth: d.isMinimal ? 40 : 0
|
||||
Layout.preferredHeight: 40
|
||||
Layout.preferredWidth: d.isMinimal ? 30 : 0
|
||||
Layout.preferredHeight: 30
|
||||
Layout.alignment: Qt.AlignVCenter
|
||||
onClicked: {
|
||||
d.enableNavigationPanel = !d.enableNavigationPanel
|
||||
@ -529,6 +525,7 @@ Item {
|
||||
}
|
||||
return 5
|
||||
}
|
||||
sourceSize: Qt.size(40,40)
|
||||
Layout.alignment: Qt.AlignVCenter
|
||||
}
|
||||
FluText{
|
||||
@ -538,6 +535,22 @@ Item {
|
||||
font: FluTextStyle.Body
|
||||
}
|
||||
}
|
||||
|
||||
Item{
|
||||
anchors.right: parent.right
|
||||
height: parent.height
|
||||
width: {
|
||||
if(loader_action.item){
|
||||
return loader_action.item.width
|
||||
}
|
||||
return 0
|
||||
}
|
||||
Loader{
|
||||
id:loader_action
|
||||
anchors.centerIn: parent
|
||||
sourceComponent: actionItem
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Item{
|
||||
@ -620,7 +633,7 @@ Item {
|
||||
if(d.isMinimal || d.isCompactAndPanel){
|
||||
return FluTheme.dark ? Qt.rgba(61/255,61/255,61/255,1) : Qt.rgba(243/255,243/255,243/255,1)
|
||||
}
|
||||
if(window && window.active){
|
||||
if(Window.window.active){
|
||||
return FluTheme.dark ? Qt.rgba(26/255,34/255,41/255,1) : Qt.rgba(238/255,244/255,249/255,1)
|
||||
}
|
||||
return FluTheme.dark ? Qt.rgba(32/255,32/255,32/255,1) : Qt.rgba(243/255,243/255,243/255,1)
|
||||
|
@ -8,19 +8,20 @@ Item {
|
||||
|
||||
property alias title: text_title.text
|
||||
default property alias content: container.data
|
||||
property int spacing : 5
|
||||
property int leftPadding: 0
|
||||
property int spacing : 0
|
||||
property int leftPadding: 10
|
||||
property int topPadding: 0
|
||||
property int rightPadding: 0
|
||||
property int bottomPadding: 0
|
||||
property int rightPadding: 10
|
||||
property int bottomPadding: 10
|
||||
|
||||
id:control
|
||||
|
||||
FluText{
|
||||
id:text_title
|
||||
font: FluTextStyle.TitleLarge
|
||||
font: FluTextStyle.Title
|
||||
visible: text !== ""
|
||||
height: visible?implicitHeight:0
|
||||
height: visible ? implicitHeight : 0
|
||||
padding: 0
|
||||
anchors{
|
||||
top: parent.top
|
||||
topMargin: control.topPadding
|
||||
|
@ -1,16 +0,0 @@
|
||||
import QtQuick
|
||||
import QtQuick.Controls
|
||||
import FluentUI
|
||||
|
||||
QtObject {
|
||||
|
||||
id:control
|
||||
|
||||
Component.onCompleted: {
|
||||
FluApp.setFluApp(FluApp)
|
||||
FluApp.setFluColors(FluColors)
|
||||
FluApp.setFluTheme(FluTheme)
|
||||
FluApp.setFluTools(FluTools)
|
||||
}
|
||||
|
||||
}
|
@ -1,5 +1,6 @@
|
||||
import QtQuick
|
||||
import QtQuick.Controls
|
||||
import QtQuick.Controls.Basic
|
||||
import QtQuick.Layouts
|
||||
import FluentUI
|
||||
|
||||
@ -144,12 +145,22 @@ Item {
|
||||
}
|
||||
}
|
||||
model:model_data_source
|
||||
delegate: Item{
|
||||
delegate: Control{
|
||||
id:item_control
|
||||
height: table_row.maxHeight
|
||||
width: layout_table.width
|
||||
property var model_values : getObjectValues(index)
|
||||
property var itemObject: getObject(index)
|
||||
property var listModel: model
|
||||
Rectangle{
|
||||
anchors.fill: parent
|
||||
color: {
|
||||
if(item_control.hovered){
|
||||
return FluTheme.dark ? Qt.rgba(68/255,68/255,68/255,1) : Qt.rgba(251/255,251/255,251/255,1)
|
||||
}
|
||||
return FluTheme.dark ? Qt.rgba(62/255,62/255,62/255,1) : Qt.rgba(1,1,1,1)
|
||||
}
|
||||
}
|
||||
Row{
|
||||
id: table_row
|
||||
spacing: 0
|
||||
|
@ -4,7 +4,7 @@ import QtQuick.Controls
|
||||
import QtQuick.Layouts
|
||||
import FluentUI
|
||||
|
||||
ApplicationWindow {
|
||||
Window {
|
||||
|
||||
enum LaunchMode {
|
||||
Standard,
|
||||
@ -20,7 +20,7 @@ ApplicationWindow {
|
||||
property var pageRegister
|
||||
property var closeFunc: function(event){
|
||||
if(closeDestory){
|
||||
destoryWindow()
|
||||
deleteWindow()
|
||||
}else{
|
||||
visible = false
|
||||
event.accepted = false
|
||||
@ -28,13 +28,9 @@ ApplicationWindow {
|
||||
}
|
||||
signal initArgument(var argument)
|
||||
|
||||
QtObject{
|
||||
id:d
|
||||
property bool firstFlag: true
|
||||
}
|
||||
|
||||
id:window
|
||||
background: Rectangle{
|
||||
Rectangle{
|
||||
anchors.fill: parent
|
||||
color: {
|
||||
if(active){
|
||||
return FluTheme.dark ? Qt.rgba(26/255,34/255,40/255,1) : Qt.rgba(238/255,244/255,249/255,1)
|
||||
@ -51,17 +47,9 @@ ApplicationWindow {
|
||||
Item{
|
||||
id:container
|
||||
anchors.fill: parent
|
||||
anchors.margins: window.visibility === Window.Maximized && FluTheme.frameless ? 8/Screen.devicePixelRatio : 0
|
||||
clip: true
|
||||
}
|
||||
|
||||
onActiveChanged: {
|
||||
if(d.firstFlag){
|
||||
helper.firstUpdate()
|
||||
d.firstFlag = false
|
||||
}
|
||||
}
|
||||
|
||||
onClosing:(event)=>closeFunc(event)
|
||||
|
||||
FluInfoBar{
|
||||
@ -76,8 +64,6 @@ ApplicationWindow {
|
||||
Component.onCompleted: {
|
||||
helper.initWindow(window)
|
||||
initArgument(argument)
|
||||
window.x = (Screen.width - window.width)/2
|
||||
window.y = (Screen.desktopAvailableHeight - window.height)/2
|
||||
}
|
||||
|
||||
function showSuccess(text,duration,moremsg){
|
||||
@ -100,8 +86,8 @@ ApplicationWindow {
|
||||
return helper.createRegister(window,path)
|
||||
}
|
||||
|
||||
function destoryWindow(){
|
||||
helper.destoryWindow()
|
||||
function deleteWindow(){
|
||||
helper.deleteWindow()
|
||||
}
|
||||
|
||||
function onResult(data){
|
||||
|
17
src/imports/FluentUI/designer/fluentui.metainfo
Normal file
@ -0,0 +1,17 @@
|
||||
MetaInfo {
|
||||
Type {
|
||||
name: "FluentUI.Controls.FluButton"
|
||||
icon: "images/button-icon16.png"
|
||||
|
||||
ItemLibraryEntry {
|
||||
name: "FluButton"
|
||||
category: "FluentUI - Controls"
|
||||
libraryIcon: "images/button-icon.png"
|
||||
version: "2.0"
|
||||
requiredImport: "FluentUI"
|
||||
toolTip: qsTr("A button with text.")
|
||||
|
||||
Property { name: "text"; type: "binding"; value: "qsTr(\"Button\")" }
|
||||
}
|
||||
}
|
||||
}
|
BIN
src/imports/FluentUI/designer/images/busyindicator-icon.png
Normal file
After Width: | Height: | Size: 320 B |
BIN
src/imports/FluentUI/designer/images/busyindicator-icon16.png
Normal file
After Width: | Height: | Size: 229 B |
BIN
src/imports/FluentUI/designer/images/busyindicator-icon@2x.png
Normal file
After Width: | Height: | Size: 643 B |
BIN
src/imports/FluentUI/designer/images/button-icon.png
Normal file
After Width: | Height: | Size: 162 B |
BIN
src/imports/FluentUI/designer/images/button-icon16.png
Normal file
After Width: | Height: | Size: 145 B |
BIN
src/imports/FluentUI/designer/images/button-icon@2x.png
Normal file
After Width: | Height: | Size: 259 B |
BIN
src/imports/FluentUI/designer/images/checkbox-icon.png
Normal file
After Width: | Height: | Size: 258 B |
BIN
src/imports/FluentUI/designer/images/checkbox-icon16.png
Normal file
After Width: | Height: | Size: 230 B |
BIN
src/imports/FluentUI/designer/images/checkbox-icon@2x.png
Normal file
After Width: | Height: | Size: 336 B |
BIN
src/imports/FluentUI/designer/images/combobox-icon.png
Normal file
After Width: | Height: | Size: 156 B |
BIN
src/imports/FluentUI/designer/images/combobox-icon16.png
Normal file
After Width: | Height: | Size: 155 B |
BIN
src/imports/FluentUI/designer/images/combobox-icon@2x.png
Normal file
After Width: | Height: | Size: 185 B |
BIN
src/imports/FluentUI/designer/images/control-icon.png
Normal file
After Width: | Height: | Size: 293 B |
BIN
src/imports/FluentUI/designer/images/control-icon16.png
Normal file
After Width: | Height: | Size: 229 B |
BIN
src/imports/FluentUI/designer/images/control-icon@2x.png
Normal file
After Width: | Height: | Size: 509 B |
BIN
src/imports/FluentUI/designer/images/delaybutton-icon.png
Normal file
After Width: | Height: | Size: 189 B |
BIN
src/imports/FluentUI/designer/images/delaybutton-icon16.png
Normal file
After Width: | Height: | Size: 160 B |
BIN
src/imports/FluentUI/designer/images/delaybutton-icon@2x.png
Normal file
After Width: | Height: | Size: 286 B |
BIN
src/imports/FluentUI/designer/images/dial-icon.png
Normal file
After Width: | Height: | Size: 267 B |
BIN
src/imports/FluentUI/designer/images/dial-icon16.png
Normal file
After Width: | Height: | Size: 243 B |
BIN
src/imports/FluentUI/designer/images/dial-icon@2x.png
Normal file
After Width: | Height: | Size: 505 B |
BIN
src/imports/FluentUI/designer/images/frame-icon.png
Normal file
After Width: | Height: | Size: 121 B |
BIN
src/imports/FluentUI/designer/images/frame-icon16.png
Normal file
After Width: | Height: | Size: 117 B |
BIN
src/imports/FluentUI/designer/images/frame-icon@2x.png
Normal file
After Width: | Height: | Size: 125 B |
BIN
src/imports/FluentUI/designer/images/groupbox-icon.png
Normal file
After Width: | Height: | Size: 133 B |
BIN
src/imports/FluentUI/designer/images/groupbox-icon16.png
Normal file
After Width: | Height: | Size: 125 B |
BIN
src/imports/FluentUI/designer/images/groupbox-icon@2x.png
Normal file
After Width: | Height: | Size: 136 B |
BIN
src/imports/FluentUI/designer/images/itemdelegate-icon.png
Normal file
After Width: | Height: | Size: 127 B |
BIN
src/imports/FluentUI/designer/images/itemdelegate-icon16.png
Normal file
After Width: | Height: | Size: 124 B |
BIN
src/imports/FluentUI/designer/images/itemdelegate-icon@2x.png
Normal file
After Width: | Height: | Size: 133 B |
BIN
src/imports/FluentUI/designer/images/label-icon.png
Normal file
After Width: | Height: | Size: 206 B |
BIN
src/imports/FluentUI/designer/images/label-icon16.png
Normal file
After Width: | Height: | Size: 182 B |
BIN
src/imports/FluentUI/designer/images/label-icon@2x.png
Normal file
After Width: | Height: | Size: 284 B |
BIN
src/imports/FluentUI/designer/images/page-icon.png
Normal file
After Width: | Height: | Size: 190 B |
BIN
src/imports/FluentUI/designer/images/page-icon16.png
Normal file
After Width: | Height: | Size: 148 B |
BIN
src/imports/FluentUI/designer/images/page-icon@2x.png
Normal file
After Width: | Height: | Size: 195 B |
BIN
src/imports/FluentUI/designer/images/pageindicator-icon.png
Normal file
After Width: | Height: | Size: 179 B |
BIN
src/imports/FluentUI/designer/images/pageindicator-icon16.png
Normal file
After Width: | Height: | Size: 158 B |
BIN
src/imports/FluentUI/designer/images/pageindicator-icon@2x.png
Normal file
After Width: | Height: | Size: 207 B |
BIN
src/imports/FluentUI/designer/images/pane-icon.png
Normal file
After Width: | Height: | Size: 93 B |
BIN
src/imports/FluentUI/designer/images/pane-icon16.png
Normal file
After Width: | Height: | Size: 92 B |
BIN
src/imports/FluentUI/designer/images/pane-icon@2x.png
Normal file
After Width: | Height: | Size: 96 B |
BIN
src/imports/FluentUI/designer/images/progressbar-icon.png
Normal file
After Width: | Height: | Size: 101 B |
BIN
src/imports/FluentUI/designer/images/progressbar-icon16.png
Normal file
After Width: | Height: | Size: 92 B |
BIN
src/imports/FluentUI/designer/images/progressbar-icon@2x.png
Normal file
After Width: | Height: | Size: 127 B |
BIN
src/imports/FluentUI/designer/images/radiobutton-icon.png
Normal file
After Width: | Height: | Size: 279 B |
BIN
src/imports/FluentUI/designer/images/radiobutton-icon16.png
Normal file
After Width: | Height: | Size: 218 B |
BIN
src/imports/FluentUI/designer/images/radiobutton-icon@2x.png
Normal file
After Width: | Height: | Size: 482 B |
BIN
src/imports/FluentUI/designer/images/rangeslider-icon.png
Normal file
After Width: | Height: | Size: 269 B |
BIN
src/imports/FluentUI/designer/images/rangeslider-icon16.png
Normal file
After Width: | Height: | Size: 231 B |
BIN
src/imports/FluentUI/designer/images/rangeslider-icon@2x.png
Normal file
After Width: | Height: | Size: 282 B |
BIN
src/imports/FluentUI/designer/images/roundbutton-icon.png
Normal file
After Width: | Height: | Size: 229 B |
BIN
src/imports/FluentUI/designer/images/roundbutton-icon16.png
Normal file
After Width: | Height: | Size: 186 B |
BIN
src/imports/FluentUI/designer/images/roundbutton-icon@2x.png
Normal file
After Width: | Height: | Size: 381 B |
BIN
src/imports/FluentUI/designer/images/scrollview-icon.png
Normal file
After Width: | Height: | Size: 110 B |
BIN
src/imports/FluentUI/designer/images/scrollview-icon16.png
Normal file
After Width: | Height: | Size: 116 B |
BIN
src/imports/FluentUI/designer/images/scrollview-icon@2x.png
Normal file
After Width: | Height: | Size: 145 B |
BIN
src/imports/FluentUI/designer/images/slider-icon.png
Normal file
After Width: | Height: | Size: 190 B |
BIN
src/imports/FluentUI/designer/images/slider-icon16.png
Normal file
After Width: | Height: | Size: 156 B |
BIN
src/imports/FluentUI/designer/images/slider-icon@2x.png
Normal file
After Width: | Height: | Size: 227 B |
BIN
src/imports/FluentUI/designer/images/spinbox-icon.png
Normal file
After Width: | Height: | Size: 144 B |
BIN
src/imports/FluentUI/designer/images/spinbox-icon16.png
Normal file
After Width: | Height: | Size: 151 B |
BIN
src/imports/FluentUI/designer/images/spinbox-icon@2x.png
Normal file
After Width: | Height: | Size: 178 B |
BIN
src/imports/FluentUI/designer/images/stackview-icon.png
Normal file
After Width: | Height: | Size: 162 B |
BIN
src/imports/FluentUI/designer/images/stackview-icon16.png
Normal file
After Width: | Height: | Size: 151 B |
BIN
src/imports/FluentUI/designer/images/stackview-icon@2x.png
Normal file
After Width: | Height: | Size: 167 B |
BIN
src/imports/FluentUI/designer/images/swipeview-icon.png
Normal file
After Width: | Height: | Size: 163 B |
BIN
src/imports/FluentUI/designer/images/swipeview-icon16.png
Normal file
After Width: | Height: | Size: 152 B |
BIN
src/imports/FluentUI/designer/images/swipeview-icon@2x.png
Normal file
After Width: | Height: | Size: 184 B |
BIN
src/imports/FluentUI/designer/images/switch-icon.png
Normal file
After Width: | Height: | Size: 205 B |
BIN
src/imports/FluentUI/designer/images/switch-icon16.png
Normal file
After Width: | Height: | Size: 160 B |
BIN
src/imports/FluentUI/designer/images/switch-icon@2x.png
Normal file
After Width: | Height: | Size: 314 B |
BIN
src/imports/FluentUI/designer/images/textarea-icon.png
Normal file
After Width: | Height: | Size: 149 B |
BIN
src/imports/FluentUI/designer/images/textarea-icon16.png
Normal file
After Width: | Height: | Size: 133 B |
BIN
src/imports/FluentUI/designer/images/textarea-icon@2x.png
Normal file
After Width: | Height: | Size: 163 B |
BIN
src/imports/FluentUI/designer/images/textfield-icon.png
Normal file
After Width: | Height: | Size: 154 B |
BIN
src/imports/FluentUI/designer/images/textfield-icon16.png
Normal file
After Width: | Height: | Size: 147 B |
BIN
src/imports/FluentUI/designer/images/textfield-icon@2x.png
Normal file
After Width: | Height: | Size: 172 B |