Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. International
  3. Chinese
  4. Chinese Character in Qt
Qt 6.11 is out! See what's new in the release blog

Chinese Character in Qt

Scheduled Pinned Locked Moved Chinese
2 Posts 2 Posters 1.8k Views 1 Watching
  • 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.
  • S Offline
    S Offline
    saravanavelu39
    wrote on last edited by
    #1

    In here i just pass the string
    @@QString ItemPushButton::name_check(QString str)
    {
    QTextCodec::setCodecForCStrings(QTextCodec::codecForName("UTF-8"));
    QRegExp [removed]"#([0-9]+);");
    QStringList list,list1;
    int pos = 0;
    int length;
    while((pos = expression.indexIn(str,pos))!=-1)
    {
    list << expression.cap(1);
    QString v;
    length = expression.matchedLength();
    v=str.mid(pos+1,length-1-1);
    QByteArray ba = v.toUtf8();
    QString str1 = QString(QChar(v.toInt()));
    list1 <<str1;
    pos += expression.matchedLength();
    }
    foreach (QString s, list) {
    str.replace(s,"");
    }
    str = str.replace("#","");
    str = str.replace(";","");

    foreach (QString s, list1) {
        str = str.append(s);
    }
    return str;
    

    }@
    This return string is a chinese character,, I displayed this string in Qpushbutton,,In here chinese characters are displayed correctly,, But i pass this string to template and take the print means in the receipt chinese character are overwrite,,(i.e) If i pass the three chinese character means in the receipt bill it displayed 5 chinese character,,please give a suggestion,,,Thanks

    1 Reply Last reply
    0
    • J Offline
      J Offline
      jiangcaiyang
      wrote on last edited by
      #2

      我还是倾向于使用Linguist翻译成中文,然后载入.qml文件进行中文的显示。

      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