aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/qmldesigner/shortcutmanager.cpp
diff options
context:
space:
mode:
authorEike Ziller <eike.ziller@qt.io>2018-04-16 14:21:01 +0200
committerEike Ziller <eike.ziller@qt.io>2018-04-16 13:11:47 +0000
commitc00c4fc9c2be8e248ea16d84bcc809418def45b4 (patch)
treedc03527742a43f28833d769e40aef151971e744e /src/plugins/qmldesigner/shortcutmanager.cpp
parente50b3c14129ba398965e5b281859ade80b85bf1e (diff)
QmlDesigner: Do not access clipboard if not requested to by user
QClipboard documentation states for X11: "Lastly, the X11 clipboard is event driven, i.e. the clipboard will not function properly if the event loop is not running. Similarly, it is recommended that the contents of the clipboard are stored or retrieved in direct response to user-input events, e.g. mouse button or key presses and releases. You should not store or retrieve the clipboard contents in response to timer or non-user-input events." So do not request the clipboard data when the QClipboard signals that the data has changed, because that locks up if the application providing the data is unresponsive. Task-number: QTCREATORBUG-20262 Change-Id: Ifd10150e1de62c8153ab2bb93a3e953a36fb243a Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
Diffstat (limited to 'src/plugins/qmldesigner/shortcutmanager.cpp')
-rw-r--r--src/plugins/qmldesigner/shortcutmanager.cpp12
1 files changed, 1 insertions, 11 deletions
diff --git a/src/plugins/qmldesigner/shortcutmanager.cpp b/src/plugins/qmldesigner/shortcutmanager.cpp
index 066bb350e9..fe5b640210 100644
--- a/src/plugins/qmldesigner/shortcutmanager.cpp
+++ b/src/plugins/qmldesigner/shortcutmanager.cpp
@@ -59,12 +59,6 @@
#include <QApplication>
#include <QClipboard>
-static void updateClipboard(QAction *action)
-{
- const bool dataInClipboard = !QApplication::clipboard()->text().isEmpty();
- action->setEnabled(dataInClipboard);
-}
-
namespace QmlDesigner {
ShortCutManager::ShortCutManager()
@@ -247,6 +241,7 @@ void ShortCutManager::registerActions(const Core::Context &qmlDesignerMainContex
m_deleteAction.setEnabled(itemsSelected && !rootItemIsSelected);
m_cutAction.setEnabled(itemsSelected && !rootItemIsSelected);
m_copyAction.setEnabled(itemsSelected);
+ m_pasteAction.setEnabled(true);
});
connect(Core::ICore::instance(), &Core::ICore::contextChanged, this, [&designerActionManager, this](const Core::Context &context){
@@ -260,11 +255,6 @@ void ShortCutManager::registerActions(const Core::Context &qmlDesignerMainContex
}
});
-
- updateClipboard(&m_pasteAction);
- connect(QApplication::clipboard(), &QClipboard::QClipboard::changed, this, [this]() {
- updateClipboard(&m_pasteAction);
- });
}
void ShortCutManager::updateActions(Core::IEditor* currentEditor)