KIO
kfileitemdelegate.cpp
Go to the documentation of this file.
81 QString elidedText(QTextLayout &layout, const QStyleOptionViewItemV4 &option, const QSize &maxSize) const;
99 QString information(const QStyleOptionViewItemV4 &option, const QModelIndex &index, const KFileItem &item) const;
107 void drawTextItems(QPainter *painter, const QTextLayout &labelLayout, const QTextLayout &infoLayout,
109 KIO::AnimationState *animationState(const QStyleOptionViewItemV4 &option, const QModelIndex &index,
115 void drawFocusRect(QPainter *painter, const QStyleOptionViewItemV4 &option, const QRect &rect) const;
119 void paintJobTransfers(QPainter* painter, const qreal& jobAnimationAngle, const QPoint& iconPos, const QStyleOptionViewItemV4& opt);
143 showToolTipWhenElided(true), wrapMode( QTextOption::WrapAtWordBoundaryOrAnywhere ), jobTransfersVisible(false),
156 void KFileItemDelegate::Private::setVerticalMargin(MarginType type, int left, int top, int right, int bottom)
165 void KFileItemDelegate::Private::setHorizontalMargin(MarginType type, int left, int top, int right, int bottom)
174 void KFileItemDelegate::Private::setVerticalMargin(MarginType type, int horizontal, int vertical)
180 void KFileItemDelegate::Private::setHorizontalMargin(MarginType type, int horizontal, int vertical)
219 QString KFileItemDelegate::Private::itemSize(const QModelIndex &index, const KFileItem &item) const
240 // Returns the additional information string, if one should be shown, or an empty string otherwise
241 QString KFileItemDelegate::Private::information(const QStyleOptionViewItemV4 &option, const QModelIndex &index,
346 QSize KFileItemDelegate::Private::layoutText(QTextLayout &layout, const QStyleOptionViewItemV4 &option,
362 QSize KFileItemDelegate::Private::layoutText(QTextLayout &layout, const QString &text, int maxWidth) const
391 QString KFileItemDelegate::Private::elidedText(QTextLayout &layout, const QStyleOptionViewItemV4 &option,
427 elided += option.fontMetrics.elidedText(text.mid(start, length), option.textElideMode, maxWidth);
441 void KFileItemDelegate::Private::setLayoutOptions(QTextLayout &layout, const QStyleOptionViewItemV4 &option) const
446 textoption.setWrapMode((option.features & QStyleOptionViewItemV2::WrapText) ? wrapMode : QTextOption::NoWrap);
520 QBrush KFileItemDelegate::Private::brush(const QVariant &value, const QStyleOptionViewItemV4 &option) const
538 QBrush KFileItemDelegate::Private::foregroundBrush(const QStyleOptionViewItemV4 &option, const QModelIndex &index) const
592 KIO::AnimationState *KFileItemDelegate::Private::animationState(const QStyleOptionViewItemV4 &option,
607 QPixmap KFileItemDelegate::Private::transition(const QPixmap &from, const QPixmap &to, qreal amount) const
721 void KFileItemDelegate::Private::layoutTextItems(const QStyleOptionViewItemV4 &option, const QModelIndex &index,
762 const QSize size(qMax(labelSize.width(), infoSize.width()), labelSize.height() + infoSize.height());
763 *textBoundingRect = QStyle::alignedRect(option.direction, option.displayAlignment, size, textRect);
771 void KFileItemDelegate::Private::drawTextItems(QPainter *painter, const QTextLayout &labelLayout,
797 QImage image(boundingRect.size() + QSize(padding * 2, padding * 2), QImage::Format_ARGB32_Premultiplied);
805 painter->drawImage(boundingRect.topLeft() - QPoint(padding, padding) + shadowOffset.toPoint(), image);
869 void KFileItemDelegate::Private::paintJobTransfers(QPainter *painter, const qreal &jobAnimationAngle, const QPoint &iconPos, const QStyleOptionViewItemV4& opt)
875 QPoint bottomRightCorner = QPoint(iconPos.x() + iconSize.width() * 0.75, iconPos.y() + iconSize.height() * 0.60);
885 painter->drawPixmap(-downArrow.size().width() * .50, -downArrow.size().height() * .50, downArrow);
919 d->setHorizontalMargin(Private::TextMargin, textMargin, focusVMargin, focusHMargin, focusVMargin);
921 d->setHorizontalMargin(Private::TextMargin, focusHMargin, focusVMargin, textMargin, focusVMargin);
941 QSize KFileItemDelegate::sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const
1099 QRect KFileItemDelegate::iconRect(const QStyleOptionViewItem &option, const QModelIndex &index) const
1120 QIcon KFileItemDelegate::Private::decoration(const QStyleOptionViewItemV4 &option, const QModelIndex &index) const
1220 void KFileItemDelegate::Private::drawFocusRect(QPainter *painter, const QStyleOptionViewItemV4 &option,
1299 const QPixmap fadeFromPixmap = d->transition(fadeFromCache->regular, fadeFromCache->hover, progress);
1329 // The cache may have been discarded, but the animation handler still needs to know about new icons
1394 const QPixmap fadeFromPixmap = d->transition(fadeFromCache->regular, fadeFromCache->hover, progress);
1455 bool KFileItemDelegate::editorEvent(QEvent *event, QAbstractItemModel *model, const QStyleOptionViewItem &option,
1498 void KFileItemDelegate::setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const
1507 void KFileItemDelegate::updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &option,
1546 bool KFileItemDelegate::helpEvent(QHelpEvent *event, QAbstractItemView *view, const QStyleOptionViewItem &option,
QTextOption textOption() const
QRegion shape(const QStyleOptionViewItem &option, const QModelIndex &index)
Returns the shape of the item as a region.
Definition: kfileitemdelegate.cpp:1587
void setBottom(int y)
QSize boundedTo(const QSize &otherSize) const
int indexOf(QChar ch, int from, Qt::CaseSensitivity cs) const
QSize size() const
bool isRightToLeft()
QSize size() const
Type type() const
int width() const
Definition: kdirmodel.h:132
void setFont(const QFont &font)
virtual void updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &option, const QModelIndex &index) const
Reimplemented from QAbstractItemDelegate.
Definition: kfileitemdelegate.cpp:1507
bool end()
qreal height() const
void fillRect(const QRectF &rectangle, const QBrush &brush)
void setCompositionMode(CompositionMode mode)
void setRenderHint(RenderHint hint, bool on)
The local path to the file or the URL in case it is not a local file.
Definition: kfileitemdelegate.h:175
void fill(const QColor &color)
int right() const
static KIconLoader * global()
void setMaximumSize(const QSize &size)
Sets the maximum size for KFileItemDelegate::sizeHint().
Definition: kfileitemdelegate.cpp:1064
qreal hoverProgress() const
Definition: delegateanimationhandler.cpp:153
virtual QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const
Returns the nominal size for the item referred to by index, given the provided options.
Definition: kfileitemdelegate.cpp:941
InformationList showInformation() const
Returns the file item information that should be shown below item labels in list views.
Definition: kfileitemdelegate.cpp:1022
The date and time the file/folder was last accessed.
Definition: kfileitemdelegate.h:171
A simple comment that can be displayed to the user as is.
Definition: kfileitemdelegate.h:176
The permissions as an octal value, e.g. 0644.
Definition: kfileitemdelegate.h:166
virtual void setEditorData(QWidget *editor, const QModelIndex &index) const
Reimplemented from QAbstractItemDelegate.
Definition: kfileitemdelegate.cpp:1467
Display * display()
QString label(StandardShortcut id)
virtual int pixelMetric(PixelMetric metric, const QStyleOption *option, const QWidget *widget) const =0
qreal naturalTextWidth() const
void setShadowColor(const QColor &color)
Sets the color used for drawing the text shadow.
Definition: kfileitemdelegate.cpp:1028
int & rwidth()
void setShadowBlur(qreal radius)
Sets the blur radius for the text shadow.
Definition: kfileitemdelegate.cpp:1052
virtual bool editorEvent(QEvent *event, QAbstractItemModel *model, const QStyleOptionViewItem &option, const QModelIndex &index)
Reimplemented from QAbstractItemDelegate.
Definition: kfileitemdelegate.cpp:1455
The user name of the file owner, e.g. root.
Definition: kfileitemdelegate.h:167
QString formatLong(long num) const
void translate(int dx, int dy)
void save()
QPixmap fromImage(const QImage &image, QFlags< Qt::ImageConversionFlag > flags)
returns whether or not there is a job on an item (file/directory)
Definition: kdirmodel.h:139
QList< Information > InformationList
Definition: kfileitemdelegate.h:179
int height() const
int x() const
QString comment() const
A comment which can contain anything - even rich text.
Definition: kfileitem.cpp:1005
mode_t permissions() const
Returns the permissions of the file (stat.st_mode containing only permissions).
Definition: kfileitem.cpp:1551
void rotate(qreal angle)
virtual void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
Paints the item indicated by index, using painter.
Definition: kfileitemdelegate.cpp:1245
QString toPlainText() const
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:1099
virtual QPaintEngine * paintEngine() const =0
typedef Alignment
The user and group that owns the file, e.g. root:root.
Definition: kfileitemdelegate.h:168
void selectAll()
void beginLayout()
QRect alignedRect(Qt::LayoutDirection direction, QFlags< Qt::AlignmentFlag > alignment, const QSize &size, const QRect &rectangle)
int x() const
int y() const
returns the number of items in a directory, or ChildCountUnknown
Definition: kdirmodel.h:138
qreal jobAnimationAngle() const
Definition: delegateanimationhandler.cpp:166
Information
This enum defines the additional information that can be displayed below item labels in icon views...
Definition: kfileitemdelegate.h:162
bool movePosition(MoveOperation operation, MoveMode mode, int n)
QString i18nc(const char *ctxt, const char *text)
bool showToolTipWhenElided() const
Returns whether a tooltip should be shown if the display role is elided containing the full display r...
void setGeometry(int x, int y, int w, int h)
int & rheight()
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:1107
virtual void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const
Reimplemented from QAbstractItemDelegate.
Definition: kfileitemdelegate.cpp:1498
void setLineWidth(qreal width)
virtual bool event(QEvent *e)
void setCachedRendering(CachedRendering *rendering)
Definition: delegateanimationhandler_p.h:76
bool jobTransfersVisible() const
Returns whether or not the displaying of job transfers is enabled.
bool hasJobAnimation() const
Definition: delegateanimationhandler.cpp:171
void setWrapMode(WrapMode mode)
QColor color() const
bool isValid() const
void setEnabled(bool)
QString number(int n, int base)
bool helpEvent(QHelpEvent *event, QAbstractItemView *view, const QStyleOptionViewItem &option, const QModelIndex &index)
Reimplemented from QAbstractItemDelegate.
Definition: kfileitemdelegate.cpp:1546
void setPosition(const QPointF &pos)
int toInt(bool *ok) const
void fill(uint pixelValue)
void setWrapMode(QTextOption::WrapMode wrapMode)
When the contents text needs to be wrapped, wrapMode strategy will be followed.
Definition: kfileitemdelegate.cpp:1088
QString preProcessWrap(const QString &text)
int top() const
Definition: kfileitem.h:58
QString i18ncp(const char *ctxt, const char *sing, const char *plur, const A1 &a1)
void setPen(const QColor &color)
QTextLine createLine()
void drawEllipse(const QRectF &rectangle)
void setTop(int y)
int left() const
void setHorizontalScrollBarPolicy(Qt::ScrollBarPolicy)
void drawPixmap(const QRectF &target, const QPixmap &pixmap, const QRectF &source)
void setWidth(int width)
QString localPath() const
Returns the local path if isLocalFile() == true or the KIO item has a UDS_LOCAL_PATH atom...
Definition: kfileitem.cpp:602
QString linkDest() const
Returns the link destination if isLink() == true.
Definition: kfileitem.cpp:568
bool isEmpty() const
QRect rect() const
void setShadowOffset(const QPointF &offset)
Sets the horizontal and vertical offset for the text shadow.
Definition: kfileitemdelegate.cpp:1040
QString pathOrUrl() const
No additional information will be shown for items.
Definition: kfileitemdelegate.h:163
QString formatByteSize(double size) const
virtual QWidget * createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const
Reimplemented from QAbstractItemDelegate.
Definition: kfileitemdelegate.cpp:1439
QString mimeComment() const
Returns the user-readable string representing the type of this file, like "OpenDocument Text File"...
Definition: kfileitem.cpp:823
void setBrush(const QBrush &brush)
bool endsWith(const QString &s, Qt::CaseSensitivity cs) const
QPoint center() const
QString elidedText(const QFontMetrics &fontMetrics, int width, Qt::TextElideMode mode, const QString &text)
void closeEditor(QWidget *editor, QAbstractItemDelegate::EndEditHint hint)
void addPixmap(const QPixmap &pixmap, Mode mode, State state)
CachedRendering * cachedRenderingFadeFrom() const
Definition: delegateanimationhandler_p.h:82
QTextOption::WrapMode wrapMode() const
Returns the wrapping strategy followed to show text when it needs wrapping.
Definition: kfileitemdelegate.cpp:1094
virtual bool eventFilter(QObject *object, QEvent *event)
Reimplemented from QAbstractItemDelegate.
Definition: kfileitemdelegate.cpp:1630
bool isFile() const
Returns true if this item represents a file (and not a a directory)
Definition: kfileitem.cpp:1154
int textStart() const
void setTextCursor(const QTextCursor &cursor)
QString permissionsString() const
Returns the access permissions for the file as a string.
Definition: kfileitem.cpp:1403
qreal fadeProgress() const
Definition: delegateanimationhandler.cpp:161
InformationList information
This property holds which additional information (if any) should be shown below items in icon views...
Definition: kfileitemdelegate.h:79
KIconEffect * iconEffect() const
int userType() const
QRect adjusted(int dx1, int dy1, int dx2, int dy2) const
Definition: kdirmodel.h:120
The descriptive name for the mime type, e.g. HTML Document.
Definition: kfileitemdelegate.h:173
int key() const
bool isLink() const
Returns true if this item represents a link in the UNIX sense of a link.
Definition: kfileitem.cpp:1567
bool isNull() const
int leading() const
bool helpEvent(QHelpEvent *event, QAbstractItemView *view, const QStyleOptionViewItem &option, const QModelIndex &index)
KLocale * locale()
void restore()
The date and time the file/folder was created.
Definition: kfileitemdelegate.h:169
void setRight(int x)
int width() const
void drawImage(const QRectF &target, const QImage &image, const QRectF &source, QFlags< Qt::ImageConversionFlag > flags)
QPointF shadowOffset() const
Returns the offset used for the text shadow.
QString mid(int position, int n) const
frameWidth
QVariant data(int role) const
int textLength() const
The mime type for the item, e.g. text/html.
Definition: kfileitemdelegate.h:172
QStyle * style()
QTextLine lineAt(int i) const
QFont font() const
QSize maximumSize() const
Returns the maximum size for KFileItemDelegate::sizeHint().
QString text() const
QWidget * activePopupWidget()
The date and time the file/folder was last modified.
Definition: kfileitemdelegate.h:170
QRect visualRect(Qt::LayoutDirection direction, const QRect &boundingRectangle, const QRect &logicalRectangle)
void setTextDirection(Qt::LayoutDirection direction)
bool hasEffect(int group, int state) const
Definition: kfileitem.h:60
bool checkValidity(QStyle::State current) const
Definition: delegateanimationhandler_p.h:46
int height() const
KFileItemDelegate is intended to be used to provide a KDE file system view, when using one of the sta...
Definition: kfileitemdelegate.h:67
void adjust(int dx1, int dy1, int dx2, int dy2)
int bottom() const
QPoint topLeft() const
int column() const
int length() const
void reserve(int size)
bool toBool() const
void translate(const QPointF &offset)
CachedRendering * cachedRendering() const
Definition: delegateanimationhandler_p.h:74
void setCachedRenderingFadeFrom(CachedRendering *rendering)
Definition: delegateanimationhandler_p.h:84
virtual void drawPrimitive(PrimitiveElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget) const =0
void setTextOption(const QTextOption &option)
QString timeString(FileTimes which=ModificationTime) const
Requests the modification, access or creation time as a string, depending on which.
Definition: kfileitem.cpp:1415
virtual bool setData(const QModelIndex &index, const QVariant &value, int role)
void draw(QPainter *p, const QPointF &pos, const QVector< FormatRange > &selections, const QRectF &clip) const
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:1076
void setAlphaF(qreal alpha)
bool isValid() const
KFileItemDelegate(QObject *parent=0)
Constructs a new KFileItemDelegate.
Definition: kfileitemdelegate.cpp:910
The file size for files, and the number of items for folders.
Definition: kfileitemdelegate.h:164
double toDouble(bool *ok) const
bool hasFeature(QFlags< QPaintEngine::PaintEngineFeature > feature) const
A UNIX permissions string, e.g. -rwxr-xr-x.
Definition: kfileitemdelegate.h:165
void commitData(QWidget *editor)
QImage apply(const QImage &src, int group, int state) const
Qt::Alignment visualAlignment(Qt::LayoutDirection direction, QFlags< Qt::AlignmentFlag > alignment)
QImage toImage() const
static GraphicEffects graphicEffectsLevel()
QColor shadowColor() const
Returns the color used for the text shadow.
void moveCenter(const QPoint &position)
QString formatNumber(double num, int precision=-1) const
void setShowInformation(const InformationList &list)
Sets the list of information lines that are shown below the icon label in list views.
Definition: kfileitemdelegate.cpp:1007
void setText(const QString &string)
void setPosition(const QPointF &p)
Type type() const
static void shadowBlur(QImage &image, float radius, const QColor &color)
Definition: imagefilter.cpp:253
QObject * parent() const
bool begin(QPaintDevice *device)
void setAlignment(QFlags< Qt::AlignmentFlag > alignment)
const QPen & pen() const
QRect rect() const
QString toString() const
void setVerticalScrollBarPolicy(Qt::ScrollBarPolicy)
Definition: kdirmodel.h:121
void setLeft(int x)
void setAlignment(QFlags< Qt::AlignmentFlag > a)
void insertPlainText(const QString &text)
void setAcceptRichText(bool accept)
QTextCursor textCursor() const
void endLayout()
A KFileItem is a generic class to handle a file, local or remote.
Definition: kfileitem.h:45
CachedRendering * takeCachedRendering()
Definition: delegateanimationhandler_p.h:80
Definition: kfileitem.h:59
QStringList list(const QString &fileClass)
Returns a list of directories associated with this file-class.
Definition: krecentdirs.cpp:60
int lineCount() const
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:24:53 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:24:53 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.