#pragma once #include #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 ModulesConfig* modules); void clear(); // Shows an empty placeholder box (no ship layout) so the preview stays // visible while no schematic is selected (REQ-MOD-UI-PREVIEW). void showPlaceholder(); protected: void paintEvent(QPaintEvent* event) override; private: struct CellInfo { bool buildable; std::optional moduleIndex; // nullopt if empty }; std::vector> m_grid; std::vector m_placedModules; const ModulesConfig* m_modules; int m_rows; int m_cols; bool m_placeholder = false; };