2 * This file is part of the System Settings package
3 * Copyright (C) 2005 Benjamin C Meyer
4 * <ben+systempreferences at meyerhome dot net>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Library General Public License for more details.
16 * You should have received a copy of the GNU Library General Public License
17 * along with this library; see the file COPYING.LIB. If not, write to
18 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19 * Boston, MA 02110-1301, USA.
22 #ifndef MODULEICONITEM_H
23 #define MODULEICONITEM_H
25 #include <QItemDelegate>
26 #include <QListWidgetItem>
28 #include <QPainterPath>
33 class ModuleIconItemDelegate
: public QItemDelegate
36 ModuleIconItemDelegate(QObject
*parent
);
38 void paint(QPainter
*painter
, const QStyleOptionViewItem
&option
, const QModelIndex
&index
) const;
41 // Method taken from KFileItemDelegate. Check whether it has been moved to
42 // kdefx/kdrawutil.cpp as the comment says on Fredrik's code. If so, remove
43 // this code (duplication), and use the library one.
44 QPainterPath
roundedRectangle(const QRectF
&rect
, qreal radius
) const;
48 * Stores information about what modules goes with this item.
49 * Also provides means of loading the enabled/disabled image (see kcmsearch).
51 class ModuleIconItem
: public QListWidgetItem
55 ModuleIconItem( QListWidget
*parent
, const KCModuleInfo
& module
);
57 ModuleIconItem( QListWidget
*parent
, const QString
&text
, const QString
&imageName
);
60 * Update the icon to either be enabled or not.
62 void loadIcon( bool enabled
= true );
64 // The modules that go with this item
65 QList
<KCModuleInfo
> modules
;
73 #endif // MODULEICONITEM_H