From 9a2f2828450b0a6d1ab022513fc81889b89283dd Mon Sep 17 00:00:00 2001 From: Maxime Gimeno Date: Wed, 10 Jul 2019 14:32:57 +0200 Subject: [PATCH 1/4] restore recenter scene --- Polyhedron/demo/Polyhedron/MainWindow.cpp | 6 +++++- Polyhedron/demo/Polyhedron/MainWindow.h | 2 +- Polyhedron/demo/Polyhedron/MainWindow.ui | 11 ----------- 3 files changed, 6 insertions(+), 13 deletions(-) diff --git a/Polyhedron/demo/Polyhedron/MainWindow.cpp b/Polyhedron/demo/Polyhedron/MainWindow.cpp index 4fa880e9043..7c3480a870b 100644 --- a/Polyhedron/demo/Polyhedron/MainWindow.cpp +++ b/Polyhedron/demo/Polyhedron/MainWindow.cpp @@ -180,6 +180,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); + connect(shortcut, &QShortcut::activated, + this, &MainWindow::recenterScene); + } proxyModel = new QSortFilterProxyModel(this); @@ -2366,7 +2370,7 @@ void MainWindow::setAddKeyFrameKeyboardModifiers(::Qt::KeyboardModifiers m) viewer->setAddKeyFrameKeyboardModifiers(m); } -void MainWindow::on_actionRecenterScene_triggered() +void MainWindow::recenterScene() { //force the recomputaion of the bbox bbox_need_update = true; diff --git a/Polyhedron/demo/Polyhedron/MainWindow.h b/Polyhedron/demo/Polyhedron/MainWindow.h index 8ddb5611649..3dabccff9b3 100644 --- a/Polyhedron/demo/Polyhedron/MainWindow.h +++ b/Polyhedron/demo/Polyhedron/MainWindow.h @@ -362,7 +362,7 @@ protected Q_SLOTS: //!menus. void filterOperations(); //!Updates the bounding box and moves the camera to fits the scene. - void on_actionRecenterScene_triggered(); + void recenterScene(); //!Resizes the header of the scene view void resetHeader(); //!apply an action named `name` to all selected items diff --git a/Polyhedron/demo/Polyhedron/MainWindow.ui b/Polyhedron/demo/Polyhedron/MainWindow.ui index 06257db41c7..b5a6faaa122 100644 --- a/Polyhedron/demo/Polyhedron/MainWindow.ui +++ b/Polyhedron/demo/Polyhedron/MainWindow.ui @@ -94,7 +94,6 @@ - @@ -454,14 +453,6 @@ &Organize Viewers - - - Recenter Scene - - - Ctrl+R - - Sa&ve the Scene as a Script File... @@ -476,8 +467,6 @@ - - From ee762418055ca080341e02a933048b592e92f2c6 Mon Sep 17 00:00:00 2001 From: Maxime Gimeno Date: Wed, 10 Jul 2019 14:42:18 +0200 Subject: [PATCH 2/4] Restore Ctrl+T --- Polyhedron/demo/Polyhedron/MainWindow.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Polyhedron/demo/Polyhedron/MainWindow.cpp b/Polyhedron/demo/Polyhedron/MainWindow.cpp index 7c3480a870b..7b707c4f5d1 100644 --- a/Polyhedron/demo/Polyhedron/MainWindow.cpp +++ b/Polyhedron/demo/Polyhedron/MainWindow.cpp @@ -183,7 +183,15 @@ MainWindow::MainWindow(const QStringList &keywords, bool verbose, QWidget* paren 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); + connect(shortcut, &QShortcut::activated, + this, + [this](){ + Viewer* viewer = qobject_cast(CGAL::Three::Three::activeViewer()); + bool b = viewer->property("draw_two_sides").toBool(); + viewer->setTwoSides(!b); + } + ); } proxyModel = new QSortFilterProxyModel(this); From 5b66c7337eccca000820ef0d00cde1ad34e255aa Mon Sep 17 00:00:00 2001 From: Maxime Gimeno Date: Wed, 10 Jul 2019 15:15:06 +0200 Subject: [PATCH 3/4] Fix mnemonics and actionRearrangeViewers --- Polyhedron/demo/Polyhedron/MainWindow.cpp | 15 +++++++++++---- Polyhedron/demo/Polyhedron/MainWindow.h | 2 +- Polyhedron/demo/Polyhedron/MainWindow.ui | 6 +++--- 3 files changed, 15 insertions(+), 8 deletions(-) diff --git a/Polyhedron/demo/Polyhedron/MainWindow.cpp b/Polyhedron/demo/Polyhedron/MainWindow.cpp index 7b707c4f5d1..af26cac7f43 100644 --- a/Polyhedron/demo/Polyhedron/MainWindow.cpp +++ b/Polyhedron/demo/Polyhedron/MainWindow.cpp @@ -2981,7 +2981,7 @@ QObject* MainWindow::getDirectChild(QObject* widget) return getDirectChild(widget->parent()); } -void MainWindow::on_action_Organize_Viewers_triggered() +void MainWindow::on_action_Rearrange_Viewers_triggered() { if(ui->mdiArea->subWindowList().size() == 1) ui->mdiArea->subWindowList().first()->showMaximized(); @@ -3032,7 +3032,7 @@ SubViewer::SubViewer(QWidget *parent, MainWindow* mw, Viewer* mainviewer) actionCopyCamera->setObjectName("actionCopyCamera"); QAction* actionPasteCamera = new QAction("&Paste Camera",this); actionPasteCamera->setObjectName("actionPasteCamera"); - QMenu* cameraMenu = new QMenu("Camera", mw); + QMenu* cameraMenu = new QMenu("Ca&mera", mw); cameraMenu->addAction(actionDumpCamera); cameraMenu->addAction(actionCopyCamera); cameraMenu->addAction(actionPasteCamera); @@ -3048,12 +3048,12 @@ SubViewer::SubViewer(QWidget *parent, MainWindow* mw, Viewer* mainviewer) actionDrawTwoSide->setCheckable(true); actionDrawTwoSide->setChecked(false); viewMenu->addAction(actionDrawTwoSide); - QAction* actionQuick = new QAction("Quick Camera Mode",this); + QAction* actionQuick = new QAction("&Quick Camera Mode",this); actionQuick->setObjectName("actionQuick"); actionQuick->setCheckable(true); actionQuick->setChecked(true); viewMenu->addAction(actionQuick); - QAction* actionOrtho = new QAction("Orthographic Projection",this); + QAction* actionOrtho = new QAction("&Orthographic Projection",this); actionOrtho->setObjectName("actionOrtho"); actionOrtho->setCheckable(true); actionOrtho->setChecked(false); @@ -3136,6 +3136,9 @@ void SubViewer::changeEvent(QEvent *event) //| Qt::WindowSystemMenuHint | Qt::WindowTitleHint ); + QAction* action = mw->findChild("action_Rearrange_Viewers"); + action->setVisible(false); + viewer->update(); } else { @@ -3151,6 +3154,10 @@ void SubViewer::changeEvent(QEvent *event) | Qt::WindowSystemMenuHint | Qt::WindowTitleHint ); + QAction* action = mw->findChild("action_Rearrange_Viewers"); + action->setVisible(true); + for(auto v : CGAL::QGLViewer::QGLViewerPool()) + v->update(); } } } diff --git a/Polyhedron/demo/Polyhedron/MainWindow.h b/Polyhedron/demo/Polyhedron/MainWindow.h index 3dabccff9b3..576eaac5e12 100644 --- a/Polyhedron/demo/Polyhedron/MainWindow.h +++ b/Polyhedron/demo/Polyhedron/MainWindow.h @@ -463,7 +463,7 @@ private: private Q_SLOTS: void on_actionAdd_Viewer_triggered(); - void on_action_Organize_Viewers_triggered(); + void on_action_Rearrange_Viewers_triggered(); void recenterViewer(); private: diff --git a/Polyhedron/demo/Polyhedron/MainWindow.ui b/Polyhedron/demo/Polyhedron/MainWindow.ui index b5a6faaa122..a011dedab64 100644 --- a/Polyhedron/demo/Polyhedron/MainWindow.ui +++ b/Polyhedron/demo/Polyhedron/MainWindow.ui @@ -93,7 +93,7 @@ - + @@ -448,9 +448,9 @@ Add &Viewer - + - &Organize Viewers + &Rearrange Viewers From 0ed8ed17b786e865d5541a1a95ed5a54b3931273 Mon Sep 17 00:00:00 2001 From: Maxime Gimeno Date: Wed, 10 Jul 2019 15:29:34 +0200 Subject: [PATCH 4/4] remove useless capture --- Polyhedron/demo/Polyhedron/MainWindow.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Polyhedron/demo/Polyhedron/MainWindow.cpp b/Polyhedron/demo/Polyhedron/MainWindow.cpp index af26cac7f43..11fbdd2ed88 100644 --- a/Polyhedron/demo/Polyhedron/MainWindow.cpp +++ b/Polyhedron/demo/Polyhedron/MainWindow.cpp @@ -186,7 +186,7 @@ MainWindow::MainWindow(const QStringList &keywords, bool verbose, QWidget* paren shortcut = new QShortcut(QKeySequence(Qt::CTRL+Qt::Key_T), this); connect(shortcut, &QShortcut::activated, this, - [this](){ + [](){ Viewer* viewer = qobject_cast(CGAL::Three::Three::activeViewer()); bool b = viewer->property("draw_two_sides").toBool(); viewer->setTwoSides(!b);