diff options
author | Alessandro Portale <alessandro.portale@qt.io> | 2017-04-24 17:01:10 +0200 |
---|---|---|
committer | Alessandro Portale <alessandro.portale@qt.io> | 2017-04-24 18:36:28 +0000 |
commit | 3624a663d8e94c57cdabca774962a2995c8f79f3 (patch) | |
tree | 0fef1f9ed7d5ec3da5faafb81fd92ae6c300fe66 /src/plugins/cpaster | |
parent | 07884645af8fb449d6b1343d33b734925588768a (diff) | |
download | qt-creator-3624a663d8e94c57cdabca774962a2995c8f79f3.tar.gz |
Reduce usage of qApp in favor of static function calls
Q*Application classes have unusually many static functions. In many
cases in our code, these functions are unnecessarily called as instance
functions, using the qApp helper.
This patch replaces many occurencies of qApp with the according
Q*Application classname.
Change-Id: I6099a419fa7bf969891269c37ed7a9e817ef5124
Reviewed-by: hjk <hjk@qt.io>
Diffstat (limited to 'src/plugins/cpaster')
-rw-r--r-- | src/plugins/cpaster/cpasterplugin.cpp | 2 | ||||
-rw-r--r-- | src/plugins/cpaster/frontend/main.cpp | 6 |
2 files changed, 4 insertions, 4 deletions
diff --git a/src/plugins/cpaster/cpasterplugin.cpp b/src/plugins/cpaster/cpasterplugin.cpp index c30be1c95b..c97e89ae5b 100644 --- a/src/plugins/cpaster/cpasterplugin.cpp +++ b/src/plugins/cpaster/cpasterplugin.cpp @@ -241,7 +241,7 @@ void CodepasterPlugin::post(PasteSources pasteSources) textFromCurrentEditor(&data, &mimeType); if (data.isEmpty() && (pasteSources & PasteClipboard)) { QString subType = QStringLiteral("plain"); - data = qApp->clipboard()->text(subType, QClipboard::Clipboard); + data = QGuiApplication::clipboard()->text(subType, QClipboard::Clipboard); } post(data, mimeType); } diff --git a/src/plugins/cpaster/frontend/main.cpp b/src/plugins/cpaster/frontend/main.cpp index 65c9c9e6b1..2789ebdb51 100644 --- a/src/plugins/cpaster/frontend/main.cpp +++ b/src/plugins/cpaster/frontend/main.cpp @@ -63,13 +63,13 @@ public: ? file.open(stdin, QIODevice::ReadOnly) : file.open(QIODevice::ReadOnly); if (!success) { std::cerr << "Error: Failed to open file to paste from." << std::endl; - qApp->exit(EXIT_FAILURE); + QCoreApplication::exit(EXIT_FAILURE); return; } const QString content = QString::fromLocal8Bit(file.readAll()); if (content.isEmpty()) { std::cerr << "Empty input, aborting." << std::endl; - qApp->exit(EXIT_FAILURE); + QCoreApplication::exit(EXIT_FAILURE); return; } connect(m_protocol.data(), &Protocol::pasteDone, this, &PasteReceiver::handlePasteDone); @@ -80,7 +80,7 @@ private: void handlePasteDone(const QString &link) { std::cout << qPrintable(link) << std::endl; - qApp->quit(); + QCoreApplication::quit(); } const QString m_filePath; |