]> https://gitweb.dealii.org/ - parameter_gui.git/commitdiff
Make compile with and use Qt5 by default.
authorRene Gassmoeller <rene.gassmoeller@mailbox.org>
Fri, 23 Jun 2017 23:17:04 +0000 (17:17 -0600)
committerRene Gassmoeller <rene.gassmoeller@mailbox.org>
Sat, 24 Jun 2017 21:42:57 +0000 (15:42 -0600)
CMakeLists.txt
browse_lineedit.cpp
info_message.cpp
mainwindow.cpp
parameter_delegate.cpp
prm_parameter_writer.cpp
settings_dialog.cpp
xml_parameter_reader.cpp
xml_parameter_writer.cpp

index 5a702c0337367d4d035d5af70864ee208591e5b8..f291d9a43bc394da63a37392a07ec4506208b27d 100644 (file)
@@ -20,24 +20,44 @@ IF("${DEAL_II_EXECUTABLE_RELDIR}" STREQUAL "")
   SET(DEAL_II_EXECUTABLE_RELDIR "bin")
 ENDIF()
 
-FIND_PACKAGE(Qt4 REQUIRED QtCore QtGui QtXml)
-MARK_AS_ADVANCED(QT_QMAKE_EXECUTABLE)
+FIND_PACKAGE(Qt5 COMPONENTS Core Gui Xml Widgets)
+
+IF(${Qt5_FOUND})
+ELSE()
+  FIND_PACKAGE(Qt4 REQUIRED QtCore QtGui QtXml)
+  INCLUDE(${QT_USE_FILE})
+ENDIF()
 
-INCLUDE(${QT_USE_FILE})
+MARK_AS_ADVANCED(QT_QMAKE_EXECUTABLE)
 
 INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR})
 
-QT4_WRAP_CPP(SOURCE_MOC
-  browse_lineedit.h
-  info_message.h
-  settings_dialog.h
-  mainwindow.h
-  parameter_delegate.h
-  )
+IF(${Qt5_FOUND})
+  QT5_WRAP_CPP(SOURCE_MOC
+    browse_lineedit.h
+    info_message.h
+    settings_dialog.h
+    mainwindow.h
+    parameter_delegate.h
+    )
+
+  QT5_ADD_RESOURCES(SOURCE_RCC
+    application.qrc
+    )
+ELSE()
+  QT4_WRAP_CPP(SOURCE_MOC
+    browse_lineedit.h
+    info_message.h
+    settings_dialog.h
+    mainwindow.h
+    parameter_delegate.h
+    )
+
+  QT4_ADD_RESOURCES(SOURCE_RCC
+    application.qrc
+    )
+ENDIF()
 
