To save the contents displayed in QsciScintilla into a text file

  • I know this is not a QsciScintilla forum , some help will be helpful
    I am using an object of QsciScintilla object and using following code to load the file.

    class myEdit:public QsciScintilla{
    void readFile();

    myEdit::readFile() {
    if (FILE* fp = fopen(ofilename.toLatin1(), "r")) {
    QTextStream ms(fp, QIODevice::ReadOnly);
    int bufferSize =(1024* 1024);
    while(!ms.atEnd() {
    QString s =;
    I want to save contents of the Editor into an text file so that I use the same for regressions. Can some one guide me , how to save the contents of the Editor into a text file

  • Qt Champions 2017

    It seems you can get the text with
    QString QsciScintilla::text ()
    and then you can just save that.

  • Super easy!

    myEdit::writeFile() {
    QFile destination("destination.txt");
    if ( {
    QTextStream ms(&destination);
    ms << text();

Log in to reply

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