>From d1fc9b599aa0786133334077df2307fa2254bba6 Mon Sep 17 00:00:00 2001
From: Aaron Hexamer <hexamer@comcast.net>
Date: Sat, 9 May 2015 08:21:34 -0500
Subject: [PATCH] fix configuration for case where memqt is the only Qt device

---
 bindings/qt_gui/plqt.cpp    | 2 +-
 cmake/modules/qt.cmake      | 8 --------
 examples/c++/CMakeLists.txt | 2 +-
 include/CMakeLists.txt      | 3 +++
 include/qt.h                | 2 +-
 5 files changed, 6 insertions(+), 11 deletions(-)

diff --git a/bindings/qt_gui/plqt.cpp b/bindings/qt_gui/plqt.cpp
index 3eb1da2..00cdf1a 100644
--- a/bindings/qt_gui/plqt.cpp
+++ b/bindings/qt_gui/plqt.cpp
@@ -507,7 +507,7 @@ void QtPLDriver::setSolid()
 }
 
 ////////////////// Raster driver-specific definitions: class and interface functions /////////
-#if defined ( PLD_bmpqt ) || defined ( PLD_jpgqt ) || defined ( PLD_pngqt ) || defined ( PLD_ppmqt ) || defined ( PLD_tiffqt )
+#if defined ( PLD_bmpqt ) || defined ( PLD_jpgqt ) || defined ( PLD_pngqt ) || defined ( PLD_ppmqt ) || defined ( PLD_tiffqt ) || defined ( PLD_memqt )
 QtRasterDevice::QtRasterDevice( int i_iWidth, int i_iHeight ) :
     QtPLDriver( i_iWidth, i_iHeight ),
     QImage( i_iWidth, i_iHeight, QImage::Format_RGB32 )
diff --git a/cmake/modules/qt.cmake b/cmake/modules/qt.cmake
index b4f349f..e4e09eb 100644
--- a/cmake/modules/qt.cmake
+++ b/cmake/modules/qt.cmake
@@ -180,14 +180,6 @@ if(NOT ANY_QT_DEVICE)
   set(PLD_extqt OFF CACHE BOOL "Enable Qt ext device" FORCE)
 endif(NOT ANY_QT_DEVICE)
 
-if(ENABLE_qt AND NOT PLD_extqt)
-  message(STATUS
-    "WARNING: PLD_extqt is OFF so "
-    "setting ENABLE_qt to OFF."
-    )
-  set(ENABLE_qt OFF CACHE BOOL "Enable Qt bindings" FORCE)
-endif(ENABLE_qt AND NOT PLD_extqt)
-
 if(ENABLE_qt)
   if(NOT PLPLOT_USE_QT5)
     # Use a minimum version corresponding to the version installed by
diff --git a/examples/c++/CMakeLists.txt b/examples/c++/CMakeLists.txt
index a9e5e6b..b72d998 100644
--- a/examples/c++/CMakeLists.txt
+++ b/examples/c++/CMakeLists.txt
@@ -143,7 +143,7 @@ if(BUILD_TEST)
     target_link_libraries(wxPLplotDemo plplotwxwidgets plplotcxx ${wxwidgets_LINK_FLAGS} ${MATH_LIB})
   endif(ENABLE_wxwidgets)
 
-  if(ENABLE_qt)
+  if(ENABLE_qt AND PLD_extqt)
     if(CORE_BUILD)
       set(BUILD_qt_example ON)
       if(NOT PLPLOT_USE_QT5 AND NOT QT_LIBRARIES)
diff --git a/include/CMakeLists.txt b/include/CMakeLists.txt
index acaeedf..71a49f9 100644
--- a/include/CMakeLists.txt
+++ b/include/CMakeLists.txt
@@ -119,6 +119,9 @@ if(ANY_QT_DEVICE)
   if(PLD_extqt)
     list(APPEND MOC_OPTIONS -DPLD_extqt)
   endif(PLD_extqt)
+  if(PLD_memqt)
+    list(APPEND MOC_OPTIONS -DPLD_memqt)
+  endif(PLD_memqt)
   if(MOC_OPTIONS)
     # This creates a custom command with OUTPUT ${QT_MOC_OUTFILES}.
     if(PLPLOT_USE_QT5)
diff --git a/include/qt.h b/include/qt.h
index 33e86cf..4167f60 100644
--- a/include/qt.h
+++ b/include/qt.h
@@ -164,7 +164,7 @@ protected:
     QPainter * m_painterP;
 };
 
-#if defined ( PLD_bmpqt ) || defined ( PLD_jpgqt ) || defined ( PLD_pngqt ) || defined ( PLD_ppmqt ) || defined ( PLD_tiffqt )
+#if defined ( PLD_bmpqt ) || defined ( PLD_jpgqt ) || defined ( PLD_pngqt ) || defined ( PLD_ppmqt ) || defined ( PLD_tiffqt ) || defined ( PLD_memqt )
 // Driver painting whatever raster format Qt can save
 class PLDLLIMPEXP_QT QtRasterDevice : public QtPLDriver, public QImage
 {
-- 
1.9.0.msysgit.0

