QGIS API Documentation
3.99.0-Master (2fe06baccd8)
Loading...
Searching...
No Matches
src
core
network
qgsnewsfeedmodel.h
Go to the documentation of this file.
1
/***************************************************************************
2
qgsnewsfeedmodel.h
3
------------------
4
begin : July 2019
5
copyright : (C) 2019 by Nyall Dawson
6
email : nyall dot dawson at gmail dot com
7
***************************************************************************
8
* *
9
* This program is free software; you can redistribute it and/or modify *
10
* it under the terms of the GNU General Public License as published by *
11
* the Free Software Foundation; either version 2 of the License, or *
12
* (at your option) any later version. *
13
* *
14
***************************************************************************/
15
#ifndef QGSNEWSFEEDMODEL_H
16
#define QGSNEWSFEEDMODEL_H
17
18
#include "qgis_core.h"
19
#include "
qgis_sip.h
"
20
#include "
qgsnewsfeedparser.h
"
21
22
#include <QAbstractItemModel>
23
#include <QSortFilterProxyModel>
24
34
class
CORE_EXPORT
QgsNewsFeedModel
:
public
QAbstractItemModel
35
{
36
Q_OBJECT
37
public
:
38
39
// *INDENT-OFF*
40
47
enum class
CustomRole
SIP_MONKEYPATCH_SCOPEENUM_UNNEST
(
QgsNewsFeedModel
, Role ) : int
48
{
49
Key = Qt::UserRole + 1,
50
Title,
51
Content,
52
ImageUrl,
53
Image,
54
Link,
55
Sticky,
56
};
57
Q_ENUM( CustomRole )
58
// *INDENT-ON*
59
60
66
QgsNewsFeedModel
(
QgsNewsFeedParser
*parser, QObject *parent
SIP_TRANSFERTHIS
=
nullptr
);
67
68
QVariant data(
const
QModelIndex &index,
int
role )
const override
;
69
Qt::ItemFlags flags(
const
QModelIndex &index )
const override
;
70
QModelIndex index(
int
row,
int
column,
const
QModelIndex &parent = QModelIndex() )
const override
;
71
QModelIndex parent(
const
QModelIndex &index )
const override
;
72
int
rowCount(
const
QModelIndex &parent = QModelIndex() )
const override
;
73
int
columnCount(
const
QModelIndex &parent = QModelIndex() )
const override
;
74
75
private
slots:
76
77
void
onEntryAdded(
const
QgsNewsFeedParser::Entry
&entry );
78
void
onEntryRemoved(
const
QgsNewsFeedParser::Entry
&entry );
79
void
onEntryUpdated(
const
QgsNewsFeedParser::Entry
&entry );
80
void
onImageFetched(
int
key,
const
QPixmap &pixmap );
81
82
private
:
83
84
QgsNewsFeedParser
*mParser =
nullptr
;
85
QList< QgsNewsFeedParser::Entry > mEntries;
86
};
87
96
class
CORE_EXPORT
QgsNewsFeedProxyModel
:
public
QSortFilterProxyModel
97
{
98
Q_OBJECT
99
public
:
100
107
explicit
QgsNewsFeedProxyModel
(
QgsNewsFeedParser
*parser, QObject *parent
SIP_TRANSFERTHIS
=
nullptr
);
108
109
protected
:
110
bool
lessThan
(
const
QModelIndex &left,
const
QModelIndex &right )
const override
;
111
112
private
:
113
114
QgsNewsFeedModel
*mModel =
nullptr
;
115
116
};
117
118
#endif
// QGSNEWSFEEDMODEL_H
QgsNewsFeedModel
A model for published QGIS news feeds.
Definition
qgsnewsfeedmodel.h:35
QgsNewsFeedModel::CustomRole
CustomRole
Custom model roles.
Definition
qgsnewsfeedmodel.h:48
QgsNewsFeedModel::QgsNewsFeedModel
QgsNewsFeedModel(QgsNewsFeedParser *parser, QObject *parent=nullptr)
Constructor for QgsNewsFeedModel, with the specified parent object.
Definition
qgsnewsfeedmodel.cpp:27
QgsNewsFeedParser::Entry
Represents a single entry from a news feed.
Definition
qgsnewsfeedparser.h:70
QgsNewsFeedParser
Parser for published QGIS news feeds.
Definition
qgsnewsfeedparser.h:44
QgsNewsFeedProxyModel::lessThan
bool lessThan(const QModelIndex &left, const QModelIndex &right) const override
Definition
qgsnewsfeedmodel.cpp:187
QgsNewsFeedProxyModel::QgsNewsFeedProxyModel
QgsNewsFeedProxyModel(QgsNewsFeedParser *parser, QObject *parent=nullptr)
Constructor for QgsNewsFeedProxyModel, with the specified parent object.
Definition
qgsnewsfeedmodel.cpp:177
qgis_sip.h
SIP_TRANSFERTHIS
#define SIP_TRANSFERTHIS
Definition
qgis_sip.h:53
SIP_MONKEYPATCH_SCOPEENUM_UNNEST
#define SIP_MONKEYPATCH_SCOPEENUM_UNNEST(OUTSIDE_CLASS, FORMERNAME)
Definition
qgis_sip.h:268
qgsnewsfeedparser.h
Generated on
for QGIS API Documentation by
1.15.0