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 virtual void accessibleToggleAction();
56
57 bool isPressAndHoldConnected();
58 bool isDoubleClickConnected();
59 void startPressAndHold();
60 void stopPressAndHold();
61
62 void startRepeatDelay();
63 void startPressRepeat();
64 void stopPressRepeat();
65
66#if QT_CONFIG(shortcut)
67 void grabShortcut();
68 void ungrabShortcut();
69#endif
70
71 QQuickAbstractButton *findCheckedButton() const;
72 QList<QQuickAbstractButton *> findExclusiveButtons() const;
73
74 void actionTextChange();
75 void setText(const QString &text, QQml::PropertyUtils::State propertyState);
76 void init();
77
78 void updateEffectiveIcon();
79
80 void click();
81 void trigger(bool doubleClick = false);
82 void toggle(bool value);
83
84 void cancelIndicator();
85 void executeIndicator(bool complete = false);
86
87 void itemImplicitWidthChanged(QQuickItem *item) override;
88 void itemImplicitHeightChanged(QQuickItem *item) override;
89 void itemDestroyed(QQuickItem *item) override;
90
91 // copied from qabstractbutton.cpp
92 static const int AUTO_REPEAT_DELAY = 300;
93 static const int AUTO_REPEAT_INTERVAL = 100;
94
95 bool explicitText = false;
96 bool down = false;
97 bool explicitDown = false;
98 bool pressed = false;
99 bool keepPressed = false;
100 bool checked = false;
101 bool checkable = false;
102 bool autoExclusive = false;
103 bool autoRepeat = false;
104 bool wasHeld = false;
105 bool wasDoubleClick = false;
106 int holdTimer = 0;
107 int delayTimer = 0;
108 int repeatTimer = 0;
109 int repeatDelay = AUTO_REPEAT_DELAY;
110 int repeatInterval = AUTO_REPEAT_INTERVAL;
111 int animateTimer = 0;
112#if QT_CONFIG(shortcut)
113 int shortcutId = 0;
114 QKeySequence shortcut;
115#endif
116 qreal lastTouchReleaseTimestamp = 0;
117 QString text;
118 QQuickIcon icon;
119 QQuickIcon effectiveIcon;
120 QPointF pressPoint;
121 QPointF movePoint;
122 Qt::MouseButtons pressButtons = Qt::NoButton;
123 QQuickAbstractButton::Display display = QQuickAbstractButton::TextBesideIcon;
124 QQuickDeferredPointer<QQuickItem> indicator;
125 QQuickButtonGroup *group = nullptr;
126 QPointer<QQuickAction> action;
127};
128
129QT_END_NAMESPACE
130
131#endif // QQUICKABSTRACTBUTTON_P_P_H
Combined button and popup list for selecting options.