VPTissue Reference Manual
SimShell::Gui::WorkspaceQtModel Class Reference

Abstraction of workspace on the filesystem. More...

#include <WorkspaceQtModel.h>

Inheritance diagram for SimShell::Gui::WorkspaceQtModel:
Inheritance graph
Collaboration diagram for SimShell::Gui::WorkspaceQtModel:
Collaboration graph

Public Types

enum  ItemType { RootType, ProjectType, FileType }
 

Public Member Functions

bool Close ()
 Close a project if opened. More...
 
bool Close (const QModelIndex &index)
 Close project with given index. More...
 
virtual int columnCount (QModelIndex const &parent=QModelIndex()) const
 
virtual QVariant data (QModelIndex const &index, int role=Qt::DisplayRole) const
 
virtual Qt::ItemFlags flags (QModelIndex const &index) const
 
std::vector< QAction * > GetContextMenuActions (const QModelIndex &index) const
 Get additional context menu actions specific to the selected index. More...
 
const std::string & GetName (QModelIndex const &index) const
 Get name of given index. More...
 
ItemType GetType (QModelIndex const &index) const
 Get type of given index. More...
 
virtual QVariant headerData (int section, Qt::Orientation, int role) const
 
virtual QModelIndex index (int row, int column, QModelIndex const &parent=QModelIndex()) const
 
virtual bool insertRow (int row, QModelIndex const &parent=QModelIndex())
 
virtual bool insertRows (int row, int count, QModelIndex const &parent=QModelIndex())
 
bool IsOpened (const QModelIndex &index) const
 
bool Open (const QModelIndex &index)
 
virtual QModelIndex parent (QModelIndex const &index) const
 
virtual bool removeRow (int row, QModelIndex const &parent=QModelIndex())
 
virtual bool removeRows (int row, int count, QModelIndex const &parent=QModelIndex())
 
virtual int rowCount (QModelIndex const &parent=QModelIndex()) const
 
std::shared_ptr< IWorkspaceWorkspace ()
 

Static Public Member Functions

static std::shared_ptr< WorkspaceQtModelCreate (const std::shared_ptr< IWorkspace > &, Controller::ProjectController *c, QObject *parent=0)
 

Detailed Description

Abstraction of workspace on the filesystem.

Intended to be used with WorkspaceView widget. Once initiated, will 'watch' filesystem for changes. Uses Workspace template classes internally.

See also
WorkspaceView

Definition at line 49 of file WorkspaceQtModel.h.

Member Function Documentation

bool SimShell::Gui::WorkspaceQtModel::Close ( )

Close a project if opened.

Returns
true if we are in closed state.

Definition at line 95 of file WorkspaceQtModel.cpp.

bool SimShell::Gui::WorkspaceQtModel::Close ( const QModelIndex &  index)

Close project with given index.

Parameters
indexIndex of project to close.
Returns
true if we are in closed state.

Definition at line 100 of file WorkspaceQtModel.cpp.

vector< QAction * > SimShell::Gui::WorkspaceQtModel::GetContextMenuActions ( const QModelIndex &  index) const

Get additional context menu actions specific to the selected index.

Index must be valid and pointing to a project or file or an error will be thrown.

Parameters
indexVALID index of which to get context menu actions.
Returns
List of QActions specific to selected index.
Exceptions
Exceptionif index is invalid. See QModelIndex::isValid().

Definition at line 244 of file WorkspaceQtModel.cpp.

string const & SimShell::Gui::WorkspaceQtModel::GetName ( QModelIndex const &  index) const

Get name of given index.

Index must be valid and pointing to a project or file or an error will be thrown. Root is never visible and should not be tested for by external users of this class.

Parameters
indexVALID index of which we want to know the type.
Returns
Name of project or file index pointing to.
Exceptions
Exceptionif index is invalid. See QModelIndex::isValid().

Definition at line 261 of file WorkspaceQtModel.cpp.

WorkspaceQtModel::ItemType SimShell::Gui::WorkspaceQtModel::GetType ( QModelIndex const &  index) const

Get type of given index.

Index must be valid or an error will be thrown. An item of this model can be of three types: Root, Project and Leaf. Root is never visible and should not be tested for by external users of this class.

Parameters
indexVALID index of which we want to know the type.
Returns
Type of given index.
Exceptions
Exceptionif index is invalid. See QModelIndex::isValid().

Definition at line 278 of file WorkspaceQtModel.cpp.


The documentation for this class was generated from the following files: