Compare commits

..

No commits in common. "72610da66e182ed11c40abe8efbbe71e03116032" and "f4112ee5dcf51ce977e7b31b082064cfc9bd555a" have entirely different histories.

8 changed files with 58 additions and 181 deletions

View File

@ -240,7 +240,7 @@ FluWindow {
id:com_reveal
CircularReveal{
id:reveal
target:window.layoutContainer()
target:window.contentItem
anchors.fill: parent
onAnimationFinished:{
//
@ -269,7 +269,7 @@ FluWindow {
return
}
loader_reveal.sourceComponent = com_reveal
var target = window.layoutContainer()
var target = window.contentItem
var pos = button.mapToItem(target,0,0)
var mouseX = pos.x
var mouseY = pos.y

View File

@ -243,7 +243,7 @@ FluWindow {
id:com_reveal
CircularReveal{
id:reveal
target:window.layoutContainer()
target:window.contentItem
anchors.fill: parent
onAnimationFinished:{
//
@ -272,7 +272,7 @@ FluWindow {
return
}
loader_reveal.sourceComponent = com_reveal
var target = window.layoutContainer()
var target = window.contentItem
var pos = button.mapToItem(target,0,0)
var mouseX = pos.x
var mouseY = pos.y

View File

@ -1,12 +1,10 @@
#include "FluFramelessHelper.h"
#include "FluFrameless.h"
#include <QGuiApplication>
#include <QOperatingSystemVersion>
#ifdef Q_OS_WIN
#pragma comment (lib,"user32.lib")
#pragma comment (lib,"dwmapi.lib")
#pragma comment(lib, "user32.lib")
#include <windows.h>
#include <dwmapi.h>
static inline QByteArray qtNativeEventType()
{
@ -30,26 +28,6 @@ static inline bool isCompositionEnabled(){
return false;
}
static inline void showShadow(HWND hwnd){
if(isCompositionEnabled()){
const MARGINS shadow = { 1, 1, 1, 1 };
typedef HRESULT (WINAPI* DwmExtendFrameIntoClientAreaPtr)(HWND hWnd, const MARGINS *pMarInset);
HMODULE module = LoadLibraryW(L"dwmapi.dll");
if (module)
{
DwmExtendFrameIntoClientAreaPtr dwm_extendframe_into_client_area_;
dwm_extendframe_into_client_area_= reinterpret_cast<DwmExtendFrameIntoClientAreaPtr>(GetProcAddress(module, "DwmExtendFrameIntoClientArea"));
if (dwm_extendframe_into_client_area_)
{
dwm_extendframe_into_client_area_(hwnd, &shadow);
}
}
}else{
ULONG_PTR cNewStyle = GetClassLongPtr(hwnd, GCL_STYLE) | CS_DROPSHADOW;
SetClassLongPtr(hwnd, GCL_STYLE, cNewStyle);
}
}
#endif
FramelessEventFilter::FramelessEventFilter(QQuickWindow* window){
@ -108,15 +86,15 @@ bool FramelessEventFilter::nativeEventFilter(const QByteArray &eventType, void *
return false;
}
FluFramelessHelper::FluFramelessHelper(QObject *parent)
FluFrameless::FluFrameless(QObject *parent)
: QObject{parent}
{
}
void FluFramelessHelper::classBegin(){
void FluFrameless::classBegin(){
}
void FluFramelessHelper::updateCursor(int edges){
void FluFrameless::updateCursor(int edges){
switch (edges) {
case 0:
_window->setCursor(Qt::ArrowCursor);
@ -140,7 +118,7 @@ void FluFramelessHelper::updateCursor(int edges){
}
}
bool FluFramelessHelper::eventFilter(QObject *obj, QEvent *ev){
bool FluFrameless::eventFilter(QObject *obj, QEvent *ev){
if (!_window.isNull() && _window->flags() & Qt::FramelessWindowHint) {
static int edges = 0;
@ -200,7 +178,7 @@ bool FluFramelessHelper::eventFilter(QObject *obj, QEvent *ev){
return QObject::eventFilter(obj, ev);
}
void FluFramelessHelper::componentComplete(){
void FluFrameless::componentComplete(){
auto o = parent();
while (nullptr != o) {
_window = (QQuickWindow*)o;
@ -212,11 +190,13 @@ void FluFramelessHelper::componentComplete(){
_nativeEvent =new FramelessEventFilter(_window);
qApp->installNativeEventFilter(_nativeEvent);
HWND hwnd = reinterpret_cast<HWND>(_window->winId());
ULONG_PTR cNewStyle = GetClassLongPtr(hwnd, GCL_STYLE) | CS_DROPSHADOW;
SetClassLongPtr(hwnd, GCL_STYLE, cNewStyle);
DWORD style = GetWindowLongPtr(hwnd,GWL_STYLE);
SetWindowLongPtr(hwnd, GWL_STYLE, style | WS_THICKFRAME | WS_CAPTION &~ WS_SYSMENU);
SetWindowPos(hwnd,nullptr,0,0,0,0,SWP_NOZORDER | SWP_NOOWNERZORDER | SWP_NOMOVE | SWP_NOSIZE |SWP_FRAMECHANGED);
showShadow(hwnd);
#endif
_stayTop = QQmlProperty(_window,"stayTop");
_onStayTopChange();
_stayTop.connectNotifySignal(this,SLOT(_onStayTopChange()));
_screen = QQmlProperty(_window,"screen");
_screen.connectNotifySignal(this,SLOT(_onScreenChanged()));
@ -224,12 +204,12 @@ void FluFramelessHelper::componentComplete(){
}
}
void FluFramelessHelper::_onScreenChanged(){
void FluFrameless::_onScreenChanged(){
_window->update();
QGuiApplication::processEvents();
}
void FluFramelessHelper::_onStayTopChange(){
void FluFrameless::_onStayTopChange(){
bool isStayTop = _stayTop.read().toBool();
#ifdef Q_OS_WIN
HWND hwnd = reinterpret_cast<HWND>(_window->winId());
@ -245,7 +225,7 @@ void FluFramelessHelper::_onStayTopChange(){
#endif
}
FluFramelessHelper::~FluFramelessHelper(){
FluFrameless::~FluFrameless(){
if (!_window.isNull()) {
_window->setFlags(Qt::Window);
#ifdef Q_OS_WIN

View File

@ -1,5 +1,5 @@
#ifndef FLUFRAMELESSHELPER_H
#define FLUFRAMELESSHELPER_H
#ifndef FLUFRAMELESS_H
#define FLUFRAMELESS_H
#include <QObject>
#include <QQuickWindow>
@ -25,13 +25,13 @@ public:
qint64 _current = 0;
};
class FluFramelessHelper : public QObject, public QQmlParserStatus
class FluFrameless : public QObject, public QQmlParserStatus
{
Q_OBJECT
QML_NAMED_ELEMENT(FluFramelessHelper)
QML_NAMED_ELEMENT(FluFrameless)
public:
explicit FluFramelessHelper(QObject *parent = nullptr);
~FluFramelessHelper();
explicit FluFrameless(QObject *parent = nullptr);
~FluFrameless();
void classBegin() override;
void componentComplete() override;
protected:
@ -47,4 +47,4 @@ private:
QQmlProperty _screen;
};
#endif // FLUFRAMELESSHELPER_H
#endif // FLUFRAMELESS_H

View File

@ -16,7 +16,7 @@
#include "Screenshot.h"
#include "FluRectangle.h"
#include "FluNetwork.h"
#include "FluFramelessHelper.h"
#include "FluFrameless.h"
#include "QRCode.h"
void FluentUI::registerTypes(QQmlEngine *engine){
@ -41,7 +41,7 @@ void FluentUI::registerTypes(const char *uri){
qmlRegisterType<FluRectangle>(uri,major,minor,"FluRectangle");
qmlRegisterType<NetworkCallable>(uri,major,minor,"FluNetworkCallable");
qmlRegisterType<NetworkParams>(uri,major,minor,"FluNetworkParams");
qmlRegisterType<FluFramelessHelper>(uri,major,minor,"FluFramelessHelper");
qmlRegisterType<FluFrameless>(uri,major,minor,"FluFrameless");
qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/ColorPicker/ColorPicker.qml"),uri,major,minor,"ColorPicker");
qmlRegisterType(QUrl("qrc:/qt/qml/FluentUI/Controls/ColorPicker/Content/Checkerboard.qml"),uri,major,minor,"Checkerboard");

View File

@ -5,7 +5,7 @@ import QtQuick.Layouts 1.15
import FluentUI 1.0
Window {
default property alias content: layout_content.data
default property alias content: container.data
property string windowIcon: FluApp.windowIcon
property bool closeDestory: true
property int launchMode: FluWindowType.Standard
@ -92,7 +92,7 @@ Window {
}
Component{
id:com_frameless
FluFramelessHelper{}
FluFrameless{}
}
Component{
id:com_background
@ -168,11 +168,14 @@ Window {
}
}
}
FluLoader{
anchors.fill: parent
sourceComponent: background
}
FluLoader{
id:loader_frameless
}
Item{
id:layout_container
property int offsetX: {
if(window.visibility === Window.Maximized){
return Math.abs(window.x-Screen.virtualX)
@ -195,10 +198,6 @@ Window {
onWidthChanged: {
window.appBar.width = width
}
FluLoader{
anchors.fill: parent
sourceComponent: background
}
FluLoader{
id:loader_app_bar
anchors {
@ -215,7 +214,7 @@ Window {
sourceComponent: window.useSystemAppBar ? undefined : com_app_bar
}
Item{
id:layout_content
id:container
anchors{
top: loader_app_bar.bottom
left: parent.left
@ -228,7 +227,7 @@ Window {
property string loadingText: "加载中..."
property bool cancel: false
id:loader_loading
anchors.fill: layout_content
anchors.fill: container
}
FluInfoBar{
id:infoBar
@ -287,10 +286,7 @@ Window {
_pageRegister.onResult(data)
}
}
function layoutContainer(){
return layout_container
}
function layoutContent(){
return layout_content
function containerItem(){
return container
}
}

View File

@ -4,7 +4,7 @@ import QtQuick.tooling 1.2
// It is used for QML tooling purposes only.
//
// This file was auto-generated by:
// 'qmlplugindump -nonrelocatable FluentUI 1.0 D:\QtProjects\build-FluentUI-Desktop_Qt_5_15_2_MSVC2019_64bit-Release\src'
// 'qmlplugindump -nonrelocatable FluentUI 1.0 D:/QtProjects/build-FluentUI-Desktop_Qt_5_15_2_MSVC2019_64bit-Release/src'
Module {
dependencies: ["QtQuick 2.0"]
@ -75,12 +75,6 @@ Module {
Parameter { name: "data"; type: "QVariantMap" }
}
}
Component {
name: "FluFramelessHelper"
prototype: "QObject"
exports: ["FluentUI/FluFramelessHelper 1.0"]
exportMetaObjectRevisions: [0]
}
Component {
name: "FluNavigationViewType"
exports: ["FluentUI/FluNavigationViewType 1.0"]
@ -1872,11 +1866,6 @@ Module {
type: "NetworkParams*"
Parameter { name: "target"; type: "QObject"; isPointer: true }
}
Method {
name: "openLog"
type: "NetworkParams*"
Parameter { name: "val"; type: "QVariant" }
}
Method {
name: "go"
Parameter { name: "result"; type: "NetworkCallable"; isPointer: true }
@ -2549,12 +2538,17 @@ Module {
exportMetaObjectRevisions: [0]
isComposite: true
defaultProperty: "data"
Property { name: "window"; type: "QVariant" }
Property { name: "jsChart"; type: "QVariant" }
Property { name: "chartType"; type: "string" }
Property { name: "chartData"; type: "QVariant" }
Property { name: "chartOptions"; type: "QVariant" }
Property { name: "chartAnimationProgress"; type: "double" }
Property { name: "animationEasingType"; type: "int" }
Property { name: "animationDuration"; type: "double" }
Property { name: "memorizedContext"; type: "QVariant" }
Property { name: "memorizedData"; type: "QVariant" }
Property { name: "memorizedOptions"; type: "QVariant" }
Property { name: "animationRunning"; type: "bool" }
Signal { name: "animationFinished" }
Method { name: "animateToNewData"; type: "QVariant" }
@ -2655,13 +2649,9 @@ Module {
Property { name: "neutralText"; type: "string" }
Property { name: "negativeText"; type: "string" }
Property { name: "positiveText"; type: "string" }
Property { name: "messageTextFormart"; type: "int" }
Property { name: "delayTime"; type: "int" }
Property { name: "buttonFlags"; type: "int" }
Property { name: "contentDelegate"; type: "QVariant" }
Property { name: "onNeutralClickListener"; type: "QVariant" }
Property { name: "onNegativeClickListener"; type: "QVariant" }
Property { name: "onPositiveClickListener"; type: "QVariant" }
Property { name: "messageTextFormart"; type: "int" }
Signal { name: "neutralClicked" }
Signal { name: "negativeClicked" }
Signal { name: "positiveClicked" }
@ -3013,15 +3003,15 @@ Module {
defaultProperty: "data"
Property { name: "logo"; type: "QUrl" }
Property { name: "title"; type: "string" }
Property { name: "items"; type: "FluObject_QMLTYPE_125"; isPointer: true }
Property { name: "footerItems"; type: "FluObject_QMLTYPE_125"; isPointer: true }
Property { name: "items"; type: "FluObject_QMLTYPE_124"; isPointer: true }
Property { name: "footerItems"; type: "FluObject_QMLTYPE_124"; isPointer: true }
Property { name: "displayMode"; type: "int" }
Property { name: "autoSuggestBox"; type: "QQmlComponent"; isPointer: true }
Property { name: "actionItem"; type: "QQmlComponent"; isPointer: true }
Property { name: "topPadding"; type: "int" }
Property { name: "pageMode"; type: "int" }
Property { name: "navItemRightMenu"; type: "FluMenu_QMLTYPE_34"; isPointer: true }
Property { name: "navItemExpanderRightMenu"; type: "FluMenu_QMLTYPE_34"; isPointer: true }
Property { name: "navItemRightMenu"; type: "FluMenu_QMLTYPE_39"; isPointer: true }
Property { name: "navItemExpanderRightMenu"; type: "FluMenu_QMLTYPE_39"; isPointer: true }
Property { name: "navCompactWidth"; type: "int" }
Property { name: "navTopMargin"; type: "int" }
Property { name: "cellHeight"; type: "int" }
@ -3768,91 +3758,6 @@ Module {
Method { name: "allExpand"; type: "QVariant" }
Method { name: "allCollapse"; type: "QVariant" }
}
Component {
prototype: "QQuickWindowQmlImpl"
name: "FluentUI/FluWindow 1.0"
exports: ["FluentUI/FluWindow 1.0"]
exportMetaObjectRevisions: [0]
isComposite: true
defaultProperty: "content"
Property { name: "windowIcon"; type: "string" }
Property { name: "closeDestory"; type: "bool" }
Property { name: "launchMode"; type: "int" }
Property { name: "argument"; type: "QVariant" }
Property { name: "background"; type: "QVariant" }
Property { name: "fixSize"; type: "bool" }
Property { name: "loadingItem"; type: "QQmlComponent"; isPointer: true }
Property { name: "fitsAppBarWindows"; type: "bool" }
Property { name: "appBar"; type: "QQuickItem"; isPointer: true }
Property { name: "backgroundColor"; type: "QColor" }
Property { name: "stayTop"; type: "bool" }
Property { name: "_pageRegister"; type: "QVariant" }
Property { name: "_route"; type: "string" }
Property { name: "showDark"; type: "bool" }
Property { name: "showClose"; type: "bool" }
Property { name: "showMinimize"; type: "bool" }
Property { name: "showMaximize"; type: "bool" }
Property { name: "showStayTop"; type: "bool" }
Property { name: "autoMaximize"; type: "bool" }
Property { name: "useSystemAppBar"; type: "bool" }
Property { name: "resizeBorderColor"; type: "QColor" }
Property { name: "resizeBorderWidth"; type: "int" }
Property { name: "closeListener"; type: "QVariant" }
Property { name: "content"; type: "QObject"; isList: true; isReadonly: true }
Signal {
name: "initArgument"
Parameter { name: "argument"; type: "QVariant" }
}
Signal { name: "firstVisible" }
Method { name: "destoryOnClose"; type: "QVariant" }
Method {
name: "showLoading"
type: "QVariant"
Parameter { name: "text"; type: "QVariant" }
Parameter { name: "cancel"; type: "QVariant" }
}
Method { name: "hideLoading"; type: "QVariant" }
Method {
name: "showSuccess"
type: "QVariant"
Parameter { name: "text"; type: "QVariant" }
Parameter { name: "duration"; type: "QVariant" }
Parameter { name: "moremsg"; type: "QVariant" }
}
Method {
name: "showInfo"
type: "QVariant"
Parameter { name: "text"; type: "QVariant" }
Parameter { name: "duration"; type: "QVariant" }
Parameter { name: "moremsg"; type: "QVariant" }
}
Method {
name: "showWarning"
type: "QVariant"
Parameter { name: "text"; type: "QVariant" }
Parameter { name: "duration"; type: "QVariant" }
Parameter { name: "moremsg"; type: "QVariant" }
}
Method {
name: "showError"
type: "QVariant"
Parameter { name: "text"; type: "QVariant" }
Parameter { name: "duration"; type: "QVariant" }
Parameter { name: "moremsg"; type: "QVariant" }
}
Method {
name: "registerForWindowResult"
type: "QVariant"
Parameter { name: "path"; type: "QVariant" }
}
Method { name: "moveWindowToDesktopCenter"; type: "QVariant" }
Method {
name: "onResult"
type: "QVariant"
Parameter { name: "data"; type: "QVariant" }
}
Method { name: "containerItem"; type: "QVariant" }
}
Component {
prototype: "QQuickRow"
name: "FluentUI/NumberBox 1.0"

View File

@ -4,7 +4,7 @@ import QtQuick.Layouts
import FluentUI
Window {
default property alias content: layout_content.data
default property alias content: container.data
property string windowIcon: FluApp.windowIcon
property bool closeDestory: true
property int launchMode: FluWindowType.Standard
@ -91,7 +91,7 @@ Window {
}
Component{
id:com_frameless
FluFramelessHelper{}
FluFrameless{}
}
Component{
id:com_background
@ -167,11 +167,14 @@ Window {
}
}
}
FluLoader{
anchors.fill: parent
sourceComponent: background
}
FluLoader{
id:loader_frameless
}
Item{
id:layout_container
property int offsetX: {
if(window.visibility === Window.Maximized){
return Math.abs(window.x-Screen.virtualX)
@ -194,10 +197,6 @@ Window {
onWidthChanged: {
window.appBar.width = width
}
FluLoader{
anchors.fill: parent
sourceComponent: background
}
FluLoader{
id:loader_app_bar
anchors {
@ -214,7 +213,7 @@ Window {
sourceComponent: window.useSystemAppBar ? undefined : com_app_bar
}
Item{
id:layout_content
id:container
anchors{
top: loader_app_bar.bottom
left: parent.left
@ -227,7 +226,7 @@ Window {
property string loadingText: "加载中..."
property bool cancel: false
id:loader_loading
anchors.fill: layout_content
anchors.fill: container
}
FluInfoBar{
id:infoBar
@ -286,10 +285,7 @@ Window {
_pageRegister.onResult(data)
}
}
function layoutContainer(){
return layout_container
}
function layoutContent(){
return layout_content
function containerItem(){
return container
}
}