Ported tree view
authorKevin Krammer <kevin.krammer@kdab.com>
Thu, 17 Jan 2013 10:43:56 +0000 (11:43 +0100)
committerKevin Krammer <kevin.krammer@kdab.com>
Thu, 17 Jan 2013 10:43:56 +0000 (11:43 +0100)
lib/declarativetreeview.cpp [deleted file]
lib/declarativetreeview_p.h [deleted file]
lib/declarativewidgetsdocument.cpp
lib/lib.pro
lib/objectadaptors.cpp
lib/objectadaptors_p.h

diff --git a/lib/declarativetreeview.cpp b/lib/declarativetreeview.cpp
deleted file mode 100644 (file)
index f651b4b..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
-  Copyright (C) 2012 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com
-  Author: Kevin Krammer, krake@kdab.com
-  Author: Tobias Koenig, tokoe@kdab.com
-
-  This program is free software; you can redistribute it and/or modify
-  it under the terms of the GNU General Public License as published by
-  the Free Software Foundation; either version 2 of the License, or
-  (at your option) any later version.
-
-  This program is distributed in the hope that it will be useful,
-  but WITHOUT ANY WARRANTY; without even the implied warranty of
-  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-  GNU General Public License for more details.
-
-  You should have received a copy of the GNU General Public License along
-  with this program; if not, write to the Free Software Foundation, Inc.,
-  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-*/
-
-#include "declarativetreeview_p.h"
-
-DeclarativeTreeView::DeclarativeTreeView(QObject *parent)
-  : DeclarativeWidgetProxy<TreeView>(parent)
-{
-  connectAllSignals(m_proxiedObject, this);
-}
-
-CUSTOM_METAOBJECT(DeclarativeTreeView, TreeView)
diff --git a/lib/declarativetreeview_p.h b/lib/declarativetreeview_p.h
deleted file mode 100644 (file)
index f238206..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
-  Copyright (C) 2012 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com
-  Author: Kevin Krammer, krake@kdab.com
-  Author: Tobias Koenig, tokoe@kdab.com
-
-  This program is free software; you can redistribute it and/or modify
-  it under the terms of the GNU General Public License as published by
-  the Free Software Foundation; either version 2 of the License, or
-  (at your option) any later version.
-
-  This program is distributed in the hope that it will be useful,
-  but WITHOUT ANY WARRANTY; without even the implied warranty of
-  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-  GNU General Public License for more details.
-
-  You should have received a copy of the GNU General Public License along
-  with this program; if not, write to the Free Software Foundation, Inc.,
-  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-*/
-
-#ifndef DECLARATIVETREEVIEW_P_H
-#define DECLARATIVETREEVIEW_P_H
-
-#include "declarativewidgetproxy_p.h"
-
-#include "objectadaptors_p.h"
-
-class DeclarativeTreeView : public DeclarativeWidgetProxy<TreeView>
-{
-  DECLARATIVE_OBJECT
-
-  public:
-    explicit DeclarativeTreeView(QObject *parent = 0);
-};
-
-#endif
index c2957ec..a3ef326 100644 (file)
@@ -63,7 +63,6 @@
 #include "declarativetexteditextension_p.h"
 #include "declarativetimeedit_p.h"
 #include "declarativetoolbarextension_p.h"
-#include "declarativetreeview_p.h"
 #include "declarativevboxlayout_p.h"
 #include "declarativewidgetextension.h"
 
@@ -83,6 +82,7 @@
 #include <QRadioButton>
 #include <QToolBar>
 #include <QToolButton>
+#include <QTreeView>
 #include <QWebView>
 
 class DeclarativeWidgetsDocument::Private
