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);
141void KFileItemDelegate::Private::setVerticalMargin(MarginType type, int left, int top, int right, int bottom)
149void KFileItemDelegate::Private::setHorizontalMargin(MarginType type, int left, int top, int right, int bottom)
157void KFileItemDelegate::Private::setVerticalMargin(MarginType type, int horizontal, int vertical)
162void KFileItemDelegate::Private::setHorizontalMargin(MarginType type, int horizontal, int vertical)
196QString KFileItemDelegate::Private::itemSize(const QModelIndex &index, const KFileItem &item) const
205 const int count = value.typeId() == QMetaType::Int ? value.toInt() : KDirModel::ChildCountUnknown;
217// Returns the additional information string, if one should be shown, or an empty string otherwise
218QString KFileItemDelegate::Private::information(const QStyleOptionViewItem &option, const QModelIndex &index, const KFileItem &item) const
316QSize KFileItemDelegate::Private::layoutText(QTextLayout &layout, const QStyleOptionViewItem &option, const QString &text, const QSize &constraints) const
329QSize KFileItemDelegate::Private::layoutText(QTextLayout &layout, const QString &text, int maxWidth) const
356QString KFileItemDelegate::Private::elidedText(QTextLayout &layout, const QStyleOptionViewItem &option, const QSize &size) const
389 elided += option.fontMetrics.elidedText(text.mid(start, length), option.textElideMode, maxWidth);
403void KFileItemDelegate::Private::setLayoutOptions(QTextLayout &layout, const QStyleOptionViewItem &option) const
408 textoption.setWrapMode((option.features & QStyleOptionViewItem::WrapText) ? wrapMode : QTextOption::NoWrap);
414QSize KFileItemDelegate::Private::displaySizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const
419 maxWidth = verticalLayout(option) && (option.features & QStyleOptionViewItem::WrapText) ? option.decorationSize.width() + 10 : 32757;
423 maxWidth = maximumSize.width() - (itemMargin.left + itemMargin.right) - (textMargin.left + textMargin.right);
450QSize KFileItemDelegate::Private::decorationSizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const
471 return (option.decorationPosition == QStyleOptionViewItem::Top || option.decorationPosition == QStyleOptionViewItem::Bottom);
475QBrush KFileItemDelegate::Private::brush(const QVariant &value, const QStyleOptionViewItem &option) const
492QBrush KFileItemDelegate::Private::foregroundBrush(const QStyleOptionViewItem &option, const QModelIndex &index) const
542KFileItemDelegate::Private::animationState(const QStyleOptionViewItem &option, const QModelIndex &index, const QAbstractItemView *view) const
555QPixmap KFileItemDelegate::Private::transition(const QPixmap &from, const QPixmap &to, qreal amount) const
574 const bool usePixmap = from.paintEngine()->hasFeature(QPaintEngine::PorterDuff) && from.paintEngine()->hasFeature(QPaintEngine::BlendModes);
661 const QSize size(qMax(labelSize.width(), infoSize.width()), labelSize.height() + infoSize.height());
662 *textBoundingRect = QStyle::alignedRect(option.direction, option.displayAlignment, size, textRect);
694 QImage image(boundingRect.size() + QSize(padding * 2, padding * 2), QImage::Format_ARGB32_Premultiplied);
702 painter->drawImage(boundingRect.topLeft() - QPoint(padding, padding) + shadowOffset.toPoint(), image);
722void KFileItemDelegate::Private::initStyleOption(QStyleOptionViewItem *option, const QModelIndex &index) const
770void KFileItemDelegate::Private::paintJobTransfers(QPainter *painter, const qreal &jobAnimationAngle, const QPoint &iconPos, const QStyleOptionViewItem &opt)
776 QPoint bottomRightCorner = QPoint(iconPos.x() + iconSize.width() * 0.75, iconPos.y() + iconSize.height() * 0.60);
785 painter->drawPixmap(-downArrow.size().width() * .50, -downArrow.size().height() * .50, downArrow);
818 d->setHorizontalMargin(Private::TextMargin, textMargin, focusVMargin, focusHMargin, focusVMargin);
836QSize KFileItemDelegate::sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const
974QRect KFileItemDelegate::iconRect(const QStyleOptionViewItem &option, const QModelIndex &index) const
995QIcon KFileItemDelegate::Private::decoration(const QStyleOptionViewItem &option, const QModelIndex &index) const
1023QRect KFileItemDelegate::Private::labelRectangle(const QStyleOptionViewItem &option, const QModelIndex &index) const
1025 const QSize decoSize = (index.column() == 0) ? addMargin(option.decorationSize, Private::IconMargin) : QSize(0, 0);
1090void KFileItemDelegate::Private::drawFocusRect(QPainter *painter, const QStyleOptionViewItem &option, const QRect &rect) const
1102 opt.backgroundColor = option.palette.color(option.state & QStyle::State_Selected ? QPalette::Highlight : QPalette::Base);
1113void KFileItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
1140 qreal progress = ((opt.state & QStyle::State_MouseOver) && index.column() == KDirModel::Name) ? 1.0 : 0.0;
1174 const QPixmap fadeFromPixmap = d->transition(fadeFromCache->regular, fadeFromCache->hover, progress);
1201 // The cache may have been discarded, but the animation handler still needs to know about new icons
1237 QRect focusRect = textBoundingRect.adjusted(-focusHMargin, -focusVMargin, +focusHMargin, +focusVMargin);
1277 const QPixmap fadeFromPixmap = d->transition(fadeFromCache->regular, fadeFromCache->hover, progress);
1318QWidget *KFileItemDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const
1332bool KFileItemDelegate::editorEvent(QEvent *event, QAbstractItemModel *model, const QStyleOptionViewItem &option, const QModelIndex &index)
1373void KFileItemDelegate::setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const
1381void KFileItemDelegate::updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &option, const QModelIndex &index) const
1416bool 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:56
void setShowInformation(const InformationList &list)
Sets the list of information lines that are shown below the icon label in list views.
Definition kfileitemdelegate.cpp:895
void setShadowColor(const QColor &color)
Sets the color used for drawing the text shadow.
Definition kfileitemdelegate.cpp:914
QPointF shadowOffset
This property holds the horizontal and vertical offset for the text shadow.
Definition kfileitemdelegate.h:90
QColor shadowColor
This property holds the color used for the text shadow.
Definition kfileitemdelegate.h:80
InformationList information
This property holds which additional information (if any) should be shown below items in icon views.
Definition kfileitemdelegate.h:67
void setShadowOffset(const QPointF &offset)
Sets the horizontal and vertical offset for the text shadow.
Definition kfileitemdelegate.cpp:924
qreal shadowBlur
This property holds the blur radius for the text shadow.
Definition kfileitemdelegate.h:100
bool editorEvent(QEvent *event, QAbstractItemModel *model, const QStyleOptionViewItem &option, const QModelIndex &index) override
Reimplemented from QAbstractItemDelegate.
Definition kfileitemdelegate.cpp:1332
void setMaximumSize(const QSize &size)
Sets the maximum size for KFileItemDelegate::sizeHint().
Definition kfileitemdelegate.cpp:944
void setWrapMode(QTextOption::WrapMode wrapMode)
When the contents text needs to be wrapped, wrapMode strategy will be followed.
Definition kfileitemdelegate.cpp:964
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:974
Information
This enum defines the additional information that can be displayed below item labels in icon views.
Definition kfileitemdelegate.h:146
@ Comment
A simple comment that can be displayed to the user as is.
Definition kfileitemdelegate.h:160
@ OwnerAndGroup
The user and group that owns the file, e.g. root:root.
Definition kfileitemdelegate.h:152
@ LocalPathOrUrl
The local path to the file or the URL in case it is not a local file.
Definition kfileitemdelegate.h:159
@ FriendlyMimeType
The descriptive name for the MIME type, e.g. HTML Document.
Definition kfileitemdelegate.h:157
@ ModificationTime
The date and time the file/folder was last modified.
Definition kfileitemdelegate.h:154
@ Size
The file size for files, and the number of items for folders.
Definition kfileitemdelegate.h:148
QWidget * createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const override
Reimplemented from QAbstractItemDelegate.
Definition kfileitemdelegate.cpp:1318
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:836
QSize maximumSize
This property holds the maximum size that can be returned by KFileItemDelegate::sizeHint().
Definition kfileitemdelegate.h:107
bool showToolTipWhenElided
This property determines whether a tooltip will be shown by the delegate if the display role is elide...
Definition kfileitemdelegate.h:116
KFileItemDelegate(QObject *parent=nullptr)
Constructs a new KFileItemDelegate.
Definition kfileitemdelegate.cpp:808
void updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &option, const QModelIndex &index) const override
Reimplemented from QAbstractItemDelegate.
Definition kfileitemdelegate.cpp:1381
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:984
void setShadowBlur(qreal radius)
Sets the blur radius for the text shadow.
Definition kfileitemdelegate.cpp:934
bool jobTransfersVisible
This property determines if there are KIO jobs on a destination URL visible, then they will have a sm...
Definition kfileitemdelegate.h:122
void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const override
Reimplemented from QAbstractItemDelegate.
Definition kfileitemdelegate.cpp:1373
InformationList showInformation() const
Returns the file item information that should be shown below item labels in list views.
Definition kfileitemdelegate.cpp:909
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:954
QTextOption::WrapMode wrapMode() const
Returns the wrapping strategy followed to show text when it needs wrapping.
Definition kfileitemdelegate.cpp:969
QRegion shape(const QStyleOptionViewItem &option, const QModelIndex &index)
Returns the shape of the item as a region.
Definition kfileitemdelegate.cpp:1456
bool eventFilter(QObject *object, QEvent *event) override
Reimplemented from QAbstractItemDelegate.
Definition kfileitemdelegate.cpp:1500
void setEditorData(QWidget *editor, const QModelIndex &index) const override
Reimplemented from QAbstractItemDelegate.
Definition kfileitemdelegate.cpp:1342
void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const override
Paints the item indicated by index, using painter.
Definition kfileitemdelegate.cpp:1113
bool helpEvent(QHelpEvent *event, QAbstractItemView *view, const QStyleOptionViewItem &option, const QModelIndex &index) override
Reimplemented from QAbstractItemDelegate.
Definition kfileitemdelegate.cpp:1416
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:1578
mode_t permissions() const
Returns the permissions of the file (stat.st_mode containing only permissions).
Definition kfileitem.cpp:1670
QString permissionsString() const
Returns the access permissions for the file as a string.
Definition kfileitem.cpp:1562
static void toActive(QImage &image)
static void semiTransparent(QImage &image)
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...)
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)
VehicleSection::Type type(QStringView coachNumber, QStringView coachClassification)
QString label(StandardShortcut id)
KCOREADDONS_EXPORT QString preProcessWrap(const QString &text)
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 alpha() const const
int blue() const const
int green() const const
int red() const const
void setAlphaF(float alpha)
KeyPress
frameWidth
bool isRightToLeft()
Mode
State
void addPixmap(const QPixmap &pixmap, Mode mode, State state)
QIcon fromTheme(const QString &name)
Format_ARGB32_Premultiplied
QRect rect() const const
QString toString(QDate date, FormatType format) const const
QString suffixForFileName(const QString &fileName) const const
int column() const const
QVariant data(int role) const const
bool isValid() const const
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
QPoint toPoint() 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
void moveCenter(const QPoint &position)
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
bool isEmpty() 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)
QStringView mid(qsizetype start, qsizetype length) const const
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-2024 The KDE developers.
Generated on Fri Nov 29 2024 11:50:33 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Nov 29 2024 11:50:33 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.