-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathprojecttreemodel.h
41 lines (27 loc) · 976 Bytes
/
projecttreemodel.h
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
37
38
39
40
41
/*
Ted, a simple text editor/IDE.
Copyright 2012, Blitz Research Ltd.
See LICENSE.TXT for licensing terms.
*/
#ifndef FILETREE_H
#define FILETREE_H
#include "std.h"
class ProjectTreeModel : public QFileSystemModel{
Q_OBJECT
public:
ProjectTreeModel( QObject *parent=0 );
bool addProject( const QString &dir );
void removeProject( const QString &dir );
bool isProject( const QModelIndex &index );
QVector<QString> projects(){ return _dirs; }
QString currentProject(){ return _current!=-1 ? _dirs[_current] : ""; }
virtual bool hasChildren( const QModelIndex &parent=QModelIndex() )const;
virtual int rowCount( const QModelIndex &parent=QModelIndex() )const;
virtual QModelIndex index( int row, int column, const QModelIndex &parent=QModelIndex() )const;
QVariant data( const QModelIndex &index,int role )const;
private:
int _current;
QVector<QString> _dirs;
QVector<QPersistentModelIndex> _projs;
};
#endif