CUSTOM_METAOBJECT(DeclarativeHBoxLayout, QHBoxLayout)
+// DeclarativeStackedLayout
+DeclarativeStackedLayout::DeclarativeStackedLayout(QObject *parent) : DeclarativeLayoutProxy<StackedLayout>(parent)
+{
+ connectAllSignals(m_proxiedObject, this);
+}
+
+void DeclarativeStackedLayout::addWidget(QWidget *widget, AbstractDeclarativeObject *declarativeObject)
+{
+ m_proxiedObject->addWidget(widget);
+ m_children.append(declarativeObject);
+}
+
+void DeclarativeStackedLayout::addLayout(QLayout*, AbstractDeclarativeObject *declarativeObject)
+{
+ qmlInfo(declarativeObject) << "StackedLayout does not support child layouts";
+}
+
+CUSTOM_METAOBJECT(DeclarativeStackedLayout, StackedLayout)
+
// DeclarativeVBoxLayout
DeclarativeVBoxLayout::DeclarativeVBoxLayout(QObject *parent) : DeclarativeLayoutProxy<QVBoxLayout>(parent)
{
QML_DECLARE_TYPEINFO(DeclarativeHBoxLayout, QML_HAS_ATTACHED_PROPERTIES)
+class DeclarativeStackedLayout : public DeclarativeLayoutProxy<StackedLayout>
+{
+ DECLARATIVE_OBJECT
+
+ public:
+ DeclarativeStackedLayout(QObject *parent = 0);
+
+ protected:
+ void addWidget(QWidget *widget, AbstractDeclarativeObject *declarativeObject);
+ void addLayout(QLayout *layout, AbstractDeclarativeObject *declarativeObject);
+};
+
class DeclarativeVBoxLayout : public DeclarativeLayoutProxy<QVBoxLayout>
{
DECLARATIVE_OBJECT
qmlRegisterType<DeclarativeFormLayout>("QtGui", 1, 0, "FormLayout");
qmlRegisterType<DeclarativeGridLayout>("QtGui", 1, 0, "GridLayout");
qmlRegisterType<DeclarativeHBoxLayout>("QtGui", 1, 0, "HBoxLayout");
+ qmlRegisterType<DeclarativeStackedLayout>("QtGui", 1, 0, "StackedLayout");
qmlRegisterType<DeclarativeVBoxLayout>("QtGui", 1, 0, "VBoxLayout");
// widgets
}
}
}
+
+ Widget {
+ TabWidget.label: "Stacked Layout"
+ VBoxLayout {
+ PushButton {
+ text: "Next Page"
+ onClicked: {
+ stackedLayout.currentIndex = ((stackedLayout.currentIndex + 1) % stackedLayout.count)
+ }
+ }
+ StackedLayout {
+ id: stackedLayout
+ Label {
+ text: "Page 1"
+ }
+ Label {
+ text: "Page 2"
+ }
+ Label {
+ text: "Page 3"
+ }
+ }
+ }
+ }
}
#include <QtGui/QButtonGroup>
#include <QtGui/QFileDialog>
#include <QtGui/QInputDialog>
+#include <QtGui/QStackedLayout>
#include <QtGui/QTextEdit>
class ActionItem : public QObject
void customDoubleValueChanged();
};
+class StackedLayout : public QStackedLayout
+{
+ Q_OBJECT
+
+ Q_PROPERTY(int count READ count)
+};
+
class TextEdit : public QTextEdit
{
Q_OBJECT
qscrollarea.h
qsplashscreen.h
qsplitter.h
-qstackedlayout.h
qstackedwidget.h
qtabbar.h
qtableview.h