Fix bug #9217: [Qt5] QWindowsMime class not available

The support for QWindowsMime has been reintroduced in Qt 5.4.0.
The class name has been changed to QWinMime but the interface
is exactly the same.
This commit is contained in:
Enrico Forestieri 2014-12-26 16:53:31 +01:00
parent 903917f3b8
commit 9126a99e97
5 changed files with 39 additions and 8 deletions

View File

@ -556,6 +556,7 @@ if(LYX_USE_QT MATCHES "QT5")
find_package(Qt5MacExtras REQUIRED)
endif()
find_package(Qt5X11Extras QUIET)
find_package(Qt5WinExtras QUIET)
set(QTVERSION ${Qt5Core_VERSION})
macro (qt_use_modules)
qt5_use_modules(${ARGN})

View File

@ -201,6 +201,11 @@ AC_DEFUN([QT_DO_PKG_CONFIG],
if test "x$USE_QT5" != "xno" ; then
qt_corelibs="Qt5Core"
qt_guilibs="Qt5Core Qt5Concurrent Qt5Gui Qt5Widgets"
lyx_use_winextras=false
PKG_CHECK_EXISTS(Qt5WinExtras, [lyx_use_winextras=true], [])
if $lyx_use_winextras; then
qt_guilibs="$qt_guilibs Qt5WinExtras"
fi
fi
PKG_CHECK_MODULES(QT_CORE, $qt_corelibs,,[:])
if test "$pkg_failed" = "no" ; then

View File

@ -175,6 +175,13 @@ if(LYX_USE_QT MATCHES "QT5")
"
QT_USES_X11)
endif()
if (Qt5WinExtras_FOUND)
get_target_property(_winextra_prop Qt5::WinExtras IMPORTED_CONFIGURATIONS)
get_target_property(_winextra_link_libraries Qt5::WinExtras IMPORTED_LOCATION_${_winextra_prop})
set(CMAKE_REQUIRED_LIBRARIES ${_winextra_link_libraries})
set(CMAKE_REQUIRED_INCLUDES ${Qt5WinExtras_INCLUDE_DIRS})
set(CMAKE_REQUIRED_FLAGS ${Qt5WinExtras_EXECUTABLE_COMPILE_FLAGS})
endif()
elseif(LYX_USE_QT MATCHES "QT4")
set(CMAKE_REQUIRED_LIBRARIES ${QT_QTGUI_LIBRARY})
set(CMAKE_REQUIRED_INCLUDES ${QT_INCLUDES})

View File

@ -58,7 +58,11 @@ set_target_properties(frontend_qt PROPERTIES FOLDER "applications/LyX")
if(Qt5Core_FOUND AND APPLE)
qt_use_modules(frontend_qt Core Gui Widgets Concurrent MacExtras)
else()
qt_use_modules(frontend_qt Core Gui Widgets Concurrent)
if (Qt5WinExtras_FOUND)
qt_use_modules(frontend_qt Core Gui Widgets Concurrent WinExtras)
else()
qt_use_modules(frontend_qt Core Gui Widgets Concurrent)
endif()
endif()
target_link_libraries(frontend_qt
frontends

View File

@ -124,13 +124,21 @@
#undef None
#endif
#ifdef Q_WS_WIN
#if (QT_VERSION < 0x050000) || (QT_VERSION >= 0x050400)
#if defined(Q_OS_WIN) || defined(Q_CYGWIN_WIN)
#if (QT_VERSION < 0x050000)
#include <QWindowsMime>
#define QWINDOWSMIME QWindowsMime
#else
#include <QWinMime>
#define QWINDOWSMIME QWinMime
#endif
#ifdef Q_CC_GNU
#include <wtypes.h>
#endif
#include <objidl.h>
#endif // Q_WS_WIN
#endif
#endif
#ifdef Q_OS_MAC
#include <QMacPasteboardMime>
@ -716,7 +724,8 @@ public:
////////////////////////////////////////////////////////////////////////
// Windows specific stuff goes here...
#ifdef Q_WS_WIN
#if (QT_VERSION < 0x050000) || (QT_VERSION >= 0x050400)
#if defined(Q_OS_WIN) || defined(Q_CYGWIN_WIN)
// QWindowsMimeMetafile can only be compiled on Windows.
static FORMATETC cfFromMime(QString const & mimetype)
@ -736,7 +745,7 @@ static FORMATETC cfFromMime(QString const & mimetype)
}
class QWindowsMimeMetafile : public QWindowsMime {
class QWindowsMimeMetafile : public QWINDOWSMIME {
public:
QWindowsMimeMetafile() {}
@ -813,7 +822,8 @@ public:
}
};
#endif // Q_WS_WIN
#endif
#endif
/// Allows to check whether ESC was pressed during a long operation
@ -877,9 +887,11 @@ struct GuiApplication::Private
Private(): language_model_(0), meta_fake_bit(NoModifier),
global_menubar_(0)
{
#ifdef Q_WS_WIN
#if (QT_VERSION < 0x050000) || (QT_VERSION >= 0x050400)
#if defined(Q_OS_WIN) || defined(Q_CYGWIN_WIN)
/// WMF Mime handler for Windows clipboard.
wmf_mime_ = new QWindowsMimeMetafile;
#endif
#endif
initKeySequences(&theTopLevelKeymap());
}
@ -941,9 +953,11 @@ struct GuiApplication::Private
QMacPasteboardMimeGraphics mac_pasteboard_mime_;
#endif
#ifdef Q_WS_WIN
#if (QT_VERSION < 0x050000) || (QT_VERSION >= 0x050400)
#if defined(Q_OS_WIN) || defined(Q_CYGWIN_WIN)
/// WMF Mime handler for Windows clipboard.
QWindowsMimeMetafile * wmf_mime_;
#endif
#endif
/// Allows to check whether ESC was pressed during a long operation