Retranslate pathpage.

--HG--
branch : feature
This commit is contained in:
Valentina Zhuravska 2016-01-06 07:55:51 +02:00
parent ac899a4cf1
commit aa3197fbd3
2 changed files with 37 additions and 2 deletions

View File

@ -48,7 +48,7 @@
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
PathPage::PathPage(QWidget *parent) 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(); QGroupBox *pathGroup = PathGroup();
SCASSERT(pathGroup != nullptr); SCASSERT(pathGroup != nullptr);
@ -148,10 +148,23 @@ void PathPage::EditPath()
item->setToolTip(dir); 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 *PathPage::PathGroup()
{ {
QGroupBox *pathGroup = new QGroupBox(tr("Path that use Valentina")); pathGroup = new QGroupBox(tr("Path that use Valentina"));
InitTable(); InitTable();
defaultButton = new QPushButton(tr("Default")); defaultButton = new QPushButton(tr("Default"));
@ -232,3 +245,20 @@ void PathPage::InitTable()
connect(pathTable, &QTableWidget::itemSelectionChanged, this, &PathPage::TableActivated); 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"));
}

View File

@ -46,13 +46,18 @@ public slots:
void TableActivated(); void TableActivated();
void DefaultPath(); void DefaultPath();
void EditPath(); void EditPath();
protected:
virtual void changeEvent(QEvent* event) Q_DECL_OVERRIDE;
private: private:
Q_DISABLE_COPY(PathPage) Q_DISABLE_COPY(PathPage)
QPushButton *defaultButton; QPushButton *defaultButton;
QPushButton *editButton; QPushButton *editButton;
QTableWidget *pathTable; QTableWidget *pathTable;
QGroupBox *pathGroup;
QGroupBox *PathGroup(); QGroupBox *PathGroup();
void InitTable(); void InitTable();
void RetranslateUi();
}; };
#endif // PATHPAGE_H #endif // PATHPAGE_H