Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qwidgetresizehandler_p.h
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3// Qt-Security score:significant reason:default
4
5#ifndef QWIDGETRESIZEHANDLER_P_H
6#define QWIDGETRESIZEHANDLER_P_H
7
8//
9// W A R N I N G
10// -------------
11//
12// This file is not part of the Qt API. This header file may
13// change from version to version without notice, or even be
14// removed.
15//
16// We mean it.
17//
18
19#include <QtWidgets/private/qtwidgetsglobal_p.h>
20#include "QtCore/qobject.h"
21#include "QtCore/qpoint.h"
22
24
25QT_BEGIN_NAMESPACE
26
27class QMouseEvent;
28class QKeyEvent;
29
31{
33
34public:
35 explicit QWidgetResizeHandler(QWidget *parent, QWidget *cw = nullptr);
36 void setEnabled(bool b);
37 bool isEnabled() const;
38
39 bool isButtonDown() const { return buttonDown; }
40
41 void setExtraHeight(int h) { extrahei = h; }
42
43 void setFrameWidth(int w) { fw = w; }
44
45 void doResize();
46
48 void activate();
49
50protected:
51 bool eventFilter(QObject *o, QEvent *e) override;
52 void mouseMoveEvent(QMouseEvent *e);
53 void keyPressEvent(QKeyEvent *e);
54
55private:
57
58 enum MousePosition {
59 Nowhere,
62 Center
63 };
64
65 QWidget *widget;
66 QWidget *childWidget;
67 QPoint moveOffset;
68 QPoint invertedMoveOffset;
69 MousePosition mode;
70 int fw;
71 int extrahei;
72 int range;
73 uint buttonDown :1;
74 uint active :1;
75 uint enabled :1;
76
77 void setMouseCursor(MousePosition m);
78 bool isResizing() const {
79 return active && mode != Center;
80 }
81};
82
83QT_END_NAMESPACE
84
85#endif // QWIDGETRESIZEHANDLER_P_H
bool eventFilter(QObject *o, QEvent *e) override
Filters events if this object has been installed as an event filter for the watched object.
void mouseMoveEvent(QMouseEvent *e)
void keyPressEvent(QKeyEvent *e)
static bool resizeHorizontalDirectionFixed
static bool resizeVerticalDirectionFixed
#define RANGE
QT_REQUIRE_CONFIG(resizehandler)