• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdeedu API Reference
  • KDE Home
  • Contact Us
 

marble

  • sources
  • kde-4.12
  • kdeedu
  • marble
  • src
  • lib
  • marble
PluginItemDelegate.h
Go to the documentation of this file.
1 //
2 // This file is part of the Marble Virtual Globe.
3 //
4 // This program is free software licensed under the GNU LGPL. You can
5 // find a copy of this license in LICENSE.txt in the top directory of
6 // the source code.
7 //
8 // Copyright 2009 Bastian Holst <bastianholst@gmx.de>
9 //
10 
11 #ifndef MARBLE_PLUGINITEMDELEGATE_H
12 #define MARBLE_PLUGINITEMDELEGATE_H
13 
14 #include <QAbstractItemDelegate>
15 
16 #include <QModelIndex>
17 #include <QIcon>
18 
19 class QPainter;
20 class QRect;
21 class QStyleOptionButton;
22 class QStyleOptionViewItem;
23 
24 namespace Marble
25 {
26 
27 class PluginItemDelegate : public QAbstractItemDelegate
28 {
29  Q_OBJECT
30 
31  public:
32  explicit PluginItemDelegate( QAbstractItemView *view, QObject * parent = 0 );
33  ~PluginItemDelegate();
34 
35  void paint( QPainter *painter,
36  const QStyleOptionViewItem& option,
37  const QModelIndex& index ) const;
38  QSize sizeHint( const QStyleOptionViewItem& option, const QModelIndex & index ) const;
39 
40  void setAboutIcon( const QIcon& icon );
41  void setConfigIcon( const QIcon& icon );
42 
43  Q_SIGNALS:
48  void aboutPluginClicked( const QModelIndex &index );
49 
54  void configPluginClicked( const QModelIndex &index );
55 
56  protected:
57  bool editorEvent( QEvent *event,
58  QAbstractItemModel *model,
59  const QStyleOptionViewItem &option,
60  const QModelIndex &index );
61 
62  private:
63  enum ButtonType {
64  About,
65  Configure
66  };
67 
68  QStyleOptionButton checkboxOption( const QStyleOptionViewItem& option,
69  const QModelIndex& index,
70  int position = 0,
71  Qt::AlignmentFlag alignment = Qt::AlignLeft ) const;
72  QStyleOptionButton buttonOption( const QStyleOptionViewItem& option,
73  const QModelIndex& index,
74  PluginItemDelegate::ButtonType type,
75  int position = 0,
76  Qt::AlignmentFlag alignment = Qt::AlignLeft ) const;
77  QSize nameSize( const QModelIndex& index ) const;
78 
79  QRect alignRect( QRect object, QRect frame, int position, Qt::AlignmentFlag alignment ) const;
80 
81  QModelIndex m_configPressedIndex;
82  QModelIndex m_aboutPressedIndex;
83 
84  QIcon m_aboutIcon;
85  QIcon m_configIcon;
86 };
87 
88 }
89 
90 #endif
QPainter
Marble::PluginItemDelegate::aboutPluginClicked
void aboutPluginClicked(const QModelIndex &index)
This signal is emitted if the user clicks on a "about"-button of an item in the view passed to the co...
Marble::PluginItemDelegate::sizeHint
QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const
Definition: PluginItemDelegate.cpp:121
Marble::PluginItemDelegate::paint
void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
Definition: PluginItemDelegate.cpp:46
Marble::PluginItemDelegate::PluginItemDelegate
PluginItemDelegate(QAbstractItemView *view, QObject *parent=0)
Definition: PluginItemDelegate.cpp:34
QObject
Marble::PluginItemDelegate::~PluginItemDelegate
~PluginItemDelegate()
Definition: PluginItemDelegate.cpp:42
QAbstractItemModel
Marble::PluginItemDelegate::configPluginClicked
void configPluginClicked(const QModelIndex &index)
This signal is emitted if the user clicks on a "configure"-button of an item in the view passed to th...
Marble::PluginItemDelegate::setAboutIcon
void setAboutIcon(const QIcon &icon)
Definition: PluginItemDelegate.cpp:146
Marble::PluginItemDelegate::setConfigIcon
void setConfigIcon(const QIcon &icon)
Definition: PluginItemDelegate.cpp:151
Marble::PluginItemDelegate
Definition: PluginItemDelegate.h:27
Marble::PluginItemDelegate::editorEvent
bool editorEvent(QEvent *event, QAbstractItemModel *model, const QStyleOptionViewItem &option, const QModelIndex &index)
Definition: PluginItemDelegate.cpp:156
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:38:52 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

marble

Skip menu "marble"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdeedu API Reference

Skip menu "kdeedu API Reference"
  • Analitza
  •     lib
  • kalgebra
  • kalzium
  •   libscience
  • kanagram
  • kig
  •   lib
  • klettres
  • kstars
  • libkdeedu
  •   keduvocdocument
  • marble
  • parley
  • rocs
  •   App
  •   RocsCore
  •   VisualEditor
  •   stepcore

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal