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
qquickaction_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
4#ifndef QQUICKACTION_P_H
5#define QQUICKACTION_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/qtquicktemplates2global_p.h>
19#include <QtQuickTemplates2/private/qquickicon_p.h>
20#include <QtCore/qobject.h>
21#include <QtQml/qqml.h>
22
24
25class QQuickIcon;
27
28class Q_QUICKTEMPLATES2_EXPORT QQuickAction : public QObject
29{
31 Q_PROPERTY(QString text READ text WRITE setText NOTIFY textChanged FINAL)
32 Q_PROPERTY(QQuickIcon icon READ icon WRITE setIcon NOTIFY iconChanged FINAL)
33 Q_PROPERTY(bool enabled READ isEnabled WRITE setEnabled NOTIFY enabledChanged RESET resetEnabled FINAL)
34 Q_PROPERTY(bool checked READ isChecked WRITE setChecked NOTIFY checkedChanged FINAL)
35 Q_PROPERTY(bool checkable READ isCheckable WRITE setCheckable NOTIFY checkableChanged FINAL)
36#if QT_CONFIG(shortcut)
37 Q_PRIVATE_PROPERTY(QQuickAction::d_func(), QVariant shortcut READ shortcut WRITE setShortcut NOTIFY shortcutChanged FINAL)
38#endif
39 QML_NAMED_ELEMENT(Action)
41
42public:
43 explicit QQuickAction(QObject *parent = nullptr);
44 ~QQuickAction();
45
46 QString text() const;
47 void setText(const QString &text);
48
49 QQuickIcon icon() const;
50 void setIcon(const QQuickIcon &icon);
51
52 bool isEnabled() const;
53 void setEnabled(bool enabled);
54 void resetEnabled();
55
56 bool isChecked() const;
57 void setChecked(bool checked);
58
59 bool isCheckable() const;
60 void setCheckable(bool checkable);
61
62#if QT_CONFIG(shortcut)
63 QKeySequence shortcut() const;
65#endif
66
67public Q_SLOTS:
68 void toggle(QObject *source = nullptr);
69 void trigger(QObject *source = nullptr);
70
72 void textChanged(const QString &text);
75 void checkedChanged(bool checked);
76 void checkableChanged(bool checkable);
77#if QT_CONFIG(shortcut)
78 void shortcutChanged(const QKeySequence &shortcut);
79#endif
80
81 void toggled(QObject *source = nullptr);
82 void triggered(QObject *source = nullptr);
83
84protected:
85 bool event(QEvent *event) override;
86 bool eventFilter(QObject *object, QEvent *event) override;
87
88private:
89 Q_DISABLE_COPY(QQuickAction)
90 Q_DECLARE_PRIVATE(QQuickAction)
91};
92
94
95#endif // QQUICKACTION_P_H
\inmodule QtCore
Definition qcoreevent.h:45
The QKeySequence class encapsulates a key sequence as used by shortcuts.
\inmodule QtCore
Definition qobject.h:103
void toggled(QObject *source=nullptr)
void triggered(QObject *source=nullptr)
void checkedChanged(bool checked)
void checkableChanged(bool checkable)
void enabledChanged(bool enabled)
void textChanged(const QString &text)
void iconChanged(const QQuickIcon &icon)
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:129
\inmodule QtCore
Definition qvariant.h:65
QString text
void textChanged(const QString &newText)
Combined button and popup list for selecting options.
GLenum GLenum GLsizei const GLuint GLboolean enabled
GLsizei GLsizei GLchar * source
struct _cl_event * event
#define QML_NAMED_ELEMENT(NAME)
#define QML_ADDED_IN_VERSION(MAJOR, MINOR)
#define Q_PROPERTY(...)
#define Q_OBJECT
#define Q_SLOTS
#define Q_SIGNALS
#define Q_PRIVATE_PROPERTY(d, text)
#define explicit
myAction setIcon(SomeIcon)
insertRed setText("insert red text")
button setShortcut(tr("Alt+F7"))
radio1 setChecked(true)