void TextZone::setDoc(MainTextDocument *doc)
{
    textDocument = doc;
    this->setDocument(doc);

    if(this->objectName().mid(0,7) == "textDoc"
            || this->objectName().mid(0,6) == "synDoc"
            || this->objectName().mid(0,7) == "noteDoc")
        this->setIdNumber(this->objectName().mid(this->objectName().indexOf("_") + 1).toInt());

    connect(this, SIGNAL(cursorPositionChanged(int)), doc, SLOT(setCursorPos(int)));


    connect(this, SIGNAL(cursorPositionChanged()), this, SLOT(cursorPositionChangedSlot()));






    // activate spell check at start

    QSettings settings;
    this->activateSpellcheck(settings.value("SpellChecking/globalSpellCheckActivated", true).toBool());


    //minimap :
    createThumbnail();
    connect(doc, SIGNAL(contentsChanged()), this, SLOT(createThumbnail()));

}
Exemple #2
0
GPlainTextEdit::GPlainTextEdit(QWidget *parent,VM *pVM)  : QPlainTextEdit(parent)
{
	this->pVM = pVM;
	this->pParaList = ring_list_new(0);
	strcpy(this->cblockCountChangedEvent,"");
	strcpy(this->ccopyAvailableEvent,"");
	strcpy(this->ccursorPositionChangedEvent,"");
	strcpy(this->cmodificationChangedEvent,"");
	strcpy(this->credoAvailableEvent,"");
	strcpy(this->cselectionChangedEvent,"");
	strcpy(this->ctextChangedEvent,"");
	strcpy(this->cundoAvailableEvent,"");
	strcpy(this->cupdateRequestEvent,"");

	QObject::connect(this, SIGNAL(blockCountChanged(int)),this, SLOT(blockCountChangedSlot()));
	QObject::connect(this, SIGNAL(copyAvailable(bool)),this, SLOT(copyAvailableSlot()));
	QObject::connect(this, SIGNAL(cursorPositionChanged()),this, SLOT(cursorPositionChangedSlot()));
	QObject::connect(this, SIGNAL(modificationChanged(bool)),this, SLOT(modificationChangedSlot()));
	QObject::connect(this, SIGNAL(redoAvailable(bool)),this, SLOT(redoAvailableSlot()));
	QObject::connect(this, SIGNAL(selectionChanged()),this, SLOT(selectionChanged()));
	QObject::connect(this, SIGNAL(textChanged()),this, SLOT(textChangedSlot()));
	QObject::connect(this, SIGNAL(undoAvailable(bool)),this, SLOT(undoAvailableSlot()));
	QObject::connect(this, SIGNAL(updateRequest(const QRect, int)),this, SLOT(updateRequestSlot()));

}
void TextZone::createContent()
{
    //    sounds = new Sounds(this);


    this->setAttribute(Qt::WA_KeyCompression, true);

    textDocument = new MainTextDocument(this);

    createActions();
    setContextMenuPolicy(Qt::DefaultContextMenu);
    connect(this, SIGNAL(currentCharFormatChanged(QTextCharFormat)), this, SLOT(charFormat(QTextCharFormat)));
    connect(this, SIGNAL(cursorPositionChanged()), this, SLOT(cursorPositionChangedSlot()));

    setWordWrapMode(QTextOption::WrapAtWordBoundaryOrAnywhere);

    setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);


    applyConfig();
}