Remove ComponentPaletteModelFilter from AzToolsFramework

Signed-off-by: Esteban Papp <81431996+amznestebanpapp@users.noreply.github.com>
This commit is contained in:
Esteban Papp
2021-12-01 11:52:12 -08:00
parent f8f9b79f7c
commit 643bc70c1e
3 changed files with 0 additions and 84 deletions
@@ -1,53 +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 "ComponentPaletteModelFilter.hxx"
#include <AzCore/Serialization/SerializeContext.h>
namespace AzToolsFramework
{
ComponentPaletteModelFilter::ComponentPaletteModelFilter(QObject* parent)
: QSortFilterProxyModel(parent)
{
}
bool ComponentPaletteModelFilter::filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const
{
const QModelIndex index = sourceModel()->index(sourceRow, 0, sourceParent);
if (!index.isValid())
{
return false;
}
if (!filterRegExp().isValid())
{
return true;
}
auto componentClass = reinterpret_cast<const AZ::SerializeContext::ClassData*>(sourceModel()->data(index, Qt::ItemDataRole::UserRole + 1).toULongLong());
if (componentClass)
{
const QString componentName = sourceModel()->data(index, Qt::DisplayRole).toString();
return componentName.contains(filterRegExp());
}
const int childRowCount = sourceModel()->rowCount(index);
for (int childRow = 0; childRow < childRowCount; ++childRow)
{
if (filterAcceptsRow(childRow, index))
{
return true;
}
}
return false;
}
}
#include "UI/ComponentPalette/moc_ComponentPaletteModelFilter.cpp"
@@ -1,29 +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
*
*/
#pragma once
#if !defined(Q_MOC_RUN)
#include <QSortFilterProxyModel>
#endif
namespace AzToolsFramework
{
class ComponentPaletteModelFilter : public QSortFilterProxyModel
{
Q_OBJECT
public:
ComponentPaletteModelFilter(QObject* parent = nullptr);
bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const override;
protected:
QRegExp m_filterRegExp;
};
}
@@ -356,8 +356,6 @@ set(FILES
UI/ComponentPalette/ComponentPaletteWidget.cpp
UI/ComponentPalette/ComponentPaletteModel.hxx
UI/ComponentPalette/ComponentPaletteModel.cpp
UI/ComponentPalette/ComponentPaletteModelFilter.hxx
UI/ComponentPalette/ComponentPaletteModelFilter.cpp
UI/ComponentPalette/ComponentPaletteUtil.hxx
UI/ComponentPalette/ComponentPaletteUtil.cpp
UI/Layer/NameConflictWarning.hxx