TextEdit example: fix build when clipboard is disabled.
Change-Id: Ib25563e3dc299dc2d23bed8b3071af1ba81150e7 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
This commit is contained in:
parent
6ea67f52da
commit
c9195ab36d
@ -115,10 +115,10 @@ TextEdit::TextEdit(QWidget *parent)
|
||||
actionUndo->setEnabled(textEdit->document()->isUndoAvailable());
|
||||
actionRedo->setEnabled(textEdit->document()->isRedoAvailable());
|
||||
|
||||
#ifndef QT_NO_CLIPBOARD
|
||||
actionCut->setEnabled(false);
|
||||
actionCopy->setEnabled(false);
|
||||
|
||||
#ifndef QT_NO_CLIPBOARD
|
||||
connect(QApplication::clipboard(), &QClipboard::dataChanged, this, &TextEdit::clipboardDataChanged);
|
||||
#endif
|
||||
|
||||
@ -202,6 +202,7 @@ void TextEdit::setupEditActions()
|
||||
tb->addAction(actionRedo);
|
||||
menu->addSeparator();
|
||||
|
||||
#ifndef QT_NO_CLIPBOARD
|
||||
const QIcon cutIcon = QIcon::fromTheme("edit-cut", QIcon(rsrcPath + "/editcut.png"));
|
||||
actionCut = menu->addAction(cutIcon, tr("Cu&t"), textEdit, &QTextEdit::cut);
|
||||
actionCut->setPriority(QAction::LowPriority);
|
||||
@ -219,7 +220,6 @@ void TextEdit::setupEditActions()
|
||||
actionPaste->setPriority(QAction::LowPriority);
|
||||
actionPaste->setShortcut(QKeySequence::Paste);
|
||||
tb->addAction(actionPaste);
|
||||
#ifndef QT_NO_CLIPBOARD
|
||||
if (const QMimeData *md = QApplication::clipboard()->mimeData())
|
||||
actionPaste->setEnabled(md->hasText());
|
||||
#endif
|
||||
|
@ -110,9 +110,11 @@ private:
|
||||
QAction *actionAlignJustify;
|
||||
QAction *actionUndo;
|
||||
QAction *actionRedo;
|
||||
#ifndef QT_NO_CLIPBOARD
|
||||
QAction *actionCut;
|
||||
QAction *actionCopy;
|
||||
QAction *actionPaste;
|
||||
#endif
|
||||
|
||||
QComboBox *comboStyle;
|
||||
QFontComboBox *comboFont;
|
||||
|
Loading…
Reference in New Issue
Block a user