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();
127void CollectionStatisticsDelegate::initStyleOption(QStyleOptionViewItem *option, const QModelIndex &index) const
173void 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))) {
319 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:326
void initStyleOption(QStyleOptionViewItem *option, const QModelIndex &index) const override
Definition collectionstatisticsdelegate.cpp:127
bool unreadCountShown() const
Returns whether the unread count is drawn next to the folder name.
Definition collectionstatisticsdelegate.cpp:99
void setUnreadCountShown(bool enable)
Sets whether the unread count is drawn next to the folder name.
Definition collectionstatisticsdelegate.cpp:93
void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const override
Definition collectionstatisticsdelegate.cpp:173
void setProgressAnimationEnabled(bool enable)
Definition collectionstatisticsdelegate.cpp:105
CollectionStatisticsDelegate(QAbstractItemView *parent)
Creates a new collection statistics delegate.
Definition collectionstatisticsdelegate.cpp:79
~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
LinkText
Selection
QBrush foreground(ForegroundRole=NormalText) const
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
const QColor & color() const const
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
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-2024 The KDE developers.
Generated on Sat Dec 21 2024 17:01:42 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Dec 21 2024 17:01:42 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.