diff options
author | Ben Boeckel <MathStuf@gmail.com> | 2009-03-26 05:57:16 -0400 |
---|---|---|
committer | Ben Boeckel <MathStuf@gmail.com> | 2009-03-26 05:57:16 -0400 |
commit | 5922861e94e44eb311d17b4d0c017036230fd1db (patch) | |
tree | 7cf161277e6dee06347c8d765bed07caf7ea5ba8 /sigtools | |
parent | 92530cb716baf7d978832f47321eb8f74a79da58 (diff) | |
download | sigen-5922861e94e44eb311d17b4d0c017036230fd1db.tar.gz sigen-5922861e94e44eb311d17b4d0c017036230fd1db.tar.xz sigen-5922861e94e44eb311d17b4d0c017036230fd1db.zip |
Split Model ctor
Diffstat (limited to 'sigtools')
-rw-r--r-- | sigtools/PluginTree.cpp | 4 | ||||
-rw-r--r-- | sigtools/PluginTreeModel.cpp | 6 | ||||
-rw-r--r-- | sigtools/PluginTreeModel.h | 4 |
3 files changed, 11 insertions, 3 deletions
diff --git a/sigtools/PluginTree.cpp b/sigtools/PluginTree.cpp index 3ac0365d..ecdb788c 100644 --- a/sigtools/PluginTree.cpp +++ b/sigtools/PluginTree.cpp @@ -58,7 +58,7 @@ PluginTree::Private::Private(const QStringList& types, PluginTree* tree) : m_filter(new KLineEdit(tree)), m_view(new KCategorizedView(tree)), m_drawer(new KCategoryDrawer), - m_model(new PluginTreeModel(types, tree)), + m_model(new PluginTreeModel(tree)), m_proxy(new PluginTreeProxyModel(m_filter, m_model)) { m_filter->setClearButtonShown(true); @@ -73,6 +73,8 @@ PluginTree::Private::Private(const QStringList& types, PluginTree* tree) : m_view->setMouseTracking(true); m_view->viewport()->setAttribute(Qt::WA_Hover); + m_model->setTypes(types); + m_filter->connect(m_filter, SIGNAL(textChanged(QString)), m_proxy, SLOT(invalidate())); } diff --git a/sigtools/PluginTreeModel.cpp b/sigtools/PluginTreeModel.cpp index 6a291b45..d0529c66 100644 --- a/sigtools/PluginTreeModel.cpp +++ b/sigtools/PluginTreeModel.cpp @@ -35,9 +35,13 @@ using namespace Sigencore::Interfaces; using namespace Sigtools; -PluginTreeModel::PluginTreeModel(const QStringList& types, PluginTree* tree) : +PluginTreeModel::PluginTreeModel(PluginTree* tree) : QAbstractListModel(tree) { +} + +void PluginTreeModel::setTypes(const QStringList& types) +{ foreach (const QString& type, types) { const QStringList names = PluginLoader::availablePlugins(type); diff --git a/sigtools/PluginTreeModel.h b/sigtools/PluginTreeModel.h index 04c896ec..5d5b5f96 100644 --- a/sigtools/PluginTreeModel.h +++ b/sigtools/PluginTreeModel.h @@ -42,7 +42,9 @@ class SIGTOOLS_NO_EXPORT PluginTreeModel : public QAbstractListModel QIcon m_icon; }; - PluginTreeModel(const QStringList& types, PluginTree* tree); + PluginTreeModel(PluginTree* tree); + + void setTypes(const QStringList& types); QModelIndex index(const int row, const int column = 0, const QModelIndex& parent = QModelIndex()) const; |