Files
KDDockWidgets/src/private/WidgetResizeHandler_p.h
Sergio Martins e0aa547393 qtquick: Start using the WidgetResizeHandler
It's no longer commented out in FloatingWindow.
Doesn't do much for QtQuick, but at least we don't have different
code paths

Making it work is next.
2020-11-26 23:13:46 +00:00

68 lines
1.5 KiB
C++

/*
This file is part of KDDockWidgets.
SPDX-FileCopyrightText: 2019-2020 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
Author: Sérgio 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.
*/
#ifndef KD_WIDGET_RESIZE_HANDLER_P_H
#define KD_WIDGET_RESIZE_HANDLER_P_H
#include "QWidgetAdapter.h"
#include <QPoint>
#include <QDebug>
QT_BEGIN_NAMESPACE
class QMouseEvent;
QT_END_NAMESPACE
namespace KDDockWidgets {
class FloatingWindow;
class WidgetResizeHandler : public QObject
{
Q_OBJECT
public:
explicit WidgetResizeHandler(QWidgetOrQuick *target = nullptr);
~WidgetResizeHandler() override;
void setTarget(QWidgetOrQuick *w);
#ifdef Q_OS_WIN
static bool handleWindowsNativeEvent(FloatingWindow *w, const QByteArray &eventType, void *message, long *result);
#endif
static bool s_disableAllHandlers;
protected:
bool eventFilter(QObject *o, QEvent *e) override;
private:
enum class CursorPosition {
Left,
Right,
TopLeft,
TopRight,
BottomRight,
BottomLeft,
Top,
Bottom,
Undefined
};
void mouseMoveEvent(QMouseEvent *e);
void updateCursor(CursorPosition m);
CursorPosition cursorPosition(QPoint) const;
QWidgetOrQuick *mTarget = nullptr;
CursorPosition mCursorPos = CursorPosition::Undefined;
QPoint mNewPosition;
bool mResizeWidget = false;
};
}
#endif