Part: [skip ci] cppcoreguidelines-prefer-member-initializer / cppcoreguidelines-owning-memory

This commit is contained in:
wmayer
2022-09-26 08:05:54 +02:00
parent 6f74903c3d
commit cbc5cf8ee0
2 changed files with 6 additions and 5 deletions

View File

@@ -42,9 +42,11 @@ using namespace Gui::Dialog;
* true to construct a modal dialog.
*/
DlgRunExternal::DlgRunExternal( QWidget* parent, Qt::WindowFlags fl )
: QDialog(parent, fl),process(this),advancedHidden(true)
: QDialog(parent, fl)
, process(this)
, advancedHidden(true)
, ui(new Ui_DlgRunExternal)
{
ui = new Ui_DlgRunExternal();
ui->setupUi(this);
connect(ui->chooseProgram, &QPushButton::clicked, this, &DlgRunExternal::onChooseProgramClicked);
connect(&process, qOverload<int, QProcess::ExitStatus>(&QProcess::finished),
@@ -63,8 +65,6 @@ DlgRunExternal::DlgRunExternal( QWidget* parent, Qt::WindowFlags fl )
*/
DlgRunExternal::~DlgRunExternal()
{
// no need to delete child widgets, Qt does it all for us
delete ui;
}
void DlgRunExternal::addArgument(const QString& arg)

View File

@@ -23,6 +23,7 @@
#ifndef GUI_DIALOG_DlgRunExternal_H
#define GUI_DIALOG_DlgRunExternal_H
#include <memory>
#include <QDialog>
#include <QProcess>
#include <FCGlobal.h>
@@ -60,7 +61,7 @@ private:
QStringList arguments;
QProcess process;
bool advancedHidden;
Ui_DlgRunExternal* ui;
std::unique_ptr<Ui_DlgRunExternal> ui;
};
} // namespace Dialog