libosmscout
1.1.1
Toggle main menu visibility
Loading...
Searching...
No Matches
libosmscout-client-qt
include
osmscoutclientqt
StyleFlagsModel.h
Go to the documentation of this file.
1
#ifndef OSMSCOUT_CLIENT_QT_STYLEFLAGSMODEL_H
2
#define OSMSCOUT_CLIENT_QT_STYLEFLAGSMODEL_H
3
4
/*
5
OSMScout - a Qt backend for libosmscout and libosmscout-map
6
Copyright (C) 2017 Lukas Karas
7
8
This library is free software; you can redistribute it and/or
9
modify it under the terms of the GNU Lesser General Public
10
License as published by the Free Software Foundation; either
11
version 2.1 of the License, or (at your option) any later version.
12
13
This library is distributed in the hope that it will be useful,
14
but WITHOUT ANY WARRANTY; without even the implied warranty of
15
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16
Lesser General Public License for more details.
17
18
You should have received a copy of the GNU Lesser General Public
19
License along with this library; if not, write to the Free Software
20
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21
*/
22
23
#include <unordered_map>
24
25
#include <QObject>
26
#include <QAbstractListModel>
27
#include <QSet>
28
29
#include <
osmscoutclientqt/StyleModule.h
>
30
#include <
osmscoutclientqt/ClientQtImportExport.h
>
31
32
namespace
osmscout
{
33
37
class
OSMSCOUT_CLIENT_QT_API
StyleFlagsModel
:
public
QAbstractListModel
38
{
39
Q_OBJECT
40
41
private
:
42
StyleModule
*styleModule;
43
QMap<QString,bool> mapFlags;
44
QSet<QString> inProgressFlags;
45
46
signals:
47
void
styleFlagsRequested
();
48
void
setFlagRequest
(QString key,
bool
value);
49
50
private
slots:
51
void
onStyleFlagsChanged(QMap<QString,bool>);
52
void
onFlagSet(QString key,
bool
value);
53
54
public
:
55
enum
Roles
{
56
KeyRole
= Qt::UserRole,
57
ValueRole
= Qt::UserRole+1,
58
InProgressRole
= Qt::UserRole+2,
59
};
60
Q_ENUM(Roles)
61
62
StyleFlagsModel
();
63
~
StyleFlagsModel
() override;
64
65
Q_INVOKABLE
int
inline
rowCount
(const QModelIndex &parent = QModelIndex())
const override
66
{
67
Q_UNUSED(parent);
68
return
mapFlags.size();
69
};
70
71
Q_INVOKABLE QVariant
data
(
const
QModelIndex &index,
int
role)
const override
;
72
QHash<int, QByteArray>
roleNames
()
const override
;
73
Q_INVOKABLE Qt::ItemFlags
flags
(
const
QModelIndex &index)
const override
;
74
75
Q_INVOKABLE
void
setFlag
(
const
QString &key,
bool
value);
76
};
77
78
}
79
80
#endif
/* OSMSCOUT_CLIENT_QT_STYLEFLAGSMODEL_H */
ClientQtImportExport.h
OSMSCOUT_CLIENT_QT_API
#define OSMSCOUT_CLIENT_QT_API
Definition
ClientQtImportExport.h:45
StyleModule.h
osmscout::StyleFlagsModel::data
Q_INVOKABLE QVariant data(const QModelIndex &index, int role) const override
osmscout::StyleFlagsModel::roleNames
QHash< int, QByteArray > roleNames() const override
osmscout::StyleFlagsModel::setFlag
Q_INVOKABLE void setFlag(const QString &key, bool value)
osmscout::StyleFlagsModel::styleFlagsRequested
void styleFlagsRequested()
osmscout::StyleFlagsModel::StyleFlagsModel
StyleFlagsModel()
osmscout::StyleFlagsModel::Roles
Roles
Definition
StyleFlagsModel.h:55
osmscout::StyleFlagsModel::ValueRole
@ ValueRole
Definition
StyleFlagsModel.h:57
osmscout::StyleFlagsModel::InProgressRole
@ InProgressRole
Definition
StyleFlagsModel.h:58
osmscout::StyleFlagsModel::KeyRole
@ KeyRole
Definition
StyleFlagsModel.h:56
osmscout::StyleFlagsModel::setFlagRequest
void setFlagRequest(QString key, bool value)
osmscout::StyleFlagsModel::rowCount
Q_INVOKABLE int rowCount(const QModelIndex &parent=QModelIndex()) const override
Definition
StyleFlagsModel.h:65
osmscout::StyleFlagsModel::flags
Q_INVOKABLE Qt::ItemFlags flags(const QModelIndex &index) const override
osmscout::StyleModule
Definition
StyleModule.h:37
osmscout
Definition
Area.h:39
Generated by
1.17.0