Fixing Qt4 builds

This commit is contained in:
Matthias Koefferlein 2023-01-22 10:35:13 +01:00
parent ca091203b3
commit 5276d24706
1 changed files with 7 additions and 1 deletions

View File

@ -37,7 +37,9 @@
#include <QUrl> #include <QUrl>
#include <QMimeData> #include <QMimeData>
#include <QClipboard> #include <QClipboard>
#include <QGuiApplication> #if QT_VERSION >= 0x050000
# include <QGuiApplication>
#endif
#if defined(__APPLE__) && (QT_VERSION < 0x050401) #if defined(__APPLE__) && (QT_VERSION < 0x050401)
// A workaround for the issue of Qt 4.8.x when handling "File Reference URL" in OSX // A workaround for the issue of Qt 4.8.x when handling "File Reference URL" in OSX
@ -2169,7 +2171,11 @@ MainWindow::cm_screenshot_to_clipboard ()
{ {
if (current_view ()) { if (current_view ()) {
QImage screenshot = current_view ()->get_screenshot (); QImage screenshot = current_view ()->get_screenshot ();
#if QT_VERSION >= 0x050000
QClipboard *clipboard = QGuiApplication::clipboard(); QClipboard *clipboard = QGuiApplication::clipboard();
#else
QClipboard *clipboard = QApplication::clipboard();
#endif
clipboard->setImage(screenshot); clipboard->setImage(screenshot);
} else { } else {
throw tl::Exception (tl::to_string (QObject::tr ("No view open to create a screenshot from"))); throw tl::Exception (tl::to_string (QObject::tr ("No view open to create a screenshot from")));