mirror of
https://github.com/zhuzichu520/FluentUI.git
synced 2024-11-27 13:49:08 +08:00
切换窗口会闪一下边框,需修复
This commit is contained in:
parent
a26f643ba3
commit
5ea71e2c1a
@ -2261,21 +2261,26 @@ Some contents...</source>
|
|||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="qml/page/T_Theme.qml" line="123"/>
|
<location filename="qml/page/T_Theme.qml" line="123"/>
|
||||||
|
<source>Rounded Window</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="qml/page/T_Theme.qml" line="134"/>
|
||||||
<source>Open Blur Window</source>
|
<source>Open Blur Window</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="qml/page/T_Theme.qml" line="136"/>
|
<location filename="qml/page/T_Theme.qml" line="147"/>
|
||||||
<source>window tintOpacity</source>
|
<source>window tintOpacity</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="qml/page/T_Theme.qml" line="153"/>
|
<location filename="qml/page/T_Theme.qml" line="164"/>
|
||||||
<source>window blurRadius</source>
|
<source>window blurRadius</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="qml/page/T_Theme.qml" line="169"/>
|
<location filename="qml/page/T_Theme.qml" line="180"/>
|
||||||
<source>window effect</source>
|
<source>window effect</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
|
@ -2443,21 +2443,26 @@ Some contents...</source>
|
|||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="qml/page/T_Theme.qml" line="123"/>
|
<location filename="qml/page/T_Theme.qml" line="123"/>
|
||||||
|
<source>Rounded Window</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="qml/page/T_Theme.qml" line="134"/>
|
||||||
<source>Open Blur Window</source>
|
<source>Open Blur Window</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="qml/page/T_Theme.qml" line="136"/>
|
<location filename="qml/page/T_Theme.qml" line="147"/>
|
||||||
<source>window tintOpacity</source>
|
<source>window tintOpacity</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="qml/page/T_Theme.qml" line="153"/>
|
<location filename="qml/page/T_Theme.qml" line="164"/>
|
||||||
<source>window blurRadius</source>
|
<source>window blurRadius</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="qml/page/T_Theme.qml" line="169"/>
|
<location filename="qml/page/T_Theme.qml" line="180"/>
|
||||||
<source>window effect</source>
|
<source>window effect</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
|
@ -119,6 +119,17 @@ FluScrollablePage{
|
|||||||
FluTheme.animationEnabled = !FluTheme.animationEnabled
|
FluTheme.animationEnabled = !FluTheme.animationEnabled
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
FluText{
|
||||||
|
text: qsTr("Rounded Window")
|
||||||
|
Layout.topMargin: 20
|
||||||
|
}
|
||||||
|
FluToggleSwitch{
|
||||||
|
Layout.topMargin: 5
|
||||||
|
checked: window.roundCornerEnable
|
||||||
|
onClicked: {
|
||||||
|
window.roundCornerEnable = !window.roundCornerEnable
|
||||||
|
}
|
||||||
|
}
|
||||||
FluText{
|
FluText{
|
||||||
text: qsTr("Open Blur Window")
|
text: qsTr("Open Blur Window")
|
||||||
Layout.topMargin: 20
|
Layout.topMargin: 20
|
||||||
|
@ -76,7 +76,7 @@ static inline bool isWin10Only() {
|
|||||||
|
|
||||||
static inline bool isWin7Only() {
|
static inline bool isWin7Only() {
|
||||||
RTL_OSVERSIONINFOW rovi = GetRealOSVersion();
|
RTL_OSVERSIONINFOW rovi = GetRealOSVersion();
|
||||||
return rovi.dwMajorVersion = 7;
|
return rovi.dwMajorVersion == 7;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline QByteArray qtNativeEventType() {
|
static inline QByteArray qtNativeEventType() {
|
||||||
@ -109,9 +109,8 @@ static inline bool initializeFunctionPointers() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!pDwmEnableBlurBehindWindow) {
|
if (!pDwmEnableBlurBehindWindow) {
|
||||||
pDwmEnableBlurBehindWindow =
|
pDwmEnableBlurBehindWindow = reinterpret_cast<DwmEnableBlurBehindWindowFunc>(
|
||||||
reinterpret_cast<DwmEnableBlurBehindWindowFunc>(
|
GetProcAddress(module, "DwmEnableBlurBehindWindow"));
|
||||||
GetProcAddress(module, "DwmEnableBlurBehindWindow"));
|
|
||||||
if (!pDwmEnableBlurBehindWindow) {
|
if (!pDwmEnableBlurBehindWindow) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -132,7 +131,7 @@ static inline bool initializeFunctionPointers() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static inline bool isCompositionEnabled() {
|
static inline bool isCompositionEnabled() {
|
||||||
if(initializeFunctionPointers()){
|
if (initializeFunctionPointers()) {
|
||||||
BOOL composition_enabled = false;
|
BOOL composition_enabled = false;
|
||||||
pDwmIsCompositionEnabled(&composition_enabled);
|
pDwmIsCompositionEnabled(&composition_enabled);
|
||||||
return composition_enabled;
|
return composition_enabled;
|
||||||
@ -145,6 +144,25 @@ static inline void setShadow(HWND hwnd) {
|
|||||||
if (initializeFunctionPointers()) {
|
if (initializeFunctionPointers()) {
|
||||||
pDwmExtendFrameIntoClientArea(hwnd, &shadow);
|
pDwmExtendFrameIntoClientArea(hwnd, &shadow);
|
||||||
}
|
}
|
||||||
|
if(isWin7Only()){
|
||||||
|
SetClassLong(hwnd, GCL_STYLE, GetClassLong(hwnd, GCL_STYLE) | CS_DROPSHADOW);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void setWindowRoundCorners(HWND hwnd) {
|
||||||
|
const MARGINS shadow = {-15};
|
||||||
|
if (initializeFunctionPointers()) {
|
||||||
|
pDwmExtendFrameIntoClientArea(hwnd, &shadow);
|
||||||
|
}
|
||||||
|
RECT rect;
|
||||||
|
GetWindowRect(hwnd, &rect);
|
||||||
|
int width = rect.right - rect.left;
|
||||||
|
int height = rect.bottom - rect.top;
|
||||||
|
const int radius = 15;
|
||||||
|
HRGN hRgn = CreateRoundRectRgn(0, 0, width + 1, height + 1, radius, radius);
|
||||||
|
SetWindowRgn(hwnd, hRgn, TRUE);
|
||||||
|
SetClassLong(hwnd, GCL_STYLE, GetClassLong(hwnd, GCL_STYLE) | CS_DROPSHADOW);
|
||||||
|
DeleteObject(hRgn);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline bool setWindowDarkMode(HWND hwnd, const BOOL enable) {
|
static inline bool setWindowDarkMode(HWND hwnd, const BOOL enable) {
|
||||||
@ -375,7 +393,8 @@ void FluFrameless::componentComplete() {
|
|||||||
int w = window()->width();
|
int w = window()->width();
|
||||||
int h = window()->height();
|
int h = window()->height();
|
||||||
_current = window()->winId();
|
_current = window()->winId();
|
||||||
window()->setFlags((window()->flags()) | Qt::CustomizeWindowHint | Qt::WindowMinimizeButtonHint | Qt::WindowCloseButtonHint);
|
window()->setFlags((window()->flags()) | Qt::CustomizeWindowHint |
|
||||||
|
Qt::WindowMinimizeButtonHint | Qt::WindowCloseButtonHint);
|
||||||
if (!_fixSize) {
|
if (!_fixSize) {
|
||||||
window()->setFlag(Qt::WindowMaximizeButtonHint);
|
window()->setFlag(Qt::WindowMaximizeButtonHint);
|
||||||
}
|
}
|
||||||
@ -390,7 +409,6 @@ void FluFrameless::componentComplete() {
|
|||||||
if (_closeButton) {
|
if (_closeButton) {
|
||||||
setHitTestVisible(_closeButton);
|
setHitTestVisible(_closeButton);
|
||||||
}
|
}
|
||||||
|
|
||||||
auto appBarHeight = _appbar->height();
|
auto appBarHeight = _appbar->height();
|
||||||
h = qRound(h + appBarHeight);
|
h = qRound(h + appBarHeight);
|
||||||
if (_fixSize) {
|
if (_fixSize) {
|
||||||
@ -401,15 +419,14 @@ void FluFrameless::componentComplete() {
|
|||||||
window()->setMaximumHeight(window()->maximumHeight() + appBarHeight);
|
window()->setMaximumHeight(window()->maximumHeight() + appBarHeight);
|
||||||
}
|
}
|
||||||
window()->resize(QSize(w, h));
|
window()->resize(QSize(w, h));
|
||||||
connect(this, &FluFrameless::topmostChanged, this, [this] {
|
connect(this, &FluFrameless::topmostChanged, this, [this] { _setWindowTopmost(topmost()); });
|
||||||
_setWindowTopmost(topmost());
|
|
||||||
});
|
|
||||||
_setWindowTopmost(topmost());
|
_setWindowTopmost(topmost());
|
||||||
_setMaximizeHovered(false);
|
_setMaximizeHovered(false);
|
||||||
_setMaximizePressed(false);
|
_setMaximizePressed(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
[[maybe_unused]] bool FluFrameless::nativeEventFilter(const QByteArray &eventType, void *message, QT_NATIVE_EVENT_RESULT_TYPE *result) {
|
[[maybe_unused]] bool FluFrameless::nativeEventFilter(const QByteArray &eventType, void *message,
|
||||||
|
QT_NATIVE_EVENT_RESULT_TYPE *result) {
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
if ((eventType != qtNativeEventType()) || !message) {
|
if ((eventType != qtNativeEventType()) || !message) {
|
||||||
return false;
|
return false;
|
||||||
@ -430,16 +447,17 @@ void FluFrameless::componentComplete() {
|
|||||||
auto *wp = reinterpret_cast<WINDOWPOS *>(lParam);
|
auto *wp = reinterpret_cast<WINDOWPOS *>(lParam);
|
||||||
if (wp != nullptr && (wp->flags & SWP_NOSIZE) == 0) {
|
if (wp != nullptr && (wp->flags & SWP_NOSIZE) == 0) {
|
||||||
wp->flags |= SWP_NOCOPYBITS;
|
wp->flags |= SWP_NOCOPYBITS;
|
||||||
*result = static_cast<QT_NATIVE_EVENT_RESULT_TYPE>(::DefWindowProcW(hwnd, uMsg, wParam, lParam));
|
*result = static_cast<QT_NATIVE_EVENT_RESULT_TYPE>(
|
||||||
|
::DefWindowProcW(hwnd, uMsg, wParam, lParam));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
} else if (uMsg == WM_NCCALCSIZE && wParam == TRUE) {
|
} else if (uMsg == WM_NCCALCSIZE && wParam == TRUE) {
|
||||||
bool isMaximum = ::IsZoomed(hwnd);
|
bool isMaximum = ::IsZoomed(hwnd);
|
||||||
if (isMaximum) {
|
if (isMaximum) {
|
||||||
window()->setProperty("__margins",7);
|
window()->setProperty("__margins", 7);
|
||||||
}else{
|
} else {
|
||||||
window()->setProperty("__margins",0);
|
window()->setProperty("__margins", 0);
|
||||||
}
|
}
|
||||||
_setMaximizeHovered(false);
|
_setMaximizeHovered(false);
|
||||||
*result = WVR_REDRAW;
|
*result = WVR_REDRAW;
|
||||||
@ -499,21 +517,23 @@ void FluFrameless::componentComplete() {
|
|||||||
*result = FALSE;
|
*result = FALSE;
|
||||||
return false;
|
return false;
|
||||||
} else if (uMsg == WM_NCACTIVATE) {
|
} else if (uMsg == WM_NCACTIVATE) {
|
||||||
if (effective() || (!effect().isEmpty() && _currentEffect!="normal")) {
|
if (effective() || (!effect().isEmpty() && effect() != "normal")) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
*result = TRUE;
|
*result = TRUE;
|
||||||
return true;
|
return true;
|
||||||
} else if (_isWindows11OrGreater && (uMsg == WM_NCLBUTTONDBLCLK || uMsg == WM_NCLBUTTONDOWN)) {
|
} else if (_isWindows11OrGreater && (uMsg == WM_NCLBUTTONDBLCLK || uMsg == WM_NCLBUTTONDOWN)) {
|
||||||
if (_hitMaximizeButton()) {
|
if (_hitMaximizeButton()) {
|
||||||
QMouseEvent event = QMouseEvent(QEvent::MouseButtonPress, QPoint(), QPoint(), Qt::LeftButton, Qt::LeftButton, Qt::NoModifier);
|
QMouseEvent event = QMouseEvent(QEvent::MouseButtonPress, QPoint(), QPoint(),
|
||||||
|
Qt::LeftButton, Qt::LeftButton, Qt::NoModifier);
|
||||||
QGuiApplication::sendEvent(_maximizeButton, &event);
|
QGuiApplication::sendEvent(_maximizeButton, &event);
|
||||||
_setMaximizePressed(true);
|
_setMaximizePressed(true);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
} else if (_isWindows11OrGreater && (uMsg == WM_NCLBUTTONUP || uMsg == WM_NCRBUTTONUP)) {
|
} else if (_isWindows11OrGreater && (uMsg == WM_NCLBUTTONUP || uMsg == WM_NCRBUTTONUP)) {
|
||||||
if (_hitMaximizeButton()) {
|
if (_hitMaximizeButton()) {
|
||||||
QMouseEvent event = QMouseEvent(QEvent::MouseButtonRelease, QPoint(), QPoint(), Qt::LeftButton, Qt::LeftButton, Qt::NoModifier);
|
QMouseEvent event = QMouseEvent(QEvent::MouseButtonRelease, QPoint(), QPoint(),
|
||||||
|
Qt::LeftButton, Qt::LeftButton, Qt::NoModifier);
|
||||||
QGuiApplication::sendEvent(_maximizeButton, &event);
|
QGuiApplication::sendEvent(_maximizeButton, &event);
|
||||||
_setMaximizePressed(false);
|
_setMaximizePressed(false);
|
||||||
return true;
|
return true;
|
||||||
@ -568,7 +588,8 @@ void FluFrameless::_showSystemMenu(QPoint point) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const QPoint origin = screen->geometry().topLeft();
|
const QPoint origin = screen->geometry().topLeft();
|
||||||
auto nativePos = QPointF(QPointF(point - origin) * window()->devicePixelRatio()).toPoint() + origin;
|
auto nativePos =
|
||||||
|
QPointF(QPointF(point - origin) * window()->devicePixelRatio()).toPoint() + origin;
|
||||||
HWND hwnd = reinterpret_cast<HWND>(window()->winId());
|
HWND hwnd = reinterpret_cast<HWND>(window()->winId());
|
||||||
auto hMenu = ::GetSystemMenu(hwnd, FALSE);
|
auto hMenu = ::GetSystemMenu(hwnd, FALSE);
|
||||||
if (_isMaximized() || _isFullScreen()) {
|
if (_isMaximized() || _isFullScreen()) {
|
||||||
@ -585,8 +606,10 @@ void FluFrameless::_showSystemMenu(QPoint point) {
|
|||||||
::EnableMenuItem(hMenu, SC_SIZE, MFS_DISABLED);
|
::EnableMenuItem(hMenu, SC_SIZE, MFS_DISABLED);
|
||||||
::EnableMenuItem(hMenu, SC_MAXIMIZE, MFS_DISABLED);
|
::EnableMenuItem(hMenu, SC_MAXIMIZE, MFS_DISABLED);
|
||||||
}
|
}
|
||||||
const int result = ::TrackPopupMenu(hMenu, (TPM_RETURNCMD | (QGuiApplication::isRightToLeft() ? TPM_RIGHTALIGN : TPM_LEFTALIGN)), nativePos.x(),
|
const int result = ::TrackPopupMenu(
|
||||||
nativePos.y(), 0, hwnd, nullptr);
|
hMenu,
|
||||||
|
(TPM_RETURNCMD | (QGuiApplication::isRightToLeft() ? TPM_RIGHTALIGN : TPM_LEFTALIGN)),
|
||||||
|
nativePos.x(), nativePos.y(), 0, hwnd, nullptr);
|
||||||
if (result) {
|
if (result) {
|
||||||
::PostMessageW(hwnd, WM_SYSCOMMAND, result, 0);
|
::PostMessageW(hwnd, WM_SYSCOMMAND, result, 0);
|
||||||
}
|
}
|
||||||
@ -627,27 +650,27 @@ void FluFrameless::_setMaximizeHovered(bool val) {
|
|||||||
|
|
||||||
void FluFrameless::_updateCursor(int edges) {
|
void FluFrameless::_updateCursor(int edges) {
|
||||||
switch (edges) {
|
switch (edges) {
|
||||||
case 0:
|
case 0:
|
||||||
window()->setCursor(Qt::ArrowCursor);
|
window()->setCursor(Qt::ArrowCursor);
|
||||||
break;
|
break;
|
||||||
case Qt::LeftEdge:
|
case Qt::LeftEdge:
|
||||||
case Qt::RightEdge:
|
case Qt::RightEdge:
|
||||||
window()->setCursor(Qt::SizeHorCursor);
|
window()->setCursor(Qt::SizeHorCursor);
|
||||||
break;
|
break;
|
||||||
case Qt::TopEdge:
|
case Qt::TopEdge:
|
||||||
case Qt::BottomEdge:
|
case Qt::BottomEdge:
|
||||||
window()->setCursor(Qt::SizeVerCursor);
|
window()->setCursor(Qt::SizeVerCursor);
|
||||||
break;
|
break;
|
||||||
case Qt::LeftEdge | Qt::TopEdge:
|
case Qt::LeftEdge | Qt::TopEdge:
|
||||||
case Qt::RightEdge | Qt::BottomEdge:
|
case Qt::RightEdge | Qt::BottomEdge:
|
||||||
window()->setCursor(Qt::SizeFDiagCursor);
|
window()->setCursor(Qt::SizeFDiagCursor);
|
||||||
break;
|
break;
|
||||||
case Qt::RightEdge | Qt::TopEdge:
|
case Qt::RightEdge | Qt::TopEdge:
|
||||||
case Qt::LeftEdge | Qt::BottomEdge:
|
case Qt::LeftEdge | Qt::BottomEdge:
|
||||||
window()->setCursor(Qt::SizeBDiagCursor);
|
window()->setCursor(Qt::SizeBDiagCursor);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -692,79 +715,80 @@ void FluFrameless::_setWindowTopmost(bool topmost) {
|
|||||||
::SetWindowPos(hwnd, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
|
::SetWindowPos(hwnd, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
window()->setFlag(Qt::WindowStaysOnTopHint,topmost);
|
window()->setFlag(Qt::WindowStaysOnTopHint, topmost);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FluFrameless::eventFilter(QObject *obj, QEvent *ev) {
|
bool FluFrameless::eventFilter(QObject *obj, QEvent *ev) {
|
||||||
#ifndef Q_OS_WIN
|
#ifndef Q_OS_WIN
|
||||||
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));
|
||||||
}
|
}
|
||||||
}else{
|
} else {
|
||||||
if(_hitAppBar()){
|
if (_hitAppBar()) {
|
||||||
qint64 clickTimer = QDateTime::currentMSecsSinceEpoch();
|
qint64 clickTimer = QDateTime::currentMSecsSinceEpoch();
|
||||||
qint64 offset = clickTimer - this->_clickTimer;
|
qint64 offset = clickTimer - this->_clickTimer;
|
||||||
this->_clickTimer = clickTimer;
|
this->_clickTimer = clickTimer;
|
||||||
if(offset<300){
|
if (offset < 300) {
|
||||||
if(_isMaximized()){
|
if (_isMaximized()) {
|
||||||
showNormal();
|
showNormal();
|
||||||
}else{
|
} else {
|
||||||
showMaximized();
|
showMaximized();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
window()->startSystemMove();
|
||||||
}
|
}
|
||||||
}else{
|
|
||||||
window()->startSystemMove();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
break;
|
|
||||||
case QEvent::MouseButtonRelease:
|
|
||||||
_edges = 0;
|
|
||||||
break;
|
|
||||||
case QEvent::MouseMove: {
|
|
||||||
if(_isMaximized() || _isFullScreen()){
|
|
||||||
break;
|
break;
|
||||||
}
|
case QEvent::MouseButtonRelease:
|
||||||
if(_fixSize){
|
_edges = 0;
|
||||||
break;
|
break;
|
||||||
}
|
case QEvent::MouseMove: {
|
||||||
QMouseEvent *event = static_cast<QMouseEvent*>(ev);
|
if (_isMaximized() || _isFullScreen()) {
|
||||||
QPoint p =
|
break;
|
||||||
#if QT_VERSION < QT_VERSION_CHECK(6,0,0)
|
|
||||||
event->pos();
|
|
||||||
#else
|
|
||||||
event->position().toPoint();
|
|
||||||
#endif
|
|
||||||
if(p.x() >= _margins && p.x() <= (window()->width() - _margins) && p.y() >= _margins && p.y() <= (window()->height() - _margins)){
|
|
||||||
if(_edges != 0){
|
|
||||||
_edges = 0;
|
|
||||||
_updateCursor(_edges);
|
|
||||||
}
|
}
|
||||||
|
if (_fixSize) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
QMouseEvent *event = static_cast<QMouseEvent *>(ev);
|
||||||
|
QPoint p =
|
||||||
|
# if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
||||||
|
event->pos();
|
||||||
|
# else
|
||||||
|
event->position().toPoint();
|
||||||
|
# endif
|
||||||
|
if (p.x() >= _margins && p.x() <= (window()->width() - _margins) && p.y() >= _margins &&
|
||||||
|
p.y() <= (window()->height() - _margins)) {
|
||||||
|
if (_edges != 0) {
|
||||||
|
_edges = 0;
|
||||||
|
_updateCursor(_edges);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
_edges = 0;
|
||||||
|
if (p.x() < _margins) {
|
||||||
|
_edges |= Qt::LeftEdge;
|
||||||
|
}
|
||||||
|
if (p.x() > (window()->width() - _margins)) {
|
||||||
|
_edges |= Qt::RightEdge;
|
||||||
|
}
|
||||||
|
if (p.y() < _margins) {
|
||||||
|
_edges |= Qt::TopEdge;
|
||||||
|
}
|
||||||
|
if (p.y() > (window()->height() - _margins)) {
|
||||||
|
_edges |= Qt::BottomEdge;
|
||||||
|
}
|
||||||
|
_updateCursor(_edges);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
_edges = 0;
|
default:
|
||||||
if ( p.x() < _margins ) {
|
break;
|
||||||
_edges |= Qt::LeftEdge;
|
|
||||||
}
|
|
||||||
if ( p.x() > (window()->width() - _margins) ) {
|
|
||||||
_edges |= Qt::RightEdge;
|
|
||||||
}
|
|
||||||
if ( p.y() < _margins ) {
|
|
||||||
_edges |= Qt::TopEdge;
|
|
||||||
}
|
|
||||||
if ( p.y() > (window()->height() - _margins) ) {
|
|
||||||
_edges |= Qt::BottomEdge;
|
|
||||||
}
|
|
||||||
_updateCursor(_edges);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
return QObject::eventFilter(obj, ev);
|
return QObject::eventFilter(obj, ev);
|
||||||
|
@ -162,6 +162,7 @@ private:
|
|||||||
|
|
||||||
void _setMaximizeHovered(bool val);
|
void _setMaximizeHovered(bool val);
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
quint64 _current = 0;
|
quint64 _current = 0;
|
||||||
int _edges = 0;
|
int _edges = 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user