Debian Codegraph @

tests/manual/highdpi/kitchensink/dragwidget.h

raw
1 // Copyright (C) 2016 The Qt Company Ltd.
2 // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
3
4 #ifndef DRAGWIDGET_H
5 #define DRAGWIDGET_H
6
7 #include <QWidget>
8 #include <QBasicTimer>
9
10 QT_BEGIN_NAMESPACE
11 class QDragEnterEvent;
12 class QDropEvent;
13 QT_END_NAMESPACE
14
15 class DragWidget : public QWidget
16 {
17 public:
18 DragWidget(QString text = QString(), QWidget *parent = nullptr);
19
20 protected:
21 void dragEnterEvent(QDragEnterEvent *event) override;
22 void dragLeaveEvent(QDragLeaveEvent *event) override;
23 void dropEvent(QDropEvent *event) override;
24 void mousePressEvent(QMouseEvent *event) override;
25 void dragMoveEvent(QDragMoveEvent * event) override;
26 void paintEvent(QPaintEvent *) override;
27 void timerEvent(QTimerEvent *event) override;
28 void showEvent(QShowEvent *event) override;
29 void hideEvent(QHideEvent *event) override;
30
31 private:
32 QPoint dragPos;
33 QPoint dropPos;
34 QBasicTimer dragTimer;
35 QBasicTimer dropTimer;
36 QWidget *otherWindow = nullptr;
37 };
38
39 #endif // DRAGWIDGET_H