From 3640099261a8e69eecf3b330f9a835de8b198bb2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Tue, 28 Sep 2021 15:36:51 +0200 Subject: [PATCH] fix warnings about arithmetic operations on enum --- .../Conic_x_monotone_arc_2.h | 2 +- GraphicsView/include/CGAL/Qt/Basic_viewer_qt.h | 8 ++++---- GraphicsView/include/CGAL/Qt/qglviewer.h | 18 ++++++++++++++++++ GraphicsView/include/CGAL/Qt/qglviewer_impl.h | 4 ++-- .../include/CGAL/Homogeneous/SphereH3.h | 2 +- .../CGAL/Homogeneous/function_objects.h | 2 +- Polyhedron/demo/Polyhedron/MainWindow.cpp | 6 +++--- Polyhedron/demo/Polyhedron/Viewer.cpp | 2 +- .../include/CGAL/draw_face_graph_with_paths.h | 8 ++++---- .../demo/Triangulation_3/PreferenceDlg.cpp | 12 ++++++------ .../demo/Triangulation_3/Viewer.cpp | 12 ++++++------ 11 files changed, 47 insertions(+), 29 deletions(-) diff --git a/Arrangement_on_surface_2/include/CGAL/Arr_geometry_traits/Conic_x_monotone_arc_2.h b/Arrangement_on_surface_2/include/CGAL/Arr_geometry_traits/Conic_x_monotone_arc_2.h index b6587f4e1ab..761e38b1693 100644 --- a/Arrangement_on_surface_2/include/CGAL/Arr_geometry_traits/Conic_x_monotone_arc_2.h +++ b/Arrangement_on_surface_2/include/CGAL/Arr_geometry_traits/Conic_x_monotone_arc_2.h @@ -263,7 +263,7 @@ public: Comparison_result res = ker.compare_x_2_object()(this->_source, this->_target); - this->_info = (Conic_arc_2::IS_VALID | DEGREE_1); + this->_info = (static_cast(Conic_arc_2::IS_VALID) | static_cast(DEGREE_1)); if (res == EQUAL) { // Mark that the segment is vertical. this->_info = (this->_info | IS_VERTICAL_SEGMENT); diff --git a/GraphicsView/include/CGAL/Qt/Basic_viewer_qt.h b/GraphicsView/include/CGAL/Qt/Basic_viewer_qt.h index 02d557a8a44..3bf83132a3a 100644 --- a/GraphicsView/include/CGAL/Qt/Basic_viewer_qt.h +++ b/GraphicsView/include/CGAL/Qt/Basic_viewer_qt.h @@ -160,11 +160,11 @@ public: &arrays[SMOOTH_NORMAL_COLORED_FACES]) { // Define 'Control+Q' as the new exit shortcut (default was 'Escape') - setShortcut(qglviewer::EXIT_VIEWER, ::Qt::CTRL+::Qt::Key_Q); + setShortcut(qglviewer::EXIT_VIEWER, ::Qt::CTRL, ::Qt::Key_Q); // Add custom key description (see keyPressEvent). setKeyDescription(::Qt::Key_C, "Switch clipping plane display mode"); - setKeyDescription(::Qt::Key_C+::Qt::AltModifier, "Toggle clipping plane rendering on/off"); + setKeyDescription(::Qt::AltModifier, ::Qt::Key_C, "Toggle clipping plane rendering on/off"); setKeyDescription(::Qt::Key_E, "Toggles edges display"); setKeyDescription(::Qt::Key_M, "Toggles mono color"); setKeyDescription(::Qt::Key_N, "Inverse direction of normals"); @@ -175,8 +175,8 @@ public: setKeyDescription(::Qt::Key_W, "Toggles faces display"); setKeyDescription(::Qt::Key_Plus, "Increase size of edges"); setKeyDescription(::Qt::Key_Minus, "Decrease size of edges"); - setKeyDescription(::Qt::Key_Plus+::Qt::ControlModifier, "Increase size of vertices"); - setKeyDescription(::Qt::Key_Minus+::Qt::ControlModifier, "Decrease size of vertices"); + setKeyDescription(::Qt::ControlModifier, ::Qt::Key_Plus, "Increase size of vertices"); + setKeyDescription(::Qt::ControlModifier, ::Qt::Key_Minus, "Decrease size of vertices"); setKeyDescription(::Qt::Key_PageDown, "Increase light (all colors, use shift/alt/ctrl for one rgb component)"); setKeyDescription(::Qt::Key_PageUp, "Decrease light (all colors, use shift/alt/ctrl for one rgb component)"); setKeyDescription(::Qt::Key_O, "Toggles 2D mode only"); diff --git a/GraphicsView/include/CGAL/Qt/qglviewer.h b/GraphicsView/include/CGAL/Qt/qglviewer.h index 1c11c9e4a52..da0dbace517 100644 --- a/GraphicsView/include/CGAL/Qt/qglviewer.h +++ b/GraphicsView/include/CGAL/Qt/qglviewer.h @@ -833,8 +833,26 @@ public: public Q_SLOTS: void setShortcut(qglviewer::KeyboardAction action, unsigned int key); + void setShortcut(qglviewer::KeyboardAction action, ::Qt::Modifier modifier, ::Qt::Key key) + { + setShortcut(action, + static_cast(modifier)+ + static_cast(key)); + } void setKeyDescription(unsigned int key, QString description); + void setKeyDescription(::Qt::KeyboardModifier modifier, ::Qt::Key key, QString description) + { + setKeyDescription(static_cast(modifier) + + static_cast(key), + description); + } + void setKeyDescription(::Qt::Modifier modifier, ::Qt::Key key, QString description) + { + setKeyDescription(static_cast(modifier) + + static_cast(key), + description); + } void clearShortcuts(); // Key Frames shortcut keys diff --git a/GraphicsView/include/CGAL/Qt/qglviewer_impl.h b/GraphicsView/include/CGAL/Qt/qglviewer_impl.h index 7aa487408c3..70fdfdd9a15 100644 --- a/GraphicsView/include/CGAL/Qt/qglviewer_impl.h +++ b/GraphicsView/include/CGAL/Qt/qglviewer_impl.h @@ -657,10 +657,10 @@ void CGAL::QGLViewer::setDefaultShortcuts() { setShortcut(qglviewer::DRAW_AXIS, ::Qt::Key_A); setShortcut(qglviewer::DRAW_GRID, ::Qt::Key_G); setShortcut(qglviewer::DISPLAY_FPS, ::Qt::Key_F); - setShortcut(qglviewer::ENABLE_TEXT, ::Qt::SHIFT + ::Qt::Key_Question); + setShortcut(qglviewer::ENABLE_TEXT, ::Qt::SHIFT, ::Qt::Key_Question); setShortcut(qglviewer::EXIT_VIEWER, ::Qt::Key_Escape); setShortcut(qglviewer::CAMERA_MODE, ::Qt::Key_Space); - setShortcut(qglviewer::FULL_SCREEN, ::Qt::ALT + ::Qt::Key_Return); + setShortcut(qglviewer::FULL_SCREEN, ::Qt::ALT, ::Qt::Key_Return); setShortcut(qglviewer::ANIMATION, ::Qt::Key_Return); setShortcut(qglviewer::HELP, ::Qt::Key_H); setShortcut(qglviewer::MOVE_CAMERA_LEFT, ::Qt::Key_Left); diff --git a/Homogeneous_kernel/include/CGAL/Homogeneous/SphereH3.h b/Homogeneous_kernel/include/CGAL/Homogeneous/SphereH3.h index 2515212200a..a00ec51b275 100644 --- a/Homogeneous_kernel/include/CGAL/Homogeneous/SphereH3.h +++ b/Homogeneous_kernel/include/CGAL/Homogeneous/SphereH3.h @@ -198,7 +198,7 @@ template CGAL_KERNEL_MEDIUM_INLINE Oriented_side SphereH3::oriented_side(const typename SphereH3::Point_3& p) const -{ return Oriented_side(bounded_side(p) * orientation()); } +{ return Oriented_side(static_cast(bounded_side(p)) * static_cast(orientation())); } template CGAL_KERNEL_INLINE diff --git a/Homogeneous_kernel/include/CGAL/Homogeneous/function_objects.h b/Homogeneous_kernel/include/CGAL/Homogeneous/function_objects.h index 8091a640d18..642f6854570 100644 --- a/Homogeneous_kernel/include/CGAL/Homogeneous/function_objects.h +++ b/Homogeneous_kernel/include/CGAL/Homogeneous/function_objects.h @@ -4675,7 +4675,7 @@ namespace HomogeneousKernelFunctors { result_type operator()( const Circle_2& c, const Point_2& p) const - { return Oriented_side(c.bounded_side(p) * c.orientation()); } + { return Oriented_side(static_cast(c.bounded_side(p)) * static_cast(c.orientation())); } result_type operator()( const Line_2& l, const Point_2& p) const diff --git a/Polyhedron/demo/Polyhedron/MainWindow.cpp b/Polyhedron/demo/Polyhedron/MainWindow.cpp index 284f118bbd0..b595087b242 100644 --- a/Polyhedron/demo/Polyhedron/MainWindow.cpp +++ b/Polyhedron/demo/Polyhedron/MainWindow.cpp @@ -185,7 +185,7 @@ MainWindow::MainWindow(const QStringList &keywords, bool verbose, QWidget* paren CGAL::Three::Three::s_scene = scene; CGAL::Three::Three::s_connectable_scene = scene; { - QShortcut* shortcut = new QShortcut(QKeySequence(Qt::ALT+Qt::Key_Q), this); + QShortcut* shortcut = new QShortcut(QKeySequence(Qt::ALT,Qt::Key_Q), this); connect(shortcut, SIGNAL(activated()), this, SLOT(setFocusToQuickSearch())); shortcut = new QShortcut(QKeySequence(Qt::Key_F5), this); @@ -194,10 +194,10 @@ MainWindow::MainWindow(const QStringList &keywords, bool verbose, QWidget* paren shortcut = new QShortcut(QKeySequence(Qt::Key_F11), this); connect(shortcut, SIGNAL(activated()), this, SLOT(toggleFullScreen())); - shortcut = new QShortcut(QKeySequence(Qt::CTRL+Qt::Key_R), this); + shortcut = new QShortcut(QKeySequence(Qt::CTRL,Qt::Key_R), this); connect(shortcut, &QShortcut::activated, this, &MainWindow::recenterScene); - shortcut = new QShortcut(QKeySequence(Qt::CTRL+Qt::Key_T), this); + shortcut = new QShortcut(QKeySequence(Qt::CTRL,Qt::Key_T), this); connect(shortcut, &QShortcut::activated, this, [](){ diff --git a/Polyhedron/demo/Polyhedron/Viewer.cpp b/Polyhedron/demo/Polyhedron/Viewer.cpp index 35272952770..4b58030049f 100644 --- a/Polyhedron/demo/Polyhedron/Viewer.cpp +++ b/Polyhedron/demo/Polyhedron/Viewer.cpp @@ -309,7 +309,7 @@ void Viewer::doBindings() setKeyDescription(Qt::Key_M, tr("Toggle macro mode: useful to view details very near from the camera, " "but decrease the z-buffer precision")); - setKeyDescription(Qt::Key_I + Qt::CTRL, + setKeyDescription(Qt::CTRL, Qt::Key_I, tr("Toggle the primitive IDs visibility of the selected Item, for the types selected in the context menu of the said item.")); setKeyDescription(Qt::Key_D, tr("Disable the distance between two points visibility.")); diff --git a/Surface_mesh_topology/include/CGAL/draw_face_graph_with_paths.h b/Surface_mesh_topology/include/CGAL/draw_face_graph_with_paths.h index 981cc54ca22..6a1e01e22fe 100644 --- a/Surface_mesh_topology/include/CGAL/draw_face_graph_with_paths.h +++ b/Surface_mesh_topology/include/CGAL/draw_face_graph_with_paths.h @@ -262,14 +262,14 @@ protected: { Base::init(); setKeyDescription(::Qt::Key_D, "Increase current dart drawing"); - setKeyDescription(::Qt::Key_D+::Qt::ControlModifier, "Decrease current dart drawing"); - setKeyDescription(::Qt::Key_D+::Qt::ShiftModifier, "Draw all darts"); + setKeyDescription(::Qt::ControlModifier, ::Qt::Key_D, "Decrease current dart drawing"); + setKeyDescription(::Qt::ShiftModifier, ::Qt::Key_D, "Draw all darts"); setKeyDescription(::Qt::Key_X, "Toggles marked darts display"); setKeyDescription(::Qt::Key_P, "Increase current path drawing"); - setKeyDescription(::Qt::Key_P+::Qt::ControlModifier, "Decrease current path drawing"); - setKeyDescription(::Qt::Key_P+::Qt::ShiftModifier, "Draw all paths"); + setKeyDescription(::Qt::ControlModifier, ::Qt::Key_P, "Decrease current path drawing"); + setKeyDescription(::Qt::ShiftModifier, ::Qt::Key_P, "Draw all paths"); } virtual void keyPressEvent(QKeyEvent *e) diff --git a/Triangulation_3/demo/Triangulation_3/PreferenceDlg.cpp b/Triangulation_3/demo/Triangulation_3/PreferenceDlg.cpp index c922abd6fd4..122c291d048 100644 --- a/Triangulation_3/demo/Triangulation_3/PreferenceDlg.cpp +++ b/Triangulation_3/demo/Triangulation_3/PreferenceDlg.cpp @@ -12,7 +12,7 @@ PreferenceDlg::PreferenceDlg(QWidget *parent) : QDialog(parent) QPushButton *btnVertex = new QPushButton( tr("Set Color") ); // create color label m_labelVertex = new QLabel; - m_labelVertex->setFrameStyle(QFrame::Sunken | QFrame::Panel); + m_labelVertex->setFrameStyle(static_cast(QFrame::Sunken) | static_cast(QFrame::Panel)); // create size label QLabel *labelSizeV = new QLabel( tr("Set Size") ); // create lineedit @@ -38,7 +38,7 @@ PreferenceDlg::PreferenceDlg(QWidget *parent) : QDialog(parent) QPushButton *btnDEdge = new QPushButton( tr("Set Color") ); // create color label m_labelDEdge = new QLabel; - m_labelDEdge->setFrameStyle(QFrame::Sunken | QFrame::Panel); + m_labelDEdge->setFrameStyle(static_cast(QFrame::Sunken) | static_cast(QFrame::Panel)); // create size label QLabel *labelSizeDE = new QLabel( tr("Set Size") ); // create lineedit @@ -64,7 +64,7 @@ PreferenceDlg::PreferenceDlg(QWidget *parent) : QDialog(parent) QPushButton *btnVEdge = new QPushButton( tr("Set Color") ); // create color label m_labelVEdge = new QLabel; - m_labelVEdge->setFrameStyle(QFrame::Sunken | QFrame::Panel); + m_labelVEdge->setFrameStyle(static_cast(QFrame::Sunken) | static_cast(QFrame::Panel)); // create size label QLabel *labelSizeVE = new QLabel( tr("Set Size") ); // create lineedit @@ -90,7 +90,7 @@ PreferenceDlg::PreferenceDlg(QWidget *parent) : QDialog(parent) QPushButton *btnFacet = new QPushButton( tr("Set Color") ); // create color label m_labelFacet = new QLabel; - m_labelFacet->setFrameStyle(QFrame::Sunken | QFrame::Panel); + m_labelFacet->setFrameStyle(static_cast(QFrame::Sunken) | static_cast(QFrame::Panel)); // create label and spinbox QLabel *labelFacetA = new QLabel( tr("Transparency") ); m_spinAlphaF = new QSpinBox; @@ -116,7 +116,7 @@ PreferenceDlg::PreferenceDlg(QWidget *parent) : QDialog(parent) QPushButton *btnBall = new QPushButton( tr("Set Color") ); // create color label m_labelBall = new QLabel; - m_labelBall->setFrameStyle(QFrame::Sunken | QFrame::Panel); + m_labelBall->setFrameStyle(static_cast(QFrame::Sunken) | static_cast(QFrame::Panel)); // create label and spinbox QLabel *labelBallA = new QLabel( tr("Transparency") ); m_spinAlphaB = new QSpinBox; @@ -147,7 +147,7 @@ PreferenceDlg::PreferenceDlg(QWidget *parent) : QDialog(parent) QGroupBox *groupS = new QGroupBox( tr("Empty Sphere") ); // create color label m_labelSphere = new QLabel; - m_labelSphere->setFrameStyle(QFrame::Sunken | QFrame::Panel); + m_labelSphere->setFrameStyle(static_cast(QFrame::Sunken) | static_cast(QFrame::Panel)); // create button QPushButton *btnSphere = new QPushButton( tr("Set Color") ); // create label and spinbox diff --git a/Triangulation_3/demo/Triangulation_3/Viewer.cpp b/Triangulation_3/demo/Triangulation_3/Viewer.cpp index 90af7a440db..62937f5a5bc 100644 --- a/Triangulation_3/demo/Triangulation_3/Viewer.cpp +++ b/Triangulation_3/demo/Triangulation_3/Viewer.cpp @@ -69,12 +69,12 @@ void Viewer::init() glHint(GL_LINE_SMOOTH_HINT, GL_NICEST); /* Add mouse and key description */ - setKeyDescription( Qt::CTRL + Qt::Key_G, tr("Generate points") ); - setKeyDescription( Qt::CTRL + Qt::Key_O, tr("Load points") ); - setKeyDescription( Qt::CTRL + Qt::Key_S, tr("Save points") ); - setKeyDescription( Qt::CTRL + Qt::Key_Comma, tr("Preference") ); - setKeyDescription( Qt::CTRL + Qt::Key_H, tr("Hide Kernel Demo") ); - setKeyDescription( Qt::CTRL + Qt::Key_Q, tr("Quit Kernel Demo") ); + setKeyDescription( Qt::CTRL, Qt::Key_G, tr("Generate points") ); + setKeyDescription( Qt::CTRL, Qt::Key_O, tr("Load points") ); + setKeyDescription( Qt::CTRL, Qt::Key_S, tr("Save points") ); + setKeyDescription( Qt::CTRL, Qt::Key_Comma, tr("Preference") ); + setKeyDescription( Qt::CTRL, Qt::Key_H, tr("Hide Kernel Demo") ); + setKeyDescription( Qt::CTRL, Qt::Key_Q, tr("Quit Kernel Demo") ); setKeyDescription( Qt::Key_Return, tr("Insert new point to triangulation in Input-Point mode") ); setKeyDescription( Qt::Key_Escape,