~ubuntu-branches/ubuntu/oneiric/muon/oneiric

« back to all changes in this revision

Viewing changes to src/PackageModel/PackageDelegate.h

  • Committer: Bazaar Package Importer
  • Author(s): Jonathan Thomas
  • Date: 2010-11-04 00:31:49 UTC
  • mfrom: (1.1.5 upstream)
  • Revision ID: james.westby@ubuntu.com-20101104003149-y5aeq7cbckd3m6of
Tags: 1.0.60-0ubuntu1
* New upstream alpha release: (LP: #632457, #633235, #633295)
  - Bump build-depend version on libqapt-dev to 1.0.60 or greater
  - Add new packages muon-updater and muon-notifier

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/***************************************************************************
2
 
 *   Copyright © 2010 Jonathan Thomas <echidnaman@kubuntu.org>             *
3
 
 *                                                                         *
4
 
 *   This program is free software; you can redistribute it and/or         *
5
 
 *   modify it under the terms of the GNU General Public License as        *
6
 
 *   published by the Free Software Foundation; either version 2 of        *
7
 
 *   the License or (at your option) version 3 or any later version        *
8
 
 *   accepted by the membership of KDE e.V. (or its successor approved     *
9
 
 *   by the membership of KDE e.V.), which shall act as a proxy            *
10
 
 *   defined in Section 14 of version 3 of the license.                    *
11
 
 *                                                                         *
12
 
 *   This program is distributed in the hope that it will be useful,       *
13
 
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
14
 
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
15
 
 *   GNU General Public License for more details.                          *
16
 
 *                                                                         *
17
 
 *   You should have received a copy of the GNU General Public License     *
18
 
 *   along with this program.  If not, see <http://www.gnu.org/licenses/>. *
19
 
 ***************************************************************************/
20
 
 
21
 
#ifndef PACKAGEDELEGATE_H
22
 
#define PACKAGEDELEGATE_H
23
 
 
24
 
#include <QtGui/QAbstractItemDelegate>
25
 
 
26
 
class KIcon;
27
 
 
28
 
class PackageDelegate: public QAbstractItemDelegate
29
 
{
30
 
    Q_OBJECT
31
 
public:
32
 
    explicit PackageDelegate(QObject *parent = 0);
33
 
    ~PackageDelegate();
34
 
 
35
 
protected:
36
 
    void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const;
37
 
    void paintBackground(QPainter *painter, const QStyleOptionViewItem &option) const;
38
 
    void paintPackageName(QPainter *painter, const QStyleOptionViewItem &option , const QModelIndex &index) const;
39
 
    void paintText(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const;
40
 
 
41
 
    QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const;
42
 
 
43
 
private:
44
 
    int m_iconSize;
45
 
    int m_spacing;
46
 
 
47
 
    KIcon *m_icon;
48
 
 
49
 
    int calcItemHeight(const QStyleOptionViewItem &option) const;
50
 
};
51
 
 
52
 
#endif