diff --git a/src/adventure/adventurewidget.cpp b/src/adventure/adventurewidget.cpp index e80fc5331..4b735ff72 100644 --- a/src/adventure/adventurewidget.cpp +++ b/src/adventure/adventurewidget.cpp @@ -15,7 +15,7 @@ AdventureWidget::AdventureWidget(AdventureTracker &at, QWidget *const parent) , m_adventureTracker{at} { m_textEdit = new QTextEdit(this); - m_textCursor = new QTextCursor(m_textEdit->document()); + m_textCursor = std::make_unique(m_textEdit->document()); m_textEdit->setReadOnly(true); m_textEdit->setOverwriteMode(true); @@ -32,9 +32,11 @@ AdventureWidget::AdventureWidget(AdventureTracker &at, QWidget *const parent) QTextCharFormat blockCharFormat = m_textCursor->blockCharFormat(); blockCharFormat.setForeground(settings.foregroundColor); - auto font = new QFont(); - font->fromString(settings.font); // need fromString() to extract PointSize - blockCharFormat.setFont(*font); + { + QFont font; + font.fromString(settings.font); // need fromString() to extract PointSize + blockCharFormat.setFont(font); + } m_textCursor->setBlockCharFormat(blockCharFormat); auto layout = new QVBoxLayout(this); @@ -45,7 +47,7 @@ AdventureWidget::AdventureWidget(AdventureTracker &at, QWidget *const parent) addDefaultContent(); - m_clearContentAction = new QAction("Clear Content"); + m_clearContentAction = new QAction("Clear Content", this); connect(m_clearContentAction, &QAction::triggered, this, diff --git a/src/adventure/adventurewidget.h b/src/adventure/adventurewidget.h index 1fc96d64e..9a5087dc6 100644 --- a/src/adventure/adventurewidget.h +++ b/src/adventure/adventurewidget.h @@ -48,6 +48,6 @@ private slots: AdventureTracker &m_adventureTracker; QTextEdit *m_textEdit = nullptr; - QTextCursor *m_textCursor = nullptr; + std::unique_ptr m_textCursor; QAction *m_clearContentAction = nullptr; }; diff --git a/src/display/prespammedpath.cpp b/src/display/prespammedpath.cpp index 7f935b65e..71ac88e58 100644 --- a/src/display/prespammedpath.cpp +++ b/src/display/prespammedpath.cpp @@ -17,8 +17,8 @@ static constexpr const bool USE_TEST = true; static constexpr const bool USE_TEST = false; #endif -PrespammedPath::PrespammedPath(QObject * /*unused*/) -// REVISIT: why isn't the parent passed to the base class? +PrespammedPath::PrespammedPath(QObject *parent) + : QObject(parent) { if (USE_TEST) { m_queue.append(CommandEnum::DOWN);