summaryrefslogtreecommitdiff
path: root/src/plugins/scxmleditor/common/movableframe.h
blob: 7f08eaa1e978a6b8ff2ee133cd7ee1e70ccdcc64 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0

#pragma once

#include <QFrame>

namespace ScxmlEditor {

namespace Common {

/**
 * @brief The MovableFrame class is the base class for movable frames inside the parent widget.
 *
 * For example Navigator and Warnings are the movable frames.
 */
class MovableFrame : public QFrame
{
    Q_OBJECT

public:
    explicit MovableFrame(QWidget *parent = nullptr);

signals:
    void hideFrame();

protected:
    void mousePressEvent(QMouseEvent *e) override;
    void mouseMoveEvent(QMouseEvent *e) override;
    void mouseReleaseEvent(QMouseEvent *e) override;

private:
    void checkCursor(const QPoint &p);

    QPoint m_startPoint;
    bool m_mouseDown = false;
};

} // namespace Common
} // namespace ScxmlEditor