File indexing completed on 2024-05-19 04:48:39
0001 /**************************************************************************************** 0002 * Copyright (c) 2008 Daniel Caleb Jones <danielcjones@gmail.com> * 0003 * Copyright (c) 2011 Ralf Engels <ralf-engels@gmx.de> * 0004 * * 0005 * This program is free software; you can redistribute it and/or modify it under * 0006 * the terms of the GNU General Public License as published by the Free Software * 0007 * Foundation; either version 2 of the License, or (at your option) version 3 or * 0008 * any later version accepted by the membership of KDE e.V. (or its successor approved * 0009 * by the membership of KDE e.V.), which shall act as a proxy defined in Section 14 of * 0010 * version 3 of the license. * 0011 * * 0012 * This program is distributed in the hope that it will be useful, but WITHOUT ANY * 0013 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A * 0014 * PARTICULAR PURPOSE. See the GNU General Public License for more details. * 0015 * * 0016 * You should have received a copy of the GNU General Public License along with * 0017 * this program. If not, see <http://www.gnu.org/licenses/>. * 0018 ****************************************************************************************/ 0019 0020 #ifndef AMAROK_DYNAMICBIASDELEGATE 0021 #define AMAROK_DYNAMICBIASDELEGATE 0022 0023 #include <QStyledItemDelegate> 0024 0025 namespace PlaylistBrowserNS 0026 { 0027 0028 /** A special delegate for the dynamic playlists. 0029 It will paint an additional operator hint in front of a bias. 0030 e.g. a small progress bar or a "If" text. 0031 */ 0032 class DynamicBiasDelegate : public QStyledItemDelegate 0033 { 0034 public: 0035 explicit DynamicBiasDelegate( QWidget* parent = nullptr ); 0036 ~DynamicBiasDelegate() override; 0037 0038 void paint( QPainter* painter, 0039 const QStyleOptionViewItem& option, 0040 const QModelIndex& index ) const override; 0041 0042 private: 0043 QFont m_normalFont; 0044 QFont m_smallFont; 0045 0046 QFontMetrics *m_normalFm; 0047 QFontMetrics *m_smallFm; 0048 0049 }; 0050 0051 } 0052 0053 #endif