Commit 7b853c03 authored by Utkarsh Ayachit's avatar Utkarsh Ayachit

Fix issues with Qt 5 static plugins.

The Qt macro usage was incorrect. Addresses #17157.
parent 5d75d310
......@@ -931,12 +931,17 @@ FUNCTION(ADD_PARAVIEW_PLUGIN NAME VERSION)
endif()
IF(GUI_SRCS OR SM_SRCS OR ARG_SOURCES OR ARG_PYTHON_MODULES)
if(PARAVIEW_QT_VERSION VERSION_GREATER "4")
else()
set(plugin_type_gui_qt4 TRUE)
endif()
CONFIGURE_FILE(
${ParaView_CMAKE_DIR}/pqParaViewPlugin.h.in
${CMAKE_CURRENT_BINARY_DIR}/${PLUGIN_NAME}_Plugin.h @ONLY)
CONFIGURE_FILE(
${ParaView_CMAKE_DIR}/pqParaViewPlugin.cxx.in
${CMAKE_CURRENT_BINARY_DIR}/${PLUGIN_NAME}_Plugin.cxx @ONLY)
unset(plugin_type_gui_qt4)
SET (plugin_sources
${CMAKE_CURRENT_BINARY_DIR}/${PLUGIN_NAME}_Plugin.cxx
......
......@@ -174,12 +174,17 @@ void @PLUGIN_NAME@_Plugin::GetPythonSourceList(std::vector<std::string>& modules
//-----------------------------------------------------------------------------
@PLUGIN_NAME@_Plugin::@PLUGIN_NAME@_Plugin()
{
#ifndef BUILD_SHARED_LIBS
# ifdef plugin_type_gui
#if !defined(BUILD_SHARED_LIBS) && defined(plugin_type_gui)
// For static builds, initialize the Qt resources as well as the Qt plugin.
@QRC_RESOURCES_INIT@
#ifdef plugin_type_gui_qt4
// Qt 4
Q_IMPORT_PLUGIN(@PLUGIN_NAME@)
# endif
#else
// Qt 5
Q_IMPORT_PLUGIN(@PLUGIN_NAME@_Plugin)
#endif
#endif
}
......@@ -188,12 +193,7 @@ void @PLUGIN_NAME@_Plugin::GetPythonSourceList(std::vector<std::string>& modules
PV_PLUGIN_EXPORT(@PLUGIN_NAME@, @PLUGIN_NAME@_Plugin)
//-----------------------------------------------------------------------------
#ifdef plugin_type_gui
#if defined(plugin_type_gui) && defined(plugin_type_gui_qt4)
// Required to mark this as a Qt plugin.
#if QT_VERSION >= 0x050000
Q_DECLARE_INTERFACE(@PLUGIN_NAME@_Plugin, "com.kitware/paraview/@PLUGIN_NAME@")
Q_PLUGIN_METADATA(IID "com.kitware/paraview/@PLUGIN_NAME@")
#else
Q_EXPORT_PLUGIN2(@PLUGIN_NAME@, @PLUGIN_NAME@_Plugin)
#endif
#endif
......@@ -36,6 +36,11 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#cmakedefine plugin_type_servermanager
#cmakedefine plugin_type_gui
// We can't check QT_VERSION in the header since its not defined when moc
// is run. Hence we rely on this variable to tell us that we're building
// for Qt4.
#cmakedefine plugin_type_gui_qt4
/// this is set when the plugin has source headers that are wrapped.
#cmakedefine INITIALIZE_WRAPPING
#cmakedefine INITIALIZE_EXTRA_CS_MODULES
......@@ -75,6 +80,12 @@ class @PLUGIN_NAME@_Plugin :
{
#ifdef plugin_type_gui
Q_OBJECT
Q_INTERFACES(vtkPVGUIPluginInterface)
#ifndef plugin_type_gui_qt4
// Qt 5 only
Q_PLUGIN_METADATA(IID "com.kitware/paraview/@PLUGIN_NAME@_Plugin")
#endif
//#endif
#endif
public:
@PLUGIN_NAME@_Plugin();
......@@ -102,7 +113,7 @@ public:
// Description:
// Returns a ';' separated list of plugin names required by this plugin.
const char* GetRequiredPlugins() VTK_OVERRIDE
{
{
return "@PLUGIN_REQUIRED_PLUGINS@";
}
......
......@@ -30,5 +30,5 @@ public:
virtual ~vtkPVGUIPluginInterface();
virtual QObjectList interfaces() = 0;
};
Q_DECLARE_INTERFACE(vtkPVGUIPluginInterface, "com.kitware/paraview/guiplugin")
#endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment