Example #1
0
int EditAreaTabWidget::addMarkdownTab(MarkdownEditAreaWidget *tab, const QIcon &icon, const QString &label)
{
    connect(tab, SIGNAL(showStatusMessage(QString)), manager, SIGNAL(showStatusMessage(QString)));
    if(!tab){
        Q_ASSERT(0 && "this should not be happen");
        return -1;
    }
    connect(tab, SIGNAL(focusInSignal()), this, SIGNAL(focused()));
    return addTab(tab, icon, label);
}
Example #2
0
void BaseEditor::focusInEvent(QFocusEvent *e)
{
    emit focusInSignal();
    QPlainTextEdit::focusInEvent(e);
}
             editor, SLOT( findAndHighlightText( QString, QTextDocument::FindFlags, bool, bool ) ) );
    connect( findAndReplaceWidget, SIGNAL( findHide() ),
             editor, SLOT( findFinished() ) );
    connect( findAndReplaceWidget, SIGNAL( findHide() ),
             this, SLOT( setFocusEditor() ) );
    connect( findAndReplaceWidget, SIGNAL( findHide() ),
             this, SLOT( hideFind() ) );
    connect( findAndReplaceWidget, SIGNAL( findNext( QString, QTextDocument::FindFlags, bool ) ),
             editor, SLOT( findFirstOccurrance( QString, QTextDocument::FindFlags, bool ) ) );
    connect( findAndReplaceWidget, SIGNAL( findPrevious( QString, QTextDocument::FindFlags, bool ) ),
             editor, SLOT( findFirstOccurrance( QString, QTextDocument::FindFlags, bool ) ) );
    connect( findAndReplaceWidget, SIGNAL( replace( QString ) ),
             editor, SLOT( replace( QString ) ) );
    connect( findAndReplaceWidget, SIGNAL( replaceAll( QString, QString, QTextDocument::FindFlags, bool ) ),
             editor, SLOT( replaceAll( QString, QString, QTextDocument::FindFlags, bool ) ) );
    connect( editor, SIGNAL( focusInSignal() ), this, SIGNAL( focusInSignal() ) );
}

void MarkdownEditAreaWidget::parseMarkdown()
{
    //    if (lastRevision == editor->document()->revision())
    //        return;
    //    lastRevision = editor->document()->revision();
    std::string textResult = convertMarkdownToHtml();
    previewer->page()->mainFrame()->findFirstElement( "body" ).setInnerXml( QString::fromUtf8( textResult.c_str(),
            textResult.length() ) );
}

void MarkdownEditAreaWidget::reFind()
{
    findAndReplaceWidget->resendFindTextSignal();