source: trunk/qt/TrackerDelegate.h @ 14539

Last change on this file since 14539 was 14539, checked in by mikedld, 6 years ago

Unify/prettify Qt client headers style

  • Property svn:keywords set to Date Rev Author Id
File size: 1.1 KB
Line 
1/*
2 * This file Copyright (C) 2009-2015 Mnemosyne LLC
3 *
4 * It may be used under the GNU GPL versions 2 or 3
5 * or any future license endorsed by Mnemosyne LLC.
6 *
7 * $Id: TrackerDelegate.h 14539 2015-06-12 22:12:12Z mikedld $
8 */
9
10#ifndef QTR_TRACKER_DELEGATE_H
11#define QTR_TRACKER_DELEGATE_H
12
13#include <QItemDelegate>
14
15class QStyle;
16
17class Session;
18struct TrackerInfo;
19
20class TrackerDelegate: public QItemDelegate
21{
22    Q_OBJECT
23
24  public:
25    TrackerDelegate (QObject * parent = nullptr): QItemDelegate (parent), myShowMore (false) {}
26    virtual ~TrackerDelegate () {}
27
28    void setShowMore (bool b);
29
30    // QAbstractItemDelegate
31    virtual QSize sizeHint (const QStyleOptionViewItem& option, const QModelIndex& index) const;
32    virtual void paint (QPainter * painter, const QStyleOptionViewItem& option, const QModelIndex& index) const;
33
34  protected:
35    QString getText (const TrackerInfo&) const;
36    QSize margin (const QStyle& style) const;
37
38    QSize sizeHint (const QStyleOptionViewItem&, const TrackerInfo&) const;
39    void drawTracker (QPainter *, const QStyleOptionViewItem&, const TrackerInfo&) const;
40
41  private:
42    bool myShowMore;
43};
44
45#endif // QTR_TRACKER_DELEGATE_H
Note: See TracBrowser for help on using the repository browser.