KIO
kfileitemdelegate.cpp
60 QString elidedText(QTextLayout &layout, const QStyleOptionViewItem &option, const QSize &maxSize) const;
61 QSize layoutText(QTextLayout &layout, const QStyleOptionViewItem &option, const QString &text, const QSize &constraints) const;
77 QString information(const QStyleOptionViewItem &option, const QModelIndex &index, const KFileItem &item) const;
94 KIO::AnimationState *animationState(const QStyleOptionViewItem &option, const QModelIndex &index, const QAbstractItemView *view) const;
99 void drawFocusRect(QPainter *painter, const QStyleOptionViewItem &option, const QRect &rect) const;
103 void paintJobTransfers(QPainter *painter, const qreal &jobAnimationAngle, const QPoint &iconPos, const QStyleOptionViewItem &opt);
144void KFileItemDelegate::Private::setVerticalMargin(MarginType type, int left, int top, int right, int bottom)
152void KFileItemDelegate::Private::setHorizontalMargin(MarginType type, int left, int top, int right, int bottom)
160void KFileItemDelegate::Private::setVerticalMargin(MarginType type, int horizontal, int vertical)
165void KFileItemDelegate::Private::setHorizontalMargin(MarginType type, int horizontal, int vertical)
199QString KFileItemDelegate::Private::itemSize(const QModelIndex &index, const KFileItem &item) const
208 const int count = value.typeId() == QMetaType::Int ? value.toInt() : KDirModel::ChildCountUnknown;
220// Returns the additional information string, if one should be shown, or an empty string otherwise
221QString KFileItemDelegate::Private::information(const QStyleOptionViewItem &option, const QModelIndex &index, const KFileItem &item) const
319QSize KFileItemDelegate::Private::layoutText(QTextLayout &layout, const QStyleOptionViewItem &option, const QString &text, const QSize &constraints) const
332QSize KFileItemDelegate::Private::layoutText(QTextLayout &layout, const QString &text, int maxWidth) const
359QString KFileItemDelegate::Private::elidedText(QTextLayout &layout, const QStyleOptionViewItem &option, const QSize &size) const
392 elided += option.fontMetrics.elidedText(text.mid(start, length), option.textElideMode, maxWidth);
406void KFileItemDelegate::Private::setLayoutOptions(QTextLayout &layout, const QStyleOptionViewItem &option) const
411 textoption.setWrapMode((option.features & QStyleOptionViewItem::WrapText) ? wrapMode : QTextOption::NoWrap);
417QSize KFileItemDelegate::Private::displaySizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const
422 maxWidth = verticalLayout(option) && (option.features & QStyleOptionViewItem::WrapText) ? option.decorationSize.width() + 10 : 32757;
426 maxWidth = maximumSize.width() - (itemMargin.left + itemMargin.right) - (textMargin.left + textMargin.right);
453QSize KFileItemDelegate::Private::decorationSizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const
474 return (option.decorationPosition == QStyleOptionViewItem::Top || option.decorationPosition == QStyleOptionViewItem::Bottom);
478QBrush KFileItemDelegate::Private::brush(const QVariant &value, const QStyleOptionViewItem &option) const
495QBrush KFileItemDelegate::Private::foregroundBrush(const QStyleOptionViewItem &option, const QModelIndex &index) const
545KFileItemDelegate::Private::animationState(const QStyleOptionViewItem &option, const QModelIndex &index, const QAbstractItemView *view) const
558QPixmap KFileItemDelegate::Private::transition(const QPixmap &from, const QPixmap &to, qreal amount) const
577 const bool usePixmap = from.paintEngine()->hasFeature(QPaintEngine::PorterDuff) && from.paintEngine()->hasFeature(QPaintEngine::BlendModes);
664 const QSize size(qMax(labelSize.width(), infoSize.width()), labelSize.height() + infoSize.height());
665 *textBoundingRect = QStyle::alignedRect(option.direction, option.displayAlignment, size, textRect);
697 QImage image(boundingRect.size() + QSize(padding * 2, padding * 2), QImage::Format_ARGB32_Premultiplied);
705 painter->drawImage(boundingRect.topLeft() - QPoint(padding, padding) + shadowOffset.toPoint(), image);
725void KFileItemDelegate::Private::initStyleOption(QStyleOptionViewItem *option, const QModelIndex &index) const
773void KFileItemDelegate::Private::paintJobTransfers(QPainter *painter, const qreal &jobAnimationAngle, const QPoint &iconPos, const QStyleOptionViewItem &opt)
779 QPoint bottomRightCorner = QPoint(iconPos.x() + iconSize.width() * 0.75, iconPos.y() + iconSize.height() * 0.60);
788 painter->drawPixmap(-downArrow.size().width() * .50, -downArrow.size().height() * .50, downArrow);
821 d->setHorizontalMargin(Private::TextMargin, textMargin, focusVMargin, focusHMargin, focusVMargin);
839QSize KFileItemDelegate::sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const
977QRect KFileItemDelegate::iconRect(const QStyleOptionViewItem &option, const QModelIndex &index) const
998QIcon KFileItemDelegate::Private::decoration(const QStyleOptionViewItem &option, const QModelIndex &index) const
1026QRect KFileItemDelegate::Private::labelRectangle(const QStyleOptionViewItem &option, const QModelIndex &index) const
1028 const QSize decoSize = (index.column() == 0) ? addMargin(option.decorationSize, Private::IconMargin) : QSize(0, 0);
1093void KFileItemDelegate::Private::drawFocusRect(QPainter *painter, const QStyleOptionViewItem &option, const QRect &rect) const
1105 opt.backgroundColor = option.palette.color(option.state & QStyle::State_Selected ? QPalette::Highlight : QPalette::Base);
1116void KFileItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
1143 qreal progress = ((opt.state & QStyle::State_MouseOver) && index.column() == KDirModel::Name) ? 1.0 : 0.0;
1178 const QPixmap fadeFromPixmap = d->transition(fadeFromCache->regular, fadeFromCache->hover, progress);
1206 // The cache may have been discarded, but the animation handler still needs to know about new icons
1242 QRect focusRect = textBoundingRect.adjusted(-focusHMargin, -focusVMargin, +focusHMargin, +focusVMargin);
1284 const QPixmap fadeFromPixmap = d->transition(fadeFromCache->regular, fadeFromCache->hover, progress);
1327void KFileItemDelegate::drawSelectionEmblem(QStyleOptionViewItem option, QPainter *painter, const QModelIndex &index) const
1329 if (index.column() != 0 || !qApp->style()->styleHint(QStyle::SH_ItemView_ActivateItemOnSingleClick)) {
1333 if ((state & QStyle::State_MouseOver && !fileItem(index).isDir()) || (state & QStyle::State_Selected)) {
1334 const QString selectionEmblem = state & QStyle::State_Selected ? QStringLiteral("emblem-remove") : QStringLiteral("emblem-added");
1335 const auto emblem = QIcon::fromTheme(selectionEmblem).pixmap(d->emblemRect.size(), state & QStyle::State_MouseOver ? QIcon::Active : QIcon::Disabled);
1354QWidget *KFileItemDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const
1368bool KFileItemDelegate::editorEvent(QEvent *event, QAbstractItemModel *model, const QStyleOptionViewItem &option, const QModelIndex &index)
1409void KFileItemDelegate::setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const
1417void KFileItemDelegate::updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &option, const QModelIndex &index) const
1452bool KFileItemDelegate::helpEvent(QHelpEvent *event, QAbstractItemView *view, const QStyleOptionViewItem &option, const QModelIndex &index)
@ FileItemRole
returns the KFileItem for a given index. roleName is "fileItem".
Definition kdirmodel.h:160
@ ChildCountRole
returns the number of items in a directory, or ChildCountUnknown. roleName is "childCount".
Definition kdirmodel.h:161
@ HasJobRole
returns whether or not there is a job on an item (file/directory). roleName is "hasJob".
Definition kdirmodel.h:162
KFileItemDelegate is intended to be used to provide a KDE file system view, when using one of the sta...
Definition kfileitemdelegate.h:57
void setShowInformation(const InformationList &list)
Sets the list of information lines that are shown below the icon label in list views.
Definition kfileitemdelegate.cpp:898
void setShadowColor(const QColor &color)
Sets the color used for drawing the text shadow.
Definition kfileitemdelegate.cpp:917
QPointF shadowOffset
This property holds the horizontal and vertical offset for the text shadow.
Definition kfileitemdelegate.h:91
QColor shadowColor
This property holds the color used for the text shadow.
Definition kfileitemdelegate.h:81
void setSelectionEmblemRect(QRect rect, int iconSize)
Set the rectangle where selectionEmblem should be drawn in.
Definition kfileitemdelegate.cpp:1590
InformationList information
This property holds which additional information (if any) should be shown below items in icon views.
Definition kfileitemdelegate.h:68
void setShadowOffset(const QPointF &offset)
Sets the horizontal and vertical offset for the text shadow.
Definition kfileitemdelegate.cpp:927
qreal shadowBlur
This property holds the blur radius for the text shadow.
Definition kfileitemdelegate.h:101
bool editorEvent(QEvent *event, QAbstractItemModel *model, const QStyleOptionViewItem &option, const QModelIndex &index) override
Reimplemented from QAbstractItemDelegate.
Definition kfileitemdelegate.cpp:1368
QRect selectionEmblemRect() const
Definition kfileitemdelegate.cpp:1602
void setMaximumSize(const QSize &size)
Sets the maximum size for KFileItemDelegate::sizeHint().
Definition kfileitemdelegate.cpp:947
void setWrapMode(QTextOption::WrapMode wrapMode)
When the contents text needs to be wrapped, wrapMode strategy will be followed.
Definition kfileitemdelegate.cpp:967
QRect iconRect(const QStyleOptionViewItem &option, const QModelIndex &index) const
Returns the rectangle of the icon that is aligned inside the decoration rectangle.
Definition kfileitemdelegate.cpp:977
Information
This enum defines the additional information that can be displayed below item labels in icon views.
Definition kfileitemdelegate.h:147
@ Comment
A simple comment that can be displayed to the user as is.
Definition kfileitemdelegate.h:161
@ OwnerAndGroup
The user and group that owns the file, e.g. root:root.
Definition kfileitemdelegate.h:153
@ LocalPathOrUrl
The local path to the file or the URL in case it is not a local file.
Definition kfileitemdelegate.h:160
@ FriendlyMimeType
The descriptive name for the MIME type, e.g. HTML Document.
Definition kfileitemdelegate.h:158
@ ModificationTime
The date and time the file/folder was last modified.
Definition kfileitemdelegate.h:155
@ Size
The file size for files, and the number of items for folders.
Definition kfileitemdelegate.h:149
QWidget * createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const override
Reimplemented from QAbstractItemDelegate.
Definition kfileitemdelegate.cpp:1354
QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const override
Returns the nominal size for the item referred to by index, given the provided options.
Definition kfileitemdelegate.cpp:839
QSize maximumSize
This property holds the maximum size that can be returned by KFileItemDelegate::sizeHint().
Definition kfileitemdelegate.h:108
bool showToolTipWhenElided
This property determines whether a tooltip will be shown by the delegate if the display role is elide...
Definition kfileitemdelegate.h:117
KFileItemDelegate(QObject *parent=nullptr)
Constructs a new KFileItemDelegate.
Definition kfileitemdelegate.cpp:811
void updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &option, const QModelIndex &index) const override
Reimplemented from QAbstractItemDelegate.
Definition kfileitemdelegate.cpp:1417
void setJobTransfersVisible(bool jobTransfersVisible)
Enable/Disable the displaying of an animated overlay that is shown for any destination urls (in the v...
Definition kfileitemdelegate.cpp:987
void setShadowBlur(qreal radius)
Sets the blur radius for the text shadow.
Definition kfileitemdelegate.cpp:937
bool jobTransfersVisible
This property determines if there are KIO jobs on a destination URL visible, then they will have a sm...
Definition kfileitemdelegate.h:123
void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const override
Reimplemented from QAbstractItemDelegate.
Definition kfileitemdelegate.cpp:1409
InformationList showInformation() const
Returns the file item information that should be shown below item labels in list views.
Definition kfileitemdelegate.cpp:912
void setShowToolTipWhenElided(bool showToolTip)
Sets whether a tooltip should be shown if the display role is elided containing the full display role...
Definition kfileitemdelegate.cpp:957
QTextOption::WrapMode wrapMode() const
Returns the wrapping strategy followed to show text when it needs wrapping.
Definition kfileitemdelegate.cpp:972
QRegion shape(const QStyleOptionViewItem &option, const QModelIndex &index)
Returns the shape of the item as a region.
Definition kfileitemdelegate.cpp:1492
bool eventFilter(QObject *object, QEvent *event) override
Reimplemented from QAbstractItemDelegate.
Definition kfileitemdelegate.cpp:1536
void setEditorData(QWidget *editor, const QModelIndex &index) const override
Reimplemented from QAbstractItemDelegate.
Definition kfileitemdelegate.cpp:1378
void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const override
Paints the item indicated by index, using painter.
Definition kfileitemdelegate.cpp:1116
bool helpEvent(QHelpEvent *event, QAbstractItemView *view, const QStyleOptionViewItem &option, const QModelIndex &index) override
Reimplemented from QAbstractItemDelegate.
Definition kfileitemdelegate.cpp:1452
Q_INVOKABLE QString timeString(KFileItem::FileTimes which=ModificationTime) const
Requests the modification, access or creation time as a string, depending on which.
Definition kfileitem.cpp:1579
mode_t permissions() const
Returns the permissions of the file (stat.st_mode containing only permissions).
Definition kfileitem.cpp:1671
QString permissionsString() const
Returns the access permissions for the file as a string.
Definition kfileitem.cpp:1563
static void toActive(QImage &image)
static void semiTransparent(QImage &image)
SizeHuge
SizeMedium
SizeEnormous
SizeSmallMedium
SizeSmall
Q_SCRIPTABLE Q_NOREPLY void start()
QString i18nc(const char *context, const char *text, const TYPE &arg...)
QString i18ncp(const char *context, const char *singular, const char *plural, const TYPE &arg...)
Type type(const QSqlDatabase &db)
KIOCORE_EXPORT QString convertSize(KIO::filesize_t size)
Converts size from bytes to the string representation.
Definition global.cpp:43
void informationList(QWidget *parent, const QString &text, const QStringList &strlist, const QString &title=QString(), const QString &dontShowAgainName=QString(), Options options=Notify)
void information(QWidget *parent, const QString &text, const QString &title=QString(), const QString &dontShowAgainName=QString(), Options options=Notify)
QString label(StandardShortcut id)
KCOREADDONS_EXPORT QString preProcessWrap(const QString &text)
QAbstractItemDelegate(QObject *parent)
void closeEditor(QWidget *editor, QAbstractItemDelegate::EndEditHint hint)
void commitData(QWidget *editor)
virtual bool helpEvent(QHelpEvent *event, QAbstractItemView *view, const QStyleOptionViewItem &option, const QModelIndex &index)
virtual bool setData(const QModelIndex &index, const QVariant &value, int role)
void setHorizontalScrollBarPolicy(Qt::ScrollBarPolicy)
void setVerticalScrollBarPolicy(Qt::ScrollBarPolicy)
QWidget * activePopupWidget()
QStyle * style()
LineSeparator
int blue() const const
int green() const const
int red() const const
void setAlphaF(float alpha)
KeyPress
frameWidth
bool isRightToLeft()
QPixmap pixmap(QWindow *window, const QSize &size, Mode mode, State state) const const
Mode
State
void addPixmap(const QPixmap &pixmap, Mode mode, State state)
QIcon fromTheme(const QString &name)
Format_ARGB32_Premultiplied
QRect rect() const const
QString suffixForFileName(const QString &fileName) const const
int column() const const
QVariant data(int role) const const
bool isValid() const const
QObject(QObject *parent)
Q_EMITQ_EMIT
virtual bool event(QEvent *e)
QObject * parent() const const
T qobject_cast(QObject *object)
qreal devicePixelRatioF() const const
virtual QPaintEngine * paintEngine() const const=0
PorterDuff
bool hasFeature(PaintEngineFeatures feature) const const
CompositionMode_DestinationIn
Antialiasing
bool begin(QPaintDevice *device)
QPaintDevice * device() const const
void drawEllipse(const QPoint ¢er, int rx, int ry)
void drawImage(const QPoint &point, const QImage &image)
void drawPixmap(const QPoint &point, const QPixmap &pixmap)
bool end()
void fillRect(const QRect &rectangle, QGradient::Preset preset)
void restore()
void rotate(qreal angle)
void save()
void setBrush(Qt::BrushStyle style)
void setCompositionMode(CompositionMode mode)
void setPen(Qt::PenStyle style)
void setRenderHint(RenderHint hint, bool on)
void translate(const QPoint &offset)
ColorGroup
HighlightedText
QPixmap fromImage(QImage &&image, Qt::ImageConversionFlags flags)
bool isNull() const const
QRect rect() const const
QSize size() const const
QImage toImage() const const
int x() const const
int y() const const
void adjust(int dx1, int dy1, int dx2, int dy2)
QRect adjusted(int dx1, int dy1, int dx2, int dy2) const const
int bottom() const const
QPoint center() const const
int height() const const
int left() const const
int right() const const
void setBottom(int y)
void setLeft(int x)
void setRight(int x)
void setTop(int y)
QSize size() const const
int top() const const
QPoint topLeft() const const
void translate(const QPoint &offset)
int width() const const
int x() const const
int y() const const
QSize boundedTo(const QSize &otherSize) const const
int height() const const
int & rheight()
int & rwidth()
void setWidth(int width)
int width() const const
bool endsWith(QChar c, Qt::CaseSensitivity cs) const const
qsizetype indexOf(QChar ch, qsizetype from, Qt::CaseSensitivity cs) const const
bool isEmpty() const const
qsizetype length() const const
QString mid(qsizetype position, qsizetype n) const const
QString number(double n, char format, int precision)
QString & replace(QChar before, QChar after, Qt::CaseSensitivity cs)
void reserve(qsizetype size)
PM_FocusFrameHMargin
PE_FrameFocusRect
State_Enabled
SH_Widget_Animate
QRect alignedRect(Qt::LayoutDirection direction, Qt::Alignment alignment, const QSize &size, const QRect &rectangle)
virtual void drawPrimitive(PrimitiveElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget) const const=0
virtual int pixelMetric(PixelMetric metric, const QStyleOption *option, const QWidget *widget) const const=0
Qt::Alignment visualAlignment(Qt::LayoutDirection direction, Qt::Alignment alignment)
QRect visualRect(Qt::LayoutDirection direction, const QRect &boundingRectangle, const QRect &logicalRectangle)
WrapText
typedef Alignment
NoBrush
transparent
ForegroundRole
Key_Tab
Orientation
ScrollBarAlwaysOff
QTextStream & left(QTextStream &stream)
QTextStream & right(QTextStream &stream)
KeepAnchor
StartOfBlock
bool movePosition(MoveOperation operation, MoveMode mode, int n)
void setAcceptRichText(bool accept)
void insertPlainText(const QString &text)
void selectAll()
void setAlignment(Qt::Alignment a)
void setTextCursor(const QTextCursor &cursor)
QTextCursor textCursor() const const
QString toPlainText() const const
void beginLayout()
QTextLine createLine()
void draw(QPainter *p, const QPointF &pos, const QList< FormatRange > &selections, const QRectF &clip) const const
void endLayout()
QFont font() const const
QTextLine lineAt(int i) const const
int lineCount() const const
void setFont(const QFont &font)
void setPosition(const QPointF &p)
void setText(const QString &string)
void setTextOption(const QTextOption &option)
QString text() const const
const QTextOption & textOption() const const
qreal height() const const
qreal naturalTextWidth() const const
void setLineWidth(qreal width)
void setPosition(const QPointF &pos)
int textLength() const const
int textStart() const const
WrapMode
void setAlignment(Qt::Alignment alignment)
void setTextDirection(Qt::LayoutDirection direction)
void setWrapMode(WrapMode mode)
QString toDisplayString(FormattingOptions options) const const
bool isValid() const const
bool toBool() const const
double toDouble(bool *ok) const const
int toInt(bool *ok) const const
QString toString() const const
int typeId() const const
int userType() const const
void setEnabled(bool)
void setGeometry(const QRect &)
This file is part of the KDE documentation.
Documentation copyright © 1996-2025 The KDE developers.
Generated on Fri Apr 11 2025 11:51:43 by doxygen 1.13.2 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2025 The KDE developers.
Generated on Fri Apr 11 2025 11:51:43 by doxygen 1.13.2 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.