Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. Qt 5.14.2 Display wrong text in QML for android
Forum Updated to NodeBB v4.3 + New Features

Qt 5.14.2 Display wrong text in QML for android

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
1 Posts 1 Posters 328 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.
  • E Offline
    E Offline
    es-w
    wrote on last edited by es-w
    #1

    I move my android application from Qt 5.13.2 to Qt 5.14.2. and found it has a problem with the wrong text display for Latin text.

    So now I just strict with Qt 5.13.2 (Even I would like to use a new feature for app bundle ) but I just curious why no one has the problem with display the wrong text after the move to Qt 5.14.2.
    You may notice my code below need to set the font to all text elements to display text correctly which very tedious and never happen before in the previous Qt version.

    I try all method from this post Wrong text display: Qt 5.14 only
    and also load the font in QML and set the font to all display text but some text still displays wrong text i.e. under Menu title as below it shows "Language" as "Mbohvbhft" which seem like it displays ASCII code +1

    23a8549f-df49-4fe9-adea-075175aac040-image.png

    TitleMenu.qml

    Menu {            
        id: homeOptionsMenu
        modal: true
        dim: false
        closePolicy: Popup.CloseOnPressOutside | Popup.CloseOnEscape
        x: parent.width - width
        transformOrigin: Menu.TopRight
    
        Menu {
            title: qsTr("Languages")
            font: Fonts.fontDefault
            cascade: true
            modal: true
            dim: false
            closePolicy: Popup.CloseOnPressOutside | Popup.CloseOnEscape
            transformOrigin: Menu.TopLeft
    
            MenuItem {
                text: "ภาษาไทย"
                font: Fonts.fontDefault
                icon.source: "qrc:/images/Flags-Icon-Set/24x24/TH.png"
                icon.color: "transparent"
                onTriggered: {
                    logic.languageChanged("th")
                }
            }
    
            MenuItem {
                text: "English"
                font: Fonts.fontDefault
                icon.source: "qrc:/images/Flags-Icon-Set/24x24/US.png"
                icon.color: "transparent"
                onTriggered: {
                    logic.languageChanged("en_US")
                }
            }
    
            MenuItem {
                text: "中文"
                font: Fonts.fontDefault
                icon.source: "qrc:/images/Flags-Icon-Set/24x24/CN.png"
                icon.color: "transparent"
                onTriggered: {
                    logic.languageChanged("cn")
                }
            }
        }
    
        MenuItem {
            text: qsTr("About")
            font: Fonts.fontDefault
            onTriggered: navigationIndex = aboutNavigationIndex
        }
    
        MenuSeparator { }
    
        MenuItem {
            text: qsTr("Quit")
            font: Fonts.fontDefault
            onTriggered: Qt.quit()
        }
    }
    

    Fonts.qml

    Item {
            readonly property font fontDefault: Qt.font({"family": fontRobotoLight.name, "pixelSize":  14})
            readonly property FontLoader fontRobotoLight: FontLoader {
                id: fontRobotoLight
                source: "qrc:/fonts/Roboto-Light.ttf"
            }
    }
    

    main.cpp

    int main(int argc, char *argv[])
    {
        QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
    
        qInstallMessageHandler(Utils::messageOutputHandler);
    
        QGuiApplication app(argc, argv);
        QFontDatabase::addApplicationFont(":/fonts/Roboto-Light.ttf");
        app.setFont(QFont("Roboto Light", 12));
    
       QQmlApplicationEngine engine;
      ...
    
    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