本文整理汇总了C++中QTextDocument::isRedoAvailable方法的典型用法代码示例。如果您正苦于以下问题:C++ QTextDocument::isRedoAvailable方法的具体用法?C++ QTextDocument::isRedoAvailable怎么用?C++ QTextDocument::isRedoAvailable使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QTextDocument
的用法示例。
在下文中一共展示了QTextDocument::isRedoAvailable方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: isRedoAvailable
bool QTextDocumentProto::isRedoAvailable() const
{
QTextDocument *item = qscriptvalue_cast<QTextDocument*>(thisObject());
if (item)
return item->isRedoAvailable();
return false;
}
示例2: onCurrentChanged
void Editor::onCurrentChanged(int idx)
{
if(idx < 0) return;
emit cursorPositionChanged();
QTextDocument * document = currentTextEdit()->document();
QTextCursor cursor = currentTextEdit()->textCursor();
// update cursor position.
emit cursorPositionChanged();
// update copy/undo/redo available.
emit copyAvailable(cursor.position() != cursor.anchor());
emit undoAvailable(document->isUndoAvailable());
emit redoAvailable(document->isRedoAvailable());
emit pasteAvailable(true);
connect(currentTextEdit(), SIGNAL(copyAvailable(bool)), this, SLOT(onCopyAvailable(bool)));
connect(currentTextEdit(), SIGNAL(undoAvailable(bool)), this, SLOT(onUndoAvailable(bool)));
connect(currentTextEdit(), SIGNAL(redoAvailable(bool)), this, SLOT(onRedoAvailable(bool)));
}
示例3: enableUndoRedoActions
void MainWindow::enableUndoRedoActions()
{
QTextDocument *document = m_editor->document();
m_undoAction->setEnabled(document->isUndoAvailable());
m_redoAction->setEnabled(document->isRedoAvailable());
}
示例4: textCursor
QMenu *
SimpleRichTextEdit::createContextMenu(const QPoint &mouseGlobalPos)
{
Qt::TextInteractionFlags interactionFlags = this->textInteractionFlags();
QTextDocument *document = this->document();
QTextCursor cursor = textCursor();
const bool showTextSelectionActions = (Qt::TextEditable | Qt::TextSelectableByKeyboard | Qt::TextSelectableByMouse) & interactionFlags;
QMenu *menu = new QMenu(this);
if(interactionFlags & Qt::TextEditable) {
m_actions[Undo]->setEnabled(document->isUndoAvailable());
menu->addAction(m_actions[Undo]);
m_actions[Redo]->setEnabled(document->isRedoAvailable());
menu->addAction(m_actions[Redo]);
menu->addSeparator();
m_actions[Cut]->setEnabled(cursor.hasSelection());
menu->addAction(m_actions[Cut]);
}
if(showTextSelectionActions) {
m_actions[Copy]->setEnabled(cursor.hasSelection());
menu->addAction(m_actions[Copy]);
}
if(interactionFlags & Qt::TextEditable) {
#if !defined(QT_NO_CLIPBOARD)
m_actions[Paste]->setEnabled(canPaste());
menu->addAction(m_actions[Paste]);
#endif
m_actions[Delete]->setEnabled(cursor.hasSelection());
menu->addAction(m_actions[Delete]);
m_actions[Clear]->setEnabled(!document->isEmpty());
menu->addAction(m_actions[Clear]);
if(m_insertUnicodeControlCharMenu && interactionFlags & Qt::TextEditable) {
menu->addSeparator();
menu->addMenu(m_insertUnicodeControlCharMenu);
}
}
if(showTextSelectionActions) {
menu->addSeparator();
m_actions[SelectAll]->setEnabled(!document->isEmpty());
menu->addAction(m_actions[SelectAll]);
}
if(interactionFlags & Qt::TextEditable) {
menu->addSeparator();
m_actions[ToggleBold]->setCheckable(true);
m_actions[ToggleBold]->setChecked(fontBold());
menu->addAction(m_actions[ToggleBold]);
m_actions[ToggleItalic]->setCheckable(true);
m_actions[ToggleItalic]->setChecked(fontItalic());
menu->addAction(m_actions[ToggleItalic]);
m_actions[ToggleUnderline]->setCheckable(true);
m_actions[ToggleUnderline]->setChecked(fontUnderline());
menu->addAction(m_actions[ToggleUnderline]);
m_actions[ToggleStrikeOut]->setCheckable(true);
m_actions[ToggleStrikeOut]->setChecked(fontStrikeOut());
menu->addAction(m_actions[ToggleStrikeOut]);
menu->addAction(m_actions[ChangeTextColor]);
menu->addSeparator();
m_actions[CheckSpelling]->setEnabled(!document->isEmpty());
menu->addAction(m_actions[CheckSpelling]);
m_actions[ToggleAutoSpellChecking]->setChecked(checkSpellingEnabled());
menu->addAction(m_actions[ToggleAutoSpellChecking]);
if(checkSpellingEnabled()) {
setupWordUnderPositionCursor(mouseGlobalPos);
QString selectedWord = m_selectedWordCursor.selectedText();
if(!selectedWord.isEmpty() && highlighter() && highlighter()->isWordMisspelled(selectedWord)) {
QMenu *suggestionsMenu = menu->addMenu(i18n("Suggestions"));
suggestionsMenu->addAction(i18n("Ignore"), this, SLOT(addToIgnoreList()));
suggestionsMenu->addAction(i18n("Add to Dictionary"), this, SLOT(addToDictionary()));
suggestionsMenu->addSeparator();
QStringList suggestions = highlighter()->suggestionsForWord(m_selectedWordCursor.selectedText());
if(suggestions.empty())
suggestionsMenu->addAction(i18n("No suggestions"))->setEnabled(false);
else {
for(QStringList::ConstIterator it = suggestions.begin(), end = suggestions.end(); it != end; ++it)
suggestionsMenu->addAction(*it, this, SLOT(replaceWithSuggestion()));
}
}
}
//.........这里部分代码省略.........