knode
foldertreewidget.cpp
Go to the documentation of this file.
67 return mFolderTreeWidget->style()->sizeFromContents( QStyle::CT_ItemViewItem, &opt, QSize(), mFolderTreeWidget );
70 virtual void paint( QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index ) const
96 // keeping indipendent state variables is faster than saving and restoring the whole painter state
104 QPalette::ColorGroup cg = opt.state & QStyle::State_Enabled ? QPalette::Normal : QPalette::Disabled;
109 QPalette::ColorRole cr = ( opt.state & QStyle::State_Selected ) ? QPalette::HighlightedText : QPalette::Text;
153 label = item->elidedLabelText( fm, textRect.width() - ( ITEM_LABEL_TO_UNREADCOUNT_SPACING + unreadWidth ) );
156 // the condition inside this call is an optimization (it's faster than simply label != item->labelText())
157 item->setLabelTextElided( ( label.length() != item->labelText().length() ) || ( label != item->labelText() ) );
174 painter->drawText( textRect, Qt::AlignLeft | Qt::TextSingleLine | Qt::AlignVCenter, unreadText );
179 // the condition inside this call is an optimization (it's faster than simply label != item->labelText())
180 item->setLabelTextElided( ( label.length() != item->labelText().length() ) || ( label != item->labelText() ) );
188 // the condition inside this call is an optimization (it's faster than simply label != item->labelText())
189 item->setLabelTextElided( ( label.length() != item->labelText().length() ) || ( label != item->labelText() ) );
199 virtual void setModelData( QWidget *editor, QAbstractItemModel *model, const QModelIndex &index ) const
249 setItemDelegateForColumn( mLabelColumnIndex, new FolderTreeWidgetItemLabelColumnDelegate( this ) );
415 FolderTreeWidgetItem *it = static_cast< FolderTreeWidgetItem * >( QTreeWidgetItem::child( idx ) );
504 QString sizeText = KIO::convertSize( mDataSize >= 0 ? (KIO::filesize_t)mDataSize : (KIO::filesize_t)0 );
551 if ( columnIndex!=tree->labelColumnIndex() && !tree->unreadColumnVisible() && tree->labelColumnVisible() ) {
619 QString FolderTreeWidgetItem::elidedLabelText( const QFontMetrics &metrics, unsigned int width ) const
int childrenUnreadCount() const
Returns the unread message count for the children.
Definition: foldertreewidget.h:350
int addDataSizeColumn(const QString &headerLabel)
Adds a special "DataSize" column to this view and returns its logical index.
Definition: foldertreewidget.cpp:289
void setAlternatingRowColors(bool enable)
int sortColumn() const
void updateColumn(int columnIndex)
Triggers an update for the specified column of this item.
Definition: foldertreewidget.cpp:546
int addTotalColumn(const QString &headerLabel)
Adds a special "Total" column to this view and returns its logical index.
Definition: foldertreewidget.cpp:261
int right() const
QTreeWidgetItem * child(int index) const
A folder tree node to be used with FolderTreeWidget.
Definition: foldertreewidget.h:225
A tree widget useful for displaying a tree of folders containing messages.
Definition: foldertreewidget.h:73
int unreadColumnIndex() const
Returns the logical index of the "Unread" column or -1 if such a column has not been added (yet)...
Definition: foldertreewidget.h:127
const QFont & font() const
bool unreadColumnVisible() const
Returns true if the widget contains an "Unread" column and it's currently visible.
Definition: foldertreewidget.cpp:282
int totalColumnIndex() const
Returns the logical index of the "Total" column or -1 if such a column has not been added (yet)...
Definition: foldertreewidget.h:146
void setDataSize(qint64 s)
Sets the size in bytes of the folder to be displayed in the special "DataSize" column.
Definition: foldertreewidget.cpp:499
virtual QString elidedLabelText(const QFontMetrics &metrics, unsigned int width) const
Returns the label text that has been elided if necessary to fit into the width for the given font met...
Definition: foldertreewidget.cpp:619
void setUniformRowHeights(bool uniform)
void setSortIndicatorShown(bool show)
void itemCollapsed(QTreeWidgetItem *item)
QModelIndex indexFromItem(QTreeWidgetItem *item, int column) const
void setUnreadCountColor(const QColor &clr)
Sets the color used to display the unread message count in the "Label" column.
Definition: foldertreewidget.cpp:322
bool isExpanded() const
bool dataSizeColumnVisible() const
Returns true if the widget contains a "DataSize" column and it's currently visible.
Definition: foldertreewidget.cpp:296
int addUnreadColumn(const QString &headerLabel)
Adds a special "Unread" column to this view and returns its logical index.
Definition: foldertreewidget.cpp:275
void update()
void setUnreadCount(int unreadCount)
Sets the unread message count to be displayed in the special "Unread" column.
Definition: foldertreewidget.cpp:453
bool updateChildrenCounts()
Gathers the counts for the children.
Definition: foldertreewidget.cpp:393
bool isColumnHidden(int logicalIndex) const
Returns true if the column specified by logicalIndex is actually hidden.
Definition: treewidget.cpp:207
FolderTreeWidget(QWidget *parent, const char *name=0)
Constructs a FolderTreeWidget instance.
Definition: foldertreewidget.cpp:216
void setBold(bool enable)
void setFont(const QFont &font)
QString number(int n, int base)
bool totalColumnVisible() const
Returns true if the widget contains a "Total" column and it's currently visible.
Definition: foldertreewidget.cpp:268
FolderType
Folder type information Please note that this list should be kept in the order of items that one want...
Definition: foldertreewidget.h:245
void setPen(const QColor &color)
int left() const
qint64 dataSize() const
Returns the size in bytes of the folder, displayed in the special "DataSize" column.
Definition: foldertreewidget.h:337
void setCloseToQuotaWarningColor(const QColor &clr)
Sets the color used to display the "Label" column text when the item is marked as close to quota...
Definition: foldertreewidget.cpp:316
void setWidth(int width)
QString elidedText(const QString &text, Qt::TextElideMode mode, int width, int flags) const
A basic implementation of an UI for a tree of folders.
QString protocolDescription() const
Returns a descriptive string of the folder's protocol.
Definition: foldertreewidget.cpp:364
void drawText(const QPointF &position, const QString &text)
void * internalPointer() const
void setAllColumnsShowFocus(bool enable)
QTreeWidget * treeWidget() const
Protocol protocol() const
Returns the protocol associated to the folder item.
Definition: foldertreewidget.h:379
void setAcceptDrops(bool on)
void itemExpanded(QTreeWidgetItem *item)
QString toLower() const
int dataSizeColumnIndex() const
Returns the logical index of the "DataSize" column or -1 if such a column has not been added (yet)...
Definition: foldertreewidget.h:165
int childrenTotalCount() const
Returns the total message count for the children.
Definition: foldertreewidget.h:357
QTreeWidgetItem * parent() const
void setRight(int x)
void setSortingEnabled(bool enable)
const QString & labelText() const
Returns the textual data for the "Label" column of the parent FolderTreeWidget.
Definition: foldertreewidget.h:300
int width() const
int addColumn(const QString &label, int headerAlignment=Qt::AlignLeft|Qt::AlignVCenter)
Convenience function that adds a column to this tree widget and returns its logical index...
Definition: treewidget.cpp:279
void setIsCloseToQuota(bool closeToQuota)
Sets the status of the close to quota warning.
Definition: foldertreewidget.cpp:557
friend class FolderTreeWidgetItemLabelColumnDelegate
Definition: foldertreewidget.h:75
void renamed(QTreeWidgetItem *item)
This signal is emitted when the label of item has changed after an edition.
#define ITEM_LABEL_TO_UNREADCOUNT_SPACING
Definition: foldertreewidget.cpp:45
FolderTreeWidgetItem(FolderTreeWidget *parent, const QString &label, Protocol protocol, FolderType folderType)
Constructs a root-item.
Definition: foldertreewidget.cpp:334
virtual void drawControl(ControlElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget) const =0
void setLabelText(const QString &label)
Sets the textual data for the "Label" column of the parent FolderTreeWidget.
Definition: foldertreewidget.cpp:439
void setClickable(bool clickable)
void setText(int column, const QString &text)
virtual void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const
virtual bool operator<(const QTreeWidgetItem &other) const
Operator used for item sorting.
Definition: foldertreewidget.cpp:569
int length() const
bool isLeftToRight()
void setTextAlignment(int column, int alignment)
QHeaderView * header() const
virtual QRect subElementRect(SubElement element, const QStyleOption *option, const QWidget *widget) const =0
void setItemDelegateForColumn(int column, QAbstractItemDelegate *delegate)
void setRootIsDecorated(bool show)
void setTotalCount(int totalCount)
Sets the total message count to be displayed in the special "Total" column.
Definition: foldertreewidget.cpp:476
bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
int labelColumnIndex() const
Returns the logical index of the "Label" column or -1 if such a column has not been added (yet)...
Definition: foldertreewidget.h:108
int childCount() const
const QPen & pen() const
QString arg(qlonglong a, int fieldWidth, int base, const QChar &fillChar) const
void setLeft(int x)
QString text(int column) const
qint64 childrenDataSize() const
Returns the size in bytes of the children folders displayed in the special "DataSize" column...
Definition: foldertreewidget.h:364
void updateColumnForItem(FolderTreeWidgetItem *item, int columnIndex)
Triggers an update for the specified column of the specified item.
Definition: foldertreewidget.cpp:303
void updateExpandedState()
This should be called whenever this item is expanded/collapsed.
Definition: foldertreewidget.cpp:538
bool labelColumnVisible() const
Returns true if the widget contains a "Label" column and it's currently visible.
Definition: foldertreewidget.cpp:254
int addLabelColumn(const QString &headerLabel)
Adds a special "Label" column to this view and returns its logical index.
Definition: foldertreewidget.cpp:244
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:34:18 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:34:18 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.