File indexing completed on 2023-12-03 05:01:47
0001 /* 0002 * This file is part of telepathy-accounts-kcm 0003 * 0004 * Copyright (C) 2011 David Edmundson <kde@davidedmundson.co.uk> 0005 * 0006 * This library is free software; you can redistribute it and/or 0007 * modify it under the terms of the GNU Lesser General Public 0008 * License as published by the Free Software Foundation; either 0009 * version 2.1 of the License, or (at your option) any later version. 0010 * 0011 * This library is distributed in the hope that it will be useful, 0012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 0013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 0014 * Lesser General Public License for more details. 0015 * 0016 * You should have received a copy of the GNU Lesser General Public 0017 * License along with this library; if not, write to the Free Software 0018 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 0019 */ 0020 0021 #ifndef ACCOUNTLISTDELEGATE_H 0022 #define ACCOUNTLISTDELEGATE_H 0023 0024 #include <KWidgetItemDelegate> 0025 0026 class QCheckBox; 0027 0028 class AccountsListDelegate : public KWidgetItemDelegate 0029 { 0030 Q_OBJECT 0031 public: 0032 explicit AccountsListDelegate(QAbstractItemView *itemView, QObject *parent); 0033 QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const; 0034 void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const; 0035 0036 QList<QWidget*> createItemWidgets() const; 0037 void updateItemWidgets(const QList<QWidget *> widgets, const QStyleOptionViewItem &option, const QPersistentModelIndex &index) const; 0038 0039 Q_SIGNALS: 0040 void itemChecked(const QModelIndex &index, bool checked); 0041 0042 private Q_SLOTS: 0043 void onCheckBoxToggled(bool checked); 0044 0045 private: 0046 static const int m_hpadding = 7; 0047 static const int m_vpadding = 2; 0048 }; 0049 0050 #endif // ACCOUNTLISTDELEGATE_H