kmail
configagentdelegate.cpp
Go to the documentation of this file.
62 QTextDocument* ConfigAgentDelegate::document ( const QStyleOptionViewItem &option, const QModelIndex &index ) const
70 const QString statusMessage = index.model()->data ( index, AgentInstanceModel::StatusMessageRole ).toString();
74 const QSize decorationSize( KIconLoader::global()->currentSize( KIconLoader::Desktop ), KIconLoader::global()->currentSize( KIconLoader::Desktop ) );
82 document->addResource ( QTextDocument::ImageResource, QUrl ( QLatin1String ( "status_icon" ) ), s_icons->offlinePixmap );
84 document->addResource ( QTextDocument::ImageResource, QUrl ( QLatin1String ( "status_icon" ) ), s_icons->readyPixmap );
86 document->addResource ( QTextDocument::ImageResource, QUrl ( QLatin1String ( "status_icon" ) ), s_icons->syncPixmap );
88 document->addResource ( QTextDocument::ImageResource, QUrl ( QLatin1String ( "status_icon" ) ), s_icons->errorPixmap );
91 QPalette::ColorGroup cg = option.state & QStyle::State_Enabled ? QPalette::Normal : QPalette::Disabled;
113 "</tr>" ).arg ( statusMessage ).arg ( status == 1 ? QString::fromLatin1( "(%1%)" ).arg ( progress ) : QLatin1String ( "" ) )
121 void ConfigAgentDelegate::paint ( QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index ) const
137 QPalette::ColorGroup cg = option.state & QStyle::State_Enabled ? QPalette::Normal : QPalette::Disabled;
158 QSize ConfigAgentDelegate::sizeHint ( const QStyleOptionViewItem &option, const QModelIndex & ) const
160 const int iconHeight = KIconLoader::global()->currentSize(KIconLoader::Desktop) + ( s_delegatePaddingSize*2 ); //icon height + padding either side
161 const int textHeight = option.fontMetrics.height() + qMax( option.fontMetrics.height(), 16 ) + ( s_delegatePaddingSize*2 ); //height of text + icon/text + padding either side
163 return QSize( 1,qMax( iconHeight, textHeight ) ); //any width,the view will give us the whole thing in list mode
166 QWidget * ConfigAgentDelegate::createEditor ( QWidget *, const QStyleOptionViewItem &, const QModelIndex & ) const
171 bool ConfigAgentDelegate::editorEvent ( QEvent* event, QAbstractItemModel* model, const QStyleOptionViewItem& option, const QModelIndex& index )
194 const QString ident = index.data ( Akonadi::AgentInstanceModel::InstanceIdentifierRole ).toString();
205 void ConfigAgentDelegate::drawFocus ( QPainter *painter, const QStyleOptionViewItem &option, const QRect &rect ) const
212 QPalette::ColorGroup cg = ( option.state & QStyle::State_Enabled ) ? QPalette::Normal : QPalette::Disabled;
219 QStyleOptionButton ConfigAgentDelegate::buttonOption ( const QStyleOptionViewItem& option ) const
225 int width = 22 + option.fontMetrics.width( label ) + 40; // icon size + label size + arrow and padding
226 buttonRect.setTop ( 0/*( option.rect.height() /2 ) - height / 2)*/ ); // center the button vertically
void drawContents(QPainter *p, const QRectF &rect)
Type type() const
QString toUpper() const
void setRenderHint(RenderHint hint, bool on)
QString name() const
QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const
Definition: configagentdelegate.cpp:158
QWidget * createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const
Definition: configagentdelegate.cpp:166
void save()
A delegate for listing the accounts in the account list with kmail specific options.
Definition: configagentdelegate.h:35
virtual bool event(QEvent *e)
const char * name() const
bool isValid() const
bool editorEvent(QEvent *event, QAbstractItemModel *model, const QStyleOptionViewItem &option, const QModelIndex &index)
Definition: configagentdelegate.cpp:171
uint toUInt(bool *ok) const
int toInt(bool *ok) const
void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
Definition: configagentdelegate.cpp:121
void addResource(int type, const QUrl &name, const QVariant &resource)
void setPen(const QColor &color)
void setTop(int y)
void setWidth(int width)
virtual QVariant data(const QModelIndex &index, int role) const =0
void optionsClicked(const QString &, const QPoint &)
void restore()
void setTextWidth(qreal width)
const QAbstractItemModel * model() const
QVariant data(int role) const
QStyle * style()
void setHeight(int height)
virtual void drawControl(ControlElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget) const =0
bool toBool() const
void translate(const QPointF &offset)
virtual void drawPrimitive(PrimitiveElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget) const =0
void setHtml(const QString &html)
QString fromLatin1(const char *str, int size)
bool isValid() const
const QPoint & pos() const
Type type() const
const QPen & pen() const
QString arg(qlonglong a, int fieldWidth, int base, const QChar &fillChar) const
QString toString() const
void setLeft(int x)
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:34:32 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:34:32 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.