Avoid constructing more temporaries than necessary.

Thanks Winfried Kusgörd <w.kusgoerd@arcor.de> for the patch.
main
Teo Mrnjavac 10 years ago
parent 42f0e653cc
commit dabfb68a68

@ -41,7 +41,7 @@ GreetingPage::GreetingPage( QWidget* parent )
{ {
ui->setupUi( this ); ui->setupUi( this );
QString defaultLocale = QLocale::system().name(); QLocale defaultLocale = QLocale( QLocale::system().name() );
{ {
bool isTranslationAvailable = false; bool isTranslationAvailable = false;
@ -56,8 +56,8 @@ GreetingPage::GreetingPage( QWidget* parent )
ui->languageWidget->addItem( lang ); ui->languageWidget->addItem( lang );
ui->languageWidget->item( ui->languageWidget->count() - 1 ) ui->languageWidget->item( ui->languageWidget->count() - 1 )
->setData( Qt::UserRole, thisLocale ); ->setData( Qt::UserRole, thisLocale );
if ( thisLocale.language() == QLocale( defaultLocale ).language() && if ( thisLocale.language() == defaultLocale.language() &&
thisLocale.country() == QLocale( defaultLocale ).country() ) thisLocale.country() == defaultLocale.country() )
{ {
isTranslationAvailable = true; isTranslationAvailable = true;
ui->languageWidget->setCurrentRow( ui->languageWidget->count() - 1 ); ui->languageWidget->setCurrentRow( ui->languageWidget->count() - 1 );
@ -72,7 +72,7 @@ GreetingPage::GreetingPage( QWidget* parent )
for (int i = 0; i < ui->languageWidget->count(); i++) for (int i = 0; i < ui->languageWidget->count(); i++)
{ {
QLocale thisLocale = ui->languageWidget->item(i)->data( Qt::UserRole ).toLocale(); QLocale thisLocale = ui->languageWidget->item(i)->data( Qt::UserRole ).toLocale();
if ( thisLocale.language() == QLocale( defaultLocale ).language() ) if ( thisLocale.language() == defaultLocale.language() )
{ {
isTranslationAvailable = true; isTranslationAvailable = true;
ui->languageWidget->setCurrentRow( i ); ui->languageWidget->setCurrentRow( i );

Loading…
Cancel
Save