blob: d30d1986b8f11bc41ea2b75fe2489cd46708c6f4 [file] [log] [blame]
Edric Milaret627500d2015-03-27 16:41:40 -04001/***************************************************************************
Sébastien Blin68abac92019-01-02 17:41:31 -05002 * Copyright (C) 2019-2019 by Savoir-faire Linux *
Andreas Traczykb8b13ba2018-08-21 16:30:16 -04003 * 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 Traczyk46508b52019-01-04 11:49:24 -050034 constexpr static int fontSize_ = 11;
Andreas Traczykb8b13ba2018-08-21 16:30:16 -040035 const QFont font_ = QFont("Arial", fontSize_);
Andreas Traczyk29650142019-01-03 20:33:56 -050036 constexpr static int topPadding_ = 6;
37 constexpr static int bottomPadding_ = 6;
38 constexpr static int leftPadding_ = 12;
39 constexpr static int rightPadding_ = 12;
Andreas Traczykb8b13ba2018-08-21 16:30:16 -040040 constexpr static int avatarSize_ = 36;
41 constexpr static int cellHeight_ = 48;
Edric Milaret627500d2015-03-27 16:41:40 -040042};