libosmscout
1.1.1
Toggle main menu visibility
Loading...
Searching...
No Matches
libosmscout-client-qt
include
osmscoutclientqt
MapStyleModel.h
Go to the documentation of this file.
1
#ifndef OSMSCOUT_CLIENT_QT_MAPSTYLEMODEL_H
2
#define OSMSCOUT_CLIENT_QT_MAPSTYLEMODEL_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 <QObject>
24
#include <QAbstractListModel>
25
#include <QFileInfo>
26
27
#include <
osmscoutclientqt/StyleModule.h
>
28
#include <
osmscoutclientqt/ClientQtImportExport.h
>
29
30
namespace
osmscout
{
31
35
class
OSMSCOUT_CLIENT_QT_API
MapStyleModel
:
public
QAbstractListModel
36
{
37
Q_OBJECT
38
Q_PROPERTY(QString
style
READ
getStyle
WRITE
setStyle
NOTIFY
styleChanged
)
39
40
private
:
41
StyleModule
*styleModule;
42
43
signals:
44
void
styleChanged
();
45
void
loadStyleRequested
(QString,std::unordered_map<std::string,bool>);
46
47
public
:
48
enum
Roles
{
49
NameRole
= Qt::UserRole,
50
FileRole
= Qt::UserRole+1,
51
PathRole
= Qt::UserRole+2,
52
};
53
Q_ENUM(Roles)
54
55
MapStyleModel
();
56
~
MapStyleModel
() override;
57
58
QString
getStyle
() const;
59
void
setStyle
(const QString &
style
);
60
61
Q_INVOKABLE
int
inline
rowCount
(const QModelIndex &parent = QModelIndex())
const override
62
{
63
Q_UNUSED(parent);
64
return
stylesheets.size();
65
};
66
67
Q_INVOKABLE QVariant
data
(
const
QModelIndex &index,
int
role)
const override
;
68
QHash<int, QByteArray>
roleNames
()
const override
;
69
Q_INVOKABLE Qt::ItemFlags
flags
(
const
QModelIndex &index)
const override
;
70
71
Q_INVOKABLE
int
indexOf
(
const
QString &
style
)
const
;
72
Q_INVOKABLE QString
file
(
int
i)
const
;
73
74
private
:
75
QList<QFileInfo> stylesheets;
76
};
77
78
}
79
80
#endif
/* OSMSCOUT_CLIENT_QT_MAPSTYLEHELPER_H */
81
ClientQtImportExport.h
OSMSCOUT_CLIENT_QT_API
#define OSMSCOUT_CLIENT_QT_API
Definition
ClientQtImportExport.h:45
StyleModule.h
osmscout::MapStyleModel::MapStyleModel
MapStyleModel()
osmscout::MapStyleModel::styleChanged
void styleChanged()
osmscout::MapStyleModel::setStyle
void setStyle(const QString &style)
osmscout::MapStyleModel::data
Q_INVOKABLE QVariant data(const QModelIndex &index, int role) const override
osmscout::MapStyleModel::file
Q_INVOKABLE QString file(int i) const
osmscout::MapStyleModel::rowCount
Q_INVOKABLE int rowCount(const QModelIndex &parent=QModelIndex()) const override
Definition
MapStyleModel.h:61
osmscout::MapStyleModel::loadStyleRequested
void loadStyleRequested(QString, std::unordered_map< std::string, bool >)
osmscout::MapStyleModel::roleNames
QHash< int, QByteArray > roleNames() const override
osmscout::MapStyleModel::indexOf
Q_INVOKABLE int indexOf(const QString &style) const
osmscout::MapStyleModel::style
QString style
Definition
MapStyleModel.h:38
osmscout::MapStyleModel::flags
Q_INVOKABLE Qt::ItemFlags flags(const QModelIndex &index) const override
osmscout::MapStyleModel::getStyle
QString getStyle() const
osmscout::MapStyleModel::Roles
Roles
Definition
MapStyleModel.h:48
osmscout::MapStyleModel::FileRole
@ FileRole
Definition
MapStyleModel.h:50
osmscout::MapStyleModel::PathRole
@ PathRole
Definition
MapStyleModel.h:51
osmscout::MapStyleModel::NameRole
@ NameRole
Definition
MapStyleModel.h:49
osmscout::StyleModule
Definition
StyleModule.h:37
osmscout
Definition
Area.h:39
Generated by
1.17.0