--- /dev/null
+#include "declarativetreeviewextension_p.h"
+
+#include <QTreeView>
+
+DeclarativeTreeViewExtension::DeclarativeTreeViewExtension(QObject *parent)
+ : DeclarativeItemViewExtension(parent)
+{
+}
+
+QTreeView *DeclarativeTreeViewExtension::extendedTreeView() const
+{
+ QTreeView *treeView = qobject_cast<QTreeView*>(extendedItemView());
+ Q_ASSERT(treeView);
+
+ return treeView;
+}
+
+void DeclarativeTreeViewExtension::setHeader(QHeaderView *header)
+{
+ if (header == extendedTreeView()->header())
+ return;
+
+ extendedTreeView()->setHeader(header);
+ emit headerChanged(header);
+}
+
+QHeaderView *DeclarativeTreeViewExtension::header() const
+{
+ return extendedTreeView()->header();
+}
--- /dev/null
+#ifndef DECLARATIVETREEVIEWEXTENSION_P_H
+#define DECLARATIVETREEVIEWEXTENSION_P_H
+
+#include "declarativeitemviewextension_p.h"
+
+class QHeaderView;
+class QTreeView;
+
+class DeclarativeTreeViewExtension : public DeclarativeItemViewExtension
+{
+ Q_OBJECT
+
+ Q_PROPERTY(QHeaderView* header READ header WRITE setHeader NOTIFY headerChanged)
+
+ // repeat property declarations, qmlRegisterExtendedType doesn't see the ones from base class
+ Q_PROPERTY(QAbstractItemModel* model READ model WRITE setModel NOTIFY modelChanged)
+ Q_PROPERTY(QItemSelectionModel* selectionModel READ selectionModel WRITE setSelectionModel NOTIFY selectionModelChanged)
+
+ Q_PROPERTY(QDeclarativeListProperty<QObject> data READ data DESIGNABLE false)
+
+ Q_CLASSINFO("DefaultProperty", "data")
+
+ public:
+ explicit DeclarativeTreeViewExtension(QObject *parent = 0);
+
+ QTreeView *extendedTreeView() const;
+
+ void setHeader(QHeaderView *header);
+ QHeaderView *header() const;
+
+ Q_SIGNALS:
+ void modelChanged(QAbstractItemModel *model);
+ void selectionModelChanged(QItemSelectionModel *selectionModel);
+
+ void headerChanged(QHeaderView *header);
+};
+
+#endif // DECLARATIVETREEVIEWEXTENSION_P_H
#include "declarativetableviewextension_p.h"
#include "declarativetabwidget_p.h"
#include "declarativetexteditextension_p.h"
+#include "declarativetreeviewextension_p.h"
#include "declarativevboxlayout_p.h"
#include "declarativewidgetextension.h"
#include "mainwindowwidgetcontainer_p.h"
qmlRegisterExtendedType<QTimeEdit, DeclarativeWidgetExtension>("QtGui", 1, 0, "TimeEdit");
qmlRegisterExtendedType<QToolBar, DeclarativeContainerWidgetExtension<ToolBarWidgetContainer> >("QtGui", 1, 0, "ToolBar");
qmlRegisterExtendedType<QToolButton, DeclarativeWidgetExtension>("QtGui", 1, 0, "ToolButton");
- qmlRegisterExtendedType<QTreeView, DeclarativeItemViewExtension>("QtGui", 1, 0, "TreeView");
+ qmlRegisterExtendedType<QTreeView, DeclarativeTreeViewExtension>("QtGui", 1, 0, "TreeView");
qmlRegisterExtendedType<QWebView, DeclarativeWidgetExtension>("QtGui", 1, 0, "WebView");
qmlRegisterExtendedType<QWidget, DeclarativeWidgetExtension>("QtGui", 1, 0, "Widget");
declarativetableviewextension_p.h \
declarativetabwidget_p.h \
declarativetexteditextension_p.h \
+ declarativetreeviewextension_p.h \
declarativevboxlayout_p.h \
declarativewidgetextension.h \
declarativewidgetsdocument.h \
declarativetableviewextension.cpp \
declarativetabwidget.cpp \
declarativetexteditextension.cpp \
+ declarativetreeviewextension.cpp \
declarativevboxlayout.cpp \
declarativewidgetextension.cpp \
declarativewidgetsdocument.cpp \