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

KNewStuff

  • sources
  • kde-4.14
  • kdelibs
  • knewstuff
  • knewstuff2
  • ui
knewstuff2/ui/itemsviewdelegate.h
Go to the documentation of this file.
1 /*
2  This file is part of KNewStuff2.
3  Copyright (C) 2008 Jeremy Whiting <jpwhiting@kde.org>
4 
5  This library is free software; you can redistribute it and/or
6  modify it under the terms of the GNU Lesser General Public
7  License as published by the Free Software Foundation; either
8  version 2.1 of the License, or (at your option) any later version.
9 
10  This library is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  Lesser General Public License for more details.
14 
15  You should have received a copy of the GNU Lesser General Public
16  License along with this library. If not, see <http://www.gnu.org/licenses/>.
17 */
18 
19 #ifndef KNEWSTUFF2_UI_ITEMSVIEWDELEGATE_H
20 #define KNEWSTUFF2_UI_ITEMSVIEWDELEGATE_H
21 
22 #include <kwidgetitemdelegate.h>
23 
24 #include <QtCore/QMap>
25 #include <QtCore/QModelIndex>
26 #include <QtCore/QObject>
27 #include <QtGui/QImage>
28 #include <QtGui/QLabel>
29 #include <QtGui/QToolButton>
30 
31 #include <knewstuff2/core/entry.h>
32 #include <knewstuff2/ui/downloaddialog.h>
33 
34 #include <kicon.h>
35 #include <kmenu.h>
36 
37 namespace KNS
38 {
39 class ItemsViewDelegate: public KWidgetItemDelegate
40 {
41  Q_OBJECT
42 public:
43  explicit ItemsViewDelegate(QAbstractItemView *itemView, QObject * parent = 0);
44  ~ItemsViewDelegate();
45 
46  // paint the item at index with all its attributes shown
47  virtual void paint(QPainter * painter, const QStyleOptionViewItem & option, const QModelIndex & index) const;
48 
49  // get the list of widgets
50  virtual QList<QWidget*> createItemWidgets() const;
51 
52  // update the widgets
53  virtual void updateItemWidgets(const QList<QWidget*> widgets,
54  const QStyleOptionViewItem &option,
55  const QPersistentModelIndex &index) const;
56 
57  virtual QSize sizeHint(const QStyleOptionViewItem & option, const QModelIndex & index) const;
58 
59 signals:
60 
61  void performAction(DownloadDialog::EntryAction action, KNS::Entry * entry);
62 
63  //protected:
64  //virtual bool eventFilter(QObject *watched, QEvent *event);
65 
66 private slots:
67 
68  void slotActionTriggered(QAction *action);
69  void slotInstallClicked();
70  void slotLinkClicked(const QString & url);
71 
72 private:
73  KMenu * InstallMenu(const QToolButton* button, Entry::Status status) const;
74 
75  QList<KIcon> m_statusicons;
76  QImage m_frameImage;
77 };
78 }
79 
80 #endif
QModelIndex
QAbstractItemView
KNS::ItemsViewDelegate::ItemsViewDelegate
ItemsViewDelegate(QAbstractItemView *itemView, QObject *parent=0)
Definition: knewstuff2/ui/itemsviewdelegate.cpp:38
KNS::Entry
KNewStuff data entry container.
Definition: knewstuff2/core/entry.h:46
KMenu
entry.h
KWidgetItemDelegate::itemView
QAbstractItemView * itemView() const
KNS::ItemsViewDelegate
Definition: knewstuff2/ui/itemsviewdelegate.h:39
KNS::Entry::Status
Status
Status of the entry.
Definition: knewstuff2/core/entry.h:290
KNS::DownloadDialog::EntryAction
EntryAction
Definition: knewstuff2/ui/downloaddialog.h:76
KWidgetItemDelegate
kmenu.h
QStyleOptionViewItem
QObject
QPainter
KNS::ItemsViewDelegate::updateItemWidgets
virtual void updateItemWidgets(const QList< QWidget * > widgets, const QStyleOptionViewItem &option, const QPersistentModelIndex &index) const
Definition: knewstuff2/ui/itemsviewdelegate.cpp:96
QString
QList
KNS::ItemsViewDelegate::createItemWidgets
virtual QList< QWidget * > createItemWidgets() const
Definition: knewstuff2/ui/itemsviewdelegate.cpp:75
QToolButton
QSize
QImage
kwidgetitemdelegate.h
QPersistentModelIndex
KNS::ItemsViewDelegate::~ItemsViewDelegate
~ItemsViewDelegate()
Definition: knewstuff2/ui/itemsviewdelegate.cpp:57
KNS::ItemsViewDelegate::paint
virtual void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
Definition: knewstuff2/ui/itemsviewdelegate.cpp:229
QAction
KNS::ItemsViewDelegate::performAction
void performAction(DownloadDialog::EntryAction action, KNS::Entry *entry)
kicon.h
KNS::ItemsViewDelegate::sizeHint
virtual QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const
Definition: knewstuff2/ui/itemsviewdelegate.cpp:281
QObject::parent
QObject * parent() const
downloaddialog.h
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:25:43 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KNewStuff

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

kdelibs API Reference

Skip menu "kdelibs API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver

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