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