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