Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
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
4#ifndef QWIDGETRESIZEHANDLER_P_H
5#define QWIDGETRESIZEHANDLER_P_H
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is not part of the Qt API. This header file may
12// change from version to version without notice, or even be
13// removed.
14//
15// We mean it.
16//
17
18#include <QtWidgets/private/qtwidgetsglobal_p.h>
19#include "QtCore/qobject.h"
20#include "QtCore/qpoint.h"
21
22QT_REQUIRE_CONFIG(resizehandler);
23
25
26class QMouseEvent;
27class QKeyEvent;
28
30{
32
33public:
34 explicit QWidgetResizeHandler(QWidget *parent, QWidget *cw = nullptr);
35 void setEnabled(bool b);
36 bool isEnabled() const;
37
38 bool isButtonDown() const { return buttonDown; }
39
40 void setExtraHeight(int h) { extrahei = h; }
41
42 void setFrameWidth(int w) { fw = w; }
43
44 void doResize();
45
47 void activate();
48
49protected:
50 bool eventFilter(QObject *o, QEvent *e) override;
52 void keyPressEvent(QKeyEvent *e);
53
54private:
55 Q_DISABLE_COPY_MOVE(QWidgetResizeHandler)
56
57 enum MousePosition {
58 Nowhere,
59 TopLeft, BottomRight, BottomLeft, TopRight,
60 Top, Bottom, Left, Right,
61 Center
62 };
63
64 QWidget *widget;
65 QWidget *childWidget;
66 QPoint moveOffset;
67 QPoint invertedMoveOffset;
68 MousePosition mode;
69 int fw;
70 int extrahei;
71 int range;
72 uint buttonDown :1;
73 uint active :1;
74 uint enabled :1;
75
76 void setMouseCursor(MousePosition m);
77 bool isResizing() const {
78 return active && mode != Center;
79 }
80};
81
83
84#endif // QWIDGETRESIZEHANDLER_P_H
\inmodule QtCore
Definition qcoreevent.h:45
The QKeyEvent class describes a key event.
Definition qevent.h:424
\inmodule QtGui
Definition qevent.h:196
\inmodule QtCore
Definition qobject.h:103
QObject * parent() const
Returns a pointer to the parent object.
Definition qobject.h:346
\inmodule QtCore\reentrant
Definition qpoint.h:25
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)
QWidgetResizeHandler(QWidget *parent, QWidget *cw=nullptr)
The QWidget class is the base class of all user interface objects.
Definition qwidget.h:99
Combined button and popup list for selecting options.
GLboolean GLboolean GLboolean b
GLenum mode
const GLfloat * m
GLfloat GLfloat GLfloat w
[0]
GLenum GLenum GLsizei const GLuint GLboolean enabled
GLsizei range
GLfloat GLfloat GLfloat GLfloat h
static const struct TessellationWindingOrderTab cw[]
#define QT_REQUIRE_CONFIG(feature)
#define Q_OBJECT
#define Q_SIGNALS
unsigned int uint
Definition qtypes.h:34