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
qquickabstractbutton_p_p.h
Go to the documentation of this file.
1// Copyright (C) 2017 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 QQUICKABSTRACTBUTTON_P_P_H
6#define QQUICKABSTRACTBUTTON_P_P_H
7
8//
9// W A R N I N G
10// -------------
11//
12// This file is not part of the Qt API. It exists purely as an
13// implementation detail. This header file may change from version to
14// version without notice, or even be removed.
15//
16// We mean it.
17//
18
19#include <QtQuickTemplates2/private/qquickabstractbutton_p.h>
20#include <QtQuickTemplates2/private/qquickcontrol_p_p.h>
21#if QT_CONFIG(shortcut)
22# include <QtGui/qkeysequence.h>
23#endif
24
25#include <QtCore/qpointer.h>
26
27#include <QtQml/private/qqmlpropertyutils_p.h>
28
30
31class QQuickAction;
32class QQuickButtonGroup;
33
34class Q_QUICKTEMPLATES2_EXPORT QQuickAbstractButtonPrivate : public QQuickControlPrivate
35{
36public:
37 Q_DECLARE_PUBLIC(QQuickAbstractButton)
38
39 static QQuickAbstractButtonPrivate *get(QQuickAbstractButton *button)
40 {
41 return button->d_func();
42 }
43
44 QPointF centerPressPoint() const;
45 void setPressPoint(const QPointF &point);
46 void setMovePoint(const QPointF &point);
47
48 bool handlePress(const QPointF &point, ulong timestamp) override;
49 bool handleMove(const QPointF &point, ulong timestamp) override;
50 bool handleRelease(const QPointF &point, ulong timestamp) override;
51 void handleUngrab() override;
52
53 virtual bool acceptKeyClick(Qt::Key key) const;
54 virtual void accessiblePressAction();
55
56 bool isPressAndHoldConnected();
57 bool isDoubleClickConnected();
58 void startPressAndHold();
59 void stopPressAndHold();
60
61 void startRepeatDelay();
62 void startPressRepeat();
63 void stopPressRepeat();
64
65#if QT_CONFIG(shortcut)
66 void grabShortcut();
67 void ungrabShortcut();
68#endif
69
70 QQuickAbstractButton *findCheckedButton() const;
71 QList<QQuickAbstractButton *> findExclusiveButtons() const;
72
73 void actionTextChange();
74 void setText(const QString &text, QQml::PropertyUtils::State propertyState);
75 void init();
76
77 void updateEffectiveIcon();
78
79 void click();
80 void trigger(bool doubleClick = false);
81 void toggle(bool value);
82
83 void cancelIndicator();
84 void executeIndicator(bool complete = false);
85
86 void itemImplicitWidthChanged(QQuickItem *item) override;
87 void itemImplicitHeightChanged(QQuickItem *item) override;
88 void itemDestroyed(QQuickItem *item) override;
89
90 // copied from qabstractbutton.cpp
91 static const int AUTO_REPEAT_DELAY = 300;
92 static const int AUTO_REPEAT_INTERVAL = 100;
93
94 bool explicitText = false;
95 bool down = false;
96 bool explicitDown = false;
97 bool pressed = false;
98 bool keepPressed = false;
99 bool checked = false;
100 bool checkable = false;
101 bool autoExclusive = false;
102 bool autoRepeat = false;
103 bool wasHeld = false;
104 bool wasDoubleClick = false;
105 int holdTimer = 0;
106 int delayTimer = 0;
107 int repeatTimer = 0;
108 int repeatDelay = AUTO_REPEAT_DELAY;
109 int repeatInterval = AUTO_REPEAT_INTERVAL;
110 int animateTimer = 0;
111#if QT_CONFIG(shortcut)
112 int shortcutId = 0;
113 QKeySequence shortcut;
114#endif
115 qreal lastTouchReleaseTimestamp = 0;
116 QString text;
117 QQuickIcon icon;
118 QQuickIcon effectiveIcon;
119 QPointF pressPoint;
120 QPointF movePoint;
121 Qt::MouseButtons pressButtons = Qt::NoButton;
122 QQuickAbstractButton::Display display = QQuickAbstractButton::TextBesideIcon;
123 QQuickDeferredPointer<QQuickItem> indicator;
124 QQuickButtonGroup *group = nullptr;
125 QPointer<QQuickAction> action;
126};
127
128QT_END_NAMESPACE
129
130#endif // QQUICKABSTRACTBUTTON_P_P_H