QGIS API Documentation
3.40.0-Bratislava (b56115d8743)
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
#include <QAbstractItemModel>
22
#include <QSortFilterProxyModel>
23
33
class
CORE_EXPORT
QgsNewsFeedModel
:
public
QAbstractItemModel
34
{
35
Q_OBJECT
36
public
:
37
38
// *INDENT-OFF*
39
46
enum class
CustomRole
SIP_MONKEYPATCH_SCOPEENUM_UNNEST
(
QgsNewsFeedModel
, Role ) : int
47
{
48
Key = Qt::UserRole + 1,
49
Title,
50
Content,
51
ImageUrl,
52
Image,
53
Link,
54
Sticky,
55
};
56
Q_ENUM( CustomRole )
57
// *INDENT-ON*
58
59
65
QgsNewsFeedModel
(
QgsNewsFeedParser
*parser, QObject *parent
SIP_TRANSFERTHIS
=
nullptr
);
66
67
QVariant data(
const
QModelIndex &index,
int
role )
const override
;
68
Qt::ItemFlags flags(
const
QModelIndex &index )
const override
;
69
QModelIndex index(
int
row,
int
column,
const
QModelIndex &parent = QModelIndex() )
const override
;
70
QModelIndex parent(
const
QModelIndex &index )
const override
;
71
int
rowCount(
const
QModelIndex &parent = QModelIndex() )
const override
;
72
int
columnCount(
const
QModelIndex &parent = QModelIndex() )
const override
;
73
74
private
slots:
75
76
void
onEntryAdded(
const
QgsNewsFeedParser::Entry
&entry );
77
void
onEntryRemoved(
const
QgsNewsFeedParser::Entry
&entry );
78
void
onEntryUpdated(
const
QgsNewsFeedParser::Entry
&entry );
79
void
onImageFetched(
int
key,
const
QPixmap &pixmap );
80
81
private
:
82
83
QgsNewsFeedParser
*mParser =
nullptr
;
84
QList< QgsNewsFeedParser::Entry > mEntries;
85
};
86
95
class
CORE_EXPORT
QgsNewsFeedProxyModel
:
public
QSortFilterProxyModel
96
{
97
Q_OBJECT
98
public
:
99
106
explicit
QgsNewsFeedProxyModel
(
QgsNewsFeedParser
*parser, QObject *parent
SIP_TRANSFERTHIS
=
nullptr
);
107
108
protected
:
109
bool
lessThan(
const
QModelIndex &left,
const
QModelIndex &right )
const override
;
110
111
private
:
112
113
QgsNewsFeedModel
*mModel =
nullptr
;
114
115
};
116
117
#endif
// QGSNEWSFEEDMODEL_H
QgsNewsFeedModel
A model for published QGIS news feeds.
Definition
qgsnewsfeedmodel.h:34
QgsNewsFeedModel::CustomRole
CustomRole
Custom model roles.
Definition
qgsnewsfeedmodel.h:47
QgsNewsFeedParser::Entry
Represents a single entry from a news feed.
Definition
qgsnewsfeedparser.h:71
QgsNewsFeedParser
Parser for published QGIS news feeds.
Definition
qgsnewsfeedparser.h:45
QgsNewsFeedProxyModel
A proxy model for use with QgsNewsFeedModel.
Definition
qgsnewsfeedmodel.h:96
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:271
qgsnewsfeedparser.h
Generated on Mon Oct 28 2024 22:06:03 for QGIS API Documentation by
1.9.8