objectbrowser.h 971 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. /*
  2. * objectbrowser.h, part of VCMI engine
  3. *
  4. * Authors: listed in file AUTHORS in main folder
  5. *
  6. * License: GNU General Public License v2.0 or later
  7. * Full text of license available in license.txt file, in main folder
  8. *
  9. */
  10. #pragma once
  11. #include <QSortFilterProxyModel>
  12. #include "../lib/GameConstants.h"
  13. class ObjectBrowserProxyModel : public QSortFilterProxyModel
  14. {
  15. public:
  16. explicit ObjectBrowserProxyModel(QObject *parent = nullptr);
  17. Qt::ItemFlags flags(const QModelIndex &index) const override;
  18. QMimeData * mimeData(const QModelIndexList & indexes) const override;
  19. TerrainId terrain;
  20. QString filter;
  21. protected:
  22. bool filterAcceptsRow(int source_row, const QModelIndex & source_parent) const override;
  23. bool filterAcceptsRowText(int source_row, const QModelIndex &source_parent) const;
  24. };
  25. class ObjectBrowser : public QTreeView
  26. {
  27. public:
  28. ObjectBrowser(QWidget * parent);
  29. protected:
  30. void startDrag(Qt::DropActions supportedActions) override;
  31. };