1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-01-22 04:53:52 +00:00
openmw/apps/opencs/view/world/regionmap.hpp

96 lines
2.1 KiB
C++
Raw Normal View History

#ifndef CSV_WORLD_REGIONMAP_H
#define CSV_WORLD_REGIONMAP_H
2022-10-19 17:02:00 +00:00
#include <QModelIndexList>
#include <string>
#include <vector>
#include "./dragrecordtable.hpp"
class QAction;
2022-10-19 17:02:00 +00:00
class QContextMenuEvent;
class QDropEvent;
class QMouseEvent;
class QObject;
class QWidget;
namespace CSMDoc
{
class Document;
}
namespace CSMWorld
{
class UniversalId;
}
namespace CSVWorld
{
class RegionMap : public DragRecordTable
{
2022-09-22 18:26:05 +00:00
Q_OBJECT
2022-09-22 18:26:05 +00:00
QAction* mSelectAllAction;
QAction* mClearSelectionAction;
QAction* mSelectRegionsAction;
QAction* mCreateCellsAction;
QAction* mSetRegionAction;
QAction* mUnsetRegionAction;
QAction* mViewAction;
QAction* mViewInTableAction;
std::string mRegionId;
2022-09-22 18:26:05 +00:00
private:
void contextMenuEvent(QContextMenuEvent* event) override;
2022-09-22 18:26:05 +00:00
QModelIndexList getUnselectedCells() const;
///< \note Non-existent cells are not listed.
2022-09-22 18:26:05 +00:00
QModelIndexList getSelectedCells(bool existent = true, bool nonExistent = false) const;
///< \param existent Include existent cells.
/// \param nonExistent Include non-existent cells.
2022-09-22 18:26:05 +00:00
QModelIndexList getMissingRegionCells() const;
///< Unselected cells within all regions that have at least one selected cell.
2022-09-22 18:26:05 +00:00
void setRegion(const std::string& regionId);
///< Set region Id of selected cells.
2022-09-22 18:26:05 +00:00
void mouseMoveEvent(QMouseEvent* event) override;
void dragMoveEvent(QDragMoveEvent* event) override;
2022-09-22 18:26:05 +00:00
void dropEvent(QDropEvent* event) override;
2022-09-22 18:26:05 +00:00
public:
RegionMap(const CSMWorld::UniversalId& universalId, CSMDoc::Document& document, QWidget* parent = nullptr);
2022-09-22 18:26:05 +00:00
std::vector<CSMWorld::UniversalId> getDraggedRecords() const override;
2022-09-22 18:26:05 +00:00
signals:
2022-09-22 18:26:05 +00:00
void editRequest(const CSMWorld::UniversalId& id, const std::string& hint);
2022-09-22 18:26:05 +00:00
private slots:
2014-04-13 13:46:31 +00:00
2022-09-22 18:26:05 +00:00
void selectAll() override;
2014-04-13 13:46:31 +00:00
2022-09-22 18:26:05 +00:00
void clearSelection();
2022-09-22 18:26:05 +00:00
void selectRegions();
2022-09-22 18:26:05 +00:00
void createCells();
2022-09-22 18:26:05 +00:00
void setRegion();
2022-09-22 18:26:05 +00:00
void unsetRegion();
2022-09-22 18:26:05 +00:00
void view();
2022-09-22 18:26:05 +00:00
void viewInTable();
};
}
#endif