Exemplo n.º 1
0
void CodeEdit::onTextChanged()
{
    QMdiSubWindow *sub = (QMdiSubWindow *)this->parent();

    updateTitle();

    //if hasShredded and text changed (now!) make a new revision
    if ( rev->hasShredded && undoText.compare(toPlainText())!=0 ){

        //get info from the parent revision
        QString bufferTextChanged = toPlainText();
        int cursorPos = textCursor().position();

        //new revision
        Revision *r = new Revision( rev );
        CodeArea *area = (CodeArea *)sub->mdiArea();

        undoChanges();
        listenChanges();

        undoText = toPlainText();

        area->addCodeWindow(r, bufferTextChanged, cursorPos, font().pointSize() ); //make a code window
    }
}