Removes AZAutoSizingScrollArea from AzToolsFramework

Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com>
monroegm-disable-blank-issue-2
Esteban Papp 4 years ago
parent 6b457567c7
commit acfd0d72aa

@ -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 <qscrollbar.h>
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"

@ -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 <AzCore/base.h>
#include <AzCore/Memory/SystemAllocator.h>
#pragma once
#include <QtWidgets/QScrollArea>
#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

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

Loading…
Cancel
Save