QTextEdit: how group a lot of operations? (or how convert QString<->QStringList)



  • Sometimes controls have methods beginUpdate/endUpdate od lock/unlock. How to prevent emit a 2000 textChanged() signal when :

    for (int i=0; i<2000; i++)
            editor->insertPlainText("ab");
    

    (alternatively: how change CString->vector of CStrings ->CString?)


  • Qt Champions 2017

    @AndrzejB

    (alternatively: how change CString->vector of CStrings ->CString?)

    What do you mean by CString?

    QStringList has a join operator that might do what you want:

    QStringList lines = { "first", "second", "third" };
    QString result = lines.join('\n');
    


  • Yes, QString and QStringList :

    QStringList lines = text.split("\n");
    string = lines.join("\n");
    

Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.