Marble

RouteItemDelegate.h
1#ifndef ROUTEITEMDELEGATE_H
2#define ROUTEITEMDELEGATE_H
3
4#include <QStyledItemDelegate>
5
6class QListView;
7
8namespace Marble
9{
10class CloudRouteModel;
11
12class RouteItemDelegate : public QStyledItemDelegate
13{
15
16public:
17 RouteItemDelegate(QListView *view, CloudRouteModel *model);
18
19 void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const override;
20 QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const override;
21 bool editorEvent(QEvent *event, QAbstractItemModel *model, const QStyleOptionViewItem &option, const QModelIndex &index) override;
22
24 void downloadButtonClicked(const QString &timestamp);
25 void openButtonClicked(const QString &timestamp);
26 void deleteButtonClicked(const QString &timestamp);
27 void removeFromCacheButtonClicked(const QString &timestamp);
28 void uploadToCloudButtonClicked(const QString &timestamp);
29
30private:
31 enum Element {
32 Text,
33 OpenButton,
34 DownloadButton,
35 RemoveFromCacheButton,
36 RemoveFromCloudButton,
37 Progressbar,
38 Preview,
39 UploadToCloudButton
40 };
41
42 int buttonWidth(const QStyleOptionViewItem &option) const;
43 QStyleOptionButton button(Element element, const QStyleOptionViewItem &option) const;
44 static QString text(const QModelIndex &index);
45 QRect position(Element element, const QStyleOptionViewItem &option) const;
46
47 QListView *m_view;
48 CloudRouteModel *m_model;
49 mutable int m_buttonWidth;
50 int const m_iconSize;
51 int const m_previewSize;
52 int const m_margin;
53};
54
55}
56
57#endif
Binds a QML item to a specific geodetic location in screen coordinates.
Q_OBJECTQ_OBJECT
Q_SIGNALSQ_SIGNALS
virtual bool event(QEvent *e)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 4 2024 16:37:02 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.