From: Kevin Krammer Date: Thu, 17 Jan 2013 10:43:56 +0000 (+0100) Subject: Ported tree view X-Git-Url: http://git.silmor.de/gitweb/?a=commitdiff_plain;h=1839c529093d7826e2e4f53b37978a3ef2234514;p=web%2Fkonrad%2FDeclarativeWidgets.git Ported tree view --- diff --git a/lib/declarativetreeview.cpp b/lib/declarativetreeview.cpp deleted file mode 100644 index f651b4b..0000000 --- a/lib/declarativetreeview.cpp +++ /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(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 index f238206..0000000 --- a/lib/declarativetreeview_p.h +++ /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 -{ - DECLARATIVE_OBJECT - - public: - explicit DeclarativeTreeView(QObject *parent = 0); -}; - -#endif diff --git a/lib/declarativewidgetsdocument.cpp b/lib/declarativewidgetsdocument.cpp index c2957ec..a3ef326 100644 --- a/lib/declarativewidgetsdocument.cpp +++ b/lib/declarativewidgetsdocument.cpp @@ -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 #include #include +#include #include class DeclarativeWidgetsDocument::Private @@ -134,7 +134,6 @@ DeclarativeWidgetsDocument::DeclarativeWidgetsDocument(const QUrl &url, QObject qmlRegisterType(); qmlRegisterType("QtGui", 1, 0, "TextBrowser"); qmlRegisterType("QtGui", 1, 0, "TimeEdit"); - qmlRegisterType("QtGui", 1, 0, "TreeView"); */ // objects @@ -178,6 +177,7 @@ DeclarativeWidgetsDocument::DeclarativeWidgetsDocument(const QUrl &url, QObject qmlRegisterExtendedType("QtGui", 1, 0, "TextEdit"); qmlRegisterExtendedType("QtGui", 1, 0, "ToolBar"); qmlRegisterExtendedType("QtGui", 1, 0, "ToolButton"); + qmlRegisterExtendedType("QtGui", 1, 0, "TreeView"); qmlRegisterExtendedType("QtGui", 1, 0, "WebView"); qmlRegisterExtendedType("QtGui", 1, 0, "Widget"); diff --git a/lib/lib.pro b/lib/lib.pro index 77d30d2..fde0acf 100644 --- a/lib/lib.pro +++ b/lib/lib.pro @@ -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 \ diff --git a/lib/objectadaptors.cpp b/lib/objectadaptors.cpp index ef4b483..88705a8 100644 --- a/lib/objectadaptors.cpp +++ b/lib/objectadaptors.cpp @@ -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); -} diff --git a/lib/objectadaptors_p.h b/lib/objectadaptors_p.h index 9d64af1..d2d809a 100644 --- a/lib/objectadaptors_p.h +++ b/lib/objectadaptors_p.h @@ -28,7 +28,6 @@ #include #include #include -#include 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