Uploaded image for project: 'Qt Creator'
  1. Qt Creator
  2. QTCREATORBUG-24178

Text properties with newlines not properly saved in .ui files

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Reported
    • Priority: Not Evaluated
    • Resolution: Unresolved
    • Affects Version/s: Qt Creator 4.12.2
    • Fix Version/s: None
    • Component/s: Editors
    • Labels:

      Description

      When String properties that can contains newlines (like text() for QString) are output to a ui file, some other editors may decide to reformat it and change the format of the string, in particular it may add spaces and other newlines that will alter the original string.

      For example, I have a QLabel with text()  value like "Firstname\nLastname".

      The \n character is expanded to newline in the UI file.

      If I load it in some other editor, it might legitimally reformat it and add a second newline and an indent.

      It is legit. 

      To prevent this there are two options:

       

      1) surround the text with a <![CDATA]> tag, or

      2) use an xml:space="preserve" attribute to the <string> tag.

       

      Both work with the editors I tested, i.e. jetbrain's clion.

       

        Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

            Assignee:
            davschul David Schulz
            Reporter:
            f.fuga Federico Fuga
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:

                Gerrit Reviews

                There are no open Gerrit changes