diff --git a/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/ArrangementDemoGraphicsView.cpp b/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/ArrangementDemoGraphicsView.cpp index 050a97e81df..cc08513c55b 100644 --- a/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/ArrangementDemoGraphicsView.cpp +++ b/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/ArrangementDemoGraphicsView.cpp @@ -22,8 +22,8 @@ ArrangementDemoGraphicsView::ArrangementDemoGraphicsView( QWidget* parent ) : gridColor( ::Qt::black ), backgroundColor( ::Qt::white ) { - QMatrix m( 1.0, 0.0, 0.0, -1.0, 0.0, 0.0 ); - this->setMatrix( m ); + QTransform m( 1.0, 0.0, 0.0, -1.0, 0.0, 0.0 ); + this->setTransform( m ); this->setBackgroundBrush( QBrush( backgroundColor ) ); } diff --git a/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/ArrangementDemoPropertiesDialog.h b/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/ArrangementDemoPropertiesDialog.h index 4e20f9c7835..dd6158edd48 100644 --- a/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/ArrangementDemoPropertiesDialog.h +++ b/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/ArrangementDemoPropertiesDialog.h @@ -43,7 +43,7 @@ class ArrangementDemoPropertiesDialog : public QDialog }; ArrangementDemoPropertiesDialog( ArrangementDemoWindow* parent_ = 0, - Qt::WindowFlags f = 0 ); + Qt::WindowFlags f = Qt::WindowType(0)); QVariant property( int index ); protected: diff --git a/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/NewTabDialog.cpp b/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/NewTabDialog.cpp index cf40a748f04..f0daef178fc 100644 --- a/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/NewTabDialog.cpp +++ b/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/NewTabDialog.cpp @@ -14,7 +14,7 @@ #include "ui_NewTabDialog.h" #include -NewTabDialog::NewTabDialog( QWidget* parent, Qt::WindowFlags f ) : +NewTabDialog::NewTabDialog( QWidget* parent, Qt::WindowFlags f) : QDialog( parent, f ), ui( new Ui::NewTabDialog ), buttonGroup( new QButtonGroup ) diff --git a/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/NewTabDialog.h b/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/NewTabDialog.h index 2121d5daac2..679f30a7887 100644 --- a/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/NewTabDialog.h +++ b/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/NewTabDialog.h @@ -23,7 +23,7 @@ namespace Ui class NewTabDialog : public QDialog { public: - NewTabDialog( QWidget* parent = 0, Qt::WindowFlags f = 0 ); + NewTabDialog( QWidget* parent = 0, Qt::WindowFlags f = Qt::WindowType(0) ); int checkedId( ) const; protected: diff --git a/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/OverlayDialog.h b/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/OverlayDialog.h index fc80dc35336..fb1c45ea1bb 100644 --- a/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/OverlayDialog.h +++ b/Arrangement_on_surface_2/demo/Arrangement_on_surface_2/OverlayDialog.h @@ -29,7 +29,7 @@ class OverlayDialog : public QDialog ARRANGEMENT = 32 } OverlayDialogRole; - OverlayDialog( ArrangementDemoWindow* parent, Qt::WindowFlags f = 0 ); + OverlayDialog( ArrangementDemoWindow* parent, Qt::WindowFlags f = Qt::WindowType(0) ); std::vector< CGAL::Object > selectedArrangements( ) const; diff --git a/GraphicsView/demo/Alpha_shapes_2/Alpha_shapes_2.cpp b/GraphicsView/demo/Alpha_shapes_2/Alpha_shapes_2.cpp index c473c373091..374e297f3cc 100644 --- a/GraphicsView/demo/Alpha_shapes_2/Alpha_shapes_2.cpp +++ b/GraphicsView/demo/Alpha_shapes_2/Alpha_shapes_2.cpp @@ -138,7 +138,7 @@ MainWindow::MainWindow() this->graphicsView->setMouseTracking(true); // Turn the vertical axis upside down - this->graphicsView->matrix().scale(1, -1); + this->graphicsView->transform().scale(1, -1); // The navigation adds zooming and translation functionality to the // QGraphicsView diff --git a/GraphicsView/demo/Apollonius_graph_2/Apollonius_graph_2.cpp b/GraphicsView/demo/Apollonius_graph_2/Apollonius_graph_2.cpp index 2847ac24d9e..8292f28262d 100644 --- a/GraphicsView/demo/Apollonius_graph_2/Apollonius_graph_2.cpp +++ b/GraphicsView/demo/Apollonius_graph_2/Apollonius_graph_2.cpp @@ -125,7 +125,7 @@ MainWindow::MainWindow() this->graphicsView->setMouseTracking(true); // Turn the vertical axis upside down - this->graphicsView->matrix().scale(1, -1); + this->graphicsView->transform().scale(1, -1); // The navigation adds zooming and translation functionality to the // QGraphicsView diff --git a/GraphicsView/demo/Bounding_volumes/Bounding_volumes.cpp b/GraphicsView/demo/Bounding_volumes/Bounding_volumes.cpp index fe02e1d0faa..12928ca9897 100644 --- a/GraphicsView/demo/Bounding_volumes/Bounding_volumes.cpp +++ b/GraphicsView/demo/Bounding_volumes/Bounding_volumes.cpp @@ -208,7 +208,7 @@ MainWindow::MainWindow() this->graphicsView->setMouseTracking(true); // Turn the vertical axis upside down - this->graphicsView->matrix().scale(1, -1); + this->graphicsView->transform().scale(1, -1); // The navigation adds zooming and translation functionality to the // QGraphicsView diff --git a/GraphicsView/demo/L1_Voronoi_diagram_2/L1_voronoi_diagram_2.cpp b/GraphicsView/demo/L1_Voronoi_diagram_2/L1_voronoi_diagram_2.cpp index 40b4601ea8f..621a6f6c6c9 100644 --- a/GraphicsView/demo/L1_Voronoi_diagram_2/L1_voronoi_diagram_2.cpp +++ b/GraphicsView/demo/L1_Voronoi_diagram_2/L1_voronoi_diagram_2.cpp @@ -178,7 +178,7 @@ MainWindow::MainWindow() this->graphicsView->setMouseTracking(true); // Turn the vertical axis upside down - this->graphicsView->matrix().scale(1, -1); + this->graphicsView->transform().scale(1, -1); // The navigation adds zooming and translation functionality to the // QGraphicsView diff --git a/GraphicsView/demo/Periodic_2_triangulation_2/Periodic_2_Delaunay_triangulation_2.cpp b/GraphicsView/demo/Periodic_2_triangulation_2/Periodic_2_Delaunay_triangulation_2.cpp index fca48808325..e956d72a171 100644 --- a/GraphicsView/demo/Periodic_2_triangulation_2/Periodic_2_Delaunay_triangulation_2.cpp +++ b/GraphicsView/demo/Periodic_2_triangulation_2/Periodic_2_Delaunay_triangulation_2.cpp @@ -181,7 +181,7 @@ MainWindow::MainWindow() this->graphicsView->setMouseTracking(true); // Turn the vertical axis upside down - this->graphicsView->matrix().scale(1, -1); + this->graphicsView->transform().scale(1, -1); // The navigation adds zooming and translation functionality to the // QGraphicsView diff --git a/GraphicsView/demo/Snap_rounding_2/Snap_rounding_2.cpp b/GraphicsView/demo/Snap_rounding_2/Snap_rounding_2.cpp index f16611b517e..0225624b96e 100644 --- a/GraphicsView/demo/Snap_rounding_2/Snap_rounding_2.cpp +++ b/GraphicsView/demo/Snap_rounding_2/Snap_rounding_2.cpp @@ -132,7 +132,7 @@ MainWindow::MainWindow() scene.setItemIndexMethod(QGraphicsScene::NoIndex); this->graphicsView->setScene(&scene); // Turn the vertical axis upside down - this->graphicsView->matrix().scale(1, -1); + this->graphicsView->transform().scale(1, -1); this->graphicsView->setMouseTracking(true); rgi = new CGAL::Qt::RegularGridGraphicsItem(delta, delta); diff --git a/GraphicsView/demo/Stream_lines_2/Stream_lines_2.cpp b/GraphicsView/demo/Stream_lines_2/Stream_lines_2.cpp index 0eeb169f07f..b0e1fb852ec 100644 --- a/GraphicsView/demo/Stream_lines_2/Stream_lines_2.cpp +++ b/GraphicsView/demo/Stream_lines_2/Stream_lines_2.cpp @@ -106,7 +106,7 @@ MainWindow::MainWindow() this->graphicsView->setScene(&scene); // Turn the vertical axis upside down - this->graphicsView->matrix().scale(1, -1); + this->graphicsView->transform().scale(1, -1); // The navigation adds zooming and translation functionality to the // QGraphicsView diff --git a/GraphicsView/demo/Triangulation_2/Delaunay_triangulation_2.cpp b/GraphicsView/demo/Triangulation_2/Delaunay_triangulation_2.cpp index 62ac4d75501..9d810c04398 100644 --- a/GraphicsView/demo/Triangulation_2/Delaunay_triangulation_2.cpp +++ b/GraphicsView/demo/Triangulation_2/Delaunay_triangulation_2.cpp @@ -171,7 +171,7 @@ MainWindow::MainWindow() this->graphicsView->setMouseTracking(true); // Turn the vertical axis upside down - this->graphicsView->matrix().scale(1, -1); + this->graphicsView->transform().scale(1, -1); // The navigation adds zooming and translation functionality to the // QGraphicsView diff --git a/GraphicsView/demo/Triangulation_2/Regular_triangulation_2.cpp b/GraphicsView/demo/Triangulation_2/Regular_triangulation_2.cpp index fcaf1aba96d..3b5cd7cf76b 100644 --- a/GraphicsView/demo/Triangulation_2/Regular_triangulation_2.cpp +++ b/GraphicsView/demo/Triangulation_2/Regular_triangulation_2.cpp @@ -142,7 +142,7 @@ MainWindow::MainWindow() this->graphicsView->setMouseTracking(true); // Turn the vertical axis upside down - this->graphicsView->matrix().scale(1, -1); + this->graphicsView->transform().scale(1, -1); // The navigation adds zooming and translation functionality to the // QGraphicsView diff --git a/GraphicsView/include/CGAL/Qt/DemosMainWindow.h b/GraphicsView/include/CGAL/Qt/DemosMainWindow.h index 834262cc4c8..34dab58fbfc 100644 --- a/GraphicsView/include/CGAL/Qt/DemosMainWindow.h +++ b/GraphicsView/include/CGAL/Qt/DemosMainWindow.h @@ -72,7 +72,7 @@ private: QMenu* getHelpMenu(); protected: - DemosMainWindow (QWidget * parent = 0, ::Qt::WindowFlags flags = 0 ); + DemosMainWindow (QWidget * parent = 0, ::Qt::WindowFlags flags = ::Qt::WindowType(0) ); ~DemosMainWindow(); void setupStatusBar(); void addNavigation(QGraphicsView*); diff --git a/GraphicsView/include/CGAL/Qt/GraphicsViewNavigation_impl.h b/GraphicsView/include/CGAL/Qt/GraphicsViewNavigation_impl.h index 50b4427c131..39863832586 100644 --- a/GraphicsView/include/CGAL/Qt/GraphicsViewNavigation_impl.h +++ b/GraphicsView/include/CGAL/Qt/GraphicsViewNavigation_impl.h @@ -134,15 +134,12 @@ namespace Qt { } // end case KeyRelease case QEvent::Wheel: { QWheelEvent *wheelEvent = static_cast(event); - if(wheelEvent->orientation() != ::Qt::Vertical) { - return false; - } double zoom_ratio = 240.0; if( (wheelEvent->modifiers() & ::Qt::ShiftModifier) || (wheelEvent->modifiers() & ::Qt::ControlModifier) ) { zoom_ratio = 120.0; } - scaleView(v, pow((double)2, -wheelEvent->delta() / zoom_ratio)); + scaleView(v, pow((double)2, -wheelEvent->angleDelta().y() / zoom_ratio)); // display_parameters(); return true; @@ -311,12 +308,12 @@ namespace Qt { boost::format("matrix translation=(%1%, %2%)\n" " rotation=(%3% - %4% )\n" " (%5% - %6% )\n") - % v->matrix().dx() - % v->matrix().dy() - % v->matrix().m11() - % v->matrix().m12() - % v->matrix().m21() - % v->matrix().m22(); + % v->transform().dx() + % v->transform().dy() + % v->transform().m11() + % v->transform().m12() + % v->transform().m21() + % v->transform().m22(); QRect vp_rect = v->viewport()->rect(); QPoint vp_top_left = vp_rect.topLeft(); diff --git a/GraphicsView/include/CGAL/Qt/manipulatedCameraFrame_impl.h b/GraphicsView/include/CGAL/Qt/manipulatedCameraFrame_impl.h index c13808d7320..3dfb1bf5e55 100644 --- a/GraphicsView/include/CGAL/Qt/manipulatedCameraFrame_impl.h +++ b/GraphicsView/include/CGAL/Qt/manipulatedCameraFrame_impl.h @@ -421,7 +421,7 @@ void ManipulatedCameraFrame::wheelEvent(QWheelEvent *const event, case MOVE_BACKWARD: //#CONNECTION# mouseMoveEvent() MOVE_FORWARD case translate( - inverseTransformOf(Vec(0.0, 0.0, 0.2 * flySpeed() * event->delta()))); + inverseTransformOf(Vec(0.0, 0.0, 0.2 * flySpeed() * event->angleDelta().y()))); Q_EMIT manipulated(); break; default: diff --git a/GraphicsView/include/CGAL/Qt/manipulatedFrame_impl.h b/GraphicsView/include/CGAL/Qt/manipulatedFrame_impl.h index 96d03db9adc..11a68ce0c08 100644 --- a/GraphicsView/include/CGAL/Qt/manipulatedFrame_impl.h +++ b/GraphicsView/include/CGAL/Qt/manipulatedFrame_impl.h @@ -295,7 +295,7 @@ qreal ManipulatedFrame::deltaWithPrevPos(QMouseEvent *const event, CGAL_INLINE_FUNCTION qreal ManipulatedFrame::wheelDelta(const QWheelEvent *event) const { static const qreal WHEEL_SENSITIVITY_COEF = 8E-4; - return event->delta() * wheelSensitivity() * WHEEL_SENSITIVITY_COEF; + return event->angleDelta().y() * wheelSensitivity() * WHEEL_SENSITIVITY_COEF; } CGAL_INLINE_FUNCTION diff --git a/GraphicsView/include/CGAL/Qt/qglviewer.h b/GraphicsView/include/CGAL/Qt/qglviewer.h index ed0624ef73b..8b3ff179e9c 100644 --- a/GraphicsView/include/CGAL/Qt/qglviewer.h +++ b/GraphicsView/include/CGAL/Qt/qglviewer.h @@ -73,11 +73,11 @@ class CGAL_QT_EXPORT QGLViewer : public QOpenGLWidget, public QOpenGLFunctions { public: //todo check if this is used. If not remove it explicit QGLViewer(QGLContext* context, QWidget *parent = 0, - ::Qt::WindowFlags flags = 0); + ::Qt::WindowFlags flags = ::Qt::WindowType(0)); explicit QGLViewer(QOpenGLContext* context, QWidget *parent = 0, - ::Qt::WindowFlags flags = 0); + ::Qt::WindowFlags flags = ::Qt::WindowType(0)); explicit QGLViewer(QWidget *parent = 0, - ::Qt::WindowFlags flags = 0); + ::Qt::WindowFlags flags = ::Qt::WindowType(0)); virtual ~QGLViewer(); diff --git a/Hyperbolic_triangulation_2/demo/Hyperbolic_triangulation_2/HDT2.cpp b/Hyperbolic_triangulation_2/demo/Hyperbolic_triangulation_2/HDT2.cpp index ccfb1d72a8e..9fbb9e6d730 100644 --- a/Hyperbolic_triangulation_2/demo/Hyperbolic_triangulation_2/HDT2.cpp +++ b/Hyperbolic_triangulation_2/demo/Hyperbolic_triangulation_2/HDT2.cpp @@ -207,7 +207,7 @@ MainWindow::MainWindow() this->graphicsView->shear(230, 230); // Turn the vertical axis upside down - this->graphicsView->matrix().scale(1, -1); + this->graphicsView->transform().scale(1, -1); // The navigation adds zooming and translation functionality to the // QGraphicsView diff --git a/Optimal_transportation_reconstruction_2/demo/Optimal_transportation_reconstruction_2/glviewer.cpp b/Optimal_transportation_reconstruction_2/demo/Optimal_transportation_reconstruction_2/glviewer.cpp index 64834832676..b459255eb2c 100644 --- a/Optimal_transportation_reconstruction_2/demo/Optimal_transportation_reconstruction_2/glviewer.cpp +++ b/Optimal_transportation_reconstruction_2/demo/Optimal_transportation_reconstruction_2/glviewer.cpp @@ -87,7 +87,7 @@ void GlViewer::paintGL() void GlViewer::wheelEvent(QWheelEvent *event) { if (!m_scene) return; - m_scale += 0.05 * (event->delta() / 120); + m_scale += 0.05 * (event->angleDelta().y() / 120); if (m_scale <= 0.0) m_scale = 0.0; update(); } diff --git a/Polyhedron/demo/Polyhedron/MainWindow.cpp b/Polyhedron/demo/Polyhedron/MainWindow.cpp index 3951ba10c1c..27d4717f955 100644 --- a/Polyhedron/demo/Polyhedron/MainWindow.cpp +++ b/Polyhedron/demo/Polyhedron/MainWindow.cpp @@ -9,6 +9,7 @@ #include #include #include +#include #include #include @@ -401,6 +402,7 @@ MainWindow::MainWindow(const QStringList &keywords, bool verbose, QWidget* paren objectValue); } } + filterOperations(true); // debugger->action(QScriptEngineDebugger::InterruptAction)->trigger(); #endif } @@ -408,16 +410,22 @@ MainWindow::MainWindow(const QStringList &keywords, bool verbose, QWidget* paren void addActionToMenu(QAction* action, QMenu* menu) { bool added = false; + QString atxt = action->text().remove("&"); + if(atxt.isEmpty()) + return; for(QAction* it : menu->actions()) { - QString atxt = action->text().remove("&"), - btxt = it->text().remove("&"); + QString btxt = it->text().remove("&"); int i = 0; - while(atxt[i] == btxt[i] - && i < atxt.size() - && i < btxt.size()) + if(btxt.isEmpty()) + { + continue; + } + while(i < atxt.size() + && i < btxt.size() + && atxt[i] == btxt[i]) ++i; - bool res = (atxt[i] < btxt[i]); + bool res = (i == atxt.size() || i == btxt.size() || atxt[i] < btxt[i]); if (res) { menu->insertAction(it, action); @@ -490,12 +498,12 @@ void MainWindow::filterOperations(bool) menu->removeAction(action); } } + Q_FOREACH(QAction* action, action_menu_map.keys()) { QMenu* menu = action_menu_map[action]; addActionToMenu(action, menu); } - QString filter=operationSearchBar.text(); Q_FOREACH(const PluginNamePair& p, plugins) { Q_FOREACH(QAction* action, p.first->actions()) { @@ -765,7 +773,7 @@ void MainWindow::loadPlugins() qputenv("PATH", new_path); #endif Q_FOREACH (QString pluginsDir, - env_path.split(separator, QString::SkipEmptyParts)) { + env_path.split(separator, CGAL_QT_SKIP_EMPTY_PARTS)) { QDir dir(pluginsDir); if(dir.isReadable()) plugins_directories << dir; diff --git a/Polyhedron/demo/Polyhedron/Plugins/PCA/Basic_generator_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/PCA/Basic_generator_plugin.cpp index 4215c75421b..672e4fb0f7a 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/PCA/Basic_generator_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/PCA/Basic_generator_plugin.cpp @@ -15,6 +15,7 @@ #include "Scene_polylines_item.h" #include #include +#include #include "ui_Basic_generator_widget.h" class GeneratorWidget : @@ -350,8 +351,7 @@ void Basic_generator_plugin::generateCube() for(int i=0; i<8; ++i) { - - QStringList list = point_texts[i].split(QRegExp("\\s+"), QString::SkipEmptyParts); + QStringList list = point_texts[i].split(QRegExp("\\s+"), CGAL_QT_SKIP_EMPTY_PARTS); if (list.isEmpty()) return; if (list.size()!=3){ QMessageBox *msgBox = new QMessageBox; @@ -392,7 +392,7 @@ void Basic_generator_plugin::generateCube() else { QString text = dock_widget->extremaEdit->text(); - QStringList list = text.split(QRegExp("\\s+"), QString::SkipEmptyParts); + QStringList list = text.split(QRegExp("\\s+"), CGAL_QT_SKIP_EMPTY_PARTS); if (list.isEmpty()) return; if (list.size()!=6){ QMessageBox *msgBox = new QMessageBox; @@ -443,7 +443,7 @@ void Basic_generator_plugin::generatePrism() bool is_closed = dock_widget->prismCheckBox->isChecked(); QString text = dock_widget->prism_lineEdit->text(); - QStringList list = text.split(QRegExp("\\s+"), QString::SkipEmptyParts); + QStringList list = text.split(QRegExp("\\s+"), CGAL_QT_SKIP_EMPTY_PARTS); if (list.isEmpty()) return; if (list.size()!=3){ QMessageBox *msgBox = new QMessageBox; @@ -490,7 +490,7 @@ void Basic_generator_plugin::generatePyramid() bool is_closed = dock_widget->pyramidCheckBox->isChecked(); QString text = dock_widget->pyramid_lineEdit->text(); - QStringList list = text.split(QRegExp("\\s+"), QString::SkipEmptyParts); + QStringList list = text.split(QRegExp("\\s+"), CGAL_QT_SKIP_EMPTY_PARTS); if (list.isEmpty()) return; if (list.size()!=3){ QMessageBox *msgBox = new QMessageBox; @@ -533,7 +533,7 @@ void Basic_generator_plugin::generateSphere() { int precision = dock_widget->SphereSpinBox->value(); QString text = dock_widget->center_radius_lineEdit->text(); - QStringList list = text.split(QRegExp("\\s+"), QString::SkipEmptyParts); + QStringList list = text.split(QRegExp("\\s+"), CGAL_QT_SKIP_EMPTY_PARTS); if (list.isEmpty()) return; if (list.size()!=4){ QMessageBox *msgBox = new QMessageBox; @@ -582,8 +582,7 @@ void Basic_generator_plugin::generateTetrahedron() for(int i=0; i<4; ++i) { - - QStringList list = point_texts[i].split(QRegExp("\\s+"), QString::SkipEmptyParts); + QStringList list = point_texts[i].split(QRegExp("\\s+"), CGAL_QT_SKIP_EMPTY_PARTS); if (list.isEmpty()) return; if (list.size()!=3){ QMessageBox *msgBox = new QMessageBox; @@ -624,7 +623,7 @@ void Basic_generator_plugin::generatePoints() { QString text = dock_widget->point_textEdit->toPlainText(); Scene_points_with_normal_item* item = new Scene_points_with_normal_item(); - QStringList list = text.split(QRegExp("\\s+"), QString::SkipEmptyParts); + QStringList list = text.split(QRegExp("\\s+"), CGAL_QT_SKIP_EMPTY_PARTS); int counter = 0; double coord[3]; bool ok = true; @@ -682,7 +681,8 @@ void Basic_generator_plugin::generateLines() polylines.resize(polylines.size()+1); std::vector& polyline = *(polylines.rbegin()); QStringList polylines_metadata; - QStringList list = text.split(QRegExp("\\s+"), QString::SkipEmptyParts); + + QStringList list = text.split(QRegExp("\\s+"), CGAL_QT_SKIP_EMPTY_PARTS); int counter = 0; double coord[3]; bool ok = true; @@ -782,7 +782,7 @@ void Basic_generator_plugin::generateGrid() bool triangulated = dock_widget->grid_checkBox->isChecked(); points_text= dock_widget->grid_lineEdit->text(); - QStringList list = points_text.split(QRegExp("\\s+"), QString::SkipEmptyParts); + QStringList list = points_text.split(QRegExp("\\s+"), CGAL_QT_SKIP_EMPTY_PARTS); if (list.isEmpty()) return; if (list.size()!=6){ QMessageBox *msgBox = new QMessageBox; diff --git a/Polyhedron/demo/Polyhedron/Plugins/PMP/Engrave_text_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/PMP/Engrave_text_plugin.cpp index dc8eff3084c..757c72b6cc1 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/PMP/Engrave_text_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/PMP/Engrave_text_plugin.cpp @@ -249,12 +249,17 @@ protected: } case QEvent::Wheel: { QWheelEvent* event = static_cast(ev); - QPointF old_pos = v->mapToScene(event->pos()); - if(event->delta() <0) +#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0) + QPoint pos = event->pos(); +#else + QPointF pos = event->position(); +#endif + QPointF old_pos = v->mapToScene(pos.x(), pos.y()); + if(event->angleDelta().y() <0) v->scale(1.2, 1.2); else v->scale(0.8, 0.8); - QPointF new_pos = v->mapToScene(event->pos()); + QPointF new_pos = v->mapToScene(pos.x(), pos.y()); QPointF delta = new_pos - old_pos; v->translate(delta.x(), delta.y()); v->update(); diff --git a/Polyhedron/demo/Polyhedron/Plugins/PMP/Extrude_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/PMP/Extrude_plugin.cpp index 1cb943cf4d6..308bd503d95 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/PMP/Extrude_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/PMP/Extrude_plugin.cpp @@ -116,7 +116,7 @@ public : if(event->type() == QEvent::Wheel && ctrl_pressing) { QWheelEvent *mouseEvent = static_cast(event); - int steps = mouseEvent->delta() / 120; + int steps = mouseEvent->angleDelta().y() / 120; if (steps > 0) length_+=tick; else diff --git a/Polyhedron/demo/Polyhedron/Plugins/Point_set/Point_set_selection_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/Point_set/Point_set_selection_plugin.cpp index 7c81fbd6e23..59c7c2c9224 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Point_set/Point_set_selection_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/Point_set/Point_set_selection_plugin.cpp @@ -708,7 +708,7 @@ protected: { QApplication::setOverrideCursor(Qt::WaitCursor); QWheelEvent *mouseEvent = static_cast(event); - int steps = mouseEvent->delta() / 120; + int steps = mouseEvent->angleDelta().y() / 120; if (steps > 0) neighborhood.point_set (point_set_item).expand(); else diff --git a/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh/Parameterization_plugin.cpp b/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh/Parameterization_plugin.cpp index ba2a234e0fa..eab69bce277 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh/Parameterization_plugin.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh/Parameterization_plugin.cpp @@ -143,12 +143,17 @@ protected: } case QEvent::Wheel: { QWheelEvent* event = static_cast(ev); - QPointF old_pos = v->mapToScene(event->pos()); - if(event->delta() <0) +#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0) + QPoint pos = event->pos(); +#else + QPointF pos = event->position(); +#endif + QPointF old_pos = v->mapToScene(pos.x(), pos.y()); + if(event->angleDelta().y() <0) v->scale(1.2, 1.2); else v->scale(0.8, 0.8); - QPointF new_pos = v->mapToScene(event->pos()); + QPointF new_pos = v->mapToScene(pos.x(), pos.y()); QPointF delta = new_pos - old_pos; v->translate(delta.x(), delta.y()); v->update(); diff --git a/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh/UVProjector.h b/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh/UVProjector.h index dd54dad556d..45bb627538c 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh/UVProjector.h +++ b/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh/UVProjector.h @@ -23,7 +23,7 @@ struct State{ class UVProjector:public QWidget { public: - UVProjector(QWidget* parent = 0, Qt::WindowFlags flags =0) + UVProjector(QWidget* parent = 0, Qt::WindowFlags flags = Qt::WindowType(0)) :QWidget(parent,flags) { setMouseTracking(true); @@ -108,7 +108,7 @@ protected: } void wheelEvent(QWheelEvent *event) { - if(event->delta() >0) + if(event->angleDelta().y() >0) translation[2] *= 1.2; else translation[2] /= 1.2; diff --git a/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh_deformation/Scene_edit_polyhedron_item.cpp b/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh_deformation/Scene_edit_polyhedron_item.cpp index 48d85e15612..c6ab13f76f6 100644 --- a/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh_deformation/Scene_edit_polyhedron_item.cpp +++ b/Polyhedron/demo/Polyhedron/Plugins/Surface_mesh_deformation/Scene_edit_polyhedron_item.cpp @@ -885,7 +885,7 @@ bool Scene_edit_polyhedron_item::eventFilter(QObject* /*target*/, QEvent *event) &&d->state.shift_pressing) { QWheelEvent *w_event = static_cast(event); - int steps = w_event->delta() / 120; + int steps = w_event->angleDelta().y() / 120; d->expand_or_reduce(steps, d->sm_item->polyhedron()); } if(event->type() == QEvent::MouseButtonPress || event->type() == QEvent::MouseButtonRelease) diff --git a/Polyhedron/demo/Polyhedron/Viewer.cpp b/Polyhedron/demo/Polyhedron/Viewer.cpp index 57ed3f9d84f..8c53251c18c 100644 --- a/Polyhedron/demo/Polyhedron/Viewer.cpp +++ b/Polyhedron/demo/Polyhedron/Viewer.cpp @@ -852,7 +852,7 @@ void Viewer::postSelection(const QPoint& pixel) } bool CGAL::Three::Viewer_interface::readFrame(QString s, CGAL::qglviewer::Frame& frame) { - QStringList list = s.split(" ", QString::SkipEmptyParts); + QStringList list = s.split(" ", CGAL_QT_SKIP_EMPTY_PARTS); if(list.size() != 7) return false; float vec[3]; @@ -1422,7 +1422,7 @@ void Viewer::wheelEvent(QWheelEvent* e) { if(e->modifiers().testFlag(Qt::ShiftModifier)) { - double delta = e->delta(); + double delta = e->angleDelta().y(); if(delta>0) { switch(camera()->type()) @@ -1781,7 +1781,7 @@ void Viewer::setLighting() connect(dialog->position_lineEdit, &QLineEdit::editingFinished, [this, dialog]() { - QStringList list = dialog->position_lineEdit->text().split(QRegExp(","), QString::SkipEmptyParts); + QStringList list = dialog->position_lineEdit->text().split(QRegExp(","), CGAL_QT_SKIP_EMPTY_PARTS); if (list.isEmpty()) return; if (list.size()!=3){ QMessageBox *msgBox = new QMessageBox; diff --git a/Surface_mesher/demo/Surface_mesher/values_list.cpp b/Surface_mesher/demo/Surface_mesher/values_list.cpp index f7b1805f18d..b2e8a41e86f 100644 --- a/Surface_mesher/demo/Surface_mesher/values_list.cpp +++ b/Surface_mesher/demo/Surface_mesher/values_list.cpp @@ -20,6 +20,9 @@ #include #include #include +#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0) +#include +#endif Values_delegate::Values_delegate(QWidget* parent) : QItemDelegate(parent) {} void Values_delegate::paint(QPainter * painter, const QStyleOptionViewItem & option, const QModelIndex & index) const @@ -240,7 +243,12 @@ void Values_list::addValue(const double i) newItem->setData(Value, Qt::CheckStateRole, Qt::Checked); newItem->setData(Value, Qt::DisplayRole, i); QStringList colors = QColor::colorNames(); +#if QT_VERSION < QT_VERSION_CHECK(5, 10, 0) const int color_index = qrand() % colors.size(); +#else +const int color_index = QRandomGenerator::global()->generate() % colors.size(); +#endif + QColor color = QColor(colors[color_index]); newItem->setData(Color, Qt::DisplayRole, color); newItem->setData(Name, Qt::DisplayRole, ""); diff --git a/Three/include/CGAL/Three/Three.h b/Three/include/CGAL/Three/Three.h index 38b2ac8ea7d..c62b32e13ca 100644 --- a/Three/include/CGAL/Three/Three.h +++ b/Three/include/CGAL/Three/Three.h @@ -29,8 +29,15 @@ # define THREE_EXPORT Q_DECL_IMPORT #endif +#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0) +#define CGAL_QT_SKIP_EMPTY_PARTS QString::SkipEmptyParts +#else +#define CGAL_QT_SKIP_EMPTY_PARTS ::Qt::SkipEmptyParts +#endif + namespace CGAL{ namespace Three{ +//define enum depending on Qt version class Polyhedron_demo_plugin_interface; class THREE_EXPORT Three{ public: diff --git a/Triangulation_3/demo/Triangulation_3/Viewer.cpp b/Triangulation_3/demo/Triangulation_3/Viewer.cpp index b12a9304031..097aa3c2546 100644 --- a/Triangulation_3/demo/Triangulation_3/Viewer.cpp +++ b/Triangulation_3/demo/Triangulation_3/Viewer.cpp @@ -2151,7 +2151,7 @@ void Viewer::wheelEvent(QWheelEvent *event) // note: most mouse types work in steps of 15 degrees // positive value: rotate forwards away from the user; // negative value: rotate backwards toward the user. - m_fRadius += (event->delta()*1.f / m_iStep ); // inc-/decrease by 0.1 per step + m_fRadius += (event->angleDelta().y()*1.f / m_iStep ); // inc-/decrease by 0.1 per step if( m_fRadius < 0.1f ) m_fRadius = 0.1f; @@ -2166,7 +2166,7 @@ void Viewer::wheelEvent(QWheelEvent *event) // positive value: rotate forwards away from the user; // negative value: rotate backwards toward the user. float origR = m_fRadius; - m_fRadius += (event->delta()*1.f / m_iStep ); // inc-/decrease by 0.1 per step + m_fRadius += (event->angleDelta().y()*1.f / m_iStep ); // inc-/decrease by 0.1 per step if( m_fRadius < 0.1f ) m_fRadius = 0.1f; // update the new point and its conflict region @@ -2185,7 +2185,7 @@ void Viewer::wheelEvent(QWheelEvent *event) // resize the trackball when moving a point else if( m_curMode == MOVE && modifiers == Qt::SHIFT && m_isMoving ) { float origR = m_fRadius; - m_fRadius += (event->delta()*1.f / m_iStep ); // inc-/decrease by 0.1 per step + m_fRadius += (event->angleDelta().y()*1.f / m_iStep ); // inc-/decrease by 0.1 per step if( m_fRadius < 0.1f ) m_fRadius = 0.1f; origR = m_fRadius / origR;