forked from qt-creator/qt-creator
Ensure UI tour starts with Icons and Text mode
Changed runUiTour to set mode style to Icons and Text before starting the UI tour. This ensures a consistent user experience during the tour. After the tour, the previous mode style is restored to maintain user preferences. Task-number: QTCREATORBUG-31979 Pick-to: 15.0 Change-Id: I0e303cad9afd4fd99dc76a342ebc8408c3a1a5f7 Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
@@ -5,6 +5,7 @@
|
|||||||
#include "welcometr.h"
|
#include "welcometr.h"
|
||||||
|
|
||||||
#include <coreplugin/icore.h>
|
#include <coreplugin/icore.h>
|
||||||
|
#include <coreplugin/modemanager.h>
|
||||||
|
|
||||||
#include <utils/algorithm.h>
|
#include <utils/algorithm.h>
|
||||||
#include <utils/checkablemessagebox.h>
|
#include <utils/checkablemessagebox.h>
|
||||||
@@ -40,7 +41,7 @@ struct Item
|
|||||||
class IntroductionWidget : public QWidget
|
class IntroductionWidget : public QWidget
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
IntroductionWidget();
|
IntroductionWidget(Core::ModeManager::Style previousModeStyle);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool event(QEvent *e) override;
|
bool event(QEvent *e) override;
|
||||||
@@ -63,12 +64,16 @@ private:
|
|||||||
std::vector<Item> m_items;
|
std::vector<Item> m_items;
|
||||||
QPointer<QWidget> m_stepPointerAnchor;
|
QPointer<QWidget> m_stepPointerAnchor;
|
||||||
uint m_step = 0;
|
uint m_step = 0;
|
||||||
|
Core::ModeManager::Style m_previousModeStyle;
|
||||||
};
|
};
|
||||||
|
|
||||||
IntroductionWidget::IntroductionWidget()
|
IntroductionWidget::IntroductionWidget(Core::ModeManager::Style previousModeStyle)
|
||||||
: QWidget(ICore::dialogParent()),
|
: QWidget(ICore::dialogParent()),
|
||||||
m_borderImage(":/welcome/images/border.png")
|
m_borderImage(":/welcome/images/border.png"),
|
||||||
|
m_previousModeStyle(previousModeStyle)
|
||||||
{
|
{
|
||||||
|
Core::ModeManager::setModeStyle(Core::ModeManager::Style::IconsAndText);
|
||||||
|
|
||||||
setFocusPolicy(Qt::StrongFocus);
|
setFocusPolicy(Qt::StrongFocus);
|
||||||
setFocus();
|
setFocus();
|
||||||
parentWidget()->installEventFilter(this);
|
parentWidget()->installEventFilter(this);
|
||||||
@@ -363,6 +368,7 @@ void IntroductionWidget::mouseReleaseEvent(QMouseEvent *me)
|
|||||||
|
|
||||||
void IntroductionWidget::finish()
|
void IntroductionWidget::finish()
|
||||||
{
|
{
|
||||||
|
Core::ModeManager::setModeStyle(m_previousModeStyle);
|
||||||
hide();
|
hide();
|
||||||
deleteLater();
|
deleteLater();
|
||||||
}
|
}
|
||||||
@@ -405,7 +411,7 @@ void IntroductionWidget::resizeToParent()
|
|||||||
|
|
||||||
void runUiTour()
|
void runUiTour()
|
||||||
{
|
{
|
||||||
auto intro = new IntroductionWidget;
|
auto intro = new IntroductionWidget(Core::ModeManager::modeStyle());
|
||||||
intro->show();
|
intro->show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user