diff options
author | Liang Qi <liang.qi@qt.io> | 2017-10-17 17:24:01 +0000 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2017-10-17 18:29:37 +0000 |
commit | 7e4571b7e71736cb87cdcaa7eee1c38b18b6f5ae (patch) | |
tree | 01291174cba7d1c73b65142626f5da758941f5de /examples | |
parent | 66119a07e840daae61629762ad3763abd0c16754 (diff) | |
parent | 01afc8c810201b93a12fe7030344e03566d99001 (diff) | |
download | qtbase-7e4571b7e71736cb87cdcaa7eee1c38b18b6f5ae.tar.gz |
Merge "Merge remote-tracking branch 'origin/5.9' into 5.10" into refs/staging/5.10
Diffstat (limited to 'examples')
-rw-r--r-- | examples/widgets/tools/regularexpression/regularexpressiondialog.cpp | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/examples/widgets/tools/regularexpression/regularexpressiondialog.cpp b/examples/widgets/tools/regularexpression/regularexpressiondialog.cpp index 7fdce3b674..67d0db4bed 100644 --- a/examples/widgets/tools/regularexpression/regularexpressiondialog.cpp +++ b/examples/widgets/tools/regularexpression/regularexpressiondialog.cpp @@ -129,6 +129,10 @@ PatternLineEdit::PatternLineEdit(QWidget *parent) : connect(escapeSelectionAction, &QAction::triggered, this, &PatternLineEdit::escapeSelection); connect(copyToCodeAction, &QAction::triggered, this, &PatternLineEdit::copyToCode); connect(pasteFromCodeAction, &QAction::triggered, this, &PatternLineEdit::pasteFromCode); +#if !QT_CONFIG(clipboard) + copyToCodeAction->setEnabled(false); + pasteFromCodeAction->setEnabled(false); +#endif } void PatternLineEdit::escapeSelection() @@ -144,12 +148,16 @@ void PatternLineEdit::escapeSelection() void PatternLineEdit::copyToCode() { +#if QT_CONFIG(clipboard) QGuiApplication::clipboard()->setText(patternToCode(text())); +#endif } void PatternLineEdit::pasteFromCode() { +#if QT_CONFIG(clipboard) setText(codeToPattern(QGuiApplication::clipboard()->text())); +#endif } void PatternLineEdit::contextMenuEvent(QContextMenuEvent *event) @@ -316,7 +324,7 @@ void RegularExpressionDialog::refresh() void RegularExpressionDialog::copyEscapedPatternToClipboard() { -#ifndef QT_NO_CLIPBOARD +#if QT_CONFIG(clipboard) QClipboard *clipboard = QGuiApplication::clipboard(); if (clipboard) clipboard->setText(escapedPatternLineEdit->text()); @@ -361,7 +369,7 @@ QWidget *RegularExpressionDialog::setupLeftUi() palette.setBrush(QPalette::Base, palette.brush(QPalette::Disabled, QPalette::Base)); escapedPatternLineEdit->setPalette(palette); -#ifndef QT_NO_CLIPBOARD +#if QT_CONFIG(clipboard) QAction *copyEscapedPatternAction = new QAction(this); copyEscapedPatternAction->setText(tr("Copy to clipboard")); copyEscapedPatternAction->setIcon(QIcon(QStringLiteral(":/images/copy.png"))); |