|
Krita Source Code Documentation
|
#include <klanguagebutton.h>
Inheritance diagram for KLanguageButton:Signals | |
| void | activated (const QString &languageCode) |
| void | highlighted (const QString &languageCode) |
Public Member Functions | |
| 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) |
| KLanguageButton (const QString &text, QWidget *parent=0) | |
| KLanguageButton (QWidget *parent=0) | |
| void | loadAllLanguages () |
| void | setCurrentItem (const QString &languageCode) |
| void | setLocale (const QString &locale) |
| void | setText (const QString &text) |
| void | showLanguageCodes (bool show) |
| ~KLanguageButton () override | |
Private Slots | |
| void | slotHovered (QAction *) |
| void | slotTriggered (QAction *) |
Private Attributes | |
| KLanguageButtonPrivate *const | d |
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 32 of file klanguagebutton.h.
|
explicit |
Constructs a button whose text is determined by the current language in the popup list.
| parent | the parent of the button |
Definition at line 69 of file klanguagebutton.cpp.
|
explicit |
Constructs a button with static text.
| text | the text of the button |
| parent | the parent of the button |
Definition at line 75 of file klanguagebutton.cpp.
References setText().
|
override |
|
signal |
This signal is emitted when a new item is activated.
| languageCode | code of the activated language |
| void KLanguageButton::clear | ( | ) |
Removes all combobox items.
Definition at line 213 of file klanguagebutton.cpp.
References KLanguageButtonPrivate::clear(), and d.
| bool KLanguageButton::contains | ( | const QString & | languageCode | ) | const |
Checks whether the specified language is in the popup list.
| languageCode | the language's code |
Definition at line 228 of file klanguagebutton.cpp.
References d, and KLanguageButtonPrivate::ids.
| int KLanguageButton::count | ( | ) | const |
Returns the number of items in the combo box.
Definition at line 208 of file klanguagebutton.cpp.
References d, and KLanguageButtonPrivate::ids.
| QString KLanguageButton::current | ( | ) | const |
Returns the language code of the combobox's current item.
Definition at line 233 of file klanguagebutton.cpp.
References KLanguageButtonPrivate::current, and d.
|
signal |
This signal is emitted when a new item is highlighted.
| 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.
| 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 123 of file klanguagebutton.cpp.
References checkInsertPos(), d, KLanguageButtonPrivate::ids, KLanguageButtonPrivate::popup, and KLanguageButtonPrivate::showCodes.
| void KLanguageButton::insertSeparator | ( | int | index = -1 | ) |
Inserts a separator item into the combo box. A negative index will append the item.
| index | the insertion position |
Definition at line 153 of file klanguagebutton.cpp.
References d, and KLanguageButtonPrivate::popup.
| 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 162 of file klanguagebutton.cpp.
References count(), d, insertLanguage(), length(), KLanguageButtonPrivate::locale, and setCurrentItem().
| void KLanguageButton::setCurrentItem | ( | const QString & | languageCode | ) |
Sets a given language to be the current item.
| languageCode | the language's code |
Definition at line 248 of file klanguagebutton.cpp.
References d, KLanguageButtonPrivate::findAction(), KLanguageButtonPrivate::ids, and KLanguageButtonPrivate::setCurrentItem().
| void KLanguageButton::setLocale | ( | const QString & | locale | ) |
Sets the locale to display language names. By default, QLocale::system().name() is used.
| locale | locale to use |
Definition at line 113 of file klanguagebutton.cpp.
References d, and KLanguageButtonPrivate::locale.
| void KLanguageButton::setText | ( | const QString & | text | ) |
Sets a static button text.
| text | button text |
Definition at line 107 of file klanguagebutton.cpp.
References KLanguageButtonPrivate::button, d, and KLanguageButtonPrivate::staticText.
| 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.
| show | true to show codes, false to hide codes |
Definition at line 118 of file klanguagebutton.cpp.
References d, and KLanguageButtonPrivate::showCodes.
|
privateslot |
Definition at line 201 of file klanguagebutton.cpp.
References highlighted().
|
privateslot |
Definition at line 188 of file klanguagebutton.cpp.
References activated(), KLanguageButtonPrivate::current, d, and KLanguageButtonPrivate::setCurrentItem().
|
private |
Definition at line 159 of file klanguagebutton.h.