mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
Text anchors: use PointingHandCursor
This commit is contained in:
parent
788d57c815
commit
0b56916b9f
@ -35,6 +35,7 @@ Text::Text(const QString& txt, QFont font, bool enableElide, const QString &rwTe
|
|||||||
{
|
{
|
||||||
setText(txt);
|
setText(txt);
|
||||||
setAcceptedMouseButtons(Qt::LeftButton);
|
setAcceptedMouseButtons(Qt::LeftButton);
|
||||||
|
setAcceptHoverEvents(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
Text::~Text()
|
Text::~Text()
|
||||||
@ -210,6 +211,16 @@ void Text::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
|
|||||||
QDesktopServices::openUrl(anchor);
|
QDesktopServices::openUrl(anchor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Text::hoverMoveEvent(QGraphicsSceneHoverEvent *event)
|
||||||
|
{
|
||||||
|
QString anchor = doc->documentLayout()->anchorAt(event->pos());
|
||||||
|
|
||||||
|
if(!anchor.isEmpty())
|
||||||
|
setCursor(QCursor(Qt::PointingHandCursor));
|
||||||
|
else
|
||||||
|
setCursor(QCursor());
|
||||||
|
}
|
||||||
|
|
||||||
QString Text::getText() const
|
QString Text::getText() const
|
||||||
{
|
{
|
||||||
return rawText;
|
return rawText;
|
||||||
|
@ -51,6 +51,7 @@ public:
|
|||||||
virtual qreal getAscent() const override;
|
virtual qreal getAscent() const override;
|
||||||
virtual void mousePressEvent(QGraphicsSceneMouseEvent *event) override;
|
virtual void mousePressEvent(QGraphicsSceneMouseEvent *event) override;
|
||||||
virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *event) override;
|
virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *event) override;
|
||||||
|
virtual void hoverMoveEvent(QGraphicsSceneHoverEvent* event) override;
|
||||||
|
|
||||||
virtual QString getText() const override;
|
virtual QString getText() const override;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user