more work on smart pointer transition of PTextEdit.

This commit is contained in:
suter_a 2023-10-22 09:31:22 +02:00
parent 9c2e981e2a
commit 7743eaee09
2 changed files with 10 additions and 8 deletions

View File

@ -117,7 +117,7 @@ PTextEdit::PTextEdit( QWidget *parent )
}
// initialize stuff
fMusrT0Action = nullptr;
//as35 fMusrT0Action = nullptr;
fMsr2DataParam = nullptr;
fFindReplaceData = nullptr;
@ -164,10 +164,12 @@ PTextEdit::PTextEdit( QWidget *parent )
*/
void PTextEdit::aboutToQuit()
{
/* //as35
if (fMusrT0Action) {
delete fMusrT0Action;
fMusrT0Action = nullptr;
}
*/ //as35
if (fMsr2DataParam) {
delete fMsr2DataParam;
fMsr2DataParam = nullptr;
@ -863,19 +865,19 @@ void PTextEdit::setupMusrActions()
iconName = QString(":/icons/musrt0-dark.svg");
else
iconName = QString(":/icons/musrt0-plain.svg");
fMusrT0Action = new QAction( QIcon( QPixmap(iconName) ), tr( "&T0" ), this );
fMusrT0Action = std::make_unique<QAction>( QIcon( QPixmap(iconName) ), tr( "&T0" ), this );
fMusrT0Action->setStatusTip( tr("Start musrt0") );
connect( fMusrT0Action, SIGNAL( triggered() ), this, SLOT( musrT0() ) );
menu->addAction(fMusrT0Action);
fActions["musrt0"] = fMusrT0Action;
connect( fMusrT0Action.get(), SIGNAL( triggered() ), this, SLOT( musrT0() ) );
menu->addAction(fMusrT0Action.get());
fActions["musrt0"] = fMusrT0Action.get();
if (!fDarkToolBarIcon) { // tool bar icon is not dark, even though the theme is (ubuntu)
iconName = QString(":/icons/musrt0-plain.svg");
a = new QAction( QIcon( QPixmap(iconName) ), tr( "&T0" ), this );
connect( a, SIGNAL( triggered() ), this, SLOT( musrT0() ) );
}
tb->addAction(fMusrT0Action);
tb->addAction(fMusrT0Action.get());
fMusrT0Action->setEnabled(fAdmin->getEnableMusrT0Flag());
fActions["musrt0-tb"] = fMusrT0Action;
fActions["musrt0-tb"] = fMusrT0Action.get();
// musrFT
if (fDarkMenuIcon)

View File

@ -180,7 +180,7 @@ private:
int fEditW, fEditH;
QMap<QString, QAction*> fActions;
QAction *fMusrT0Action;
std::unique_ptr<QAction> fMusrT0Action;
PMsr2DataParam *fMsr2DataParam; ///< structure holding the necessary input information for msr2data
PFindReplaceData *fFindReplaceData; ///< structure holding the ncessary input for find/replace