Akonadi
agentinstancewidget.cpp
61 void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const override;
80 void currentAgentInstanceChanged(const QModelIndex ¤tIndex, const QModelIndex &previousIndex);
90void AgentInstanceWidgetPrivate::currentAgentInstanceChanged(const QModelIndex ¤tIndex, const QModelIndex &previousIndex)
105void AgentInstanceWidgetPrivate::currentAgentInstanceDoubleClicked(const QModelIndex ¤tIndex)
149 d->mView->selectionModel()->setCurrentIndex(d->mView->model()->index(0, 0), QItemSelectionModel::Select);
152 connect(d->mView->selectionModel(), &QItemSelectionModel::currentChanged, this, [this](const auto &tl, const auto &br) {
212void AgentInstanceWidgetDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
225 QString statusMessage = index.model()->data(index, AgentInstanceModel::StatusMessageRole).toString();
250 const QSize statusIconSize = statusPixmap.size(); //= KIconLoader::global()->currentSize(KIconLoader::Small);
256 const QRect decorationRect(innerRect.left(), innerRect.top(), decorationSize.width(), innerRect.height());
257 const QRect nameTextRect(decorationRect.topRight() + QPoint(4, 0), innerRect.topRight() + QPoint(0, innerRect.height() / 2));
258 const QRect statusTextRect(decorationRect.bottomRight() + QPoint(4, -innerRect.height() / 2), innerRect.bottomRight());
260 QPalette::ColorGroup cg = (option.state & QStyle::State_Enabled) ? QPalette::Normal : QPalette::Disabled;
271 painter->drawPixmap(style->itemPixmapRect(decorationRect, Qt::AlignCenter, iconPixmap), iconPixmap);
277 painter->drawText(statusTextRect.adjusted(statusIconSize.width() + 4, 0, 0, 0), Qt::AlignVCenter | Qt::AlignLeft, statusMessage);
278 painter->drawPixmap(style->itemPixmapRect(statusTextRect, Qt::AlignVCenter | Qt::AlignLeft, statusPixmap), statusPixmap);
281QSize AgentInstanceWidgetDelegate::sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const
285 const int iconHeight = QApplication::style()->pixelMetric(QStyle::PM_MessageBoxIconSize) + (s_delegatePaddingSize * 2); // icon height + padding either side
287 option.fontMetrics.height() + qMax(option.fontMetrics.height(), 16) + (s_delegatePaddingSize * 2); // height of text + icon/text + padding either side
289 return QSize(1, qMax(iconHeight, textHeight)); // any width,the view will give us the whole thing in list mode
Represents one agent instance and takes care of communication with it.
Definition akonadicontrol/agentinstance.h:35
A proxy model for filtering AgentType or AgentInstance.
Definition agentfilterproxymodel.h:43
Provides a data model for agent instances.
Definition agentinstancemodel.h:41
@ ProgressRole
The current progress (numerical in percent) of an operation.
Definition agentinstancemodel.h:60
void doubleClicked(const Akonadi::AgentInstance ¤t)
This signal is emitted whenever there is a double click on an agent instance.
QList< AgentInstance > selectedAgentInstances() const
Returns the selected agent instances.
Definition agentinstancewidget.cpp:180
void clicked(const Akonadi::AgentInstance ¤t)
This signal is emitted whenever there is a click on an agent instance.
~AgentInstanceWidget() override
Destroys the agent instance widget.
AgentInstance currentAgentInstance() const
Returns the current agent instance or an invalid agent instance if no agent instance is selected.
Definition agentinstancewidget.cpp:165
QAbstractItemView * view() const
Returns the view used in the widget.
Definition agentinstancewidget.cpp:197
void currentChanged(const Akonadi::AgentInstance ¤t, const Akonadi::AgentInstance &previous)
This signal is emitted whenever the current agent instance changes.
AgentFilterProxyModel * agentFilterProxyModel() const
Returns the agent filter proxy model, use this to filter by agent mimetype or capabilities.
Definition agentinstancewidget.cpp:202
AgentInstanceWidget(QWidget *parent=nullptr)
Creates a new agent instance widget.
Definition agentinstancewidget.cpp:125
Q_SCRIPTABLE CaptureState status()
QString i18nc(const char *context, const char *text, const TYPE &arg...)
Helper integration between Akonadi and Qt.
QString name(StandardShortcut id)
virtual QVariant data(const QModelIndex &index, int role) const const=0
ScrollPerPixel
ExtendedSelection
void clicked(const QModelIndex &index)
void doubleClicked(const QModelIndex &index)
QStyle * style()
void setBold(bool enable)
QModelIndexList indexes() const const
void currentChanged(const QModelIndex ¤t, const QModelIndex &previous)
QModelIndex currentIndex() const const
const QItemSelection selection() const const
void addWidget(QWidget *w)
void setContentsMargins(const QMargins &margins)
void append(QList< T > &&value)
void reserve(qsizetype size)
QVariant data(int role) const const
bool isValid() const const
const QAbstractItemModel * model() const const
Q_OBJECTQ_OBJECT
QMetaObject::Connection connect(const QObject *sender, PointerToMemberFunction signal, Functor functor)
QObject * parent() const const
T qobject_cast(QObject *object)
void drawPixmap(const QPoint &point, const QPixmap &pixmap)
void drawText(const QPoint &position, const QString &text)
void setFont(const QFont &font)
void setPen(Qt::PenStyle style)
ColorGroup
HighlightedText
QSize size() const const
QPoint bottomRight() const const
int height() const const
int left() const const
int top() const const
QPoint topRight() const const
int width() const const
QString & append(QChar ch)
PM_MessageBoxIconSize
PE_PanelItemViewItem
State_Enabled
virtual void drawPrimitive(PrimitiveElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget) const const=0
virtual QRect itemPixmapRect(const QRect &rectangle, int alignment, const QPixmap &pixmap) const const
virtual int pixelMetric(PixelMetric metric, const QStyleOption *option, const QWidget *widget) const const=0
AlignCenter
CaseInsensitive
NoContextMenu
DecorationRole
bool toBool() const const
int toInt(bool *ok) const const
QString toString() const const
uint toUInt(bool *ok) const const
T value() const const
QLayout * layout() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Tue Mar 26 2024 11:13:38 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2024 The KDE developers.
Generated on Tue Mar 26 2024 11:13:38 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.