|
|
| |
if ( !ic->text().isEmpty() ) { | if ( !ic->text().isEmpty() ) { |
// first, try to get the text by priorities | // first, try to get the text by priorities |
QStringList lang; |
/* QStringList lang; |
lang << QString(QTextCodec::locale()).left(2); // most prioritent, is the local language | lang << QString(QTextCodec::locale()).left(2); // most prioritent, is the local language |
lang << ""; // and then the language without name goes (international?) | lang << ""; // and then the language without name goes (international?) |
lang << "en"; // then real English | lang << "en"; // then real English |
|
*/ |
QString str; | QString str; |
QStringList::Iterator it = lang.begin(); |
/* QStringList::Iterator it = lang.begin(); |
for ( ; it != lang.end(); ++it) { | for ( ; it != lang.end(); ++it) { |
QHash<QString, QString>::const_iterator it2 = ic->text().find( *it ); | QHash<QString, QString>::const_iterator it2 = ic->text().find( *it ); |
if ( it2 != ic->text().end() ) { | if ( it2 != ic->text().end() ) { |
|
|
break; | break; |
} | } |
} | } |
|
*/ |
// if all fails, just get the first text | // if all fails, just get the first text |
if ( str.isEmpty() ) | if ( str.isEmpty() ) |
{ | { |
QHashIterator<QString, QString> it ( ic->text() ); | QHashIterator<QString, QString> it ( ic->text() ); |
while ( it.hasNext() ) { |
it.toBack(); |
it.next(); |
while ( it.hasPrevious() ) { |
|
it.previous(); |
| |
if ( !it.value().isEmpty() ) { | if ( !it.value().isEmpty() ) { |
str = it.value(); | str = it.value(); |
|
|
| |
if ( !str.isEmpty() ) | if ( !str.isEmpty() ) |
text = str; | text = str; |
|
|
// and list of possible variants in the ToolTip | // and list of possible variants in the ToolTip |
QString toolTip; |
QString toolTip = text; |
foreach ( QString icText, ic->text() ) { |
/* foreach ( QString icText, ic->text() ) { |
if ( !toolTip.isEmpty() ) | if ( !toolTip.isEmpty() ) |
toolTip += ", "; | toolTip += ", "; |
toolTip += icText; | toolTip += icText; |
break; // comment this to get list of iconsets | break; // comment this to get list of iconsets |
} |
}*/ |
if ( toolTip.length() > 30 ) | if ( toolTip.length() > 30 ) |
toolTip = toolTip.left(30) + "..."; | toolTip = toolTip.left(30) + "..."; |
setToolTip(toolTip); | setToolTip(toolTip); |