CTK  0.1.0
The Common Toolkit is a community effort to provide support code for medical image analysis, surgical navigation, and related projects.
Public Types | Public Slots | Signals | Public Member Functions | Protected Slots | Protected Attributes | Properties | List of all members
ctkLanguageComboBox Class Reference

#include <Libs/Widgets/ctkLanguageComboBox.h>

Inheritance diagram for ctkLanguageComboBox:
Inheritance graph
[legend]
Collaboration diagram for ctkLanguageComboBox:
Collaboration graph
[legend]

Public Types

typedef QComboBox Superclass
 

Public Slots

void setCurrentLanguage (const QString &language)
 

Signals

void currentLanguageNameChanged (const QString &)
 

Public Member Functions

 ctkLanguageComboBox (const QString &defaultLanguage, QWidget *parent=0)
 
 ctkLanguageComboBox (QWidget *parent=0)
 Constructor of ctkLanguageComboBox. More...
 
QString currentLanguage () const
 
QString defaultLanguage () const
 
QString directory () const
 
void setDefaultLanguage (const QString &language)
 
void setDirectory (const QString &dir)
 
virtual ~ctkLanguageComboBox ()
 

Protected Slots

void onLanguageChanged (int index)
 

Protected Attributes

QScopedPointer< ctkLanguageComboBoxPrivate > d_ptr
 

Properties

QString currentLanguage
 
QString defaultLanguage
 This property controls the default language of the application. More...
 
QString directory
 

Detailed Description

ctkLanguageComboBox is a simple QComboBox to select the language of your application. You have to set the default language of your application and then set the directory to allow the comboBox to find the translation files. ctkLanguageComboBox automatically recognizes the language of the translation file by the suffix "_en" or "_fr" and add the associated language to the comboBox.

Note
: Translation files names need to finish with the suffix of the country. Example: for a french traduction, xxxx_fr.ts
Warning
Please don't use QComboBox methods when using this class.

Definition at line 43 of file ctkLanguageComboBox.h.

Member Typedef Documentation

◆ Superclass

Definition at line 70 of file ctkLanguageComboBox.h.

Constructor & Destructor Documentation

◆ ctkLanguageComboBox() [1/2]

ctkLanguageComboBox::ctkLanguageComboBox ( QWidget *  parent = 0)

Constructor of ctkLanguageComboBox.

◆ ctkLanguageComboBox() [2/2]

ctkLanguageComboBox::ctkLanguageComboBox ( const QString &  defaultLanguage,
QWidget *  parent = 0 
)

Constructor that specifies a default language.

See also
defaultLanguage

◆ ~ctkLanguageComboBox()

virtual ctkLanguageComboBox::~ctkLanguageComboBox ( )
virtual

Member Function Documentation

◆ currentLanguage()

QString ctkLanguageComboBox::currentLanguage ( ) const

Return the currently selected language of the combobox.

See also
currentLanguage, setCurrentLanguage()

◆ currentLanguageNameChanged

void ctkLanguageComboBox::currentLanguageNameChanged ( const QString &  )
signal

Signals emitted when the current language changed.

See also
QLocale::name()

◆ defaultLanguage()

QString ctkLanguageComboBox::defaultLanguage ( ) const

Return the default language.

See also
defaultLanguage, setDefaultLanguage()

◆ directory()

QString ctkLanguageComboBox::directory ( ) const

Set the directory with all the translation files. The list of available languages will be populated based on the discovered translation files. The default language will still be the first item in the menu. Empty by default.

◆ onLanguageChanged

void ctkLanguageComboBox::onLanguageChanged ( int  index)
protectedslot

◆ setCurrentLanguage

void ctkLanguageComboBox::setCurrentLanguage ( const QString &  language)
slot

Set the current language

See also
currentLanguage, currentLanguage()

◆ setDefaultLanguage()

void ctkLanguageComboBox::setDefaultLanguage ( const QString &  language)

Set the default language. The previous default language is removed and replaced with the new default language.

See also
defaultLanguage, defaultLanguage()

◆ setDirectory()

void ctkLanguageComboBox::setDirectory ( const QString &  dir)

Member Data Documentation

◆ d_ptr

QScopedPointer<ctkLanguageComboBoxPrivate> ctkLanguageComboBox::d_ptr
protected

Definition at line 113 of file ctkLanguageComboBox.h.

Property Documentation

◆ currentLanguage

QString ctkLanguageComboBox::currentLanguage
readwrite

This property controls the current language of the combobox. The defaultLanguage by default.

See also
currentLanguage(), setCurrentLanguage()

Definition at line 1 of file ctkLanguageComboBox.h.

◆ defaultLanguage

QString ctkLanguageComboBox::defaultLanguage
readwrite

This property controls the default language of the application.

The default language is the language in which all the texts in GUI elements are written. As the application doesn't have translation file for the default language, this property adds an item to the combobox. The language format is a lowercase, two-letter, ISO 639 language code. For example: "fr", "en" or "de_ch". If empty, there is no default language, and there is no entry added. By default, there is no default language.

See also
defaultLanguage(), setDefaultLanguage(), QLocale::setDefault()

Definition at line 1 of file ctkLanguageComboBox.h.

◆ directory

QString ctkLanguageComboBox::directory
readwrite

This property controls the directory where the translation files are located.

See also
directory(), setDirectory()

Definition at line 1 of file ctkLanguageComboBox.h.


The documentation for this class was generated from the following file: