Akonadi
collectionstatisticsdelegate.cpp
50 void getCountRecursive(const QModelIndex &index, qint64 &totalCount, qint64 &unreadCount, qint64 &totalSize) const
74 mSelectedUnreadColor[state] = KColorScheme(state, KColorScheme::Selection).foreground(KColorScheme::ActiveText).color();
75 mDeselectedUnreadColor[state] = KColorScheme(state, KColorScheme::View).foreground(KColorScheme::ActiveText).color();
130void CollectionStatisticsDelegate::initStyleOption(QStyleOptionViewItem *option, const QModelIndex &index) const
176void CollectionStatisticsDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
214 qCCritical(AKONADIWIDGETS_LOG) << "Invalid collection at index" << firstColumn << firstColumn.data().toString() << "sibling of" << index
215 << "rowCount=" << index.model()->rowCount(index.parent()) << "parent=" << index.parent().data().toString();
227 if ((d->drawUnreadAfterFolder && index.column() == 0) || (index.column() == 1 || index.column() == 2)) {
262 !(option.state & QStyle::State_Enabled) ? QPalette::Disabled : (option.state & QStyle::State_Active ? QPalette::Active : QPalette::Inactive);
263 const QColor unreadColor = (option.state & QStyle::State_Selected) ? d->mSelectedUnreadColor[group] : d->mDeselectedUnreadColor[group];
266 if (option.decorationPosition == QStyleOptionViewItem::Left || option.decorationPosition == QStyleOptionViewItem::Right) {
273 const bool enoughPlaceForText = (option.rect.width() > (folderWidth + unreadWidth + iconRect.width()));
276 folderName = fm.elidedText(folderName, Qt::ElideRight, option.rect.width() - unreadWidth - iconRect.width());
291 // the iconRect is enlarged to the whole width of the item, in case the text is wider than the underlying icon
293 painter->drawText(QRect(option.rect.x(), iconRect.y(), option.rect.width(), iconRect.height()), Qt::AlignCenter, QString::number(unreadCount));
304 if (index.column() == 1 && ((!expanded && unreadRecursiveCount > 0) || (expanded && unreadCount > 0))) {
311 if (index.column() == 2 && ((!expanded && totalRecursiveCount > 0) || (expanded && totalCount > 0))) {
324 painter->drawText(textRect, option4.displayAlignment | Qt::AlignVCenter, format.formatByteSize(totalSize));
A delegate that draws unread and total count for StatisticsProxyModel.
Definition collectionstatisticsdelegate.h:53
void updatePalette()
Definition collectionstatisticsdelegate.cpp:331
void initStyleOption(QStyleOptionViewItem *option, const QModelIndex &index) const override
Definition collectionstatisticsdelegate.cpp:130
bool unreadCountShown() const
Returns whether the unread count is drawn next to the folder name.
Definition collectionstatisticsdelegate.cpp:102
void setUnreadCountShown(bool enable)
Sets whether the unread count is drawn next to the folder name.
Definition collectionstatisticsdelegate.cpp:96
void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const override
Definition collectionstatisticsdelegate.cpp:176
void setProgressAnimationEnabled(bool enable)
Definition collectionstatisticsdelegate.cpp:108
CollectionStatisticsDelegate(QAbstractItemView *parent)
Creates a new collection statistics delegate.
Definition collectionstatisticsdelegate.cpp:82
~CollectionStatisticsDelegate() override
Destroys the collection statistics delegate.
Provides statistics information of a Collection.
Definition core/collectionstatistics.h:59
@ FetchingState
There is a fetch of items in this collection in progress.
Definition entitytreemodel.h:362
ActiveText
Selection
QString formatByteSize(double size, int precision=1, KFormat::BinaryUnitDialect dialect=KFormat::DefaultBinaryDialect, KFormat::BinarySizeUnits units=KFormat::DefaultBinaryUnits) const
Helper integration between Akonadi and Qt.
QAction * statistics(const QObject *recvr, const char *slot, QObject *parent)
virtual bool hasChildren(const QModelIndex &parent) const const
virtual QModelIndex index(int row, int column, const QModelIndex &parent) const const=0
virtual int rowCount(const QModelIndex &parent) const const=0
void setBold(bool enable)
QString elidedText(const QString &text, Qt::TextElideMode mode, int width, int flags) const const
int horizontalAdvance(QChar ch) const const
int column() const const
QVariant data(int role) const const
const QAbstractItemModel * model() const const
QModelIndex parent() const const
int row() const const
QModelIndex sibling(int row, int column) const const
QObject * parent() const const
T qobject_cast(QObject *object)
void drawText(const QPoint &position, const QString &text)
const QFont & font() const const
QFontMetrics fontMetrics() const const
void save()
void setFont(const QFont &font)
void setPen(Qt::PenStyle style)
Active
Text
int height() const const
int left() const const
int right() const const
void setRight(int x)
int top() const const
int width() const const
int y() const const
QString arg(Args &&... args) const const
bool isEmpty() const const
QString number(double n, char format, int precision)
State_Selected
SE_ItemViewItemText
virtual QRect subElementRect(SubElement element, const QStyleOption *option, const QWidget *widget) const const=0
QStyledItemDelegate(QObject *parent)
virtual void initStyleOption(QStyleOptionViewItem *option, const QModelIndex &index) const const
virtual void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const const override
AlignLeft
ForegroundRole
ElideRight
bool isValid() const const
bool toBool() const const
int toInt(bool *ok) const const
QString toString() const const
T value() const const
Q_D(Todo)
This file is part of the KDE documentation.
Documentation copyright © 1996-2025 The KDE developers.
Generated on Fri Feb 21 2025 11:50:41 by doxygen 1.13.2 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2025 The KDE developers.
Generated on Fri Feb 21 2025 11:50:41 by doxygen 1.13.2 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.