Basic classes and window layout
This commit is contained in:
commit
a9c7952f5c
10 changed files with 706 additions and 0 deletions
34
gridpreview.cpp
Normal file
34
gridpreview.cpp
Normal 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);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue