From acfd0d72aab0a89f169f492fbc3fff22dc378ddf Mon Sep 17 00:00:00 2001 From: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> Date: Wed, 1 Dec 2021 14:37:21 -0800 Subject: [PATCH] =?UTF-8?q?=EF=BB=BFRemoves=20AZAutoSizingScrollArea=20fro?= =?UTF-8?q?m=20AzToolsFramework?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com> --- .../UI/UICore/AZAutoSizingScrollArea.cpp | 55 ------------------- .../UI/UICore/AZAutoSizingScrollArea.hxx | 41 -------------- .../aztoolsframework_files.cmake | 2 - 3 files changed, 98 deletions(-) delete mode 100644 Code/Framework/AzToolsFramework/AzToolsFramework/UI/UICore/AZAutoSizingScrollArea.cpp delete mode 100644 Code/Framework/AzToolsFramework/AzToolsFramework/UI/UICore/AZAutoSizingScrollArea.hxx diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/UICore/AZAutoSizingScrollArea.cpp b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/UICore/AZAutoSizingScrollArea.cpp deleted file mode 100644 index c8a3b28173..0000000000 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/UICore/AZAutoSizingScrollArea.cpp +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - - -#include "AZAutoSizingScrollArea.hxx" - -#include - -namespace AzToolsFramework -{ - - AZAutoSizingScrollArea::AZAutoSizingScrollArea(QWidget* parent) - : QScrollArea(parent) - { - } - - // this code was copied from the regular implementation of the same function in QScrollArea, but converted - // the private calls to public calls and removed the cache. - QSize AZAutoSizingScrollArea::sizeHint() const - { - int initialSize = 2 * frameWidth(); - QSize sizeHint(initialSize, initialSize); - - if (widget()) - { - sizeHint += this->widgetResizable() ? widget()->sizeHint() : widget()->size(); - } - else - { - // If we don't have a widget, we want to reserve some space visually for ourselves. - int fontHeight = fontMetrics().height(); - sizeHint += QSize(2 * fontHeight, 2 * fontHeight); - } - - if (verticalScrollBarPolicy() == Qt::ScrollBarAlwaysOn) - { - sizeHint.setWidth(sizeHint.width() + verticalScrollBar()->sizeHint().width()); - } - - if (horizontalScrollBarPolicy() == Qt::ScrollBarAlwaysOn) - { - sizeHint.setHeight(sizeHint.height() + horizontalScrollBar()->sizeHint().height()); - } - - return sizeHint; - } - -} - -#include "UI/UICore/moc_AZAutoSizingScrollArea.cpp" diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/UICore/AZAutoSizingScrollArea.hxx b/Code/Framework/AzToolsFramework/AzToolsFramework/UI/UICore/AZAutoSizingScrollArea.hxx deleted file mode 100644 index e5e5ef59ac..0000000000 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/UI/UICore/AZAutoSizingScrollArea.hxx +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (c) Contributors to the Open 3D Engine Project. - * For complete copyright and license terms please see the LICENSE at the root of this distribution. - * - * SPDX-License-Identifier: Apache-2.0 OR MIT - * - */ - -#ifndef AZAUTOSIZINGSCROLLAREA_HXX -#define AZAUTOSIZINGSCROLLAREA_HXX - -#if !defined(Q_MOC_RUN) -#include -#include - -#pragma once - -#include -#endif - -namespace AzToolsFramework -{ - // This fixes a bug in QScrollArea which makes it so that you can dynamically add and remove elements from inside it, and the scroll - // area will take up as much room as it needs to, to prevent the need for scroll bars. Scroll bars will still appear if there is not enough - // room, but the view will scale up to eat all available room before that happens. - - // QScrollArea was supposed to do this, but it appears to cache the size of its embedded widget on startup, and never clears that cache. - class AZAutoSizingScrollArea - : public QScrollArea - { - Q_OBJECT - public: - AZ_CLASS_ALLOCATOR(AZAutoSizingScrollArea, AZ::SystemAllocator, 0); - - explicit AZAutoSizingScrollArea(QWidget* parent = 0); - - QSize sizeHint() const; - }; -} - -#endif diff --git a/Code/Framework/AzToolsFramework/AzToolsFramework/aztoolsframework_files.cmake b/Code/Framework/AzToolsFramework/AzToolsFramework/aztoolsframework_files.cmake index b0226b04af..24963d24c0 100644 --- a/Code/Framework/AzToolsFramework/AzToolsFramework/aztoolsframework_files.cmake +++ b/Code/Framework/AzToolsFramework/AzToolsFramework/aztoolsframework_files.cmake @@ -444,8 +444,6 @@ set(FILES UI/Slice/SliceRelationshipWidget.hxx UI/UICore/AspectRatioAwarePixmapWidget.hxx UI/UICore/AspectRatioAwarePixmapWidget.cpp - UI/UICore/AZAutoSizingScrollArea.hxx - UI/UICore/AZAutoSizingScrollArea.cpp UI/UICore/ColorPickerDelegate.hxx UI/UICore/ColorPickerDelegate.cpp UI/UICore/ClickableLabel.hxx