Plasma
iconwidget.cpp
Go to the documentation of this file.
387 QObject::connect(Plasma::Theme::defaultTheme(), SIGNAL(themeChanged()), q, SLOT(colorConfigChanged()));
388 QObject::connect(KGlobalSettings::self(), SIGNAL(kdisplayPaletteChanged()), q, SLOT(colorConfigChanged()));
389 QObject::connect(KGlobalSettings::self(), SIGNAL(iconChanged(int)), q, SLOT(iconConfigChanged()));
427 iconAction->setRect(d->actionRect(qMin((IconWidgetPrivate::ActionPosition)count, IconWidgetPrivate::LastIconPosition)));
525 QSizeF IconWidgetPrivate::displaySizeHint(const QStyleOptionGraphicsItem *option, const qreal width) const
574 QSizeF IconWidgetPrivate::iconSizeForWidgetSize(const QStyleOptionGraphicsItem *option, const QSizeF &rect)
610 iconWidth -= verticalMargin[IconWidgetPrivate::ItemMargin].left + verticalMargin[IconWidgetPrivate::ItemMargin].right;
622 iconWidth -= horizontalMargin[IconWidgetPrivate::ItemMargin].top + horizontalMargin[IconWidgetPrivate::ItemMargin].bottom;
658 if (!(d->states & IconWidgetPrivate::HoverState) && !d->iconChangeTimer->isActive() && !d->oldIcon.isNull()) {
671 if (d->iconSvg->isValid() && (d->iconSvgElement.isEmpty() || d->iconSvg->hasElement(d->iconSvgElement))) {
694 iconSize = qMax(d->iconSvg->elementSize(d->iconSvgElement).width(), d->iconSvg->elementSize(d->iconSvgElement).height());
765 animation->start(show ? QAbstractAnimation::KeepWhenStopped : QAbstractAnimation::DeleteWhenStopped);
806 QPixmap IconWidgetPrivate::decoration(const QStyleOptionGraphicsItem *option, bool useHoverEffect, bool usePressedEffect)
955 QSizeF IconWidgetPrivate::layoutText(QTextLayout &layout, const QString &text, qreal maxWidth) const
1077 haloRects.append(line.naturalTextRect().translated(labelLayout->position().toPoint()).toRect());
1082 haloRects.append(line.naturalTextRect().translated(infoLayout->position().toPoint()).toRect());
1136 void IconWidget::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
1156 QPixmap icon = d->decoration(option, state != IconWidgetPrivate::NoState, state & IconWidgetPrivate::PressedState);
1332 if (!(d->states & IconWidgetPrivate::HoverState) && !d->iconChangeTimer->isActive() && d->oldIcon.isNull() && !d->icon.isNull() && !icon.isNull()) {
virtual void updateGeometry()
QTextOption textOption() const
bool drawBackground() const
QGraphicsWidget * parentWidget() const
The applet is constrained horizontally, but can expand vertically.
Definition: plasma.h:77
QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint=QSizeF()) const
Definition: iconwidget.cpp:681
QSize size() const
void setAction(QAction *action)
Associate an action with this IconWidget this makes the IconWidget follow the state of the action...
Definition: iconwidget.cpp:458
virtual void hoverEnterEvent(QGraphicsSceneHoverEvent *event)
Type type() const
QColor darker(int factor) const
int width() const
void setFont(const QFont &font)
QRect toRect() const
void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event)
Definition: iconwidget.cpp:1470
void mouseMoveEvent(QGraphicsSceneMouseEvent *event)
Definition: iconwidget.cpp:1413
void setEasingCurve(const QEasingCurve &easing)
qreal height() const
void setRenderHint(RenderHint hint, bool on)
qreal x() const
qreal y() const
void setNumDisplayLines(int numLines)
Definition: iconwidget.cpp:473
void setColorAt(qreal position, const QColor &color)
void mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
Definition: iconwidget.cpp:1433
QVariant data() const
void drawActionButtonBase(QPainter *painter, const QSize &size, int element)
Definition: iconwidget.cpp:1242
virtual int pixelMetric(PixelMetric metric, const QStyleOption *option, const QWidget *widget) const =0
qreal naturalTextWidth() const
virtual QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint) const
QSizeF size() const
int numDisplayLines()
Q_INVOKABLE QSizeF sizeFromIconSize(const qreal iconWidth) const
Definition: iconwidget.cpp:1571
On the planar desktop layer, extending across the full screen from edge to edge.
Definition: plasma.h:111
QPoint screenPos() const
the text color to be used by items resting on the background
Definition: theme.h:63
void setText(const QString &text)
Sets the text associated with this icon.
Definition: iconwidget.cpp:1267
void addIconAction(QAction *action)
Plasma::IconWidget allows the user to specify a number of actions (currently four) to be displayed ar...
Definition: iconwidget.cpp:415
void setAlpha(int alpha)
void drawHalo(QPainter *painter, const QRectF &rect)
Definition: paintutils.cpp:154
Qt::Alignment alignment() const
bool sceneEventFilter(QGraphicsItem *watched, QEvent *event)
Definition: iconwidget.cpp:1514
void activated()
Indicates when the icon has been activated following the single or doubleclick settings.
typedef Alignment
void removeIconAction(QAction *action)
Removes a previously set iconAction.
Definition: iconwidget.cpp:430
QStyle * style() const
Qt::Orientation orientation() const
qreal width(const QString &text) const
void setStartValue(const QVariant &value)
void update(const QRectF &rect)
QSizeF iconSize() const
QPointF position() const
void beginLayout()
QRect alignedRect(Qt::LayoutDirection direction, QFlags< Qt::AlignmentFlag > alignment, const QSize &size, const QRect &rectangle)
bool isNull() const
void setLineWidth(qreal width)
void resize(const QSizeF &size)
QScriptValue animation(const QString &anim)
Definition: animationscriptengine.cpp:55
QFont font() const
virtual void changeEvent(QEvent *event)
QColor fromRgb(QRgb rgb)
QSizeF maximumIconSize() const
virtual void mouseMoveEvent(QGraphicsSceneMouseEvent *event)
void setPosition(const QPointF &pos)
QPainterPath roundedRectangle(const QRectF &rect, qreal radius)
Returns a nicely rounded rectanglular path for painting.
Definition: paintutils.cpp:159
void fill(uint pixelValue)
void setPen(const QColor &color)
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget=0)
Definition: iconwidget.cpp:1136
QTextLine createLine()
qreal leading() const
void drawEllipse(const QRectF &rectangle)
QSizeF preferredSize() const
void setPreferredIconSize(const QSizeF &size)
Set the size you prefer the icon will be when positioned in a layout.
Definition: iconwidget.cpp:1348
QSize toSize() const
void setSvg(const QString &svgFilePath, const QString &svgIconElement=QString())
Convenience method to set the svg image to use when given the filepath and name of svg...
Definition: iconwidget.cpp:634
void setWidth(qreal width)
void drawPixmap(const QRectF &target, const QPixmap &pixmap, const QRectF &source)
QPointF topLeft() const
bool isEmpty() const
virtual void mousePressEvent(QGraphicsSceneMouseEvent *event)
void invertLayout(bool invert)
inverts the layout of the icons if the orientation is horizontal, normally we get icon on the left wi...
Definition: iconwidget.cpp:1561
void setBrush(const QBrush &brush)
QPoint center() const
void setIcon(const QIcon &icon)
Sets the graphical icon for this Plasma::IconWidget.
Definition: iconwidget.cpp:1324
Qt::MouseButton button() const
QPixmap scaled(int width, int height, Qt::AspectRatioMode aspectRatioMode, Qt::TransformationMode transformMode) const
int textStart() const
QString right(int n) const
void shadowBlur(QImage &image, int radius, const QColor &color)
Creates a blurred shadow of the supplied image.
Definition: paintutils.cpp:38
bool isNull() const
bool isEmpty() const
QColor lighter(int factor) const
void setMaximumIconSize(const QSizeF &size)
Set the size that should be the maximum beyond the icon shouldn't scale when the icon will be when po...
Definition: iconwidget.cpp:1370
bool isVisible() const
void hoverEnterEvent(QGraphicsSceneHoverEvent *event)
Definition: iconwidget.cpp:1484
void drawImage(const QRectF &target, const QImage &image, const QRectF &source, QFlags< Qt::ImageConversionFlag > flags)
QString mid(int position, int n) const
void drawPath(const QPainterPath &path)
void setTextBackgroundColor(const QColor &color)
Sets the color to use behind the text of the icon.
Definition: iconwidget.cpp:1230
QPoint toPoint() const
int textLength() const
QStyle * style()
QTextLine lineAt(int i) const
static QScriptValue type(QScriptContext *ctx, QScriptEngine *eng)
Definition: easingcurve.cpp:63
void setPressed(bool pressed=true)
Sets the appearance of the icon to pressed or restores the appearance to normal.
Definition: iconwidget.cpp:1527
void hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
Definition: iconwidget.cpp:1498
QFont font() const
bool isNull() const
QRectF translated(qreal dx, qreal dy) const
void setTop(qreal y)
QString text() const
QRect visualRect(Qt::LayoutDirection direction, const QRect &boundingRectangle, const QRect &logicalRectangle)
virtual QPainterPath shape() const
static Plasma::Animation * create(Animator::Animation type, QObject *parent=0)
Factory to build new animation objects.
Definition: animator.cpp:61
QScriptValue data() const
QPointF bottomLeft() const
void setEndValue(const QVariant &value)
QPixmap transition(const QPixmap &from, const QPixmap &to, qreal amount)
Blends a pixmap into another.
Definition: paintutils.cpp:208
QRect toAlignedRect() const
void reserve(int size)
void translate(const QPointF &offset)
void setTextOption(const QTextOption &option)
QRectF naturalTextRect() const
QString left(int n) const
void setDuration(int msecs)
QSizeF minimumIconSize() const
void draw(QPainter *p, const QPointF &pos, const QVector< FormatRange > &selections, const QRectF &clip) const
QString infoText() const
Returns the meta text associated with this icon.
QRectF adjusted(qreal dx1, qreal dy1, qreal dx2, qreal dy2) const
qreal height() const
bool contains(const QPointF &point) const
Q_INVOKABLE QColor color(ColorRole role) const
Returns the text color to be used by items resting on the background.
Definition: theme.cpp:918
QGraphicsLayout * layout() const
Qt::Alignment visualAlignment(Qt::LayoutDirection direction, QFlags< Qt::AlignmentFlag > alignment)
void start(QAbstractAnimation::DeletionPolicy policy)
QSizeF preferredIconSize() const
qreal & rheight()
QPointF pos() const
void moveCenter(const QPoint &position)
void setText(const QString &string)
void setPosition(const QPointF &p)
qreal height() const
virtual void hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
QIcon icon() const
void setHeight(qreal height)
virtual bool contains(const QPointF &point) const
QAction * action() const
QColor textBackgroundColor() const
QRect rect() const
void setDirection(Direction direction)
virtual QRectF boundingRect() const
QPointF scenePos() const
void destroyed(QObject *obj)
qreal width() const
void setDrawBackground(bool draw)
Sets whether or not to draw a background area for the icon.
Definition: iconwidget.cpp:482
void setMinimumIconSize(const QSizeF &size)
Set the size that should be the minimum beyond the icon shouldn't scale when the icon will be when po...
Definition: iconwidget.cpp:1359
void endLayout()
int receivers(const char *signal) const
void mousePressEvent(QGraphicsSceneMouseEvent *event)
Definition: iconwidget.cpp:1386
void setOrientation(Qt::Orientation orientation)
let set the orientation of the icon Qt::Vertical: text under the icon Qt::Horizontal text at a side o...
Definition: iconwidget.cpp:1550
void pause()
void setInfoText(const QString &text)
Sets the additional information to be displayed by this icon.
Definition: iconwidget.cpp:1288
QString svg() const
int lineCount() const
void doubleClicked()
Indicates when the icon has been double-clicked.
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:23:12 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:23:12 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.