Added shortcut for closing the current tab.

This commit is contained in:
Leonardo Zide 2019-01-20 16:36:59 -08:00
parent ee6ef69ede
commit 40ad756348
4 changed files with 19 additions and 0 deletions

View file

@ -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"),

View file

@ -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,

View file

@ -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;

View file

@ -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);