KNewStuff
itemsviewdelegate.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef KNEWSTUFF2_UI_ITEMSVIEWDELEGATE_H
00020 #define KNEWSTUFF2_UI_ITEMSVIEWDELEGATE_H
00021
00022 #include <kwidgetitemdelegate.h>
00023
00024 #include <QtCore/QMap>
00025 #include <QtCore/QModelIndex>
00026 #include <QtCore/QObject>
00027 #include <QtGui/QImage>
00028 #include <QtGui/QLabel>
00029 #include <QtGui/QToolButton>
00030
00031 #include <knewstuff2/core/entry.h>
00032 #include <knewstuff2/ui/downloaddialog.h>
00033
00034 #include <kicon.h>
00035 #include <kmenu.h>
00036
00037 namespace KNS
00038 {
00039 class ItemsViewDelegate: public KWidgetItemDelegate
00040 {
00041 Q_OBJECT
00042 public:
00043 explicit ItemsViewDelegate(QAbstractItemView *itemView, QObject * parent = 0);
00044 ~ItemsViewDelegate();
00045
00046
00047 virtual void paint(QPainter * painter, const QStyleOptionViewItem & option, const QModelIndex & index) const;
00048
00049
00050 virtual QList<QWidget*> createItemWidgets() const;
00051
00052
00053 virtual void updateItemWidgets(const QList<QWidget*> widgets,
00054 const QStyleOptionViewItem &option,
00055 const QPersistentModelIndex &index) const;
00056
00057 virtual QSize sizeHint(const QStyleOptionViewItem & option, const QModelIndex & index) const;
00058
00059 signals:
00060
00061 void performAction(DownloadDialog::EntryAction action, KNS::Entry * entry);
00062
00063
00064
00065
00066 private slots:
00067
00068 void slotActionTriggered(QAction *action);
00069 void slotInstallClicked();
00070 void slotLinkClicked(const QString & url);
00071
00072 private:
00073 KMenu * InstallMenu(const QToolButton* button, Entry::Status status) const;
00074
00075 QList<KIcon> m_statusicons;
00076 QImage m_frameImage;
00077 };
00078 }
00079
00080 #endif