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 // Not exposed to QML: whether mnemonics are supported is determined by
79 // the platform and, for certain derived types (e.g. ItemDelegate, where
80 // mnemonics don't make sense), by the type itself. Not something app
81 // code should be able to toggle per-instance.
82 void setMnemonicEnabled(bool enabled);
83
84 void updateEffectiveIcon();
85
86 void click();
87 void trigger(bool doubleClick = false);
88 void toggle(bool value);
89
90 void cancelIndicator();
91 void executeIndicator(bool complete = false);
92
93 void itemImplicitWidthChanged(QQuickItem *item) override;
94 void itemImplicitHeightChanged(QQuickItem *item) override;
95 void itemDestroyed(QQuickItem *item) override;
96
97 // copied from qabstractbutton.cpp
98 static const int AUTO_REPEAT_DELAY = 300;
99 static const int AUTO_REPEAT_INTERVAL = 100;
100
101 bool explicitText = false;
102 bool down = false;
103 bool explicitDown = false;
104 bool pressed = false;
105 bool keepPressed = false;
106 bool checked = false;
107 bool checkable = false;
108 bool autoExclusive = false;
109 bool autoRepeat = false;
110 bool wasHeld = false;
111 bool wasDoubleClick = false;
112 bool wasEnabledBeforeTrigger = false;
113 int holdTimer = 0;
114 int delayTimer = 0;
115 int repeatTimer = 0;
116 int repeatDelay = AUTO_REPEAT_DELAY;
117 int repeatInterval = AUTO_REPEAT_INTERVAL;
118 int animateTimer = 0;
119#if QT_CONFIG(shortcut)
120 int shortcutId = 0;
121 QKeySequence shortcut;
122#endif
123 qreal lastTouchReleaseTimestamp = 0;
124 QString text;
125 QQuickIcon icon;
126 QQuickIcon effectiveIcon;
127 QPointF pressPoint;
128 QPointF movePoint;
129 Qt::MouseButtons pressButtons = Qt::NoButton;
130 QQuickAbstractButton::Display display = QQuickAbstractButton::TextBesideIcon;
131 QQuickDeferredPointer<QQuickItem> indicator;
132 bool mnemonicEnabled = true;
133 QQuickButtonGroup *group = nullptr;
134 QPointer<QQuickAction> action;
135};
136
137QT_END_NAMESPACE
138
139#endif // QQUICKABSTRACTBUTTON_P_P_H
Combined button and popup list for selecting options.