Files
dota_factory/src/ui/ShipLayoutPreview.h
2026-05-18 08:54:26 +02:00

39 lines
804 B
C++

#pragma once
#include <string>
#include <vector>
#include <QWidget>
#include "ModulesConfig.h"
#include "ShipLayout.h"
class ShipLayoutPreview : public QWidget
{
Q_OBJECT
public:
explicit ShipLayoutPreview(QWidget* parent = nullptr);
void setShipAndLayout(const std::vector<std::string>& shipLayout,
const ShipLayoutConfig& layout,
const std::vector<ModuleDef>* modules);
void clear();
protected:
void paintEvent(QPaintEvent* event) override;
private:
struct CellInfo
{
bool buildable;
int moduleIndex; // -1 if empty
};
std::vector<std::vector<CellInfo>> m_grid;
std::vector<PlacedModule> m_placedModules;
const std::vector<ModuleDef>* m_modules;
int m_rows;
int m_cols;
};