summaryrefslogtreecommitdiffstats
path: root/utils/themeeditor/projectmodel.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'utils/themeeditor/projectmodel.cpp')
-rw-r--r--utils/themeeditor/projectmodel.cpp22
1 files changed, 18 insertions, 4 deletions
diff --git a/utils/themeeditor/projectmodel.cpp b/utils/themeeditor/projectmodel.cpp
index 8a26aa3263..aeca1c76a7 100644
--- a/utils/themeeditor/projectmodel.cpp
+++ b/utils/themeeditor/projectmodel.cpp
@@ -21,11 +21,12 @@
#include "projectmodel.h"
+#include "projectfiles.h"
-ProjectModel::ProjectModel(QObject *parent) :
+ProjectModel::ProjectModel(QString config, QObject *parent) :
QAbstractItemModel(parent)
{
-
+ root = new ProjectRoot(config);
}
ProjectModel::~ProjectModel()
@@ -59,7 +60,7 @@ QModelIndex ProjectModel::parent(const QModelIndex &child) const
ProjectNode* foundParent = static_cast<ProjectNode*>
(child.internalPointer())->parent();
- if(foundParent == root)
+ if(foundParent == 0)
return QModelIndex();
return createIndex(foundParent->row(), 0, foundParent);
@@ -104,7 +105,8 @@ QVariant ProjectModel::headerData(int col, Qt::Orientation orientation,
Qt::ItemFlags ProjectModel::flags(const QModelIndex &index) const
{
- return Qt::ItemIsEnabled | Qt::ItemIsSelectable;
+ return static_cast<ProjectNode*>
+ (index.internalPointer())->flags(index.column());
}
bool ProjectModel::setData(const QModelIndex &index, const QVariant &value,
@@ -112,3 +114,15 @@ bool ProjectModel::setData(const QModelIndex &index, const QVariant &value,
{
return true;
}
+
+/* Constructor and destructor for the root class */
+ProjectRoot::ProjectRoot(QString config)
+{
+ children.append(new ProjectFiles(this));
+}
+
+ProjectRoot::~ProjectRoot()
+{
+ for(int i = 0; i < children.count(); i++)
+ delete children[i];
+}