blob: c3a798c5e93bb495c7d4cec16a78c869cc947c99 [file] [log] [blame]
Edric Milaret627500d2015-03-27 16:41:40 -04001/***************************************************************************
Andreas Traczykb8b13ba2018-08-21 16:30:16 -04002 * Copyright (C) 2018 by Savoir-faire Linux *
3 * Author: Andreas Traczyk <andreas.traczyk@savoirfairelinux.com> *
Edric Milaret627500d2015-03-27 16:41:40 -04004 * *
5 * This program is free software; you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation; either version 3 of the License, or *
8 * (at your option) any later version. *
9 * *
10 * This program is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
14 * *
15 * You should have received a copy of the GNU General Public License *
16 * along with this program. If not, see <http://www.gnu.org/licenses/>. *
17 **************************************************************************/
Edric Milaret5f316da2015-09-28 11:57:42 -040018#pragma once
Edric Milaret627500d2015-03-27 16:41:40 -040019
Andreas Traczykb8b13ba2018-08-21 16:30:16 -040020#include <QPainter>
Edric Milareta0ebd062016-01-13 12:18:23 -050021#include <QItemDelegate>
Edric Milaret627500d2015-03-27 16:41:40 -040022
Andreas Traczykb8b13ba2018-08-21 16:30:16 -040023class AccountItemDelegate : public QItemDelegate
Edric Milaret627500d2015-03-27 16:41:40 -040024{
25 Q_OBJECT
Edric Milaret627500d2015-03-27 16:41:40 -040026public:
Andreas Traczykb8b13ba2018-08-21 16:30:16 -040027 explicit AccountItemDelegate(QObject *parent = nullptr);
Edric Milaret627500d2015-03-27 16:41:40 -040028
Edric Milareted0b2802015-10-01 15:10:02 -040029protected:
Nicolas Jager97a21b42015-12-03 16:55:45 -050030 void paint(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const;
31 QSize sizeHint(const QStyleOptionViewItem& option, const QModelIndex& index) const;
32
Edric Milaret627500d2015-03-27 16:41:40 -040033private:
Andreas Traczykb8b13ba2018-08-21 16:30:16 -040034 constexpr static int fontSize_ = 10;
35 const QFont font_ = QFont("Arial", fontSize_);
Edric Milareta0ebd062016-01-13 12:18:23 -050036 constexpr static int dy_ = 6;
37 constexpr static int dx_ = 12;
Andreas Traczykb8b13ba2018-08-21 16:30:16 -040038 constexpr static int avatarSize_ = 36;
39 constexpr static int cellHeight_ = 48;
Edric Milaret627500d2015-03-27 16:41:40 -040040};