Qt 6.x
The Qt SDK
Loading...
Searching...
No Matches
qquickcontainer_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 QQUICKCONTAINER_P_H
5#define QQUICKCONTAINER_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/qquickcontrol_p.h>
19#include <QtQml/qqmllist.h>
20
22
24
25class Q_QUICKTEMPLATES2_PRIVATE_EXPORT QQuickContainer : public QQuickControl
26{
28 Q_PROPERTY(int count READ count NOTIFY countChanged FINAL)
29 Q_PROPERTY(QVariant contentModel READ contentModel CONSTANT FINAL)
30 Q_PROPERTY(QQmlListProperty<QObject> contentData READ contentData)
31 Q_PROPERTY(QQmlListProperty<QQuickItem> contentChildren READ contentChildren NOTIFY contentChildrenChanged FINAL)
32 Q_PROPERTY(int currentIndex READ currentIndex WRITE setCurrentIndex NOTIFY currentIndexChanged FINAL)
33 Q_PROPERTY(QQuickItem *currentItem READ currentItem NOTIFY currentItemChanged FINAL)
34 // 2.5 (Qt 5.12)
35 Q_PROPERTY(qreal contentWidth READ contentWidth WRITE setContentWidth RESET resetContentWidth NOTIFY contentWidthChanged FINAL REVISION(2, 5))
36 Q_PROPERTY(qreal contentHeight READ contentHeight WRITE setContentHeight RESET resetContentHeight NOTIFY contentHeightChanged FINAL REVISION(2, 5))
37 Q_CLASSINFO("DefaultProperty", "contentData")
38 QML_NAMED_ELEMENT(Container)
40
41public:
42 explicit QQuickContainer(QQuickItem *parent = nullptr);
44
45 int count() const;
46 Q_INVOKABLE QQuickItem *itemAt(int index) const;
48 Q_INVOKABLE void insertItem(int index, QQuickItem *item);
49 Q_INVOKABLE void moveItem(int from, int to);
50 Q_INVOKABLE void removeItem(QQuickItem *item);
51 // 2.3 (Qt 5.10)
52 Q_REVISION(2, 3) Q_INVOKABLE QQuickItem *takeItem(int index);
53
54 QVariant contentModel() const;
55 QQmlListProperty<QObject> contentData();
56 QQmlListProperty<QQuickItem> contentChildren();
57
58 int currentIndex() const;
59 QQuickItem *currentItem() const;
60
61 // 2.5 (Qt 5.12)
62 qreal contentWidth() const;
63 void setContentWidth(qreal width);
64 void resetContentWidth();
65
66 qreal contentHeight() const;
67 void setContentHeight(qreal height);
68 void resetContentHeight();
69
70public Q_SLOTS:
71 void setCurrentIndex(int index);
72 // 2.1 (Qt 5.8)
73 Q_REVISION(2, 1) void incrementCurrentIndex();
74 Q_REVISION(2, 1) void decrementCurrentIndex();
75
77 void countChanged();
78 void contentChildrenChanged();
79 void currentIndexChanged();
80 void currentItemChanged();
81 // 2.5 (Qt 5.12)
82 Q_REVISION(2, 5) void contentWidthChanged();
83 Q_REVISION(2, 5) void contentHeightChanged();
84
85protected:
87
88 void componentComplete() override;
89
90 void itemChange(ItemChange change, const ItemChangeData &data) override;
91 void contentItemChange(QQuickItem *newItem, QQuickItem *oldItem) override;
92
93 virtual bool isContent(QQuickItem *item) const;
94 virtual void itemAdded(int index, QQuickItem *item);
95 virtual void itemMoved(int index, QQuickItem *item);
96 virtual void itemRemoved(int index, QQuickItem *item);
97
99 Q_DISABLE_COPY(QQuickContainer)
100 Q_DECLARE_PRIVATE(QQuickContainer)
101 Q_PRIVATE_SLOT(d_func(), void _q_currentIndexChanged())
102};
103
105
107
108#endif // QQUICKCONTAINER_P_H
\inmodule QtCore
Definition qobject.h:90
The QQmlListProperty class allows applications to expose list-like properties of QObject-derived clas...
Definition qqmllist.h:24
Q_REVISION(2, 3) Q_INVOKABLE QQuickItem *takeItem(int index)
The QQuickItem class provides the most basic of all visual items in \l {Qt Quick}.
Definition qquickitem.h:64
ItemChange
Used in conjunction with QQuickItem::itemChange() to notify the item about certain types of changes.
Definition qquickitem.h:143
\inmodule QtCore
Definition qvariant.h:64
Combined button and popup list for selecting options.
GLint GLsizei GLsizei height
GLuint index
[2]
GLenum GLenum GLsizei count
GLint GLsizei width
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
#define QML_DECLARE_TYPE(TYPE)
Definition qqml.h:19
#define QML_NAMED_ELEMENT(NAME)
#define QML_ADDED_IN_VERSION(MAJOR, MINOR)
#define Q_PROPERTY(...)
#define Q_OBJECT
#define Q_REVISION(...)
#define Q_CLASSINFO(name, value)
#define Q_INVOKABLE
#define Q_SLOTS
#define Q_PRIVATE_SLOT(d, signature)
#define Q_SIGNALS
double qreal
Definition qtypes.h:92
scene addItem(form)
QGraphicsItem * item
IUIAutomationTreeWalker __RPC__deref_out_opt IUIAutomationElement ** parent
\inmodule QtQuick
Definition qquickitem.h:158