More Corrections
This commit is contained in:
+1
-1
@@ -174,7 +174,7 @@ namespace AzToolsFramework
|
||||
if (compStringFilterIter != subFilters.end())
|
||||
{
|
||||
auto compStringFilter = qobject_cast<QSharedPointer<const CompositeFilter>>(*compStringFilterIter);
|
||||
if (compStringFilter->GetSubFilters().size() > 0 && compStringFilter->GetSubFilters()[0])
|
||||
if (!compStringFilter->GetSubFilters().isEmpty() && compStringFilter->GetSubFilters()[0])
|
||||
{
|
||||
m_stringFilter = qobject_cast<QSharedPointer<const StringFilter>>(compStringFilter->GetSubFilters()[0]);
|
||||
}
|
||||
|
||||
+23
-21
@@ -1,3 +1,14 @@
|
||||
/*
|
||||
* 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 <AssetBrowser/AssetBrowserTableModel.h>
|
||||
#include <AssetBrowser/AssetBrowserFilterModel.h>
|
||||
#include <AzToolsFramework/AssetBrowser/Entries/AssetBrowserEntry.h>
|
||||
@@ -32,24 +43,27 @@ namespace AzToolsFramework
|
||||
{
|
||||
if (role == Qt::DisplayRole && orientation == Qt::Horizontal)
|
||||
{
|
||||
switch (section)
|
||||
auto columnRole = aznumeric_cast<AssetBrowserEntry::Column>(role);
|
||||
switch (columnRole)
|
||||
{
|
||||
case static_cast<int>(AssetBrowserEntry::Column::Name):
|
||||
case AssetBrowserEntry::Column::Name:
|
||||
return QString("Name");
|
||||
case static_cast<int>(AssetBrowserEntry::Column::Path):
|
||||
case AssetBrowserEntry::Column::Path:
|
||||
return QString("Path");
|
||||
default:
|
||||
return QString::number(section);
|
||||
}
|
||||
}
|
||||
return QSortFilterProxyModel::headerData(section, orientation, role); // QVariant();
|
||||
return QSortFilterProxyModel::headerData(section, orientation, role);
|
||||
}
|
||||
|
||||
QVariant AssetBrowserTableModel::data(const QModelIndex& index, int role) const
|
||||
{
|
||||
auto sourceIndex = mapToSource(index);
|
||||
if (!sourceIndex.isValid())
|
||||
{
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
AssetBrowserEntry* entry = GetAssetEntry(sourceIndex);
|
||||
if (entry == nullptr)
|
||||
@@ -66,22 +80,10 @@ namespace AzToolsFramework
|
||||
return parent.isValid() ? QModelIndex() : createIndex(row, column, m_indexMap[row].internalPointer());
|
||||
}
|
||||
|
||||
QModelIndex AssetBrowserTableModel::parent(const QModelIndex& child) const
|
||||
QModelIndex AssetBrowserTableModel::parent([[maybe_unused]] const QModelIndex& child) const
|
||||
{
|
||||
AZ_UNUSED(child);
|
||||
return QModelIndex();
|
||||
}
|
||||
bool AssetBrowserTableModel::filterAcceptsRow(int source_row, const QModelIndex& source_parent) const
|
||||
{
|
||||
AZ_UNUSED(source_row);
|
||||
AZ_UNUSED(source_parent);
|
||||
// no filter present, every entry is not visible
|
||||
if (!m_filterModel->GetFilter())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
int AssetBrowserTableModel::rowCount(const QModelIndex& parent) const
|
||||
{
|
||||
@@ -94,14 +96,14 @@ namespace AzToolsFramework
|
||||
for (int i = 0; i < rows; ++i)
|
||||
{
|
||||
QModelIndex index = model->index(i, 0, parent);
|
||||
if (model->hasChildren(index) == false)
|
||||
if (!model->hasChildren(index))
|
||||
{
|
||||
beginInsertRows(parent, row, row);
|
||||
m_indexMap[row] = index;
|
||||
endInsertRows();
|
||||
|
||||
Q_EMIT dataChanged(index, index);
|
||||
row = row + 1;
|
||||
++row;
|
||||
}
|
||||
|
||||
if (model->hasChildren(index))
|
||||
@@ -124,9 +126,9 @@ namespace AzToolsFramework
|
||||
}
|
||||
}
|
||||
void AssetBrowserTableModel::UpdateTableModelMaps()
|
||||
{
|
||||
{
|
||||
emit layoutAboutToBeChanged();
|
||||
if (m_indexMap.size() > 0)
|
||||
if (!m_indexMap.isEmpty())
|
||||
{
|
||||
beginRemoveRows(m_indexMap.first(), m_indexMap.first().row(), m_indexMap.last().row());
|
||||
m_indexMap.clear();
|
||||
|
||||
+12
-1
@@ -1,4 +1,16 @@
|
||||
/*
|
||||
* 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
|
||||
|
||||
#if !defined(Q_MOC_RUN)
|
||||
#include <AzCore/Asset/AssetCommon.h>
|
||||
#include <QSortFilterProxyModel>
|
||||
@@ -30,7 +42,6 @@ namespace AzToolsFramework
|
||||
public Q_SLOTS:
|
||||
void UpdateTableModelMaps();
|
||||
protected:
|
||||
bool filterAcceptsRow(int source_row, const QModelIndex& source_parent) const override;
|
||||
int rowCount(const QModelIndex& parent = QModelIndex()) const override;
|
||||
QVariant headerData(int section, Qt::Orientation orientation, int role /* = Qt::DisplayRole */) const override;
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
+17
-11
@@ -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.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <API/EditorAssetSystemAPI.h>
|
||||
|
||||
#include <AzCore/std/containers/vector.h>
|
||||
@@ -109,21 +121,16 @@ namespace AzToolsFramework
|
||||
}
|
||||
QTableView::rowsAboutToBeRemoved(parent, start, end);
|
||||
}
|
||||
void AssetBrowserTableView::layoutChangedSlot(const QList<QPersistentModelIndex>& parents, QAbstractItemModel::LayoutChangeHint hint)
|
||||
void AssetBrowserTableView::layoutChangedSlot([[maybe_unused]] const QList<QPersistentModelIndex>& parents,[[maybe_unused]] QAbstractItemModel::LayoutChangeHint hint)
|
||||
{
|
||||
AZ_UNUSED(parents);
|
||||
AZ_UNUSED(hint);
|
||||
|
||||
scrollToTop();
|
||||
}
|
||||
void AssetBrowserTableView::SelectProduct(AZ::Data::AssetId assetID)
|
||||
void AssetBrowserTableView::SelectProduct([[maybe_unused]] AZ::Data::AssetId assetID)
|
||||
{
|
||||
AZ_UNUSED(assetID);
|
||||
}
|
||||
|
||||
void AssetBrowserTableView::SelectFileAtPath(const AZStd::string& assetPath)
|
||||
void AssetBrowserTableView::SelectFileAtPath([[maybe_unused]] const AZStd::string& assetPath)
|
||||
{
|
||||
AZ_UNUSED(assetPath);
|
||||
}
|
||||
|
||||
void AssetBrowserTableView::ClearFilter()
|
||||
@@ -142,11 +149,10 @@ namespace AzToolsFramework
|
||||
{
|
||||
}
|
||||
|
||||
void AssetBrowserTableView::OnContextMenu(const QPoint& point)
|
||||
void AssetBrowserTableView::OnContextMenu([[maybe_unused]] const QPoint& point)
|
||||
{
|
||||
AZ_UNUSED(point);
|
||||
|
||||
auto selectedAssets = GetSelectedAssets();
|
||||
const auto& selectedAssets = GetSelectedAssets();
|
||||
if (selectedAssets.size() != 1)
|
||||
{
|
||||
return;
|
||||
|
||||
+11
@@ -1,3 +1,14 @@
|
||||
/*
|
||||
* 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
|
||||
#if !defined(Q_MOC_RUN)
|
||||
#include <AzCore/Asset/AssetCommon.h>
|
||||
|
||||
Reference in New Issue
Block a user