akonadi
agentinstancewidget.cpp
72 virtual void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const;
104 void AgentInstanceWidget::Private::currentAgentInstanceChanged(const QModelIndex ¤tIndex, const QModelIndex &previousIndex)
119 void AgentInstanceWidget::Private::currentAgentInstanceDoubleClicked(const QModelIndex ¤tIndex)
160 d->mView->selectionModel()->setCurrentIndex(d->mView->model()->index(0, 0), QItemSelectionModel::Select);
223 void AgentInstanceWidgetDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
236 QString statusMessage = index.model()->data(index, AgentInstanceModel::StatusMessageRole).toString();
254 QRect innerRect = option.rect.adjusted(s_delegatePaddingSize, s_delegatePaddingSize, -s_delegatePaddingSize, -s_delegatePaddingSize); //add some padding round entire delegate
256 const QSize decorationSize(KIconLoader::global()->currentSize(KIconLoader::Desktop), KIconLoader::global()->currentSize(KIconLoader::Desktop));
257 const QSize statusIconSize = QSize(16, 16); //= KIconLoader::global()->currentSize(KIconLoader::Small);
263 const QRect decorationRect(innerRect.left(), innerRect.top(), decorationSize.width(), innerRect.height());
264 const QRect nameTextRect(decorationRect.topRight() + QPoint(4, 0), innerRect.topRight() + QPoint(0, innerRect.height() / 2));
265 const QRect statusTextRect(decorationRect.bottomRight() + QPoint(4, - innerRect.height() / 2), innerRect.bottomRight());
269 QPalette::ColorGroup cg = option.state &QStyle::State_Enabled ? QPalette::Normal : QPalette::Disabled;
280 painter->drawPixmap(style->itemPixmapRect(decorationRect, Qt::AlignCenter, iconPixmap), iconPixmap);
286 painter->drawText(statusTextRect.adjusted(statusIconSize.width() + 4, 0, 0, 0), Qt::AlignVCenter | Qt::AlignLeft, statusMessage);
287 painter->drawPixmap(style->itemPixmapRect(statusTextRect, Qt::AlignVCenter | Qt::AlignLeft, statusPixmap), statusPixmap);
290 QSize AgentInstanceWidgetDelegate::sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const
294 const int iconHeight = KIconLoader::global()->currentSize(KIconLoader::Desktop) + (s_delegatePaddingSize * 2); //icon height + padding either side
295 const int textHeight = option.fontMetrics.height() + qMax(option.fontMetrics.height(), 16) + (s_delegatePaddingSize * 2); //height of text + icon/text + padding either side
297 return QSize(1, qMax(iconHeight, textHeight)); //any width,the view will give us the whole thing in list mode
QLayout * layout() const
The agent instance itself.
Definition: agentinstancemodel.h:64
QModelIndexList indexes() const
void currentChanged(const Akonadi::AgentInstance ¤t, const Akonadi::AgentInstance &previous)
This signal is emitted whenever the current agent instance changes.
AgentInstance currentAgentInstance() const
Returns the current agent instance or an invalid agent instance if no agent instance is selected...
Definition: agentinstancewidget.cpp:176
QString & append(QChar ch)
QPoint topRight() const
int width() const
The agent instance does currently nothing.
Definition: agentinstance.h:77
QModelIndex currentIndex() const
A textual presentation of the current status.
Definition: agentinstancemodel.h:67
The current online/offline status.
Definition: agentinstancemodel.h:69
The current status (numerical) of the instance.
Definition: agentinstancemodel.h:66
AgentFilterProxyModel * agentFilterProxyModel() const
Returns the agent filter proxy model, use this to filter by agent mimetype or capabilities.
Definition: agentinstancewidget.cpp:213
QPoint bottomRight() const
T value() const
The agent instance is working on something.
Definition: agentinstance.h:78
int height() const
QPixmap pixmap(const QSize &size, Mode mode, State state) const
void setBold(bool enable)
bool isValid() const
void setFont(const QFont &font)
void addWidget(QWidget *widget, int stretch, QFlags< Qt::AlignmentFlag > alignment)
void append(const T &value)
QList< AgentInstance > selectedAgentInstances() const
Returns the selected agent instances.
Definition: agentinstancewidget.cpp:191
uint toUInt(bool *ok) const
int toInt(bool *ok) const
int top() const
void setPen(const QColor &color)
const QItemSelection selection() const
int left() const
void drawPixmap(const QRectF &target, const QPixmap &pixmap, const QRectF &source)
AgentInstanceWidget(QWidget *parent=0)
Creates a new agent instance widget.
Definition: agentinstancewidget.cpp:139
void drawText(const QPointF &position, const QString &text)
Provides a data model for agent instances.
Definition: agentinstancemodel.h:50
virtual QVariant data(const QModelIndex &index, int role) const =0
void setMargin(int margin)
QAbstractItemView * view() const
Returns the view used in the widget.
Definition: agentinstancewidget.cpp:208
The current progress (numerical in percent) of an operation.
Definition: agentinstancemodel.h:68
const QAbstractItemModel * model() const
QVariant data(int role) const
QStyle * style()
A proxy model for filtering AgentType or AgentInstance.
Definition: agentfilterproxymodel.h:52
bool toBool() const
virtual void drawPrimitive(PrimitiveElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget) const =0
void doubleClicked(const Akonadi::AgentInstance ¤t)
This signal is emitted whenever there is a double click on an agent instance.
QString fromLatin1(const char *str, int size)
virtual QRect itemPixmapRect(const QRect &rectangle, int alignment, const QPixmap &pixmap) const
void clicked(const Akonadi::AgentInstance ¤t)
This signal is emitted whenever there is a click on an agent instance.
bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
QObject * parent() const
QString toString() const
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:38:02 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:38:02 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.