UI Tour: Fix clicking on the User Interface link at the end

Amends df54a15651

When fixing QTCREATORBUG-31447 this broke in turn. We may not filter out
click events to the text.

Fixes: QTCREATORBUG-31850
Change-Id: I0afd0db64c28d111109c80a8644bb4d94535ef6f
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: Robert Löhning <robert.loehning@qt.io>
This commit is contained in:
Eike Ziller
2024-10-18 10:59:14 +02:00
parent 458d1292b0
commit 7a56d615df

View File

@@ -12,6 +12,7 @@
#include <utils/qtcassert.h>
#include <utils/stylehelper.h>
#include <QDesktopServices>
#include <QEvent>
#include <QGuiApplication>
#include <QImage>
@@ -86,8 +87,12 @@ IntroductionWidget::IntroductionWidget()
m_stepText->setTextFormat(Qt::RichText);
// why is palette not inherited???
m_stepText->setPalette(palette());
m_stepText->setOpenExternalLinks(true);
m_stepText->installEventFilter(this);
connect(m_stepText, &QLabel::linkActivated, this, [this](const QString &link) {
// clicking the User Interface link should both open the documentation page
// and step forward (=end the tour)
step();
QDesktopServices::openUrl(link);
});
layout->addWidget(m_stepText);
m_continueLabel = new QLabel(this);
@@ -173,12 +178,8 @@ bool IntroductionWidget::event(QEvent *e)
bool IntroductionWidget::eventFilter(QObject *obj, QEvent *ev)
{
if (obj == parent() && ev->type() == QEvent::Resize) {
if (obj == parent() && ev->type() == QEvent::Resize)
resizeToParent();
} else if (obj == m_stepText && ev->type() == QEvent::MouseButtonRelease) {
step();
return true;
}
return QWidget::eventFilter(obj, ev);
}