Fix old Qt build

Signed-off-by: Yuhang Zhao <2546789017@qq.com>
This commit is contained in:
Yuhang Zhao 2021-06-25 16:35:32 +08:00
parent 5938fcb475
commit fe2d5716e2
3 changed files with 4 additions and 4 deletions

View File

@ -58,7 +58,7 @@ void FramelessWindowsManager::addWindow(QWindow *window)
#endif
}
void FramelessWindowsManager::setHitTestVisibleInChrome(QWindow *window, const QObject *object, const bool value)
void FramelessWindowsManager::setHitTestVisibleInChrome(QWindow *window, QObject *object, const bool value)
{
Q_ASSERT(window);
Q_ASSERT(object);
@ -72,7 +72,7 @@ void FramelessWindowsManager::setHitTestVisibleInChrome(QWindow *window, const Q
auto objList = qvariant_cast<QObjectList>(window->property(_flh_global::_flh_hitTestVisibleInChrome_flag));
if (value) {
if (objList.isEmpty() || !objList.contains(object)) {
objList.append(const_cast<QObject *>(object));
objList.append(object);
}
} else {
if (!objList.isEmpty() && objList.contains(object)) {

View File

@ -36,7 +36,7 @@ namespace FramelessWindowsManager {
FRAMELESSHELPER_API void addWindow(QWindow *window);
FRAMELESSHELPER_API void removeWindow(QWindow *window);
FRAMELESSHELPER_API bool isWindowFrameless(const QWindow *window);
FRAMELESSHELPER_API void setHitTestVisibleInChrome(QWindow *window, const QObject *object, const bool value = true);
FRAMELESSHELPER_API void setHitTestVisibleInChrome(QWindow *window, QObject *object, const bool value = true);
FRAMELESSHELPER_API int getBorderWidth(const QWindow *window);
FRAMELESSHELPER_API void setBorderWidth(QWindow *window, const int value);
FRAMELESSHELPER_API int getBorderHeight(const QWindow *window);

View File

@ -517,7 +517,7 @@ void Utilities::displaySystemMenu(const QWindow *window, const QPointF &pos)
}
const bool isRtl = QGuiApplication::isRightToLeft();
const qreal dpr = window->devicePixelRatio();
const QPointF point = pos.isNull() ? QPointF(QCursor::pos(window->screen()) * dpr) : QPointF(window->mapToGlobal(pos) * dpr);
const QPointF point = pos.isNull() ? QPointF(QCursor::pos(window->screen())) * dpr : QPointF(window->mapToGlobal(pos.toPoint())) * dpr;
const LPARAM cmd = TrackPopupMenu(hMenu,
(TPM_LEFTBUTTON | TPM_RIGHTBUTTON | TPM_RETURNCMD | TPM_TOPALIGN |
(isRtl ? TPM_RIGHTALIGN : TPM_LEFTALIGN)),