Fixing Header Data in AssetBrowserTableModel

This commit is contained in:
igarri
2021-06-10 15:14:35 +01:00
parent be21e585a0
commit 5a53c074c2
3 changed files with 222 additions and 216 deletions
@@ -46,16 +46,7 @@ namespace AzToolsFramework
{
if (role == Qt::DisplayRole && orientation == Qt::Horizontal)
{
auto columnRole = aznumeric_cast<AssetBrowserEntry::Column>(role);
switch (columnRole)
{
case AssetBrowserEntry::Column::Name:
return tr("Name");
case AssetBrowserEntry::Column::Path:
return tr("Path");
default:
return QString::number(section);
}
return tr(AssetBrowserEntry::m_columnNames[section]);
}
return QSortFilterProxyModel::headerData(section, orientation, role);
}
@@ -38,8 +38,10 @@ namespace AzToolsFramework
QModelIndex mapToSource(const QModelIndex& proxyIndex) const override;
QModelIndex index(int row, int column, const QModelIndex& parent = QModelIndex()) const override;
QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override;
public Q_SLOTS:
void UpdateTableModelMaps();
protected:
int rowCount(const QModelIndex& parent = QModelIndex()) const override;
QVariant headerData(int section, Qt::Orientation orientation, int role /* = Qt::DisplayRole */) const override;
@@ -48,6 +50,7 @@ namespace AzToolsFramework
private:
AssetBrowserEntry* GetAssetEntry(QModelIndex index) const;
int BuildTableModelMap(const QAbstractItemModel* model, const QModelIndex& parent = QModelIndex(), int row = 0);
private:
QPointer<AssetBrowserFilterModel> m_filterModel;
QMap<int, QModelIndex> m_indexMap;