diff options
Diffstat (limited to 'SQLiteStudio3/guiSQLiteStudio/dialogs/fileexecerrorsdialog.cpp')
| -rw-r--r-- | SQLiteStudio3/guiSQLiteStudio/dialogs/fileexecerrorsdialog.cpp | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/SQLiteStudio3/guiSQLiteStudio/dialogs/fileexecerrorsdialog.cpp b/SQLiteStudio3/guiSQLiteStudio/dialogs/fileexecerrorsdialog.cpp new file mode 100644 index 0000000..916c8af --- /dev/null +++ b/SQLiteStudio3/guiSQLiteStudio/dialogs/fileexecerrorsdialog.cpp @@ -0,0 +1,35 @@ +#include "fileexecerrorsdialog.h" +#include "ui_fileexecerrorsdialog.h" + +FileExecErrorsDialog::FileExecErrorsDialog(const QList<QPair<QString, QString>>& errors, bool rolledBack, QWidget *parent) : + QDialog(parent), + ui(new Ui::FileExecErrorsDialog) +{ + ui->setupUi(this); + + ui->committedLabel->setVisible(!rolledBack); + ui->rolledBackLabel->setVisible(rolledBack); + + ui->tableWidget->setRowCount(errors.size()); + int row = 0; + for (const QPair<QString, QString>& err : errors) + { + ui->tableWidget->setItem(row, 0, item(err.first)); + ui->tableWidget->setItem(row, 1, item(err.second)); + row++; + } + ui->tableWidget->horizontalHeader()->setSectionResizeMode(0, QHeaderView::Stretch); + ui->tableWidget->resizeRowsToContents(); +} + +FileExecErrorsDialog::~FileExecErrorsDialog() +{ + delete ui; +} + +QTableWidgetItem* FileExecErrorsDialog::item(const QString& text) +{ + QTableWidgetItem* item = new QTableWidgetItem(text); + item->setFlags(Qt::ItemIsEnabled); + return item; +} |
