Added mechanism for viewpanes to request buttons on the main toolbar (#1189)
This commit is contained in:
@@ -912,6 +912,12 @@ QAction* LevelEditorMenuHandler::CreateViewPaneAction(const QtViewPane* view)
|
||||
action = new QAction(menuText, this);
|
||||
action->setObjectName(view->m_name);
|
||||
action->setCheckable(true);
|
||||
|
||||
if (view->m_options.showOnToolsToolbar)
|
||||
{
|
||||
action->setIcon(QIcon(view->m_options.toolbarIcon));
|
||||
}
|
||||
|
||||
m_actionManager->AddAction(view->m_id, action);
|
||||
|
||||
if (!view->m_options.shortcut.isEmpty())
|
||||
@@ -941,6 +947,11 @@ QAction* LevelEditorMenuHandler::CreateViewPaneMenuItem(
|
||||
|
||||
menu->addAction(action);
|
||||
|
||||
if (view->m_options.showOnToolsToolbar)
|
||||
{
|
||||
m_mainWindow->GetToolbarManager()->AddButtonToEditToolbar(action);
|
||||
}
|
||||
|
||||
return action;
|
||||
}
|
||||
|
||||
|
||||
@@ -470,9 +470,11 @@ void MainWindow::Initialize()
|
||||
|
||||
InitToolActionHandlers();
|
||||
|
||||
// Initialize toolbars before we setup the menu so that any tools can be added to the toolbar as needed
|
||||
InitToolBars();
|
||||
|
||||
m_levelEditorMenuHandler->Initialize();
|
||||
|
||||
InitToolBars();
|
||||
InitStatusBar();
|
||||
|
||||
AzToolsFramework::SourceControlNotificationBus::Handler::BusConnect();
|
||||
|
||||
@@ -623,6 +623,20 @@ AmazonToolbar ToolbarManager::GetMiscToolbar() const
|
||||
return t;
|
||||
}
|
||||
|
||||
void ToolbarManager::AddButtonToEditToolbar(QAction* action)
|
||||
{
|
||||
QString toolbarName = "EditMode";
|
||||
const AmazonToolbar* toolbar = FindToolbar(toolbarName);
|
||||
|
||||
if (toolbar)
|
||||
{
|
||||
if (toolbar->Toolbar())
|
||||
{
|
||||
toolbar->Toolbar()->addAction(action);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const AmazonToolbar* ToolbarManager::FindDefaultToolbar(const QString& toolbarName) const
|
||||
{
|
||||
for (const AmazonToolbar& toolbar : m_standardToolbars)
|
||||
|
||||
@@ -169,6 +169,8 @@ public:
|
||||
AmazonToolbar GetMiscToolbar() const;
|
||||
AmazonToolbar GetPlayConsoleToolbar() const;
|
||||
|
||||
void AddButtonToEditToolbar(QAction* action);
|
||||
|
||||
private:
|
||||
Q_DISABLE_COPY(ToolbarManager);
|
||||
void SaveToolbars();
|
||||
|
||||
Reference in New Issue
Block a user