@@ -134,7 +134,6 @@ DeclarativeWidgetsDocument::DeclarativeWidgetsDocument(const QUrl &url, QObject
   qmlRegisterType<DeclarativeTabWidgetAttached>();
   qmlRegisterType<DeclarativeTextBrowser>("QtGui", 1, 0, "TextBrowser");
   qmlRegisterType<DeclarativeTimeEdit>("QtGui", 1, 0, "TimeEdit");
-  qmlRegisterType<DeclarativeTreeView>("QtGui", 1, 0, "TreeView");
   */
 
   // objects
@@ -178,6 +177,7 @@ DeclarativeWidgetsDocument::DeclarativeWidgetsDocument(const QUrl &url, QObject
   qmlRegisterExtendedType<QTextEdit, DeclarativeTextEditExtension>("QtGui", 1, 0, "TextEdit");
   qmlRegisterExtendedType<QToolBar, DeclarativeToolBarExtension>("QtGui", 1, 0, "ToolBar");
   qmlRegisterExtendedType<QToolButton, DeclarativeWidgetExtension>("QtGui", 1, 0, "ToolButton");
+  qmlRegisterExtendedType<QTreeView, DeclarativeItemViewExtension>("QtGui", 1, 0, "TreeView");
   qmlRegisterExtendedType<QWebView, DeclarativeWidgetExtension>("QtGui", 1, 0, "WebView");
   qmlRegisterExtendedType<QWidget, DeclarativeWidgetExtension>("QtGui", 1, 0, "Widget");
 
index 77d30d2..fde0acf 100644 (file)
@@ -53,7 +53,6 @@ HEADERS = \
   declarativetexteditextension_p.h \
   declarativetimeedit_p.h \
   declarativetoolbarextension_p.h \
-  declarativetreeview_p.h \
   declarativevboxlayout_p.h \
   declarativewidgetextension.h \
   declarativewidgetproxy_p.h \
@@ -109,7 +108,6 @@ SOURCES = \
   declarativetexteditextension.cpp \
   declarativetimeedit.cpp \
   declarativetoolbarextension.cpp \
-  declarativetreeview.cpp \
   declarativevboxlayout.cpp \
   declarativewidgetextension.cpp \
   declarativewidgetsdocument.cpp \
index ef4b483..88705a8 100644 (file)
@@ -243,30 +243,3 @@ void TableView::setSelectionModel(QItemSelectionModel *selectionModel)
 
   emit selectionModelChanged(selectionModel);
 }
-
-// TreeView
-TreeView::TreeView(QWidget *parent)
-  : QTreeView(parent)
-{
-}
-
-void TreeView::setModel(QAbstractItemModel *model)
-{
-  if (this->model() == model)
-    return;
-
-  QTreeView::setModel(model);
-
-  emit modelChanged(model);
-  emit selectionModelChanged(selectionModel());
-}
-
-void TreeView::setSelectionModel(QItemSelectionModel *selectionModel)
-{
-  if (this->selectionModel() == selectionModel)
-    return;
-
-  QTreeView::setSelectionModel(selectionModel);
-
-  emit selectionModelChanged(selectionModel);
-}
index 9d64af1..d2d809a 100644 (file)
@@ -28,7 +28,6 @@
 #include <QMenu>
 #include <QPointer>
 #include <QTableView>
-#include <QTreeView>
 
 class ColumnView : public QColumnView
 {
@@ -172,22 +171,4 @@ class TableView : public QTableView
     void selectionModelChanged(QItemSelectionModel*);
 };
 
-class TreeView : public QTreeView
-{
-  Q_OBJECT
-
-  Q_PROPERTY(QAbstractItemModel* model READ model WRITE setModel NOTIFY modelChanged)
-  Q_PROPERTY(QItemSelectionModel* selectionModel READ selectionModel WRITE setSelectionModel NOTIFY selectionModelChanged)
-
-  public:
-    explicit TreeView(QWidget *parent = 0);
-
-    void setModel(QAbstractItemModel *model);
-    void setSelectionModel(QItemSelectionModel *selectionModel);
-
-  Q_SIGNALS:
-    void modelChanged(QAbstractItemModel*);
-    void selectionModelChanged(QItemSelectionModel*);
-};
-
 #endif