Commit 1a2dcfd5 authored by Ruben Undheim's avatar Ruben Undheim

Merge tag 'upstream/0.0.35+git20190103.6a75e98+dfsg.1'

parents ab74cc0d 40a0c17f
......@@ -120,10 +120,9 @@ void AppCSXCAD::SaveSettings()
void AppCSXCAD::LoadSettings()
{
QSettings settings(__APPNAME__, __APPNAME__);
settings.beginGroup("MainWindow");
restoreGeometry(settings.value("Geometry").toByteArray());
restoreState(settings.value("State").toByteArray());
//restoreState(settings.value("State").toByteArray());
settings.endGroup();
}
......
......@@ -10,6 +10,10 @@ PROJECT( AppCSXCAD CXX C)
cmake_minimum_required(VERSION 2.8)
if (UNIX)
set (CMAKE_CXX_FLAGS -fPIC )
endif()
if(POLICY CMP0020)
cmake_policy(SET CMP0020 OLD)
endif()
......@@ -100,29 +104,12 @@ find_package(HDF5 1.8 COMPONENTS C HL REQUIRED)
INCLUDE_DIRECTORIES (${HDF5_INCLUDE_DIRS})
# vtk
if (WIN32)
find_package(VTK 6.1 REQUIRED)
else()
# prefer >=6.1, fallback to >=5.4
find_package(VTK 6.1 COMPONENTS vtkGUISupportQt NO_MODULE)
IF (NOT ${VTK_FOUND})
find_package(VTK REQUIRED)
endif()
endif()
find_package(VTK REQUIRED)
message(STATUS "Found package VTK. Using " ${VTK_VERSION})
include(${VTK_USE_FILE})
INCLUDE_DIRECTORIES(${VTK_INCLUDE_DIR})
if("${VTK_MAJOR_VERSION}" EQUAL 5)
set( vtk_LIBS
QVTK )
elseif("${VTK_MAJOR_VERSION}" EQUAL 6)
set( vtk_LIBS
vtkGUISupportQt)
endif()
message(STATUS "vtk libraries " ${vtk_LIBS})
# Qt
set(CMAKE_AUTOMOC ON)
if(${VTK_VERSION} VERSION_GREATER "6" AND VTK_QT_VERSION VERSION_GREATER "4")
......@@ -146,17 +133,13 @@ SET(SOURCES
ADD_EXECUTABLE( AppCSXCAD ${SOURCES} )
if(Qt5Widgets_FOUND)
qt5_use_modules(AppCSXCAD Widgets Xml)
endif()
TARGET_LINK_LIBRARIES( AppCSXCAD
${CSXCAD_LIBRARIES}
${QCSXCAD_LIBRARIES}
${HDF5_LIBRARIES}
${HDF5_HL_LIBRARIES}
${QT_LIBRARIES}
${vtk_LIBS}
Qt5::Core Qt5::Widgets Qt5::Xml
${VTK_LIBRARIES}
)
#
......
......@@ -17,16 +17,24 @@
#include "AppCSXCAD.h"
#include "vtkCommand.h"
#if VTK_MAJOR_VERSION>=8
#include <QVTKOpenGLWidget.h>
#include <QSurfaceFormat>
#endif
#include <QApplication>
int main(int argc, char *argv[])
{
#if VTK_MAJOR_VERSION>=8
QSurfaceFormat::setDefaultFormat(QVTKOpenGLWidget::defaultFormat());
#endif
#if not defined(__WIN32) && not defined(__WIN64)
//prevent that Qt changes float handling, e.g. expecting a german 1,345e+3 will fail...
setenv("LC_NUMERIC","C",1);
#endif
QApplication a(argc, argv);
AppCSXCAD w;
w.show();
return a.exec();
AppCSXCAD w;
w.show();
return a.exec();
}
......@@ -95,15 +95,7 @@ find_package(TinyXML REQUIRED)
ADD_DEFINITIONS( -DTIXML_USE_STL )
# vtk
if (WIN32)
find_package(VTK 6.1 REQUIRED)
else()
# prefer >=6.1, fallback to >=5.4
find_package(VTK 6.1 COMPONENTS vtkGUISupportQt vtkRenderingLOD vtkRenderingOpenGL vtkIOXML vtkIOPLY vtkIOImage vtkInteractionWidgets NO_MODULE)
IF (NOT ${VTK_FOUND})
find_package(VTK REQUIRED)
endif()
endif()
find_package(VTK REQUIRED)
message(STATUS "Found package VTK. Using version " ${VTK_VERSION})
include(${VTK_USE_FILE})
......
......@@ -19,7 +19,14 @@
#include "QVTKStructure.h"
#include "QVTKWidget.h"
#include "vtkCommand.h"
#if VTK_MAJOR_VERSION>=8
#include "QVTKOpenGLWidget.h"
#include "vtkGenericOpenGLRenderWindow.h"
#else
#include "QVTKWidget.h"
#endif
#include "vtkRenderWindow.h"
#include "vtkRenderWindowInteractor.h"
#include "vtkRenderer.h"
......@@ -50,7 +57,6 @@
#include "vtkDoubleArray.h"
#include "vtkActorCollection.h"
#include "vtkInteractorStyle.h"
#include "vtkCommand.h"
#include "vtkCallbackCommand.h"
#include "vtkWindowToImageFilter.h"
#include "vtkPNGWriter.h"
......@@ -93,7 +99,12 @@ QVTKStructure::QVTKStructure()
iResolution=32;
AllowUpdate=true;
#if VTK_MAJOR_VERSION>=8
VTKWidget = new QVTKOpenGLWidget();
VTKWidget->SetRenderWindow(vtkGenericOpenGLRenderWindow::New());
#else
VTKWidget= new QVTKWidget();
#endif
ren = vtkRenderer::New();
VTKWidget->GetRenderWindow()->AddRenderer(ren);
......
......@@ -20,7 +20,12 @@
#include <QtGui>
class QVTKWidget;
#include "vtkCommand.h"
#if VTK_MAJOR_VERSION>=8
class QVTKOpenGLWidget;
#else
class QVTKWidget;
#endif
class vtkRenderWindow;
class vtkRenderWindowInteractor;
class vtkRenderer;
......@@ -95,7 +100,11 @@ protected:
unsigned int uID;
} VTKLayerStruct;
#if VTK_MAJOR_VERSION>=8
QVTKOpenGLWidget *VTKWidget;
#else
QVTKWidget *VTKWidget;
#endif
//set to false if this widget is hidden
bool AllowUpdate;
......
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