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

KNewStuff

itemsviewdelegate.h

Go to the documentation of this file.
00001 /***************************************************************************
00002  *   Copyright (C) 2008 Jeremy Whiting <jeremy@scitools.com>               *
00003  *                                                                         *
00004  *   This library is free software; you can redistribute it and/or         *
00005  *   modify it under the terms of the GNU Lesser General Public            *
00006  *   License as published by the Free Software Foundation; either          *
00007  *   version 2 of the License, or (at your option) any later version.      *
00008  *                                                                         *
00009  *   This library is distributed in the hope that it will be useful,       *
00010  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00011  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU     *
00012  *   Lesser General Public License for more details.                       *
00013  *                                                                         *
00014  *   You should have received a copy of the GNU Lesser General Public      *
00015  *   License along with this library; if not, write to the                 *
00016  *   Free Software Foundation, Inc.,                                       *
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     // paint the item at index with all it's attributes shown
00047     virtual void paint(QPainter * painter, const QStyleOptionViewItem & option, const QModelIndex & index) const;
00048 
00049     // get the list of widgets
00050     virtual QList<QWidget*> createItemWidgets() const;
00051 
00052     // update the widgets
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     //protected:
00064     //virtual bool eventFilter(QObject *watched, QEvent *event);
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

KNewStuff

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

kdelibs

Skip menu "kdelibs"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • Kate
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • KIO
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • Kross
  • KUtils
  • Nepomuk
  • Solid
  • Sonnet
  • ThreadWeaver
Generated for kdelibs by doxygen 1.5.4
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal