2022-10-12 23:51:55 +02:00
|
|
|
/*
|
|
|
|
* objectbrowser.h, part of VCMI engine
|
|
|
|
*
|
|
|
|
* Authors: listed in file AUTHORS in main folder
|
|
|
|
*
|
|
|
|
* License: GNU General Public License v2.0 or later
|
|
|
|
* Full text of license available in license.txt file, in main folder
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2022-09-24 22:55:05 +02:00
|
|
|
#pragma once
|
2022-09-18 01:23:17 +02:00
|
|
|
|
|
|
|
#include <QSortFilterProxyModel>
|
2023-01-09 01:17:37 +02:00
|
|
|
#include "../lib/GameConstants.h"
|
2022-09-18 01:23:17 +02:00
|
|
|
|
2022-12-04 04:45:39 +02:00
|
|
|
class ObjectBrowserProxyModel : public QSortFilterProxyModel
|
2022-09-18 01:23:17 +02:00
|
|
|
{
|
|
|
|
public:
|
2022-12-04 04:45:39 +02:00
|
|
|
explicit ObjectBrowserProxyModel(QObject *parent = nullptr);
|
|
|
|
|
|
|
|
Qt::ItemFlags flags(const QModelIndex &index) const override;
|
2022-12-21 02:28:56 +02:00
|
|
|
|
2022-12-04 04:45:39 +02:00
|
|
|
QMimeData * mimeData(const QModelIndexList & indexes) const override;
|
2022-09-18 01:23:17 +02:00
|
|
|
|
2022-10-08 21:54:45 +02:00
|
|
|
TerrainId terrain;
|
2022-09-18 01:23:17 +02:00
|
|
|
QString filter;
|
|
|
|
|
|
|
|
protected:
|
|
|
|
bool filterAcceptsRow(int source_row, const QModelIndex & source_parent) const override;
|
|
|
|
bool filterAcceptsRowText(int source_row, const QModelIndex &source_parent) const;
|
|
|
|
};
|
2022-12-04 04:45:39 +02:00
|
|
|
|
|
|
|
class ObjectBrowser : public QTreeView
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
ObjectBrowser(QWidget * parent);
|
2022-12-04 12:51:01 +02:00
|
|
|
|
|
|
|
protected:
|
|
|
|
void startDrag(Qt::DropActions supportedActions) override;
|
2022-12-04 04:45:39 +02:00
|
|
|
};
|