From 3bf02d59d6f64eb6861f75eb4f34b85bbea4bbca Mon Sep 17 00:00:00 2001 From: HemantAntony <88136054+HemantAntony@users.noreply.github.com> Date: Mon, 6 Feb 2023 12:23:46 +0530 Subject: [PATCH] Fix #15666: RTL Languages break splash screen --- src/appshell/view/internal/splashscreen.cpp | 9 ++++++--- src/appshell/view/internal/splashscreen.h | 2 ++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/appshell/view/internal/splashscreen.cpp b/src/appshell/view/internal/splashscreen.cpp index 0f3bb5278896..b10f22010881 100644 --- a/src/appshell/view/internal/splashscreen.cpp +++ b/src/appshell/view/internal/splashscreen.cpp @@ -59,7 +59,7 @@ SplashScreen::SplashScreen() setAttribute(Qt::WA_TranslucentBackground); setSize(splashScreenSize); - m_message = qtrc("appshell", "Loading…"); + m_message = qtrc("appshell", "Loading…\u200e"); repaint(); } @@ -99,16 +99,19 @@ void SplashScreen::draw(QPainter* painter) painter->drawText(messageRect, Qt::AlignTop | Qt::AlignHCenter | Qt::TextDontClip, m_message); + Qt::AlignmentFlag alignment = languagesService()->currentLanguage().direction == Qt::RightToLeft + ? Qt::AlignLeft : Qt::AlignRight; + // Draw website URL QRectF websiteBoundingRect; - painter->drawText(websiteRect, Qt::AlignBottom | Qt::AlignRight | Qt::TextDontClip, website, &websiteBoundingRect); + painter->drawText(websiteRect, Qt::AlignBottom | alignment | Qt::TextDontClip, website, &websiteBoundingRect); // Draw version number pen.setColor(versionNumberColor); painter->setPen(pen); painter->drawText(websiteRect.translated(0.0, -websiteBoundingRect.height() - versionNumberSpacing), - Qt::AlignBottom | Qt::AlignRight | Qt::TextDontClip, + Qt::AlignBottom | alignment | Qt::TextDontClip, qtrc("appshell", "Version %1").arg(QString::fromStdString(framework::MUVersion::fullVersion().toStdString()))); } diff --git a/src/appshell/view/internal/splashscreen.h b/src/appshell/view/internal/splashscreen.h index b85e454b5e6f..3af5b03b0dc7 100644 --- a/src/appshell/view/internal/splashscreen.h +++ b/src/appshell/view/internal/splashscreen.h @@ -27,6 +27,7 @@ #include "modularity/ioc.h" #include "ui/iuiconfiguration.h" +#include "languages/ilanguagesservice.h" class QSvgRenderer; @@ -36,6 +37,7 @@ class SplashScreen : public QWidget Q_OBJECT INJECT(appshell, ui::IUiConfiguration, uiConfiguration) + INJECT(appshell, languages::ILanguagesService, languagesService) public: SplashScreen();