Commit d507252d authored by Hugo Beauzée-Luyssen's avatar Hugo Beauzée-Luyssen

PathWidget: Handle language changes.

parent e74c516f
......@@ -23,6 +23,7 @@
#include "PathWidget.h"
#include "SettingValue.h"
#include <QEvent>
#include <QFileDialog>
#include <QLineEdit>
#include <QPushButton>
......@@ -32,7 +33,7 @@ PathWidget::PathWidget( SettingValue *s, QWidget *parent /*= NULL*/ ) :
{
m_lineEdit = new QLineEdit( this );
m_pushButton = new QPushButton( this );
m_pushButton->setText( tr( "Select a path" ) );
retranslate();
layout()->addWidget( m_lineEdit );
layout()->addWidget( m_pushButton );
......@@ -40,11 +41,25 @@ PathWidget::PathWidget( SettingValue *s, QWidget *parent /*= NULL*/ ) :
connect( m_pushButton, SIGNAL( clicked() ), this, SLOT( selectPathButtonPressed() ) );
}
void
PathWidget::retranslate()
{
m_pushButton->setText( tr( "Select a path" ) );
}
void
PathWidget::changeEvent( QEvent *event )
{
if ( event->type() == QEvent::LanguageChange )
retranslate();
}
void
PathWidget::save()
{
m_setting->set( m_lineEdit->text() );
}
void
PathWidget::changed( const QVariant &val )
{
......
......@@ -39,6 +39,10 @@ class PathWidget : public ISettingsCategoryWidget
PathWidget( SettingValue *s, QWidget *parent = NULL );
void save();
protected:
void changeEvent( QEvent *event );
void retranslate();
private slots:
virtual void changed( const QVariant& );
void selectPathButtonPressed();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment