Important: Please read the Qt Code of Conduct -

Word Wrapping In Plain TextEdit

  • I am trying to display ascii chars on a PlainTextEdit widget, however I've run into the issue where my lines are suddenly cut in half. There is a \n character where I actually want the text to start a new line, so this word wrapping feature is undesirable. I've tried setting the word wrap and line wrap modes to NoWrap, however it still produces the same undesirable image shown below. I can't display all the text for proprietary reasons, but essentially what happens is each C should be the start of a new line. There are 80 chars in each line, hence the loop. The widget is much larger than where the text is wrapped, so I'm really not sure what is happening here. alt text

    uint8_t count = 0;
    QString textualFileCharacterString;
    char currentCharacter;
    const char* currentCharacterPointer = &currentCharacter;
    while (bytePosition < 3200)
        for(count = 0; count < 80; count ++)
  *)(&ASCIIorEBCDICchar[0]), BUF_LEN_1);
            if (EBCDICtoASCIIConvNeeded == TRUE)
                currentCharacter = ebc_to_ascii_table(ASCIIorEBCDICchar[0]); // file is encoded in EBCDIC
                currentCharacter = ASCIIorEBCDICchar[0]; // file is encoded in ASCII
            // if(currentCharacter == 32)//Auto space formatting fix, if current character equals space it converts it to a dot
            //   currentCharacter = 46;
            textualFileCharacterString = QString::fromUtf8(currentCharacterPointer, ONE_BYTE); //converts ASCII value to usable QString

  • @brazz said in Word Wrapping In Plain TextEdit:


    Hmm. Works as expected for me (Qt 5.9.1, Desktop Linux)


    void MainWindow::on_pushButton_clicked()
        auto const s = QString("Lorem Ipsum is simply dummy text of the printing and typesetting industry.\nLorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.");

  • strange, I have a windows 10 partition so os might have an effect. I change the loop to 160 and it works fine now. Odd, but oh well

Log in to reply