update Cluster file name to ButtonGroup

This commit is contained in:
hultonha
2021-04-27 11:24:58 +01:00
parent 0da9a05d87
commit 0952b7bd87
15 changed files with 92 additions and 70 deletions
@@ -13,7 +13,6 @@
#include "AzToolsFramework_precompiled.h"
#include <AzToolsFramework/ViewportUi/Button.h>
#include <AzToolsFramework/ViewportUi/Cluster.h>
namespace AzToolsFramework::ViewportUi::Internal
{
@@ -12,7 +12,6 @@
#pragma once
#include <AzToolsFramework/ViewportUi/Cluster.h>
#include <AzToolsFramework/ViewportUi/ViewportUiRequestBus.h>
namespace AzToolsFramework::ViewportUi::Internal
@@ -11,7 +11,7 @@
*/
#include <AzToolsFramework/ViewportUi/Button.h>
#include <AzToolsFramework/ViewportUi/Cluster.h>
#include <AzToolsFramework/ViewportUi/ButtonGroup.h>
#pragma optimize("", off)
#pragma inline_depth(0)
@@ -9,9 +9,10 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
#include "AzToolsFramework_precompiled.h"
#include <AzToolsFramework/ViewportUi/Cluster.h>
#include <AzToolsFramework/ViewportUi/ButtonGroup.h>
#include <AzToolsFramework/ViewportUi/ViewportUiCluster.h>
namespace AzToolsFramework::ViewportUi::Internal
@@ -13,7 +13,7 @@
#pragma once
#include <AzToolsFramework/ViewportUi/Button.h>
#include <AzToolsFramework/ViewportUi/Cluster.h>
#include <AzToolsFramework/ViewportUi/ButtonGroup.h>
#include <AzToolsFramework/ViewportUi/TextField.h>
#include <AzToolsFramework/ViewportUi/ViewportUiRequestBus.h>
#include <AzToolsFramework/ViewportUi/ViewportUiDisplayLayout.h>
@@ -14,7 +14,7 @@
#include <AzCore/std/smart_ptr/make_shared.h>
#include <AzToolsFramework/ViewportUi/Button.h>
#include <AzToolsFramework/ViewportUi/Cluster.h>
#include <AzToolsFramework/ViewportUi/ButtonGroup.h>
#include <AzToolsFramework/ViewportUi/ViewportUiManager.h>
#include <AzToolsFramework/ViewportUi/ViewportUiDisplay.h>
@@ -13,7 +13,6 @@
#pragma once
#include <AzToolsFramework/ViewportUi/Button.h>
#include <AzToolsFramework/ViewportUi/Cluster.h>
#include <AzToolsFramework/ViewportUi/TextField.h>
#include <AzToolsFramework/ViewportUi/ViewportUiDisplay.h>
@@ -21,6 +20,7 @@ namespace AzToolsFramework::ViewportUi
{
namespace Internal
{
class ButtonGroup;
class ViewportUiDisplay;
}
@@ -1,4 +1,16 @@
#include <AzToolsFramework/ViewportUi/Cluster.h>
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
#include <AzToolsFramework/ViewportUi/ButtonGroup.h>
#include <AzToolsFramework/ViewportUi/ViewportUiSwitcher.h>
namespace AzToolsFramework::ViewportUi::Internal
@@ -9,7 +21,8 @@ namespace AzToolsFramework::ViewportUi::Internal
setOrientation(Qt::Orientation::Horizontal);
setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Preferred);
setStyleSheet(QString("QToolBar {background-color: none; border: none; spacing: 3px;}"
"QToolButton {background-color: black; border: outset; border-color: white; border-radius: 7px; border-width: 2px; padding: 7px; color: white;}"));
"QToolButton {background-color: black; border: outset; border-color: white; border-radius: 7px; "
"border-width: 2px; padding: 7px; color: white;}"));
// Add am empty active button (is set in the call to SetActiveMode)
m_activeButton = new QToolButton();
@@ -51,7 +64,7 @@ namespace AzToolsFramework::ViewportUi::Internal
action->setProperty("IconHasHoverEffect", true);
// add the action
addAction(action);
addAction(action);
// resize to fit new action with minimum extra space
resize(minimumSizeHint());
@@ -68,14 +81,12 @@ namespace AzToolsFramework::ViewportUi::Internal
}
// register the action
m_widgetCallbacks.AddWidget(action, [updateCallback](QPointer<QObject> object)
{
updateCallback(static_cast<QAction*>(object.data()));
});
m_widgetCallbacks.AddWidget(
action, [updateCallback](QPointer<QObject> object) { updateCallback(static_cast<QAction*>(object.data())); });
m_buttonActionMap.insert({button->m_buttonId, action});
}
void ViewportUiSwitcher::RemoveButton(ButtonId buttonId)
{
if (auto actionEntry = m_buttonActionMap.find(buttonId); actionEntry != m_buttonActionMap.end())
@@ -124,12 +135,12 @@ namespace AzToolsFramework::ViewportUi::Internal
QIcon buttonIcon = QString(((*buttonIt)->m_icon).c_str());
m_activeButton->setIcon(buttonIcon);
m_activeButton->setText(buttonName);
}
}
// Look up button ID in map then remove it from its current position
auto itr = m_buttonActionMap.find(buttonId);
QAction* action = itr->second;
removeAction(action);
removeAction(action);
if (!initialActiveMode)
{
@@ -139,7 +150,7 @@ namespace AzToolsFramework::ViewportUi::Internal
itr = m_buttonActionMap.find(m_activeButtonId);
action = itr->second;
addAction(action);
}
}
}
m_activeButtonId = buttonId;
@@ -1,3 +1,15 @@
/*
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
* its licensors.
*
* For complete copyright and license terms please see the LICENSE at the root of this
* distribution (the "License"). All use of this software is governed by the License,
* or, if provided, by the license below or the license accompanying this file. Do not
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*
*/
#pragma once
#include <AzToolsFramework/ViewportUi/Button.h>
@@ -487,8 +487,8 @@ set(FILES
Viewport/ViewportTypes.cpp
ViewportUi/Button.h
ViewportUi/Button.cpp
ViewportUi/Cluster.h
ViewportUi/Cluster.cpp
ViewportUi/ButtonGroup.h
ViewportUi/ButtonGroup.cpp
ViewportUi/TextField.h
ViewportUi/TextField.cpp
ViewportUi/ViewportUiDisplay.h
@@ -731,7 +731,7 @@ set(FILES
# Prevent the following files from being grouped in UNITY builds
set(SKIP_UNITY_BUILD_INCLUSION_FILES
# The following files are skipped from unity to avoid duplicated symbols related to an ebus
AzToolsFrameworkModule.cpp
AzToolsFrameworkModule.cpp
Application/ToolsApplication.cpp
UI/PropertyEditor/PropertyEntityIdCtrl.cpp
UI/PropertyEditor/PropertyManagerComponent.cpp