kde-playground/kdepim/kmail/configuredialog/configagentdelegate.h
Ivailo Monev a9b00154bc generic: replace forward class declarations with header inclusions
Signed-off-by: Ivailo Monev <xakepa10@laimg.moc>
2019-07-31 18:05:48 +00:00

56 lines
2.2 KiB
C++

/*
Copyright (C) 2010 Casey Link <unnamedrambler@gmail.com>
Copyright (c) 2009-2010 Klaralvdalens Datakonsult AB, a KDAB Group company <info@kdab.net>
Copyright (c) 2006-2008 Tobias Koenig <tokoe@kde.org>
This library is free software; you can redistribute it and/or modify it
under the terms of the GNU Library General Public License as published by
the Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
This library is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
*/
#ifndef CONFIGAGENTDELEGATE_H
#define CONFIGAGENTDELEGATE_H
#include <QStyledItemDelegate>
#include <QTextDocument>
/**
* @short A delegate for listing the accounts in the account list with kmail specific options.
* Based off Akonadi::Internal::AgentInstanceWidgetDelegate
* by Tobias Koenig.
*
*/
class ConfigAgentDelegate : public QStyledItemDelegate
{
Q_OBJECT
public:
explicit ConfigAgentDelegate ( QObject *parent = 0 );
void paint ( QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index ) const;
QSize sizeHint ( const QStyleOptionViewItem &option, const QModelIndex &index ) const;
bool editorEvent ( QEvent* event, QAbstractItemModel* model, const QStyleOptionViewItem& option, const QModelIndex& index );
QWidget *createEditor ( QWidget * parent, const QStyleOptionViewItem & option, const QModelIndex & index ) const;
signals:
void optionsClicked ( const QString &, const QPoint & );
private:
void drawFocus ( QPainter*, const QStyleOptionViewItem&, const QRect& ) const;
QTextDocument* document ( const QStyleOptionViewItem &option, const QModelIndex &index ) const;
QStyleOptionButton buttonOption ( const QStyleOptionViewItem &option ) const;
};
#endif // CONFIGAGENTDELEGATE_H