Files
o3de/Code/Editor/LevelTreeModel.h
T
Steve Pham b4a2edec6a Final update copyright headers to reference license files at the repo root (#1693)
* Final update copyright headers to reference license files at the repo root

Signed-off-by: spham <spham@amazon.com>

* Fix copyright validator unit tests to support the stale O3DE header scenario

Signed-off-by: spham <spham@amazon.com>
2021-06-30 19:51:55 -07:00

53 lines
1.4 KiB
C++

/*
* 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 CRYINCLUDE_EDITOR_LEVEL_ITEM_MODEL_H
#define CRYINCLUDE_EDITOR_LEVEL_ITEM_MODEL_H
#pragma once
#if !defined(Q_MOC_RUN)
#include <QStandardItemModel>
#include <QSortFilterProxyModel>
#endif
class QString;
class QStandardItem;
class LevelTreeModelFilter
: public QSortFilterProxyModel
{
Q_OBJECT
public:
explicit LevelTreeModelFilter(QObject* parent = nullptr);
bool filterAcceptsRow(int source_row, const QModelIndex& source_parent) const;
void setFilterText(const QString&);
QVariant data(const QModelIndex& index, int role) const override;
private:
QString m_filterText;
};
class LevelTreeModel
: public QStandardItemModel
{
Q_OBJECT
public:
enum Role
{
FullPathRole = Qt::UserRole + 1,
IsLevelFolderRole
};
explicit LevelTreeModel(QObject* parent = nullptr);
~LevelTreeModel();
void ReloadTree(bool recurseIfNoLevels);
void AddItem(const QString& name, const QModelIndex& parent); // Called when clicking "New folder"
QVariant data(const QModelIndex& index, int role) const override;
private:
void ReloadTree(QStandardItem* root, bool recurseIfNoLevels);
};
#endif