Buttons functionality
This commit is contained in:
parent
67e63561c4
commit
6b2dacb28f
4 changed files with 50 additions and 0 deletions
|
|
@ -90,3 +90,35 @@ bool MainWindow::isSelectedLineCorrect(int line)
|
|||
return line >= 0 && line < size && size > 0;
|
||||
}
|
||||
|
||||
|
||||
void MainWindow::on_buttonSave_clicked()
|
||||
{
|
||||
QString fileName = QFileDialog::getSaveFileName(this, QString("Save grid"), ".", "Lua source code (*.lua)");
|
||||
QFile file(fileName);
|
||||
if (!file.open(QIODevice::WriteOnly | QIODevice::Text))
|
||||
return;
|
||||
|
||||
QTextStream out(&file);
|
||||
out << ui->gridPreview->toLuaTable();
|
||||
}
|
||||
|
||||
|
||||
void MainWindow::on_buttonClear_clicked()
|
||||
{
|
||||
ui->gridPreview->clear();
|
||||
}
|
||||
|
||||
|
||||
void MainWindow::on_buttonDeleteLine_clicked()
|
||||
{
|
||||
int selected = ui->listLines->currentRow();
|
||||
|
||||
if (!isSelectedLineCorrect(selected))
|
||||
return;
|
||||
|
||||
ui->gridPreview->getCapturedProbe().ownerIndex = -1;
|
||||
ui->gridPreview->removeLine(selected);
|
||||
|
||||
ui->listLines->clearSelection();
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue