• Skip to content
  • Skip to link menu
KDE 4.2 API Reference
  • KDE API Reference
  • kdeedu
  • Sitemap
  • Contact Us
 

kalzium

directorytreemodel.h

Go to the documentation of this file.
00001 /**********************************************************************
00002   DirectoryTreeModel - model for multiple directories / files
00003 
00004   Copyright (C) 2008 Geoffrey R. Hutchison
00005 
00006   Inspired by example code from Qt/Examples by Trolltech.
00007 
00008   This file is part of the Avogadro molecular editor project.
00009   For more information, see <http://avogadro.sourceforge.net/>
00010 
00011   Avogadro is free software; you can redistribute it and/or modify
00012   it under the terms of the GNU General Public License as published by
00013   the Free Software Foundation; either version 2 of the License, or
00014   (at your option) any later version.
00015 
00016   Avogadro is distributed in the hope that it will be useful,
00017   but WITHOUT ANY WARRANTY; without even the implied warranty of
00018   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00019   GNU General Public License for more details.
00020 
00021   You should have received a copy of the GNU General Public License
00022   along with this program; if not, write to the Free Software
00023   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
00024   02110-1301, USA.
00025  **********************************************************************/
00026 
00027 #ifndef DIRECTORYTREEMODEL_H
00028 #define DIRECTORYTREEMODEL_H
00029 
00030 #include <QAbstractItemModel>
00031 #include <QModelIndex>
00032 #include <QVariant>
00033 #include <QStringList>
00034 
00035 namespace Avogadro {
00036 
00037   class FileTreeItem;
00038 
00039   class DirectoryTreeModel : public QAbstractItemModel
00040   {
00041     Q_OBJECT
00042 
00043       public:
00044     explicit DirectoryTreeModel(const QString &dirList, QObject *parent = 0);
00045     explicit DirectoryTreeModel(const QStringList &dirList, QObject *parent = 0);
00046     ~DirectoryTreeModel();
00047 
00048     QVariant data(const QModelIndex &index, int role) const;
00049     QString  filePath(const QModelIndex &index) const;
00050     Qt::ItemFlags flags(const QModelIndex &index) const;
00051     QVariant headerData(int section, Qt::Orientation orientation,
00052                         int role = Qt::DisplayRole) const;
00053     QModelIndex index(int row, int column,
00054                       const QModelIndex &parent = QModelIndex()) const;
00055     QModelIndex parent(const QModelIndex &index) const;
00056     int rowCount(const QModelIndex &parent = QModelIndex()) const;
00057     int columnCount(const QModelIndex &parent = QModelIndex()) const;
00058 
00059     const QStringList &directoryList() const;
00060     void setDirectoryList(const QStringList &dirList);
00061     void appendDirectory(const QString &path);
00062   
00063   private:
00064     void setupModelData(const QStringList &directories, FileTreeItem *parent);
00065 
00066     QStringList _directoryList;
00067     FileTreeItem *_rootItem;
00068   };
00069 
00070 } // end namespace
00071 
00072 #endif

kalzium

Skip menu "kalzium"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

kdeedu

Skip menu "kdeedu"
  • kalzium
  • kanagram
  • kig
  •   lib
  • klettres
  • kstars
  • libkdeedu
  •   keduvocdocument
  •   docs
  •   src
  • parley
  •   stepcore
Generated for kdeedu by doxygen 1.5.4
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal