• Skip to content
  • Skip to link menu
KDE 4.6 API Reference
  • KDE API Reference
  • kdelibs
  • KDE Home
  • Contact Us
 

KDEUI

Signals | Public Member Functions

KLanguageButton Class Reference

KLanguageButton is a pushbutton which allows a language to be selected from a popup list. More...

#include <klanguagebutton.h>

Inheritance diagram for KLanguageButton:
Inheritance graph
[legend]

List of all members.

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.

klanguagebutton.png

KDE Language Selection Widget

Author:
Hans Petter Bieker <bieker@kde.org>, Martijn Klingens <klingens@kde.org>, David Jarvie <software@astrojar.org.uk>

Definition at line 46 of file klanguagebutton.h.


Constructor & Destructor Documentation

KLanguageButton::KLanguageButton ( QWidget *  parent = 0) [explicit]

Constructs a button whose text is determined by the current language in the popup list.

Parameters:
parentthe parent of the button

Definition at line 76 of file klanguagebutton.cpp.

KLanguageButton::KLanguageButton ( const QString &  text,
QWidget *  parent = 0 
) [explicit]

Constructs a button with static text.

Parameters:
textthe text of the button
parentthe parent of the button

Definition at line 82 of file klanguagebutton.cpp.

KLanguageButton::~KLanguageButton ( ) [virtual]

Deconstructor.

Definition at line 109 of file klanguagebutton.cpp.


Member Function Documentation

void KLanguageButton::activated ( const QString &  languageCode) [signal]

This signal is emitted when a new item is activated.

Parameters:
languageCodecode of the activated language
void KLanguageButton::clear ( )

Removes all combobox items.

Definition at line 209 of file klanguagebutton.cpp.

bool KLanguageButton::contains ( const QString &  languageCode) const

Checks whether the specified language is in the popup list.

Parameters:
languageCodethe 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.

void KLanguageButton::highlighted ( const QString &  languageCode) [signal]

This signal is emitted when a new item is highlighted.

Parameters:
languageCodecode 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:
languageCodethe code for the language
namelanguage name. If empty, the name is obtained automatically.
indexthe 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:
indexthe 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:
languageCodethe 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:
localelocale to use

Definition at line 120 of file klanguagebutton.cpp.

void KLanguageButton::setText ( const QString &  text)

Sets a static button text.

Parameters:
textbutton 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:
showtrue 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:
  • klanguagebutton.h
  • klanguagebutton.cpp

KDEUI

Skip menu "KDEUI"
  • Main Page
  • Modules
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members
  • Related Pages

kdelibs

Skip menu "kdelibs"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • Kate
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Generated for kdelibs by doxygen 1.7.3
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal