Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Special Characters
Forum Updated to NodeBB v4.3 + New Features

Special Characters

Scheduled Pinned Locked Moved Solved QML and Qt Quick
7 Posts 3 Posters 3.3k Views 4 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.
  • beeckscheB Offline
    beeckscheB Offline
    beecksche
    wrote on last edited by
    #1

    Hi,
    I changed from Qt 5.9.3 and Qt Creator 4.4.1 to Qt 5.10.0 and Qt 4.5.0.

    Now special charaters in labels, etc. are not displayed correctly in the application.

    If you need more informations, feel free to ask. Thanks!

    1 Reply Last reply
    0
    • L Offline
      L Offline
      Leonardo
      wrote on last edited by
      #2

      Which platform?

      beeckscheB 1 Reply Last reply
      0
      • L Leonardo

        Which platform?

        beeckscheB Offline
        beeckscheB Offline
        beecksche
        wrote on last edited by
        #3

        @Leonardo
        Compiled and run on Windows 10.

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          Hi,

          Can you show a picture of what you get ?

          A minimal sample application triggering that ?

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          beeckscheB 1 Reply Last reply
          0
          • SGaistS SGaist

            Hi,

            Can you show a picture of what you get ?

            A minimal sample application triggering that ?

            beeckscheB Offline
            beeckscheB Offline
            beecksche
            wrote on last edited by beecksche
            #5

            @SGaist

            I wrote a little example and recognized, it only has effect of the text in a Button!

            The source code:

            import QtQuick 2.6
            import QtQuick.Controls 2.1
            //import QtQuick.Controls 2.3 // no change
            import QtQuick.Window 2.2
            
            Window {
                visible: true
                width: 400
                height: 150
                title: qsTr("Hello World")
            
                Column {
                    anchors.fill: parent
            
                    spacing: 20
            
                    Text {
                        anchors.horizontalCenter: parent.horizontalCenter
                        text: qsTr("Qt 5.10.0")
            //            text: qsTr("Qt 5.9.3")
                    }
            
                    Text {
                        anchors.horizontalCenter: parent.horizontalCenter
                        text: qsTr("Hello & Welcome")
                    }
            
                    Button  {
                        anchors.horizontalCenter: parent.horizontalCenter
                        text: qsTr("Hello & Welcome")
                    }
                }
            }
            

            And the displayed windows, compiled with Qt5.10.0 and Qt5.9.3 (msvc 2013):

            1_1515745273988_Qt5-10-0.JPG 0_1515745273987_Qt5-9-3.JPG

            1 Reply Last reply
            0
            • L Offline
              L Offline
              Leonardo
              wrote on last edited by
              #6

              Based on your image, it looks like Qt 5.10 has introduced a new feature. When we set the label for a button in a native application, we use & to specify a shortcut. For example, "&Open" would be rendered as "Open" with the first "O" underlined, meaning that Alt+o is a shortcut for that button. In your case, after the & there's a space, which we can also see underlined. When that's not the desired behavior, we should escape the & character. Try "Hello \\& Welcome" or "Hello && Welcome".

              beeckscheB 1 Reply Last reply
              2
              • L Leonardo

                Based on your image, it looks like Qt 5.10 has introduced a new feature. When we set the label for a button in a native application, we use & to specify a shortcut. For example, "&Open" would be rendered as "Open" with the first "O" underlined, meaning that Alt+o is a shortcut for that button. In your case, after the & there's a space, which we can also see underlined. When that's not the desired behavior, we should escape the & character. Try "Hello \\& Welcome" or "Hello && Welcome".

                beeckscheB Offline
                beeckscheB Offline
                beecksche
                wrote on last edited by
                #7

                @Leonardo

                Thanks for that information. You're right: in Qt5.10 they added thw QML type Action. The AbstractButton has in Qt 5.10 an Action with a shortcut.

                So i changed the code to

                import QtQuick 2.6
                import QtQuick.Controls 2.3
                import QtQuick.Window 2.2
                
                Window {
                    visible: true
                    width: 400
                    height: 150
                    title: qsTr("Hello World")
                
                    Column {
                        anchors.fill: parent
                
                        spacing: 20
                
                        Text {
                            anchors.horizontalCenter: parent.horizontalCenter
                            text: qsTr("Qt 5.10.0")
                        }
                
                        Text {
                            anchors.horizontalCenter: parent.horizontalCenter
                            text: qsTr("Hello & Welcome")
                        }
                
                        ToolButton  {
                            anchors.horizontalCenter: parent.horizontalCenter
                            text: qsTr("Hello && Welcome")
                        }
                    }
                }
                

                and now it works fine.

                0_1516007255838_Qt5-10-0-2.JPG

                Thanks a lot!

                1 Reply Last reply
                1

                • Login

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