commit 17b24cf480ca864a746cc2cbb808209d8c976a55
Author: Enrico Forestieri <for...@lyx.org>
Date:   Fri Apr 28 23:34:01 2023 +0200

    Re-enable QWindowsMimeMetafile with Qt6
    
    Qt 6.5.0 has dropped support for the QWindowsMime class
    in favor of a new QWindowsMimeConverter class. They say:
      "If you have implementations of QWindowsMime or QMacMime in Qt 5,
       then those will almost directly translate to the new APIs but
       require less boiler-plate code to register the converters with Qt."
    This may be true, but in practice they break binary compatibility with
    previous versions. If you used the QWindowsMime class until Qt 6.4 by
    using boiler-plate code to register the converters with Qt, you now
    need to modify the sources and recompile. Fantastic!
---
 src/frontends/qt/GuiApplication.cpp |   12 +++++++++---
 1 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/src/frontends/qt/GuiApplication.cpp 
b/src/frontends/qt/GuiApplication.cpp
index 0fd63a3..1b29eec 100644
--- a/src/frontends/qt/GuiApplication.cpp
+++ b/src/frontends/qt/GuiApplication.cpp
@@ -130,6 +130,11 @@
 #if (QT_VERSION >= 0x050400)
 #if defined(Q_OS_WIN) || defined(Q_CYGWIN_WIN)
 #if (QT_VERSION >= 0x060000)
+#if (QT_VERSION >= 0x060500)
+#include <QtGui/QWindowsMimeConverter>
+#define QWINDOWSMIME QWindowsMimeConverter
+#define QVARIANTTYPE QMetaType
+#else
 #include <QtGui/private/qguiapplication_p.h>
 #include <QtGui/private/qwindowsmime_p.h>
 #include <QtGui/qpa/qplatformintegration.h>
@@ -137,6 +142,7 @@
 #define QVARIANTTYPE QMetaType
 using QWindowsMime = QNativeInterface::Private::QWindowsMime;
 using QWindowsApplication = QNativeInterface::Private::QWindowsApplication;
+#endif
 #else
 #include <QWinMime>
 #define QWINDOWSMIME QWinMime
@@ -1031,7 +1037,7 @@ struct GuiApplication::Private
        #if defined(Q_OS_WIN) || defined(Q_CYGWIN_WIN)
                /// WMF Mime handler for Windows clipboard.
                wmf_mime_ = new QWindowsMimeMetafile;
-       #if (QT_VERSION >= 0x060000)
+       #if (QT_VERSION >= 0x060000 && QT_VERSION < 0x060500)
                win_app_ = dynamic_cast<QWindowsApplication *>
                        (QGuiApplicationPrivate::platformIntegration());
                win_app_->registerMime(wmf_mime_);
@@ -1041,7 +1047,7 @@ struct GuiApplication::Private
                initKeySequences(&theTopLevelKeymap());
        }
 
-       #if (QT_VERSION >= 0x060000)
+       #if (QT_VERSION >= 0x060000 && QT_VERSION < 0x060500)
        #if defined(Q_OS_WIN) || defined(Q_CYGWIN_WIN)
        ~Private()
        {
@@ -1120,7 +1126,7 @@ struct GuiApplication::Private
 #if defined(Q_OS_WIN) || defined(Q_CYGWIN_WIN)
        /// WMF Mime handler for Windows clipboard.
        QWindowsMimeMetafile * wmf_mime_;
-#if (QT_VERSION >= 0x060000)
+#if (QT_VERSION >= 0x060000 && QT_VERSION < 0x060500)
        QWindowsApplication * win_app_;
 #endif
 #endif
-- 
lyx-cvs mailing list
lyx-cvs@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-cvs

Reply via email to