Marble

RouteItemDelegate.h
1#ifndef ROUTEITEMDELEGATE_H
2#define ROUTEITEMDELEGATE_H
3
4#include <QStyledItemDelegate>
5
6class QListView;
7
8namespace Marble {
9class CloudRouteModel;
10
11class RouteItemDelegate : public QStyledItemDelegate {
13
14public:
15 RouteItemDelegate( QListView *view, CloudRouteModel *model );
16
17 void paint( QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index ) const override;
18 QSize sizeHint( const QStyleOptionViewItem& option, const QModelIndex& index ) const override;
19 bool editorEvent(QEvent* event, QAbstractItemModel* model, const QStyleOptionViewItem& option, const QModelIndex& index) override;
20
21
23 void downloadButtonClicked( const QString& timestamp );
24 void openButtonClicked( const QString& timestamp );
25 void deleteButtonClicked( const QString& timestamp );
26 void removeFromCacheButtonClicked( const QString& timestamp );
27 void uploadToCloudButtonClicked( const QString& timestamp );
28
29private:
30 enum Element {
31 Text,
32 OpenButton,
33 DownloadButton,
34 RemoveFromCacheButton,
35 RemoveFromCloudButton,
36 Progressbar,
37 Preview,
38 UploadToCloudButton
39 };
40
41 int buttonWidth( const QStyleOptionViewItem &option ) const;
42 QStyleOptionButton button( Element element, const QStyleOptionViewItem &option ) const;
43 static QString text( const QModelIndex &index );
44 QRect position( Element element, const QStyleOptionViewItem &option ) const;
45
46 QListView *m_view;
47 CloudRouteModel *m_model;
48 mutable int m_buttonWidth;
49 int const m_iconSize;
50 int const m_previewSize;
51 int const m_margin;
52};
53
54}
55
56#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 Fri Jun 21 2024 12:00:06 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.