itom
Loading...
Searching...
No Matches
ito::BookmarkModel Class Reference

model for management of all bookmarks. This model will be displayed by a viewer-widget in the main window More...

Inheritance diagram for ito::BookmarkModel:

Public Types

enum  BookmarkRole { RoleFilename = Qt::UserRole + 1 , RoleLineIdx = Qt::UserRole + 2 , RoleEnabled = Qt::UserRole + 3 }
 

Public Slots

void clearAllBookmarks ()
 
void gotoNextBookmark ()
 
void gotoPreviousBookmark ()
 

Signals

void bookmarkAdded (const BookmarkItem &item)
 
void bookmarkDeleted (const BookmarkItem &item)
 
void gotoBookmark (const BookmarkItem &item)
 

Public Member Functions

 BookmarkModel ()
 constructor
 
 ~BookmarkModel ()
 destructor
 
RetVal saveState ()
 Saves the breakpoint model into the settings.
 
RetVal restoreState ()
 Restores the breakpoint model from the settings.
 
QVariant data (const QModelIndex &index, int role) const
 overwritten data method of QAbstractItemModel
 
QModelIndex index (int row, int column, const QModelIndex &parent=QModelIndex()) const
 returns QModelIndex for given row and column
 
QModelIndex parent (const QModelIndex &index) const
 returns parent of given QModelIndex
 
int rowCount (const QModelIndex &parent=QModelIndex()) const
 counts number of bookmarks in this model
 
int columnCount (const QModelIndex &parent=QModelIndex()) const
 counts number of columns in this model (corresponds to number of header-elements)
 
QVariant headerData (int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const
 returns header element at given position
 
RetVal addBookmark (const BookmarkItem &item)
 adds given bookmark to model
 
RetVal deleteBookmark (const BookmarkItem &item)
 delete a given bookmark
 
RetVal deleteBookmarks (const QList< BookmarkItem > &items)
 delete the given bookmarks
 
RetVal deleteAllBookmarks ()
 delete all bookmarks
 
RetVal changeBookmark (const BookmarkItem &item, const QString &newFilename, int newLineNo)
 
QList< BookmarkItemgetBookmarks (const QString &filenameFilter=QString()) const
 
QAction * bookmarkNextAction () const
 
QAction * bookmarkPreviousAction () const
 
QAction * bookmarkClearAllAction () const
 
bool bookmarkExists (const BookmarkItem &item) const
 
bool bookmarkExists (const QString &filename, int lineno) const
 
void gotoBookmark (const QModelIndex &index)
 

Protected Member Functions

const BookmarkItemitemFromModelIndex (const QModelIndex &index) const
 returns BookmarkItem for given QModelIndex
 
QModelIndex modelIndexFromItem (const BookmarkItem &item) const
 
void updateActions ()
 

Private Attributes

QList< BookmarkItemm_bookmarks
 
QList< QString > m_headers
 
QList< QVariant > m_alignment
 
Qt::CaseSensitivity m_filenameCaseSensitivity
 
int m_currentIndex
 
QAction * m_pBookmarkNext
 
QAction * m_pBookmarkPrevious
 
QAction * m_pBookmarkClearAll
 
BookmarkItem m_invalidBookmarkItem
 

Detailed Description

model for management of all bookmarks. This model will be displayed by a viewer-widget in the main window

Constructor & Destructor Documentation

◆ BookmarkModel()

ito::BookmarkModel::BookmarkModel ( )

constructor

initializes headers and its alignment

Member Function Documentation

◆ addBookmark()

RetVal ito::BookmarkModel::addBookmark ( const BookmarkItem & item)

adds given bookmark to model

if added, the signal bookmarkAdded is emitted.

Parameters
[in]BookmarkItemto be appended
Returns
retOk if this item could be appended, retError if it already exists.

◆ bookmarkAdded

void ito::BookmarkModel::bookmarkAdded ( const BookmarkItem & item)
signal

emitted if bookmark has been added to model at position row

◆ bookmarkDeleted

void ito::BookmarkModel::bookmarkDeleted ( const BookmarkItem & item)
signal

emitted if bookmark has been deleted

◆ columnCount()

int ito::BookmarkModel::columnCount ( const QModelIndex & parent = QModelIndex()) const

counts number of columns in this model (corresponds to number of header-elements)

Returns
number of columns

◆ data()

QVariant ito::BookmarkModel::data ( const QModelIndex & index,
int role ) const

overwritten data method of QAbstractItemModel

data method will be called by View-Widget in order to fill the table.

Parameters
indexQModelIndex of item, whose content should be returned
Returns
content of desired item and column

◆ deleteAllBookmarks()

RetVal ito::BookmarkModel::deleteAllBookmarks ( )

delete all bookmarks

Parameters
indizeslist of QModelIndex
Returns
retOk
See also
deleteBookmark

◆ deleteBookmark()

RetVal ito::BookmarkModel::deleteBookmark ( const BookmarkItem & item)

delete a given bookmark

emits bookmarkDeleted if deletion has been successful.

Parameters
indexQModelIndex of bookmark which should be deleted
Returns
retOk in case of success, if QModelIndex not valid retError

◆ deleteBookmarks()

RetVal ito::BookmarkModel::deleteBookmarks ( const QList< BookmarkItem > & items)

delete the given bookmarks

emits bookmarkDeleted if deletion has been successful.

Parameters
indexQModelIndex of bookmark which should be deleted
Returns
retOk in case of success, if QModelIndex not valid retError

◆ gotoBookmark

void ito::BookmarkModel::gotoBookmark ( const BookmarkItem & item)
signal

emitted if the cursor should jump to a certain bookmark

◆ headerData()

QVariant ito::BookmarkModel::headerData ( int section,
Qt::Orientation orientation,
int role = Qt::DisplayRole ) const

returns header element at given position

Parameters
sectionposition in m_headers list
orientationthe model's orientation should be horizontal, no other orientation is supported
rolemodel is only prepared for DisplayRole
Returns
name of header or empty QVariant value (if no header element available)

◆ index()

QModelIndex ito::BookmarkModel::index ( int row,
int column,
const QModelIndex & parent = QModelIndex() ) const

returns QModelIndex for given row and column

Parameters
rowrow of desired entry, corresponds to index in m_bookmarks list
columncolumn of desired entry
parentsince this model is no tree model, parent always points to a "virtual" root element
Returns
empty QModelIndex if row or column are out of bound, else returns new valid QModelIndex for that combination of row and column

◆ itemFromModelIndex()

const BookmarkItem & ito::BookmarkModel::itemFromModelIndex ( const QModelIndex & index) const
protected

returns BookmarkItem for given QModelIndex

Parameters
indexgiven QModelIndex
Returns
BookmarkItem to the QModelIndex that was given

◆ parent()

QModelIndex ito::BookmarkModel::parent ( const QModelIndex & index) const

returns parent of given QModelIndex

since this model is not a tree model, returns always an empty QModelIndex

◆ rowCount()

int ito::BookmarkModel::rowCount ( const QModelIndex & parent = QModelIndex()) const

counts number of bookmarks in this model

Returns
number of elements

Member Data Documentation

◆ m_alignment

QList<QVariant> ito::BookmarkModel::m_alignment
private

list of alignments for the corresponding headers

◆ m_bookmarks

QList<BookmarkItem> ito::BookmarkModel::m_bookmarks
private

list of bookmarks (BookmarkItem) which are currently available in this application

◆ m_headers

QList<QString> ito::BookmarkModel::m_headers
private

string list of names of column headers


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