-QT4_ADD_RESOURCES(SOURCE_RCC
-  application.qrc
-  )
 
 ADD_EXECUTABLE(parameter_gui_exe
   browse_lineedit.cpp
@@ -68,3 +88,7 @@ EXPORT(TARGETS parameter_gui_exe
   ${CMAKE_BINARY_DIR}/${DEAL_II_PROJECT_CONFIG_RELDIR}/${DEAL_II_PROJECT_CONFIG_NAME}Targets.cmake
   APPEND
   )
+
+IF(${Qt5_FOUND})
+  QT5_USE_MODULES(parameter_gui_exe Core Gui Xml Widgets)
+ENDIF()
index e35abdef22d107b91cfceedbb1ac3662414cd79f..26eb2c9f255b7c9ec14eeddf88b48e923ed0154b 100644 (file)
 //
 // ---------------------------------------------------------------------
 
-
-#include <QtGui>
-
 #include "browse_lineedit.h"
 
+#if QT_VERSION >= 0x050000
+#include <QtWidgets>
+#else
+#include <QtGui>
+#endif
 
 namespace dealii
 {
index 20ce13703b1d834279bc2a68cb0d60477f8d73ca..028a99a59652c39cd287039b6325e5ad21b7ed50 100644 (file)
 // ---------------------------------------------------------------------
 
 
-#include <QtGui>
-
 #include "info_message.h"
 
+#if QT_VERSION >= 0x050000
+#include <QtWidgets>
+#else
+#include <QtGui>
+#endif
 
 namespace dealii
 {
index 24d007765c3f81e0c672f7a71d862b365d0b519f..fe8686ccd8941f0a8369f486f37d5d470c081b1f 100644 (file)
 // ---------------------------------------------------------------------
 
 
-#include <QtGui>
-
 #include "mainwindow.h"
 #include "parameter_delegate.h"
 #include "xml_parameter_reader.h"
 #include "xml_parameter_writer.h"
 #include "prm_parameter_writer.h"
 
+#if QT_VERSION >= 0x050000
+#include <QtWidgets>
+#else
+#include <QtGui>
+#endif
 
 namespace dealii
 {
@@ -36,7 +39,11 @@ namespace dealii
       tree_widget = new QTreeWidget;
 
       // Setup the tree and the window first:
+#if QT_VERSION >= 0x050000
+      tree_widget->header()->setSectionResizeMode(QHeaderView::ResizeToContents);
+#else
       tree_widget->header()->setResizeMode(QHeaderView::ResizeToContents);
+#endif
       tree_widget->setHeaderLabels(QStringList() << tr("(Sub)Sections/Parameters")
                                                  << tr("Value"));
 
index 98b71c0139c8064737f258bda88e266ca2853315..1b68c0bef17c4f3956e19f11c9c1f2f9ec82f9f6 100644 (file)
 // ---------------------------------------------------------------------
 
 
-#include <QtGui>
-
 #include "parameter_delegate.h"
 
 #include <limits>
 
+#if QT_VERSION >= 0x050000
+#include <QtWidgets>
+#else
+#include <QtGui>
+#endif
 
 namespace dealii
 {
index e5d1777d85a297091454ed315b8fb21e80cac66a..4ef1ef905bb3b63382192644639339b5caf80dd4 100644 (file)
 // ---------------------------------------------------------------------
 
 
-#include <QtGui>
-
 #include "prm_parameter_writer.h"
 
+#if QT_VERSION >= 0x050000
+#include <QtWidgets>
+#else
+#include <QtGui>
+#endif
 
 namespace dealii
 {
@@ -36,7 +39,7 @@ namespace dealii
       for (int i = 0; i < tree_widget->topLevelItemCount(); ++i)
         {
         const QString item_string = item_to_string(tree_widget->topLevelItem(i),0);
-        device->write(item_string.toAscii());
+        device->write(item_string.toLatin1());
         }
 
       return true;
@@ -75,7 +78,7 @@ namespace dealii
 
           if (!item_string.isEmpty())
             {
-              item_string.push_front("subsection " + item->text(0).toAscii() + "\n");
+              item_string.push_front("subsection " + item->text(0).toLatin1() + "\n");
               for (unsigned int i=0; i<indentation_level;++i)
                 item_string.push_front("  ");
 
index 38333f98c8e6f30ca4403b0a244b4e73296ef2ad..095cb520be1563c1ae1d755a70a09d8f8331172b 100644 (file)
 // ---------------------------------------------------------------------
 
 
-#include <QtGui>
-
 #include "settings_dialog.h"
 
+#if QT_VERSION >= 0x050000
+#include <QtWidgets>
+#else
+#include <QtGui>
+#endif
 
 namespace dealii
 {
index ea1f32c9248c00d207092e1662e6271f40c23ca2..dac8d5d3aaf77312544da3bab8dab1d8ef513939 100644 (file)
 // ---------------------------------------------------------------------
 
 
-#include <QtGui>
-
 #include "xml_parameter_reader.h"
 
+#if QT_VERSION >= 0x050000
+#include <QtWidgets>
+#else
+#include <QtGui>
+#endif
 
 namespace dealii
 {
index cbaa9e4da7e391e03ef11d3fbcf0b5d91ecf65c1..fccd1af4f053840f1b478d174739ddfe0a90a5fc 100644 (file)
 // ---------------------------------------------------------------------
 
 
-#include <QtGui>
-
 #include "xml_parameter_writer.h"
 
+#if QT_VERSION >= 0x050000
+#include <QtWidgets>
+#else
+#include <QtGui>
+#endif
 
 namespace dealii
 {

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.