Basic classes and window layout

This commit is contained in:
Alexey 2025-06-27 14:11:44 +03:00
commit a9c7952f5c
10 changed files with 706 additions and 0 deletions

34
gridpreview.cpp Normal file
View file

@ -0,0 +1,34 @@
#include "gridpreview.h"
GridPreview::GridPreview(QWidget *parent)
: QWidget{parent}
{}
void GridPreview::setSize(int newWidth, int newHeight)
{
width = newWidth;
height = newHeight;
}
void GridPreview::addLine(Line &line)
{
lines.push_back(line);
}
void GridPreview::removeLine(int index)
{
lines.removeAt(index);
}
QString GridPreview::toLuaTable()
{
QString output(tableTemplate.arg(width).arg(height));
QString linesSubTable = "";
for(auto iter = lines.begin(); iter != lines.end(); iter++ )
{
linesSubTable += QString(" %1,\n").arg(iter->toLuaTable());
}
linesSubTable.removeLast(); // \n
linesSubTable.removeLast(); // ,
return output.arg(linesSubTable);
}