Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. change character size automatically with longer translations in QtLinguist
Forum Updated to NodeBB v4.3 + New Features

change character size automatically with longer translations in QtLinguist

Scheduled Pinned Locked Moved Qt Creator and other tools
qmltextsizeqtlinguistqtcreatorcreatorlinguist
6 Posts 2 Posters 2.5k Views 2 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.
  • L Offline
    L Offline
    louis
    wrote on 3 Sept 2015, 11:25 last edited by
    #1

    Hey,

    i am currently working with qtLinguist in my (qt-qml-)Project. I do have a problem with translated strings that exceeds my scopes.

    Is there a way to change text sizes if the translation exceeds a number of pixles (or characters).

    If not, is there any way to highlight translated strings that are to long in qtLinguist so i can choose another translation for all the string that are to long?

    regards
    louis

    1 Reply Last reply
    0
    • S Offline
      S Offline
      SGaist
      Lifetime Qt Champion
      wrote on 3 Sept 2015, 20:57 last edited by
      #2

      Hi,

      Do you mean elide your texts ?

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

      1 Reply Last reply
      0
      • L Offline
        L Offline
        louis
        wrote on 4 Sept 2015, 09:15 last edited by
        #3

        No, I want to show the whole text but in a smaller pixelSize

        1 Reply Last reply
        0
        • S Offline
          S Offline
          SGaist
          Lifetime Qt Champion
          wrote on 4 Sept 2015, 20:01 last edited by
          #4

          You would have to do that by hand using e.g. QFontMetrics to get the size of your text for a given font size

          Hope it helps

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

          1 Reply Last reply
          0
          • L Offline
            L Offline
            louis
            wrote on 17 Sept 2015, 07:41 last edited by
            #5

            what i now do is:

                TextMultiLine
                {
                  ...
                  width: 466
                  height: 75
                  font.pixelSize: lineCount > 1 ?  30 : 40
                  maximumLineCount: 2
                  wrapMode: Text.Wrap
                  elide: Text.ElideRight
                }
            

            this does fix the Problem*.
            *But there can be of corse a binding loop because lineCount can be 2 with pixlesize 40 and 1 with a smaler linecount. I guess this is ok for me

            L 1 Reply Last reply 18 Oct 2016, 08:16
            0
            • L louis
              17 Sept 2015, 07:41

              what i now do is:

                  TextMultiLine
                  {
                    ...
                    width: 466
                    height: 75
                    font.pixelSize: lineCount > 1 ?  30 : 40
                    maximumLineCount: 2
                    wrapMode: Text.Wrap
                    elide: Text.ElideRight
                  }
              

              this does fix the Problem*.
              *But there can be of corse a binding loop because lineCount can be 2 with pixlesize 40 and 1 with a smaler linecount. I guess this is ok for me

              L Offline
              L Offline
              louis
              wrote on 18 Oct 2016, 08:16 last edited by
              #6

              i just found fontSizeMode: Text.VerticalFit. This will try to fix sizes

              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