aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/scxmleditor/common/sizegrip.h
blob: 4a4d9da4e4432359ef1ac9df021b319247cdac28 (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
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0

#pragma once

#include <QWidget>

namespace ScxmlEditor {

namespace Common {

class SizeGrip : public QWidget
{
public:
    SizeGrip(QWidget *parent = nullptr);

protected:
    void resizeEvent(QResizeEvent *e) override;
    void mousePressEvent(QMouseEvent *e) override;
    void mouseMoveEvent(QMouseEvent *e) override;
    void mouseReleaseEvent(QMouseEvent *e) override;
    void paintEvent(QPaintEvent *e) override;
    void leaveEvent(QEvent *e) override;

private:
    void checkCursor(const QPoint &p);

    QPolygon m_pol;
    QPoint m_startPoint;
    QRect m_startRect;
    bool m_mouseDown = false;
};

} // namespace Common
} // namespace ScxmlEditor