~ubuntu-branches/ubuntu/vivid/psi/vivid

« back to all changes in this revision

Viewing changes to src/tools/optionstree/optionstreemodel.h

  • Committer: Bazaar Package Importer
  • Author(s): Jan Niehusmann
  • Date: 2008-08-28 18:46:52 UTC
  • mfrom: (1.2.4 upstream)
  • Revision ID: james.westby@ubuntu.com-20080828184652-iiik12dl91nq7cdi
Tags: 0.12-2
Uploading to unstable (Closes: Bug#494352)

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
 
24
24
#include <QAbstractItemModel>
25
25
#include <QVariant>
 
26
#include <QHash>
 
27
#include <QStack>
26
28
 
27
29
class OptionsTree;
28
30
 
37
39
        int rowCount(const QModelIndex& parent = QModelIndex()) const;
38
40
        int columnCount (const QModelIndex& parent = QModelIndex()) const;
39
41
        QVariant data(const QModelIndex& index, int role) const;
 
42
        bool setData ( const QModelIndex & index, const QVariant & value, int role = Qt::EditRole );
40
43
        QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
41
44
        QModelIndex index(int row, int column, const QModelIndex & parent = QModelIndex() ) const;
42
45
        QModelIndex parent(const QModelIndex& index) const;
43
46
        Qt::ItemFlags flags(const QModelIndex& index) const;
44
47
 
 
48
        // custom accessors
 
49
        QString indexToOptionName(QModelIndex idx) const;
 
50
 
45
51
public slots:
46
52
        void setFlat(bool);
47
53
 
48
54
protected:
49
 
        enum Section { Name = 0, Type = 1, Value = 2, Comment = 3};
 
55
        enum Section { Name = 0, Type = 1, Value = 2, Comment = 3, SectionBound=4};
 
56
        QString getParentName(const QString &option) const;
 
57
        QModelIndex index(const QString &option, Section sec=Name) const;
 
58
        int nameToIndex(QString name) const;
 
59
        bool internalNode(QString name) const;
 
60
 
 
61
        
 
62
protected slots:
 
63
        void optionChanged(const QString& option);
 
64
        void optionAboutToBeInserted(const QString& option);
 
65
        void optionInserted(const QString& option);     
 
66
        void optionAboutToBeRemoved(const QString& option);
 
67
        void optionRemoved(const QString& option);      
 
68
        
50
69
 
51
70
private:
52
71
        OptionsTree* tree_;
53
72
        bool flat_;
 
73
        mutable QHash<int, QString> indexMap;
 
74
        mutable QHash<QString, int> nameMap;
 
75
        mutable int nextIdx;
 
76
        QStack<bool> realRemove;
54
77
};
55
78
 
56
79
#endif