Results 1 to 6 of 6

Thread: Language Selector QCombobox question

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2006
    Location
    Ljubljana
    Posts
    687
    Thanks
    111
    Thanked 4 Times in 4 Posts
    Qt products
    Qt5 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows Android

    Question Language Selector QCombobox question

    Good morning to all, especialy nice and kind experts like wysota and jpn!!!

    Can I get some help, please? I need a QComboBox that act as language selector widget. I've written this (header):
    Qt Code:
    1. #ifndef CLANGUAGESETTINGSPAGE_H_
    2. #define CLANGUAGESETTINGSPAGE_H_
    3.  
    4. // qt includes
    5. #include <QtGui>
    6. #include <QVBoxLayout>
    7. #include <QHBoxLayout>
    8. #include <QPointer>
    9. #include <QString>
    10.  
    11. // custom includes
    12. #include "globals.h"
    13. class CLanguageSettingsPage : public QWidget
    14. {
    15. public:
    16. CLanguageSettingsPage(QWidget* pParent=0);
    17. ~CLanguageSettingsPage();
    18.  
    19. inline QPointer<QLabel> languageSelectorLB()
    20. { return m_pLangaugeSelectorLB; };
    21. inline QPointer<QComboBox> languageSelectorCB()
    22. { return m_pLanguageSelectorCB; };
    23. inline QPointer<QHBoxLayout> languageSelectorHBL()
    24. { return m_pLanguageSelectorHBL; };
    25.  
    26. private:
    27. QPointer<QLabel> m_pLangaugeSelectorLB; // lang. sel. label
    28. QPointer<QComboBox> m_pLanguageSelectorCB; // lang. sel. combo box
    29. QPointer<QHBoxLayout> m_pLanguageSelectorHBL; // lang. sel. horiz. layout
    30. };
    31.  
    32. #endif /*CLANGUAGESETTINGSPAGE_H_*/
    To copy to clipboard, switch view to plain text mode 
    and it's implementation:
    Qt Code:
    1. #include "CLanguageSettingsPage.h"
    2.  
    3. CLanguageSettingsPage::CLanguageSettingsPage(QWidget* pParent)
    4. : QWidget(pParent)
    5. {
    6. // language selector label
    7. m_pLangaugeSelectorLB=new QLabel(tr("Client default language:"), this); // creates new label
    8. Q_CHECK_PTR(m_pLangaugeSelectorLB); // checks creation
    9. //m_pLangaugeSelectorLB->setFrameStyle(QFrame::Panel | QFrame::Raised); // test
    10. // **** end oflanguage selector label
    11.  
    12. // language selector combo box
    13. m_pLanguageSelectorCB=new QComboBox(this); // creates new combo box
    14. Q_CHECK_PTR(m_pLanguageSelectorCB); // checks creation
    15. m_pLanguageSelectorCB->addItem("SlovenÅ¡čina");
    16. m_pLanguageSelectorCB->addItem("English");
    17. m_pLanguageSelectorCB->addItem("Deutsch");
    18. m_pLanguageSelectorCB->addItem("Italiano");
    19. m_pLanguageSelectorCB->addItem("Español");
    20. // **** end oflanguage selector combo box
    21.  
    22. // layout creation
    23. m_pLanguageSelectorHBL=new QHBoxLayout(); // creates new layout
    24. Q_CHECK_PTR(m_pLanguageSelectorHBL); // checks creation
    25. // adds widget to layout
    26. m_pLanguageSelectorHBL->addWidget(m_pLangaugeSelectorLB);
    27. // adds widget to layout
    28. m_pLanguageSelectorHBL->addWidget(m_pLanguageSelectorCB);
    29. // sets layout
    30. setLayout(m_pLanguageSelectorHBL);
    31. }
    32.  
    33. CLanguageSettingsPage::~CLanguageSettingsPage()
    34. {
    35. }
    To copy to clipboard, switch view to plain text mode 
    Everything works fine, however, language native charaters (in Slovenian language and Espanol) are not shown. How do I achieve so native characters will be shown?? I've attached a sscreenshot of a problem.
    Attached Images Attached Images
    Last edited by MarkoSan; 31st January 2008 at 05:05.
    Qt 5.3 Opensource & Creator 3.1.2

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.