X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=blobdiff_plain;f=src%2Fclient%2Ftreemodel.h;h=7e097ecae144c804d242fe97188d8861724ebfb2;hp=df34fb06e0c328f0489f944fd1bbf1883444b8fa;hb=39328183a6a87c6eb10a9dbbffcd5d65bf154a1f;hpb=1cb02004ee5973b89368bd84f234d4652794690d diff --git a/src/client/treemodel.h b/src/client/treemodel.h index df34fb06..7e097eca 100644 --- a/src/client/treemodel.h +++ b/src/client/treemodel.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2005-2015 by the Quassel Project * + * Copyright (C) 2005-2018 by the Quassel Project * * devel@quassel-irc.org * * * * This program is free software; you can redistribute it and/or modify * @@ -18,8 +18,9 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ -#ifndef TREEMODEL_H -#define TREEMODEL_H +#pragma once + +#include "client-export.h" #include #include @@ -31,7 +32,7 @@ /***************************************** * general item used in the Tree Model *****************************************/ -class AbstractTreeItem : public QObject +class CLIENT_EXPORT AbstractTreeItem : public QObject { Q_OBJECT @@ -42,7 +43,7 @@ public: }; Q_DECLARE_FLAGS(TreeItemFlags, TreeItemFlag) - AbstractTreeItem(AbstractTreeItem *parent = 0); + AbstractTreeItem(AbstractTreeItem *parent = nullptr); bool newChild(AbstractTreeItem *child); bool newChilds(const QList &items); @@ -100,12 +101,12 @@ private: /***************************************** * SimpleTreeItem *****************************************/ -class SimpleTreeItem : public AbstractTreeItem +class CLIENT_EXPORT SimpleTreeItem : public AbstractTreeItem { Q_OBJECT public: - SimpleTreeItem(const QList &data, AbstractTreeItem *parent = 0); + SimpleTreeItem(const QList &data, AbstractTreeItem *parent = nullptr); virtual ~SimpleTreeItem(); virtual QVariant data(int column, int role) const; @@ -121,33 +122,27 @@ private: /***************************************** * PropertyMapItem *****************************************/ -class PropertyMapItem : public AbstractTreeItem +class CLIENT_EXPORT PropertyMapItem : public AbstractTreeItem { Q_OBJECT public: - PropertyMapItem(const QStringList &propertyOrder, AbstractTreeItem *parent = 0); - PropertyMapItem(AbstractTreeItem *parent = 0); + PropertyMapItem(AbstractTreeItem *parent = nullptr); - virtual ~PropertyMapItem(); + virtual QStringList propertyOrder() const = 0; virtual QVariant data(int column, int role) const; virtual bool setData(int column, const QVariant &value, int role); virtual QString toolTip(int column) const { Q_UNUSED(column) return QString(); } virtual int columnCount() const; - - void appendProperty(const QString &property); - -private: - QStringList _propertyOrder; }; /***************************************** * TreeModel *****************************************/ -class TreeModel : public QAbstractItemModel +class CLIENT_EXPORT TreeModel : public QAbstractItemModel { Q_OBJECT @@ -157,9 +152,11 @@ public: UserRole }; - TreeModel(const QList &, QObject *parent = 0); + TreeModel(const QList &, QObject *parent = nullptr); virtual ~TreeModel(); + AbstractTreeItem *root() const; + virtual QVariant data(const QModelIndex &index, int role) const; virtual bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole); @@ -208,6 +205,3 @@ private slots: void debug_rowsRemoved(const QModelIndex &parent, int start, int end); void debug_dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight); }; - - -#endif