forked from qt-creator/qt-creator
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:
@@ -12,6 +12,7 @@
|
|||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
#include <utils/stylehelper.h>
|
#include <utils/stylehelper.h>
|
||||||
|
|
||||||
|
#include <QDesktopServices>
|
||||||
#include <QEvent>
|
#include <QEvent>
|
||||||
#include <QGuiApplication>
|
#include <QGuiApplication>
|
||||||
#include <QImage>
|
#include <QImage>
|
||||||
@@ -86,8 +87,12 @@ IntroductionWidget::IntroductionWidget()
|
|||||||
m_stepText->setTextFormat(Qt::RichText);
|
m_stepText->setTextFormat(Qt::RichText);
|
||||||
// why is palette not inherited???
|
// why is palette not inherited???
|
||||||
m_stepText->setPalette(palette());
|
m_stepText->setPalette(palette());
|
||||||
m_stepText->setOpenExternalLinks(true);
|
connect(m_stepText, &QLabel::linkActivated, this, [this](const QString &link) {
|
||||||
m_stepText->installEventFilter(this);
|
// 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);
|
layout->addWidget(m_stepText);
|
||||||
|
|
||||||
m_continueLabel = new QLabel(this);
|
m_continueLabel = new QLabel(this);
|
||||||
@@ -173,12 +178,8 @@ bool IntroductionWidget::event(QEvent *e)
|
|||||||
|
|
||||||
bool IntroductionWidget::eventFilter(QObject *obj, QEvent *ev)
|
bool IntroductionWidget::eventFilter(QObject *obj, QEvent *ev)
|
||||||
{
|
{
|
||||||
if (obj == parent() && ev->type() == QEvent::Resize) {
|
if (obj == parent() && ev->type() == QEvent::Resize)
|
||||||
resizeToParent();
|
resizeToParent();
|
||||||
} else if (obj == m_stepText && ev->type() == QEvent::MouseButtonRelease) {
|
|
||||||
step();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return QWidget::eventFilter(obj, ev);
|
return QWidget::eventFilter(obj, ev);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user