From 426773c69455cf04ae69558a06315b95b0d9ffae Mon Sep 17 00:00:00 2001 From: Chris Galvan Date: Thu, 28 Oct 2021 16:47:00 -0500 Subject: [PATCH 1/2] Made some improvements to the C++ Shape Example. Signed-off-by: Chris Galvan --- .../Code/Source/ShapeExampleEditorSystemComponent.cpp | 2 +- cpp_gems/ShapeExample/Code/Source/ShapeExampleWidget.cpp | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/cpp_gems/ShapeExample/Code/Source/ShapeExampleEditorSystemComponent.cpp b/cpp_gems/ShapeExample/Code/Source/ShapeExampleEditorSystemComponent.cpp index d708fdd..fee9522 100644 --- a/cpp_gems/ShapeExample/Code/Source/ShapeExampleEditorSystemComponent.cpp +++ b/cpp_gems/ShapeExample/Code/Source/ShapeExampleEditorSystemComponent.cpp @@ -70,7 +70,7 @@ namespace ShapeExample options.toolbarIcon = ":/ShapeExample/toolbar_icon.svg"; // Register our custom widget as a dockable tool with the Editor - AzToolsFramework::RegisterViewPane("ShapeExample", "Tools", options); + AzToolsFramework::RegisterViewPane("Shape Example (C++)", "Examples", options); } } // namespace ShapeExample diff --git a/cpp_gems/ShapeExample/Code/Source/ShapeExampleWidget.cpp b/cpp_gems/ShapeExample/Code/Source/ShapeExampleWidget.cpp index 5cfb5be..e4aa105 100644 --- a/cpp_gems/ShapeExample/Code/Source/ShapeExampleWidget.cpp +++ b/cpp_gems/ShapeExample/Code/Source/ShapeExampleWidget.cpp @@ -89,6 +89,7 @@ namespace ShapeExample // Create a button with the shape components name and icon QPushButton* shapeButton = new QPushButton(QIcon(iconPath), QString::fromUtf8(name.c_str()), this); + shapeButton->setStyleSheet("text-align: left;"); shapeButton->setMinimumHeight(40); // Example of listening to signals using a lambda as the handler @@ -105,6 +106,10 @@ namespace ShapeExample shapeButtons->setLayout(gridLayout); mainLayout->addWidget(shapeButtons); + // Add stretch at bottom of the layout to fill any expanded space larger than what is needed, + // so that if our tool is resized large our content will stay together + mainLayout->addStretch(); + setLayout(mainLayout); } From 95767dcd8d5b05d5be60a639c2fa752c5900e619 Mon Sep 17 00:00:00 2001 From: Chris Galvan Date: Fri, 29 Oct 2021 11:32:04 -0500 Subject: [PATCH 2/2] Removed left-align in push buttons. Signed-off-by: Chris Galvan --- cpp_gems/ShapeExample/Code/Source/ShapeExampleWidget.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/cpp_gems/ShapeExample/Code/Source/ShapeExampleWidget.cpp b/cpp_gems/ShapeExample/Code/Source/ShapeExampleWidget.cpp index e4aa105..ff42eb6 100644 --- a/cpp_gems/ShapeExample/Code/Source/ShapeExampleWidget.cpp +++ b/cpp_gems/ShapeExample/Code/Source/ShapeExampleWidget.cpp @@ -89,7 +89,6 @@ namespace ShapeExample // Create a button with the shape components name and icon QPushButton* shapeButton = new QPushButton(QIcon(iconPath), QString::fromUtf8(name.c_str()), this); - shapeButton->setStyleSheet("text-align: left;"); shapeButton->setMinimumHeight(40); // Example of listening to signals using a lambda as the handler