qt6: build is fixed now

This commit is contained in:
Sergio Martins
2020-12-08 21:47:35 +00:00
parent f475312f11
commit 89635d8b98
5 changed files with 33 additions and 7 deletions

View File

@@ -55,6 +55,7 @@ set(DOCKS_INSTALLABLE_INCLUDES
FrameworkWidgetFactory.h
DockWidgetBase.h
KDDockWidgets.h
Qt5Qt6Compat_p.h
FocusScope.h
QWidgetAdapter.h
LayoutSaver.h

View File

@@ -19,15 +19,15 @@
#ifndef KD_KDDOCKWIDGETS_H
#define KD_KDDOCKWIDGETS_H
#include "Qt5Qt6Compat_p.h"
#include <QObject>
#ifdef Q_OS_WIN
// Only on Windows, where this is popular. On linux it the Qt::Tool windows need reparenting. Untested on macOS.
// Only on Windows, where this is popular. On linux the Qt::Tool windows need reparenting. Untested on macOS.
# define KDDOCKWIDGETS_SUPPORTS_NESTED_MAINWINDOWS
#endif
namespace KDDockWidgets
{
enum Location {
@@ -120,7 +120,7 @@ namespace KDDockWidgets
};
///@internal
inline uint qHash(SideBarLocation loc, uint seed)
inline Qt5Qt6Compat::qhashtype qHash(SideBarLocation loc, Qt5Qt6Compat::qhashtype seed)
{
return ::qHash(static_cast<uint>(loc), seed);
}

View File

@@ -13,6 +13,7 @@
#define KDDOCKWIDGETS_QT5QT6_COMPAT_P_H
#include <QMouseEvent>
#include <QDropEvent>
namespace KDDockWidgets {
namespace Qt5Qt6Compat {
@@ -21,6 +22,12 @@ namespace Qt5Qt6Compat {
using QEnterEvent = QEnterEvent;
using qintptr = ::qintptr;
using qhashtype = size_t;
inline QPoint eventPos(QDropEvent *ev)
{
return ev->position().toPoint();
}
inline QPoint eventGlobalPos(QMouseEvent *ev)
{
@@ -32,6 +39,12 @@ inline QPoint eventGlobalPos(QMouseEvent *ev)
using QEnterEvent = QEvent;
using qintptr = long;
using qhashtype = uint;
inline QPoint eventPos(QDropEvent *ev)
{
return ev->pos();
}
inline QPoint eventGlobalPos(QMouseEvent *ev)
{

View File

@@ -0,0 +1,12 @@
/*
This file is part of KDDockWidgets.
SPDX-FileCopyrightText: 2020 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
Author: Sergio Martins <sergio.martins@kdab.com>
SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only
Contact KDAB at <info@kdab.com> for commercial licensing options.
*/
#include "../../Qt5Qt6Compat_p.h"

View File

@@ -415,7 +415,7 @@ bool StateDraggingWayland::handleDragEnter(QDragEnterEvent *ev, DropArea *dropAr
return true;
}
dropArea->hover(q->m_windowBeingDragged.get(), dropArea->mapToGlobal(ev->pos()));
dropArea->hover(q->m_windowBeingDragged.get(), dropArea->mapToGlobal(Qt5Qt6Compat::eventPos(ev)));
ev->accept();
return true;
@@ -433,7 +433,7 @@ bool StateDraggingWayland::handleDrop(QDropEvent *ev, DropArea *dropArea)
if (!mimeData || !q->m_windowBeingDragged)
return false; // Not for us, some other user drag.
if (dropArea->drop(q->m_windowBeingDragged.get(), dropArea->mapToGlobal(ev->pos()))) {
if (dropArea->drop(q->m_windowBeingDragged.get(), dropArea->mapToGlobal(Qt5Qt6Compat::eventPos(ev)))) {
ev->setDropAction(Qt::MoveAction);
ev->accept();
Q_EMIT q->dropped();
@@ -451,7 +451,7 @@ bool StateDraggingWayland::handleDragMove(QDragMoveEvent *ev, DropArea *dropArea
if (!mimeData || !q->m_windowBeingDragged)
return false; // Not for us, some other user drag.
dropArea->hover(q->m_windowBeingDragged.get(), dropArea->mapToGlobal(ev->pos()));
dropArea->hover(q->m_windowBeingDragged.get(), dropArea->mapToGlobal(Qt5Qt6Compat::eventPos(ev)));
return true;
}