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

Provided by KDAB

Privacy Policy
Learn to use CMake with our Intro Training
Find out more

source code of qtdeclarative/src/quicktemplates/qquickabstractbutton_p_p.h