diff --git a/common/lc_commands.cpp b/common/lc_commands.cpp index fceb0803..ed0f85ad 100644 --- a/common/lc_commands.cpp +++ b/common/lc_commands.cpp @@ -997,6 +997,13 @@ lcCommand gCommands[LC_NUM_COMMANDS] = QT_TRANSLATE_NOOP("Status", "Toggle fullscreen mode"), QT_TRANSLATE_NOOP("Shortcut", "") }, + // LC_VIEW_CLOSE_CURRENT_TAB + { + QT_TRANSLATE_NOOP("Action", "View.CloseCurrentTab"), + QT_TRANSLATE_NOOP("Menu", "Close &Tab"), + QT_TRANSLATE_NOOP("Status", "Close current tab"), + QT_TRANSLATE_NOOP("Shortcut", "Ctrl+W") + }, // LC_VIEW_SHADE_WIREFRAME { QT_TRANSLATE_NOOP("Action", "View.Shade.Wireframe"), diff --git a/common/lc_commands.h b/common/lc_commands.h index ed8a7a26..f7b1095a 100644 --- a/common/lc_commands.h +++ b/common/lc_commands.h @@ -152,6 +152,7 @@ enum lcCommandId LC_VIEW_REMOVE_VIEW, LC_VIEW_RESET_VIEWS, LC_VIEW_FULLSCREEN, + LC_VIEW_CLOSE_CURRENT_TAB, LC_VIEW_SHADING_FIRST, LC_VIEW_SHADING_WIREFRAME = LC_VIEW_SHADING_FIRST, LC_VIEW_SHADING_FLAT, diff --git a/common/lc_mainwindow.cpp b/common/lc_mainwindow.cpp index 65244ae9..6e7a76e3 100644 --- a/common/lc_mainwindow.cpp +++ b/common/lc_mainwindow.cpp @@ -1406,6 +1406,12 @@ void lcMainWindow::RemoveAllModelTabs() } } +void lcMainWindow::CloseCurrentModelTab() +{ + if (mModelTabWidget->count() > 1) + delete mModelTabWidget->currentWidget(); +} + void lcMainWindow::SetCurrentModelTab(lcModel* Model) { lcModelTabWidget* EmptyWidget = nullptr; @@ -2553,6 +2559,10 @@ void lcMainWindow::HandleCommand(lcCommandId CommandId) ToggleFullScreen(); break; + case LC_VIEW_CLOSE_CURRENT_TAB: + CloseCurrentModelTab(); + break; + case LC_VIEW_SHADING_WIREFRAME: SetShadingMode(LC_SHADING_WIREFRAME); break; diff --git a/common/lc_mainwindow.h b/common/lc_mainwindow.h index 6ffe9adf..850d53ee 100644 --- a/common/lc_mainwindow.h +++ b/common/lc_mainwindow.h @@ -253,6 +253,7 @@ public: QByteArray GetTabLayout(); void RestoreTabLayout(const QByteArray& TabLayout); void RemoveAllModelTabs(); + void CloseCurrentModelTab(); void SetCurrentModelTab(lcModel* Model); void ResetCameras(); void AddView(View* View);