Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Setting Unicode Char to QComboBox
Forum Updated to NodeBB v4.3 + New Features

Setting Unicode Char to QComboBox

Scheduled Pinned Locked Moved Solved General and Desktop
3 Posts 2 Posters 734 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    TheEnigmist
    wrote on last edited by
    #1

    I'm trying to add a € char in a QComboBox, but all my attempts gave � as result.
    I tried:

    • comboBox->addItem("€");
    • comboBox->addItem("\u20ac");
    • comboBox->addItem("QString::fromUtf8(\u20ac"));

    How can I let comboBox display properly unicode chars?

    jsulmJ 1 Reply Last reply
    0
    • T TheEnigmist

      I'm trying to add a € char in a QComboBox, but all my attempts gave � as result.
      I tried:

      • comboBox->addItem("€");
      • comboBox->addItem("\u20ac");
      • comboBox->addItem("QString::fromUtf8(\u20ac"));

      How can I let comboBox display properly unicode chars?

      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @TheEnigmist Works for me.
      On which OS are you, which Qt version? Also, is your source code stored as UTF-8?

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      T 1 Reply Last reply
      2
      • jsulmJ jsulm

        @TheEnigmist Works for me.
        On which OS are you, which Qt version? Also, is your source code stored as UTF-8?

        T Offline
        T Offline
        TheEnigmist
        wrote on last edited by TheEnigmist
        #3

        @jsulm Wow, what a stupid coder I'm! The problem was that source file was set as ANSI and not as UTF-8!
        I'm actually working on Windows 10 x64, Qt version 5.11.2 and I'm coding with Visual Studio 2017.
        For some readon the .cpp file was setted as ANSI instead of UTF8

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved