Akonadi
collectionstatisticsdelegate.cpp
50 void getCountRecursive(const QModelIndex &index, qint64 &totalCount, qint64 &unreadCount, qint64 &totalSize) const
72 mSelectedUnreadColor = KColorScheme(QPalette::Active, KColorScheme::Selection).foreground(KColorScheme::LinkText).color();
73 mDeselectedUnreadColor = KColorScheme(QPalette::Active, KColorScheme::View).foreground(KColorScheme::LinkText).color();
127 void CollectionStatisticsDelegate::initStyleOption(QStyleOptionViewItem *option, const QModelIndex &index) const
173 void CollectionStatisticsDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
211 qCCritical(AKONADIWIDGETS_LOG) << "Invalid collection at index" << firstColumn << firstColumn.data().toString() << "sibling of" << index
212 << "rowCount=" << index.model()->rowCount(index.parent()) << "parent=" << index.parent().data().toString();
224 if ((d->drawUnreadAfterFolder && index.column() == 0) || (index.column() == 1 || index.column() == 2)) {
258 const QColor unreadColor = (option.state & QStyle::State_Selected) ? d->mSelectedUnreadColor : d->mDeselectedUnreadColor;
261 if (option.decorationPosition == QStyleOptionViewItem::Left || option.decorationPosition == QStyleOptionViewItem::Right) {
268 const bool enoughPlaceForText = (option.rect.width() > (folderWidth + unreadWidth + iconRect.width()));
271 folderName = fm.elidedText(folderName, Qt::ElideRight, option.rect.width() - unreadWidth - iconRect.width());
286 // the iconRect is enlarged to the whole width of the item, in case the text is wider than the underlying icon
288 painter->drawText(QRect(option.rect.x(), iconRect.y(), option.rect.width(), iconRect.height()), Qt::AlignCenter, QString::number(unreadCount));
299 if (index.column() == 1 && ((!expanded && unreadRecursiveCount > 0) || (expanded && unreadCount > 0))) {
306 if (index.column() == 2 && ((!expanded && totalRecursiveCount > 0) || (expanded && totalCount > 0))) {
318 painter->drawText(textRect, option4.displayAlignment | Qt::AlignVCenter, KIO::convertSize(totalSize));
void setProgressAnimationEnabled(bool enable)
Definition: collectionstatisticsdelegate.cpp:105
const QColor & color() const const
virtual bool hasChildren(const QModelIndex &parent) const const
Provides statistics information of a Collection.
Definition: core/collectionstatistics.h:58
AlignLeft
void setPen(const QColor &color)
bool isValid() const const
Selection
ForegroundRole
SE_ItemViewItemText
KIOCORE_EXPORT QString convertSize(KIO::filesize_t size)
QString number(int n, int base)
~CollectionStatisticsDelegate() override
Destroys the collection statistics delegate.
virtual int rowCount(const QModelIndex &parent) const const=0
QModelIndex sibling(int row, int column) const const
Text
int right() const const
int column() const const
T value() const const
int horizontalAdvance(const QString &text, int len) const const
bool unreadCountShown() const
Returns whether the unread count is drawn next to the folder name.
Definition: collectionstatisticsdelegate.cpp:99
int width() const const
void drawText(const QPointF &position, const QString &text)
State_Selected
int left() const const
LinkText
void setRight(int x)
QVariant data(int role) const const
int top() const const
virtual void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const const override
void initStyleOption(QStyleOptionViewItem *option, const QModelIndex &index) const override
Definition: collectionstatisticsdelegate.cpp:127
bool isEmpty() const const
QFontMetrics fontMetrics() const const
int toInt(bool *ok) const const
QAction * statistics(const QObject *recvr, const char *slot, QObject *parent)
virtual void initStyleOption(QStyleOptionViewItem *option, const QModelIndex &index) const const
QBrush foreground(ForegroundRole=NormalText) const
bool toBool() const const
int row() const const
@ FetchingState
There is a fetch of items in this collection in progress.
Definition: entitytreemodel.h:362
ElideRight
CollectionStatisticsDelegate(QAbstractItemView *parent)
Creates a new collection statistics delegate.
Definition: collectionstatisticsdelegate.cpp:79
void updatePalette()
Definition: collectionstatisticsdelegate.cpp:325
int height() const const
QString arg(qlonglong a, int fieldWidth, int base, QChar fillChar) const const
void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const override
Definition: collectionstatisticsdelegate.cpp:173
virtual QRect subElementRect(QStyle::SubElement element, const QStyleOption *option, const QWidget *widget) const const=0
const QFont & font() const const
virtual QModelIndex index(int row, int column, const QModelIndex &parent) const const=0
void setUnreadCountShown(bool enable)
Sets whether the unread count is drawn next to the folder name.
Definition: collectionstatisticsdelegate.cpp:93
QModelIndex parent() const const
void save()
void setBold(bool enable)
Active
void setFont(const QFont &font)
QString elidedText(const QString &text, Qt::TextElideMode mode, int width, int flags) const const
A delegate that draws unread and total count for StatisticsProxyModel.
Definition: collectionstatisticsdelegate.h:52
QObject * parent() const const
const QAbstractItemModel * model() const const
Q_D(Todo)
QString toString() const const
Helper integration between Akonadi and Qt.
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Tue Dec 5 2023 03:52:44 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2023 The KDE developers.
Generated on Tue Dec 5 2023 03:52:44 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.