KDEGames
kgamepopupitem.cpp
61 void TextItemWithOpacity::paint(QPainter *p, const QStyleOptionGraphicsItem *option, QWidget *widget)
67 // whether the given color is equal to the one already set. Just calling setDefaultTextColor without
68 // this check may result in an infinite loop of paintEvent -> setDefaultTextColor -> update -> paintEvent...
188 connect(d->m_textChildItem, &TextItemWithOpacity::linkActivated, this, &KGamePopupItem::linkActivated);
189 connect(d->m_textChildItem, &TextItemWithOpacity::linkHovered, this, &KGamePopupItem::onLinkHovered);
190 connect(d->m_textChildItem, &TextItemWithOpacity::mouseClicked, this, &KGamePopupItem::onTextItemClicked);
207 d->m_textChildItem->setTextColor(KStatefulBrush(KColorScheme::Tooltip, KColorScheme::NormalText));
216 void KGamePopupItem::paint(QPainter *p, const QStyleOptionGraphicsItem *option, QWidget *widget)
236 p->drawPixmap(MARGIN, static_cast<int>(d->m_boundRect.height() / 2) - d->m_iconPix.height() / 2.0 / d->m_iconPix.devicePixelRatio(), d->m_iconPix);
278 qreal w = d->m_textChildItem->boundingRect().width() + MARGIN * 2 + d->m_iconPix.width() / iconDpr + SOME_SPACE;
295 roundRectPath.arcTo(w - (2 * d->m_sharpness), 0.0, (2 * d->m_sharpness), (d->m_sharpness), 0.0, 90.0);
299 roundRectPath.arcTo(0.0, h - (2 * d->m_sharpness), 2 * d->m_sharpness, 2 * d->m_sharpness, 180.0, 90.0);
301 roundRectPath.arcTo(w - (2 * d->m_sharpness), h - (2 * d->m_sharpness), (2 * d->m_sharpness), (2 * d->m_sharpness), 270.0, 90.0);
307 d->m_textChildItem->setPos(d->m_textChildItem->x(), d->m_boundRect.height() / 2 - d->m_textChildItem->boundingRect().height() / 2);
330 int start = static_cast<int>(d->m_visibleSceneRect.top() - d->m_mappedBoundRect.height() - d->m_mapped_SHOW_OFFSET);
335 int end = static_cast<int>(d->m_visibleSceneRect.bottom() - d->m_mappedBoundRect.height() - d->m_mapped_SHOW_OFFSET);
339 setPos(d->m_visibleSceneRect.left() + d->m_visibleSceneRect.width() / 2 - d->m_mappedBoundRect.width() / 2,
340 d->m_visibleSceneRect.top() + d->m_visibleSceneRect.height() / 2 - d->m_mappedBoundRect.height() / 2);
351 setPos(d->m_visibleSceneRect.right() - d->m_mappedBoundRect.width() - d->m_mapped_SHOW_OFFSET, frame);
435 if (d->m_timeout != 0 && !d->m_timer.isActive() && d->m_timeLine.state() != QTimeLine::Running) {
Q_OBJECTQ_OBJECT
void setZValue(qreal z)
void arcTo(const QRectF &rectangle, qreal startAngle, qreal sweepLength)
void setPen(const QColor &color)
HideType
Used to specify how to hide in forceHide() - instantly or animatedly.
Definition: kgamepopupitem.h:122
qreal devicePixelRatio() const const
void drawPixmap(const QRectF &target, const QPixmap &pixmap, const QRectF &source)
Forward
palette
Q_EMITQ_EMIT
QRectF boundingRect() const const
void update(const QRectF &rect)
NormalText
virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *event) override
void setOpacity(qreal opacity)
Q_SCRIPTABLE Q_NOREPLY void start()
QIcon fromTheme(const QString &name)
ItemIsFocusable
void setHideOnMouseClick(bool hide)
Sets whether to hide this popup item on mouse click.
Definition: kgamepopupitem.cpp:378
void paint(QPainter *p, const QStyleOptionGraphicsItem *option, QWidget *widget) override
Paints item.
Definition: kgamepopupitem.cpp:216
const QPen & pen() const const
void prepareGeometryChange()
void frameChanged(int frame)
QMetaObject::Connection connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
void setWidthF(qreal width)
ReplaceMode
Possible values for message showing mode in respect to a previous message.
Definition: kgamepopupitem.h:47
KIOCORE_EXPORT CopyJob * link(const QList< QUrl > &src, const QUrl &destDir, JobFlags flags=DefaultFlags)
void setAcceptHoverEvents(bool enabled)
QList< QGraphicsView * > views() const const
LinksAccessibleByMouse
void setPos(const QPointF &pos)
QGraphicsScene * scene() const const
parent
void timeout()
void drawPath(const QPainterPath &path)
ArrowCursor
void linkActivated(const QString &link)
Emitted when user clicks on a link in item.
void forceHide(HideType type=AnimatedHide)
Requests the item to be hidden immediately.
Definition: kgamepopupitem.cpp:456
void setFlag(QGraphicsItem::GraphicsItemFlag flag, bool enabled)
void show()
NormalBackground
Running
void setBrush(const QBrush &brush)
void setMessageIcon(const QPixmap &pix)
Sets custom pixmap to show instead of default icon on the left.
Definition: kgamepopupitem.cpp:440
Position
The possible places in the scene where a message can be shown.
Definition: kgamepopupitem.h:55
Q_SIGNALSQ_SIGNALS
void setOpacity(qreal opacity)
void linkHovered(const QString &link)
Emitted when user hovers a link in item.
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override
void closeSubpath()
void setBackgroundBrush(const QBrush &brush)
Sets brush used to paint item background By default system-default brush is used.
Definition: kgamepopupitem.cpp:485
qreal y() const const
void setSharpness(Sharpness sharpness)
Sets the popup angles sharpness.
Definition: kgamepopupitem.cpp:514
QPixmap pixmap(const QSize &size, QIcon::Mode mode, QIcon::State state) const const
Tooltip
Definition: kgamepopupitem.h:37
void moveTo(const QPointF &point)
void showMessage(const QString &text, Position pos, ReplaceMode mode=LeavePrevious)
Shows the message: item will appear at specified place of the scene using simple animation Item will ...
Definition: kgamepopupitem.cpp:240
void restore()
KGamePopupItem(QGraphicsItem *parent=nullptr)
Constructs a message item.
Definition: kgamepopupitem.cpp:175
QPointF pos() const const
void save()
bool isVisible() const const
Active
void setTextColor(const QColor &color)
Sets default color for unformatted text By default system-default color is used.
Definition: kgamepopupitem.cpp:492
qreal opacity() const const
QWidget * viewport() const const
void setMessageOpacity(qreal opacity)
Sets the message opacity from 0 (fully transparent) to 1 (fully opaque) For example 0....
Definition: kgamepopupitem.cpp:392
void hide()
void setMessageTimeout(int msec)
Sets the amount of time the item will stay visible on screen before it goes away.
Definition: kgamepopupitem.cpp:371
const QList< QKeySequence > & end()
black
QPointF mapToScene(const QPoint &point) const const
int width() const const
Q_D(Todo)
QRect contentsRect() const const
void finished()
void lineTo(const QPointF &endPoint)
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Thu Dec 7 2023 03:50:25 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2023 The KDE developers.
Generated on Thu Dec 7 2023 03:50:25 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.