mirror of
https://github.com/zhuzichu520/FluentUI.git
synced 2024-12-01 23:42:22 +08:00
update
This commit is contained in:
parent
4dbb68abf6
commit
7546547364
@ -3,6 +3,7 @@
|
|||||||
#include <QGuiApplication>
|
#include <QGuiApplication>
|
||||||
#include <QScreen>
|
#include <QScreen>
|
||||||
#include "FluTools.h"
|
#include "FluTools.h"
|
||||||
|
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
#pragma comment (lib,"user32.lib")
|
#pragma comment (lib,"user32.lib")
|
||||||
#pragma comment (lib,"dwmapi.lib")
|
#pragma comment (lib,"dwmapi.lib")
|
||||||
@ -32,7 +33,6 @@ static inline bool isCompositionEnabled(){
|
|||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
FramelessEventFilter::FramelessEventFilter(FluFramelessHelper* helper){
|
FramelessEventFilter::FramelessEventFilter(FluFramelessHelper* helper){
|
||||||
@ -125,7 +125,7 @@ bool FramelessEventFilter::nativeEventFilter(const QByteArray &eventType, void *
|
|||||||
QGuiApplication::sendEvent(_helper->maximizeButton(),&event);
|
QGuiApplication::sendEvent(_helper->maximizeButton(),&event);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}else if(uMsg == WM_NCPAINT || uMsg == 0x00AE || uMsg == 0x00AF){
|
}else if(uMsg == WM_NCPAINT){
|
||||||
*result = FALSE;
|
*result = FALSE;
|
||||||
return true;
|
return true;
|
||||||
}else if(uMsg == WM_NCACTIVATE){
|
}else if(uMsg == WM_NCACTIVATE){
|
||||||
@ -181,22 +181,20 @@ void FluFramelessHelper::_updateCursor(int edges){
|
|||||||
|
|
||||||
bool FluFramelessHelper::eventFilter(QObject *obj, QEvent *ev){
|
bool FluFramelessHelper::eventFilter(QObject *obj, QEvent *ev){
|
||||||
if (!window.isNull() && window->flags()) {
|
if (!window.isNull() && window->flags()) {
|
||||||
|
static int margin = 8;
|
||||||
static int edges = 0;
|
|
||||||
const int margin = 8;
|
|
||||||
switch (ev->type()) {
|
switch (ev->type()) {
|
||||||
case QEvent::MouseButtonPress:
|
case QEvent::MouseButtonPress:
|
||||||
if(edges!=0){
|
if(_edges!=0){
|
||||||
QMouseEvent *event = static_cast<QMouseEvent*>(ev);
|
QMouseEvent *event = static_cast<QMouseEvent*>(ev);
|
||||||
if(event->button() == Qt::LeftButton){
|
if(event->button() == Qt::LeftButton){
|
||||||
_updateCursor(edges);
|
_updateCursor(_edges);
|
||||||
window->startSystemResize(Qt::Edges(edges));
|
window->startSystemResize(Qt::Edges(_edges));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case QEvent::MouseButtonRelease:
|
case QEvent::MouseButtonRelease:
|
||||||
edges = 0;
|
_edges = 0;
|
||||||
_updateCursor(edges);
|
_updateCursor(_edges);
|
||||||
break;
|
break;
|
||||||
case QEvent::MouseMove: {
|
case QEvent::MouseMove: {
|
||||||
if(_maximized() || _fullScreen()){
|
if(_maximized() || _fullScreen()){
|
||||||
@ -213,26 +211,26 @@ bool FluFramelessHelper::eventFilter(QObject *obj, QEvent *ev){
|
|||||||
event->position().toPoint();
|
event->position().toPoint();
|
||||||
#endif
|
#endif
|
||||||
if(p.x() >= margin && p.x() <= (window->width() - margin) && p.y() >= margin && p.y() <= (window->height() - margin)){
|
if(p.x() >= margin && p.x() <= (window->width() - margin) && p.y() >= margin && p.y() <= (window->height() - margin)){
|
||||||
if(edges != 0){
|
if(_edges != 0){
|
||||||
edges = 0;
|
_edges = 0;
|
||||||
_updateCursor(edges);
|
_updateCursor(_edges);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
edges = 0;
|
_edges = 0;
|
||||||
if ( p.x() < margin ) {
|
if ( p.x() < margin ) {
|
||||||
edges |= Qt::LeftEdge;
|
_edges |= Qt::LeftEdge;
|
||||||
}
|
}
|
||||||
if ( p.x() > (window->width() - margin) ) {
|
if ( p.x() > (window->width() - margin) ) {
|
||||||
edges |= Qt::RightEdge;
|
_edges |= Qt::RightEdge;
|
||||||
}
|
}
|
||||||
if ( p.y() < margin ) {
|
if ( p.y() < margin ) {
|
||||||
edges |= Qt::TopEdge;
|
_edges |= Qt::TopEdge;
|
||||||
}
|
}
|
||||||
if ( p.y() > (window->height() - margin) ) {
|
if ( p.y() > (window->height() - margin) ) {
|
||||||
edges |= Qt::BottomEdge;
|
_edges |= Qt::BottomEdge;
|
||||||
}
|
}
|
||||||
_updateCursor(edges);
|
_updateCursor(_edges);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
|
@ -61,6 +61,7 @@ private:
|
|||||||
QQmlProperty _realHeight;
|
QQmlProperty _realHeight;
|
||||||
QQmlProperty _realWidth;
|
QQmlProperty _realWidth;
|
||||||
QQmlProperty _appBarHeight;
|
QQmlProperty _appBarHeight;
|
||||||
|
int _edges = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // FLUFRAMELESSHELPER_H
|
#endif // FLUFRAMELESSHELPER_H
|
||||||
|
Loading…
Reference in New Issue
Block a user