KDEUI
#include <klanguagebutton.h>
Signals | |
void | activated (const QString &languageCode) |
void | highlighted (const QString &languageCode) |
Public Member Functions | |
KLanguageButton (QWidget *parent=0) | |
KLanguageButton (const QString &text, QWidget *parent=0) | |
virtual | ~KLanguageButton () |
void | clear () |
bool | contains (const QString &languageCode) const |
int | count () const |
QString | current () const |
void | insertLanguage (const QString &languageCode, const QString &name=QString(), int index=-1) |
void | insertSeparator (int index=-1) |
void | loadAllLanguages () |
void | setCurrentItem (const QString &languageCode) |
void | setLocale (const KLocale *locale) |
void | setText (const QString &text) |
void | showLanguageCodes (bool show) |
Detailed Description
KLanguageButton is a pushbutton which allows a language to be selected from a popup list.
Languages are identified by their ISO 639-1 codes, e.g. en, pt_BR.
Definition at line 46 of file klanguagebutton.h.
Constructor & Destructor Documentation
|
explicit |
Constructs a button whose text is determined by the current language in the popup list.
- Parameters
-
parent the parent of the button
Definition at line 76 of file klanguagebutton.cpp.
Constructs a button with static text.
- Parameters
-
text the text of the button parent the parent of the button
Definition at line 82 of file klanguagebutton.cpp.
|
virtual |
Deconstructor.
Definition at line 109 of file klanguagebutton.cpp.
Member Function Documentation
|
signal |
This signal is emitted when a new item is activated.
- Parameters
-
languageCode code of the activated language
void KLanguageButton::clear | ( | ) |
Removes all combobox items.
Definition at line 209 of file klanguagebutton.cpp.
Checks whether the specified language is in the popup list.
- Parameters
-
languageCode the language's code
- Returns
- true if in the list
Definition at line 224 of file klanguagebutton.cpp.
int KLanguageButton::count | ( | ) | const |
Returns the number of items in the combo box.
Definition at line 204 of file klanguagebutton.cpp.
QString KLanguageButton::current | ( | ) | const |
Returns the language code of the combobox's current item.
- Returns
- the current item's language code
Definition at line 229 of file klanguagebutton.cpp.
|
signal |
This signal is emitted when a new item is highlighted.
- Parameters
-
languageCode code of the highlighted language
void KLanguageButton::insertLanguage | ( | const QString & | languageCode, |
const QString & | name = QString() , |
||
int | index = -1 |
||
) |
Inserts a language into the combo box.
Normally the display name of the language is obtained automatically, but if either the language code does not exist, or there are special display requirements, the name of the language can be specified in name
.
- Parameters
-
languageCode the code for the language name language name. If empty, the name is obtained automatically. index the insertion position, or -1 to insert in alphabetical order
Definition at line 130 of file klanguagebutton.cpp.
void KLanguageButton::insertSeparator | ( | int | index = -1 | ) |
Inserts a separator item into the combo box.
A negative index will append the item.
- Parameters
-
index the insertion position
Definition at line 158 of file klanguagebutton.cpp.
void KLanguageButton::loadAllLanguages | ( | ) |
Load all known languages into the popup list.
The current language in the list is set to the default language for the current locale (as modified by setLocale()).
Definition at line 166 of file klanguagebutton.cpp.
void KLanguageButton::setCurrentItem | ( | const QString & | languageCode | ) |
Sets a given language to be the current item.
- Parameters
-
languageCode the language's code
Definition at line 243 of file klanguagebutton.cpp.
void KLanguageButton::setLocale | ( | const KLocale * | locale | ) |
Sets the locale to display language names.
By default, KGlobal::locale() is used.
- Parameters
-
locale locale to use
Definition at line 120 of file klanguagebutton.cpp.
void KLanguageButton::setText | ( | const QString & | text | ) |
Sets a static button text.
- Parameters
-
text button text
Definition at line 114 of file klanguagebutton.cpp.
void KLanguageButton::showLanguageCodes | ( | bool | show | ) |
Specifies whether language codes should be shown alongside language names in the popup.
Calling this method does not affect any previously inserted language texts, so it should normally be called before populating the list.
- Parameters
-
show true to show codes, false to hide codes
Definition at line 125 of file klanguagebutton.cpp.
The documentation for this class was generated from the following files:
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:49:17 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.