diff --git a/aboutdialog/aboutdialog.cpp b/aboutdialog/aboutdialog.cpp index e373b10..076c45f 100644 --- a/aboutdialog/aboutdialog.cpp +++ b/aboutdialog/aboutdialog.cpp @@ -125,6 +125,9 @@ bool AboutDialog::event(QEvent *event) case QEvent::PaletteChange: setStyleSheet(dialogStyleForPalette(palette())); break; + case QEvent::LanguageChange: + m_ui->retranslateUi(this); + break; default:; } return res; diff --git a/enterpassworddialog/enterpassworddialog.cpp b/enterpassworddialog/enterpassworddialog.cpp index 8850628..a4593ab 100644 --- a/enterpassworddialog/enterpassworddialog.cpp +++ b/enterpassworddialog/enterpassworddialog.cpp @@ -223,6 +223,9 @@ bool EnterPasswordDialog::event(QEvent *event) m_ui->capslockWarningWidget->setVisible(m_capslockPressed); break; } + case QEvent::LanguageChange: + m_ui->retranslateUi(this); + break; default:; } return QDialog::event(event); diff --git a/paletteeditor/paletteeditor.cpp b/paletteeditor/paletteeditor.cpp index 052d355..2b4d3b6 100644 --- a/paletteeditor/paletteeditor.cpp +++ b/paletteeditor/paletteeditor.cpp @@ -107,6 +107,18 @@ void PaletteEditor::setPalette(const QPalette &palette, const QPalette &parentPa setPalette(palette); } +bool PaletteEditor::event(QEvent *event) +{ + switch(event->type()) { + case QEvent::LanguageChange: + m_ui->retranslateUi(this); + break; + default: + ; + } + return QDialog::event(event); +} + void PaletteEditor::handleComputeRadioClicked() { if (m_compute) { diff --git a/paletteeditor/paletteeditor.h b/paletteeditor/paletteeditor.h index 7106cf3..e3177ef 100644 --- a/paletteeditor/paletteeditor.h +++ b/paletteeditor/paletteeditor.h @@ -39,6 +39,9 @@ public: void setPalette(const QPalette &palette); void setPalette(const QPalette &palette, const QPalette &parentPalette); +protected: + bool event(QEvent *event) override; + private Q_SLOTS: void buildPalette(); void paletteChanged(const QPalette &palette); diff --git a/widgets/pathselection.cpp b/widgets/pathselection.cpp index dfe2392..9b0dc18 100644 --- a/widgets/pathselection.cpp +++ b/widgets/pathselection.cpp @@ -53,7 +53,7 @@ PathSelection::PathSelection(QWidget *parent) m_lineEdit->installEventFilter(this); m_lineEdit->setCompleter(s_completer); m_button->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Fixed); - m_button->setText(tr("Select ...")); + setTexts(); auto *const layout = new QHBoxLayout(this); layout->setSpacing(3); @@ -65,6 +65,18 @@ PathSelection::PathSelection(QWidget *parent) connect(m_button, &QPushButton::clicked, this, &PathSelection::showFileDialog); } +bool PathSelection::event(QEvent *event) +{ + switch(event->type()) { + case QEvent::LanguageChange: + setTexts(); + break; + default: + ; + } + return QWidget::event(event); +} + bool PathSelection::eventFilter(QObject *obj, QEvent *event) { #ifndef QT_NO_CONTEXTMENU @@ -127,4 +139,10 @@ void PathSelection::showFileDialog() } } } + +void PathSelection::setTexts() +{ + m_button->setText(tr("Select ...")); +} + } // namespace QtUtilities diff --git a/widgets/pathselection.h b/widgets/pathselection.h index 25a79ae..e8b1eed 100644 --- a/widgets/pathselection.h +++ b/widgets/pathselection.h @@ -24,10 +24,12 @@ public: void provideCustomFileDialog(QFileDialog *customFileDialog); protected: + bool event(QEvent *event) override; bool eventFilter(QObject *obj, QEvent *event) override; private Q_SLOTS: void showFileDialog(); + void setTexts(); private: ClearLineEdit *m_lineEdit;