QGIS/src/app/qgsrecentprojectsitemsmodel.h

60 lines
2.2 KiB
C
Raw Normal View History

/***************************************************************************
----------------------------------------------------
date : 17.8.2015
copyright : (C) 2015 by Matthias Kuhn
email : matthias (at) opengis.ch
***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef QGSWELCOMEPAGEITEMSMODEL_H
#define QGSWELCOMEPAGEITEMSMODEL_H
#include <QAbstractListModel>
#include <QStringList>
#include <QStyledItemDelegate>
2019-05-22 10:36:12 +02:00
class QgsMapCanvas;
class QgsRecentProjectItemsModel : public QAbstractListModel
{
Q_OBJECT
public:
2015-08-18 23:25:20 +02:00
struct RecentProjectData
{
2017-03-03 08:42:00 +01:00
bool operator==( const RecentProjectData &other ) const { return other.path == this->path; }
2015-08-18 23:25:20 +02:00
QString path;
QString title;
QString previewImagePath;
QString crs;
mutable bool pin = false;
mutable bool checkedExists = false;
mutable bool exists = false;
};
explicit QgsRecentProjectItemsModel( QObject *parent = nullptr );
2017-03-03 08:42:00 +01:00
void setRecentProjects( const QList<RecentProjectData> &recentProjects );
2019-05-22 11:51:49 +02:00
int rowCount( const QModelIndex &parent = QModelIndex() ) const override;
2017-03-03 08:42:00 +01:00
QVariant data( const QModelIndex &index, int role ) const override;
Qt::ItemFlags flags( const QModelIndex &index ) const override;
void pinProject( const QModelIndex &index );
void unpinProject( const QModelIndex &index );
void removeProject( const QModelIndex &index );
void recheckProject( const QModelIndex &index );
private:
QList<RecentProjectData> mRecentProjects;
};
#endif // QGSRECENTPROJECTITEMSMODEL_H