mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Import: Make DiveLogImportDialog modal
By making this modal, we can use a local variable and remove the nasty "deleteLater()" hack to reclaim the resources after the dialog closes. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
3f51849dc3
commit
5a78730561
3 changed files with 2 additions and 20 deletions
|
@ -1010,22 +1010,6 @@ void DiveLogImportDialog::on_buttonBox_accepted()
|
||||||
MainWindow::instance()->refreshDisplay();
|
MainWindow::instance()->refreshDisplay();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Since this is a non-modal dialog, the caller can't delete it at the call-site.
|
|
||||||
// Therefore, hook into the accept() and reject() functions and schedule the object
|
|
||||||
// for deletion with deleteLater(). Horrible, but absolutely the "Qt-way".
|
|
||||||
// TODO: Think about making the dialog modal.
|
|
||||||
void DiveLogImportDialog::accept()
|
|
||||||
{
|
|
||||||
QDialog::accept();
|
|
||||||
deleteLater();
|
|
||||||
}
|
|
||||||
|
|
||||||
void DiveLogImportDialog::reject()
|
|
||||||
{
|
|
||||||
QDialog::reject();
|
|
||||||
deleteLater();
|
|
||||||
}
|
|
||||||
|
|
||||||
TagDragDelegate::TagDragDelegate(QObject *parent) : QStyledItemDelegate(parent)
|
TagDragDelegate::TagDragDelegate(QObject *parent) : QStyledItemDelegate(parent)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
|
@ -89,8 +89,6 @@ slots:
|
||||||
void loadFileContents(int value, enum whatChanged triggeredBy);
|
void loadFileContents(int value, enum whatChanged triggeredBy);
|
||||||
int setup_csv_params(QStringList r, char **params, int pnr);
|
int setup_csv_params(QStringList r, char **params, int pnr);
|
||||||
int parseTxtHeader(QString fileName, char **params, int pnr);
|
int parseTxtHeader(QString fileName, char **params, int pnr);
|
||||||
void accept() override;
|
|
||||||
void reject() override;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool selector;
|
bool selector;
|
||||||
|
|
|
@ -1811,8 +1811,8 @@ void MainWindow::on_actionImportDiveLog_triggered()
|
||||||
}
|
}
|
||||||
|
|
||||||
if (csvFiles.size()) {
|
if (csvFiles.size()) {
|
||||||
DiveLogImportDialog *diveLogImport = new DiveLogImportDialog(csvFiles, this);
|
DiveLogImportDialog diveLogImport(csvFiles, this);
|
||||||
diveLogImport->show();
|
diveLogImport.exec();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue