A gentle reminder. I am stuck in my problem and your help will he really helpful
On Sat, Jun 11, 2016 at 4:01 PM, Roshni Lalwani <[email protected]> wrote: > If we load the fiile a file in in object of QScintilla using folllowing > code > > > Header myEditor.h > > class myScintilla: public QScintilla { > public readFile();}; > #include "myEditor.h"void myEditor::readFile() { > > if (FILE* fp = fopen(ofilename.toLatin1(), "r")) { > QTextStream ts(fp, QIODevice::ReadOnly); > int bufferSize =(1024* 1024)/2; > do { > QString s = ts.read(bufferSize); > append(s); > } while(!ts.atEnd());} > > > > there will be still performance issue while reading large files. It took > around > > 1) 25 seconds to read a file of size 1.5 GB. (Machine cores 4 , 16 GB RAM) > 2 10 seconds of file of size 512MB (on same machine) > > Is there any way we can load the file in QScintilla object incrementally > based on movement of scrollbar? > > There is ILoader in Scintilla::ScintillaEdit that has the capabilty . > How Can we have same capability in object of QScintilla and how Can we > use ILoader in object of QScintilla > > > The Scintilla documentation can be found at: > > Here’s the basic mechanism to load the source into Scintilla using > ILoader. dEditorPtr is an instance of Scintilla::ScintillaEdit. lFileSize > is the size of the source file in bytes. > > > > char lBuffer[8192]; > > size_t lCnt; > > ILoader *lLoader = (ILoader*) dEditorPtr->createLoader(lFileSize); > > FILE* lFP = fopen(ofilename.toLatin1(), “r”); > > while (!feof(lFP)) { > > lCnt = fread(lBuffer, 1, sizeof(lBuffer), lFP); > > if (lLoader->AddData(lBuffer, lCnt) != SC_STATUS_OK) { > > // report error > > } > > } > > dEditorPtr->setDocPointer(lLoader->ConvertToDocument()); > >
_______________________________________________ QScintilla mailing list [email protected] https://www.riverbankcomputing.com/mailman/listinfo/qscintilla
