From aa3197fbd362d3ba2e4504b2520354039f41421a Mon Sep 17 00:00:00 2001 From: Valentina Zhuravska Date: Wed, 6 Jan 2016 07:55:51 +0200 Subject: [PATCH] Retranslate pathpage. --HG-- branch : feature --- .../dialogs/configpages/pathpage.cpp | 34 +++++++++++++++++-- .../valentina/dialogs/configpages/pathpage.h | 5 +++ 2 files changed, 37 insertions(+), 2 deletions(-) diff --git a/src/app/valentina/dialogs/configpages/pathpage.cpp b/src/app/valentina/dialogs/configpages/pathpage.cpp index 8915ded0b..d72a5c316 100644 --- a/src/app/valentina/dialogs/configpages/pathpage.cpp +++ b/src/app/valentina/dialogs/configpages/pathpage.cpp @@ -48,7 +48,7 @@ //--------------------------------------------------------------------------------------------------------------------- PathPage::PathPage(QWidget *parent) - : QWidget(parent), defaultButton(nullptr), editButton(nullptr), pathTable(nullptr) + : QWidget(parent), defaultButton(nullptr), editButton(nullptr), pathTable(nullptr), pathGroup(nullptr) { QGroupBox *pathGroup = PathGroup(); SCASSERT(pathGroup != nullptr); @@ -148,10 +148,23 @@ void PathPage::EditPath() item->setToolTip(dir); } +//--------------------------------------------------------------------------------------------------------------------- +void PathPage::changeEvent(QEvent *event) +{ + if (event->type() == QEvent::LanguageChange) + { + // retranslate designer form (single inheritance approach) + RetranslateUi(); + } + + // remember to call base class implementation + QWidget::changeEvent(event); +} + //--------------------------------------------------------------------------------------------------------------------- QGroupBox *PathPage::PathGroup() { - QGroupBox *pathGroup = new QGroupBox(tr("Path that use Valentina")); + pathGroup = new QGroupBox(tr("Path that use Valentina")); InitTable(); defaultButton = new QPushButton(tr("Default")); @@ -232,3 +245,20 @@ void PathPage::InitTable() connect(pathTable, &QTableWidget::itemSelectionChanged, this, &PathPage::TableActivated); } + +//--------------------------------------------------------------------------------------------------------------------- +void PathPage::RetranslateUi() +{ + pathGroup->setTitle(tr("Path that use Valentina")); + defaultButton->setText(tr("Default")); + editButton->setText(tr("Edit")); + + const QStringList tableHeader = QStringList() << tr("Type") << tr("Path"); + pathTable->setHorizontalHeaderLabels(tableHeader); + + pathTable->item(0, 0)->setText(tr("Individual measurements")); + pathTable->item(1, 0)->setText(tr("Standard measurements")); + pathTable->item(2, 0)->setText(tr("Patterns")); + pathTable->item(3, 0)->setText(tr("Layout")); + pathTable->item(4, 0)->setText(tr("Templates")); +} diff --git a/src/app/valentina/dialogs/configpages/pathpage.h b/src/app/valentina/dialogs/configpages/pathpage.h index f050baf01..f89be0add 100644 --- a/src/app/valentina/dialogs/configpages/pathpage.h +++ b/src/app/valentina/dialogs/configpages/pathpage.h @@ -46,13 +46,18 @@ public slots: void TableActivated(); void DefaultPath(); void EditPath(); +protected: + virtual void changeEvent(QEvent* event) Q_DECL_OVERRIDE; private: Q_DISABLE_COPY(PathPage) QPushButton *defaultButton; QPushButton *editButton; QTableWidget *pathTable; + QGroupBox *pathGroup; + QGroupBox *PathGroup(); void InitTable(); + void RetranslateUi(); }; #endif // PATHPAGE_H