File indexing completed on 2025-01-19 11:19:01
0001 /* 0002 SPDX-FileCopyrightText: 2017-2018 Michail Vourlakos <mvourlakos@gmail.com> 0003 SPDX-License-Identifier: GPL-2.0-or-later 0004 */ 0005 0006 #include "backgrounddelegate.h" 0007 0008 // local 0009 #include "../layoutsmodel.h" 0010 #include "../../generic/generictools.h" 0011 0012 // Qt 0013 #include <QDebug> 0014 #include <QModelIndex> 0015 #include <QPainter> 0016 #include <QString> 0017 0018 0019 namespace Latte { 0020 namespace Settings { 0021 namespace Layout { 0022 namespace Delegate { 0023 0024 const int MARGIN = 2; 0025 0026 BackgroundDelegate::BackgroundDelegate(QObject *parent) 0027 : QStyledItemDelegate(parent) 0028 { 0029 } 0030 0031 void BackgroundDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const 0032 { 0033 QStyleOptionViewItem myOptions = option; 0034 Latte::Data::LayoutIcon icon = index.data(Qt::UserRole).value<Latte::Data::LayoutIcon>(); 0035 0036 //! background 0037 Latte::drawBackground(painter, option); 0038 Latte::drawLayoutIcon(painter, option, icon.isBackgroundFile, icon.name, Qt::AlignHCenter, -1, 3); 0039 } 0040 0041 } 0042 } 0043 } 0044 } 0045