Important: Please read the Qt Code of Conduct -

TextArea auto new line problem

  • Hi, I met a problem about TextArea.
    I created a qt quick application in QtCreater 3.1.2. In main.qml, I only add a TextArea control.
    I inputed some chinese words, where the cursor reached the TextArea.right , any more input will cause new input text going to new line.
    But if I only input text such as a~z,0~9 and so on , the TextArea will never change to new line.
    Is any one can help me ? Thanks!

  • Hi,

    Does it happen if you put some space characters? If don't, it happens because there is no way to know when to break a word or a number. So, Qt start a new line just when find a space character.


  • Thanks for reply!
    I did not put any space characters.
    I tested like this: first input one chinese word, than input some character 'a' untile the cursor reached the right end of the area. The result was all those 'a' appeared in the new line.
    I also tested input some space characters. It looks like Qt treated chinese words as space character.

    I only want to inputing texts auto breaking into new line when reach the right end of the textarea. Now I found the example in Qt examples at 'declarative\tutorials\gettingStarted\core\textArea.qml'

Log in to reply