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

libplasma

delegate.h

Go to the documentation of this file.
00001 /*  
00002     Copyright 2007 Robert Knight <robertknight@gmail.com>
00003     Copyright 2008 Marco Martin <notmart@gmail.com>
00004 
00005     This library is free software; you can redistribute it and/or
00006     modify it under the terms of the GNU Library General Public
00007     License as published by the Free Software Foundation; either
00008     version 2 of the License, or (at your option) any later version.
00009 
00010     This library is distributed in the hope that it will be useful,
00011     but WITHOUT ANY WARRANTY; without even the implied warranty of
00012     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013     Library General Public License for more details.
00014 
00015     You should have received a copy of the GNU Library General Public License
00016     along with this library; see the file COPYING.LIB.  If not, write to
00017     the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00018     Boston, MA 02110-1301, USA.
00019 */
00020 
00021 #ifndef DELEGATE_H
00022 #define DELEGATE_H
00023 
00024 // Qt
00025 #include <QtGui/QAbstractItemDelegate>
00026 
00027 // Plasma
00028 #include <plasma/plasma_export.h>
00029 
00030 namespace Plasma
00031 {
00032 
00033 class DelegatePrivate;
00034 
00044 class PLASMA_EXPORT Delegate : public QAbstractItemDelegate
00045 {
00046     Q_OBJECT
00047 public:
00048 
00049     enum SpecificRoles {
00050          SubTitleRole = Qt::UserRole + 1,
00051          SubTitleMandatoryRole = Qt::UserRole + 2,
00052          ColumnTypeRole = Qt::UserRole + 3
00053     };
00054 
00055     enum ColumnType {
00056          MainColumn = 1,
00057          SecondaryActionColumn = 2
00058     };
00059 
00060     Delegate(QObject *parent = 0);
00061     ~Delegate();
00062 
00070     void setRoleMapping(SpecificRoles role, int actual);
00071 
00072     int roleMapping(SpecificRoles role) const;
00073 
00074     //Reimplemented
00075     virtual void paint(QPainter *painter,const QStyleOptionViewItem& option,const QModelIndex& index) const;
00076 
00077 protected:
00086     QRect rectAfterTitle(const QStyleOptionViewItem& option, const QModelIndex& index) const;
00087 
00096     QRect rectAfterSubTitle(const QStyleOptionViewItem& option, const QModelIndex& index) const;
00097 
00106     QRect emptyRect(const QStyleOptionViewItem& option, const QModelIndex& index) const;
00107 
00108     virtual QSize sizeHint(const QStyleOptionViewItem& option , const QModelIndex& index) const;
00109 
00110 private:
00111     DelegatePrivate * const d;
00112 };
00113 
00114 }
00115 
00116 #endif // ITEMDELEGATE_H 

libplasma

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

API Reference

Skip menu "API Reference"
  • KWin
  •   KWin Libraries
  • Libraries
  •   libkworkspace
  •   libplasma
  •   libsolidcontrol
  •   libtaskmanager
  • Plasma
  •   Animators
  •   Applets
  •   Engines
  • Solid Modules
Generated for API Reference 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