summaryrefslogtreecommitdiffstats
path: root/examples/widgets/richtext/textedit
diff options
context:
space:
mode:
authorRafael Roquetto <rafael.roquetto@kdab.com>2015-10-19 10:03:38 -0200
committerRafael Roquetto <rafael.roquetto@kdab.com>2015-10-19 14:56:45 +0000
commitc9195ab36de6cdc124826edfab3739060bf4d8cc (patch)
tree3faf00eb21e2e45e9ee190301231c42148614ed6 /examples/widgets/richtext/textedit
parent6ea67f52dab17267805410d7d2ce3950210c7b9c (diff)
TextEdit example: fix build when clipboard is disabled.
Change-Id: Ib25563e3dc299dc2d23bed8b3071af1ba81150e7 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
Diffstat (limited to 'examples/widgets/richtext/textedit')
-rw-r--r--examples/widgets/richtext/textedit/textedit.cpp4
-rw-r--r--examples/widgets/richtext/textedit/textedit.h2
2 files changed, 4 insertions, 2 deletions
diff --git a/examples/widgets/richtext/textedit/textedit.cpp b/examples/widgets/richtext/textedit/textedit.cpp
index 201151c32e..be46c4d008 100644
--- a/examples/widgets/richtext/textedit/textedit.cpp
+++ b/examples/widgets/richtext/textedit/textedit.cpp
@@ -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
diff --git a/examples/widgets/richtext/textedit/textedit.h b/examples/widgets/richtext/textedit/textedit.h
index b338493d83..ca2fb86b29 100644
--- a/examples/widgets/richtext/textedit/textedit.h
+++ b/examples/widgets/richtext/textedit/textedit.h
@@ -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;