KDEGames
kgamepopupitem.cpp
61void 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));
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);
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) {
NormalText
NormalBackground
Tooltip
QGraphicsItem capable of showing short popup messages which do not interrupt the gameplay.
Definition kgamepopupitem.h:38
KGamePopupItem(QGraphicsItem *parent=nullptr)
Constructs a message item.
Definition kgamepopupitem.cpp:175
void setMessageOpacity(qreal opacity)
Sets the message opacity from 0 (fully transparent) to 1 (fully opaque) For example 0....
Definition kgamepopupitem.cpp:392
void setSharpness(Sharpness sharpness)
Sets the popup angles sharpness.
Definition kgamepopupitem.cpp:514
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 setMessageIcon(const QPixmap &pix)
Sets custom pixmap to show instead of default icon on the left.
Definition kgamepopupitem.cpp:440
HideType
Used to specify how to hide in forceHide() - instantly or animatedly.
Definition kgamepopupitem.h:136
void paint(QPainter *p, const QStyleOptionGraphicsItem *option, QWidget *widget) override
Paints item.
Definition kgamepopupitem.cpp:216
void linkHovered(const QString &link)
Emitted when user hovers a link in item.
ReplaceMode
Possible values for message showing mode in respect to a previous message.
Definition kgamepopupitem.h:47
void forceHide(HideType type=AnimatedHide)
Requests the item to be hidden immediately.
Definition kgamepopupitem.cpp:456
void setHideOnMouseClick(bool hide)
Sets whether to hide this popup item on mouse click.
Definition kgamepopupitem.cpp:378
void setBackgroundBrush(const QBrush &brush)
Sets brush used to paint item background By default system-default brush is used.
Definition kgamepopupitem.cpp:485
void setTextColor(const QColor &color)
Sets default color for unformatted text By default system-default color is used.
Definition kgamepopupitem.cpp:492
Position
The possible places in the scene where a message can be shown.
Definition kgamepopupitem.h:63
void setMessageTimeout(int msec)
Sets the amount of time the item will stay visible on screen before it goes away.
Definition kgamepopupitem.cpp:371
void linkActivated(const QString &link)
Emitted when user clicks on a link in item.
QBrush brush(const QPalette &) const
Q_SCRIPTABLE Q_NOREPLY void start()
KIOCORE_EXPORT CopyJob * link(const QList< QUrl > &src, const QUrl &destDir, JobFlags flags=DefaultFlags)
const QList< QKeySequence > & end()
QWidget * viewport() const const
const QColor & color() const const
ItemIsFocusable
void hide()
bool isVisible() const const
qreal opacity() const const
QPointF pos() const const
void prepareGeometryChange()
QGraphicsScene * scene() const const
void setAcceptHoverEvents(bool enabled)
void setFlag(GraphicsItemFlag flag, bool enabled)
void setPos(const QPointF &pos)
void setZValue(qreal z)
void show()
void update(const QRectF &rect)
parent
QList< QGraphicsView * > views() const const
QColor defaultTextColor() const const
void linkActivated(const QString &link)
void linkHovered(const QString &link)
virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *event) override
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override
void setDefaultTextColor(const QColor &col)
QPainterPath mapToScene(const QPainterPath &path) const const
QPixmap pixmap(QWindow *window, const QSize &size, Mode mode, State state) const const
QIcon fromTheme(const QString &name)
Q_EMITQ_EMIT
Q_OBJECTQ_OBJECT
Q_SIGNALSQ_SIGNALS
QMetaObject::Connection connect(const QObject *sender, PointerToMemberFunction signal, Functor functor)
void drawPath(const QPainterPath &path)
void drawPixmap(const QPoint &point, const QPixmap &pixmap)
const QPen & pen() const const
void restore()
void save()
void setBrush(Qt::BrushStyle style)
void setOpacity(qreal opacity)
void setPen(Qt::PenStyle style)
void arcTo(const QRectF &rectangle, qreal startAngle, qreal sweepLength)
QRectF boundingRect() const const
void closeSubpath()
void lineTo(const QPointF &endPoint)
void moveTo(const QPointF &point)
Active
void setWidthF(qreal width)
qreal devicePixelRatio() const const
int width() const const
QRectF boundingRect() const const
ArrowCursor
black
LinksAccessibleByMouse
Forward
Running
void finished()
void frameChanged(int frame)
void timeout()
QRect contentsRect() const const
palette
Q_D(Todo)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:13:43 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:13:43 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.