Skip to content

Commit

Permalink
Fix #15666: RTL Languages break splash screen
Browse files Browse the repository at this point in the history
  • Loading branch information
HemantAntony authored and igorkorsukov committed Feb 14, 2023
1 parent 0168522 commit 3bf02d5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/appshell/view/internal/splashscreen.cpp
Expand Up @@ -59,7 +59,7 @@ SplashScreen::SplashScreen()
setAttribute(Qt::WA_TranslucentBackground);
setSize(splashScreenSize);

m_message = qtrc("appshell", "Loading…");
m_message = qtrc("appshell", "Loading…\u200e");

repaint();
}
Expand Down Expand Up @@ -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())));
}

Expand Down
2 changes: 2 additions & 0 deletions src/appshell/view/internal/splashscreen.h
Expand Up @@ -27,6 +27,7 @@

#include "modularity/ioc.h"
#include "ui/iuiconfiguration.h"
#include "languages/ilanguagesservice.h"

class QSvgRenderer;

Expand All @@ -36,6 +37,7 @@ class SplashScreen : public QWidget
Q_OBJECT

INJECT(appshell, ui::IUiConfiguration, uiConfiguration)
INJECT(appshell, languages::ILanguagesService, languagesService)

public:
SplashScreen();
Expand Down

0 comments on commit 3bf02d5

Please sign in to comment.