File: model.h

package info (click to toggle)
libqxt 0.6.1-6
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 19,004 kB
  • sloc: cpp: 57,512; xml: 296; sh: 251; makefile: 56; php: 14
file content (36 lines) | stat: -rw-r--r-- 1,219 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#ifndef MODEL_H_INCLUDED
#define MODEL_H_INCLUDED

#include <QAbstractItemModel>
#include <QxtBdbTree>
#include <QxtLinkedTree>
#include "node.h"
#include <QStringList>

struct XmlDbModelCacheItem
{
    QxtBdbTreeIterator<XmlNode> node;
    int children;
};


class XmlDbModel : public QAbstractItemModel, public QxtBdbTree<XmlNode>
{
public:
    XmlDbModel(QString db);
    XmlDbModel();
    bool open  (QString file);
    void loadXml (QStringList  files);
    virtual int columnCount ( const QModelIndex & parent = QModelIndex() ) const;
    virtual QVariant data ( const QModelIndex & index, int role = Qt::DisplayRole ) const;
    virtual QVariant headerData ( int section, Qt::Orientation orientation, int role = Qt::DisplayRole ) const;
    virtual QModelIndex parent ( const QModelIndex & index ) const;
    virtual QModelIndex index ( int row, int column, const QModelIndex & parent = QModelIndex() ) const;
    virtual int rowCount ( const QModelIndex & parent = QModelIndex() ) const;
    virtual bool canFetchMore ( const QModelIndex & parent ) const;
    virtual void fetchMore ( const QModelIndex & parent );
private:
    mutable QxtLinkedTree <XmlDbModelCacheItem> cache ;
};

#endif // MODEL_H_INCLUDED