Compare commits
2 Commits
2bd0a831e7
...
af6e39d8c0
Author | SHA1 | Date |
---|---|---|
|
af6e39d8c0 | |
|
6d2a8cde7a |
|
@ -30,6 +30,7 @@ SolidCompression=yes
|
||||||
WizardStyle=modern
|
WizardStyle=modern
|
||||||
UninstallDisplayIcon={app}\{#MyAppExeName}
|
UninstallDisplayIcon={app}\{#MyAppExeName}
|
||||||
SetupIconFile=.\..\favicon.ico
|
SetupIconFile=.\..\favicon.ico
|
||||||
|
MinVersion = 6.0
|
||||||
|
|
||||||
[Languages]
|
[Languages]
|
||||||
Name: "chinesesimplified"; MessagesFile: "compiler:Languages\ChineseSimplified.isl"
|
Name: "chinesesimplified"; MessagesFile: "compiler:Languages\ChineseSimplified.isl"
|
||||||
|
|
|
@ -6,7 +6,6 @@ project(example VERSION 1.0)
|
||||||
set(CMAKE_CXX_STANDARD 17)
|
set(CMAKE_CXX_STANDARD 17)
|
||||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||||
|
|
||||||
|
|
||||||
#导入exmaple的QML位置,不然import example有时候会爆红
|
#导入exmaple的QML位置,不然import example有时候会爆红
|
||||||
set(QML_IMPORT_PATH ${CMAKE_BINARY_DIR}/example CACHE STRING "Qt Creator extra QML import paths" FORCE)
|
set(QML_IMPORT_PATH ${CMAKE_BINARY_DIR}/example CACHE STRING "Qt Creator extra QML import paths" FORCE)
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,6 @@ endif()
|
||||||
set(CMAKE_CXX_STANDARD 17)
|
set(CMAKE_CXX_STANDARD 17)
|
||||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||||
|
|
||||||
|
|
||||||
if (FLUENTUI_BUILD_STATIC_LIB)
|
if (FLUENTUI_BUILD_STATIC_LIB)
|
||||||
add_definitions(-DFLUENTUI_BUILD_STATIC_LIB)
|
add_definitions(-DFLUENTUI_BUILD_STATIC_LIB)
|
||||||
endif()
|
endif()
|
||||||
|
|
|
@ -73,16 +73,11 @@ bool FramelessEventFilter::nativeEventFilter(const QByteArray &eventType, void *
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}else if(uMsg == WM_NCACTIVATE){
|
}else if(uMsg == WM_NCACTIVATE){
|
||||||
if(isCompositionEnabled()){
|
if(!isCompositionEnabled()){
|
||||||
*result = DefWindowProc(hwnd, uMsg, wParam, -1);
|
*result = 1;
|
||||||
}else{
|
return true;
|
||||||
if (wParam == FALSE) {
|
|
||||||
*result = TRUE;
|
|
||||||
} else {
|
|
||||||
*result = FALSE;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return true;
|
return false;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
#endif
|
#endif
|
||||||
|
@ -197,6 +192,8 @@ void FluFrameless::componentComplete(){
|
||||||
DWORD style = GetWindowLongPtr(hwnd,GWL_STYLE);
|
DWORD style = GetWindowLongPtr(hwnd,GWL_STYLE);
|
||||||
SetWindowLongPtr(hwnd,GWL_STYLE,style &~ WS_SYSMENU);
|
SetWindowLongPtr(hwnd,GWL_STYLE,style &~ WS_SYSMENU);
|
||||||
SetWindowPos(hwnd,nullptr,0,0,0,0,SWP_NOZORDER | SWP_NOOWNERZORDER | SWP_NOMOVE | SWP_NOSIZE |SWP_FRAMECHANGED);
|
SetWindowPos(hwnd,nullptr,0,0,0,0,SWP_NOZORDER | SWP_NOOWNERZORDER | SWP_NOMOVE | SWP_NOSIZE |SWP_FRAMECHANGED);
|
||||||
|
_stayTop = QQmlProperty(_window,"stayTop");
|
||||||
|
_stayTop.connectNotifySignal(this,SLOT(_stayTopChange()));
|
||||||
#else
|
#else
|
||||||
_window->setFlag(Qt::FramelessWindowHint,true);
|
_window->setFlag(Qt::FramelessWindowHint,true);
|
||||||
#endif
|
#endif
|
||||||
|
@ -204,6 +201,14 @@ void FluFrameless::componentComplete(){
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void FluFrameless::_stayTopChange(){
|
||||||
|
#ifdef Q_OS_WIN
|
||||||
|
HWND hwnd = reinterpret_cast<HWND>(_window->winId());
|
||||||
|
DWORD style = GetWindowLongPtr(hwnd,GWL_STYLE);
|
||||||
|
SetWindowLongPtr(hwnd,GWL_STYLE,style &~ WS_SYSMENU);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
FluFrameless::~FluFrameless(){
|
FluFrameless::~FluFrameless(){
|
||||||
if (!_window.isNull()) {
|
if (!_window.isNull()) {
|
||||||
_window->removeEventFilter(this);
|
_window->removeEventFilter(this);
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
#include <QQuickWindow>
|
#include <QQuickWindow>
|
||||||
#include <QtQml/qqml.h>
|
#include <QtQml/qqml.h>
|
||||||
#include <QAbstractNativeEventFilter>
|
#include <QAbstractNativeEventFilter>
|
||||||
|
#include <QQmlProperty>
|
||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
|
|
||||||
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
||||||
|
@ -28,7 +29,6 @@ public:
|
||||||
class FluFrameless : public QObject, public QQmlParserStatus
|
class FluFrameless : public QObject, public QQmlParserStatus
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
Q_PROPERTY_AUTO(bool,stayTop)
|
|
||||||
QML_NAMED_ELEMENT(FluFrameless)
|
QML_NAMED_ELEMENT(FluFrameless)
|
||||||
public:
|
public:
|
||||||
explicit FluFrameless(QObject *parent = nullptr);
|
explicit FluFrameless(QObject *parent = nullptr);
|
||||||
|
@ -39,9 +39,11 @@ protected:
|
||||||
bool eventFilter(QObject *obj, QEvent *event) override;
|
bool eventFilter(QObject *obj, QEvent *event) override;
|
||||||
private:
|
private:
|
||||||
void updateCursor(int edges);
|
void updateCursor(int edges);
|
||||||
|
Q_SLOT void _stayTopChange();
|
||||||
private:
|
private:
|
||||||
QPointer<QQuickWindow> _window = nullptr;
|
QPointer<QQuickWindow> _window = nullptr;
|
||||||
FramelessEventFilter* _nativeEvent = nullptr;
|
FramelessEventFilter* _nativeEvent = nullptr;
|
||||||
|
QQmlProperty _stayTop;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // FLUFRAMELESS_H
|
#endif // FLUFRAMELESS_H
|
||||||
|
|
|
@ -112,9 +112,7 @@ Window {
|
||||||
}
|
}
|
||||||
Component{
|
Component{
|
||||||
id:com_frameless
|
id:com_frameless
|
||||||
FluFrameless{
|
FluFrameless{}
|
||||||
stayTop: window.stayTop
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
Component{
|
Component{
|
||||||
id:com_background
|
id:com_background
|
||||||
|
|
|
@ -111,9 +111,7 @@ Window {
|
||||||
}
|
}
|
||||||
Component{
|
Component{
|
||||||
id:com_frameless
|
id:com_frameless
|
||||||
FluFrameless{
|
FluFrameless{}
|
||||||
stayTop: window.stayTop
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
Component{
|
Component{
|
||||||
id:com_background
|
id:com_background
|
||||||
|
|
Loading…
Reference in New Issue