Fix bugs in UNIX helper.
Found during using it in a real project. Signed-off-by: Yuhang Zhao <2546789017@qq.com>
This commit is contained in:
parent
f8cb5cf234
commit
a34834c3f7
|
@ -204,12 +204,11 @@ void FramelessHelper::removeWindowFrame(QObject *const obj) {
|
||||||
if (obj) {
|
if (obj) {
|
||||||
// Don't miss the Qt::Window flag.
|
// Don't miss the Qt::Window flag.
|
||||||
const Qt::WindowFlags flags = Qt::Window | Qt::FramelessWindowHint;
|
const Qt::WindowFlags flags = Qt::Window | Qt::FramelessWindowHint;
|
||||||
QWindow *const window = getWindowHandle(obj);
|
const auto window = qobject_cast<QWindow *>(obj);
|
||||||
if (window) {
|
if (window) {
|
||||||
window->setFlags(flags);
|
window->setFlags(flags);
|
||||||
// MouseTracking is always enabled for QWindow.
|
// MouseTracking is always enabled for QWindow.
|
||||||
window->installEventFilter(this);
|
window->installEventFilter(this);
|
||||||
updateQtFrame(window, m_titleBarHeight);
|
|
||||||
}
|
}
|
||||||
#ifdef QT_WIDGETS_LIB
|
#ifdef QT_WIDGETS_LIB
|
||||||
else {
|
else {
|
||||||
|
@ -220,6 +219,7 @@ void FramelessHelper::removeWindowFrame(QObject *const obj) {
|
||||||
// disabled.
|
// disabled.
|
||||||
widget->setMouseTracking(true);
|
widget->setMouseTracking(true);
|
||||||
widget->installEventFilter(this);
|
widget->installEventFilter(this);
|
||||||
|
updateQtFrame(widget->windowHandle(), m_titleBarHeight);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -247,7 +247,6 @@ bool FramelessHelper::eventFilter(QObject *object, QEvent *event) {
|
||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
if (!object || !isWindowTopLevel(object)) {
|
if (!object || !isWindowTopLevel(object)) {
|
||||||
event->ignore();
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
const auto getWindowEdges = [this](const QPointF &point, const int ww,
|
const auto getWindowEdges = [this](const QPointF &point, const int ww,
|
||||||
|
@ -533,6 +532,5 @@ bool FramelessHelper::eventFilter(QObject *object, QEvent *event) {
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
event->ignore();
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue