summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrederik Schwarzer <[email protected]>2016-05-23 20:07:43 +0200
committerFrederik Schwarzer <[email protected]>2016-05-23 20:07:43 +0200
commitff1e1f10b14b1db2526c2d4e5ccf2788966e883f (patch)
tree3452358994af3f6d7b4127bd335bd4c6d864814f
parentdffedc7acd0146af6c7c301dee7ca6b1a91e7746 (diff)
Do not use smart pointers here with QStatusBar.
QStatusBar reparents the QLabels handed over by the caller, so they are deleted twice.
-rw-r--r--src/app.cpp16
-rw-r--r--src/app.h8
2 files changed, 12 insertions, 12 deletions
diff --git a/src/app.cpp b/src/app.cpp
index 6b61fb4..499c186 100644
--- a/src/app.cpp
+++ b/src/app.cpp
@@ -96,17 +96,17 @@ App::App(QWidget * parent)
void App::setupStatusBar()
{
- m_gameTipLabel = std::make_unique<QLabel>(i18n("Select a tile"), statusBar());
- statusBar()->addWidget(m_gameTipLabel.get(), 1);
+ m_gameTipLabel = new QLabel(i18n("Select a tile"), statusBar());
+ statusBar()->addWidget(m_gameTipLabel, 1);
- m_gameTimerLabel = std::make_unique<QLabel>(i18n("Time: 0:00:00"), statusBar());
- statusBar()->addWidget(m_gameTimerLabel.get());
+ m_gameTimerLabel = new QLabel(i18n("Time: 0:00:00"), statusBar());
+ statusBar()->addWidget(m_gameTimerLabel);
- m_gameTilesLabel = std::make_unique<QLabel>(i18n("Removed: 0/0"), statusBar());
- statusBar()->addWidget(m_gameTilesLabel.get());
+ m_gameTilesLabel = new QLabel(i18n("Removed: 0/0"), statusBar());
+ statusBar()->addWidget(m_gameTilesLabel);
- m_gameCheatLabel = std::make_unique<QLabel>(i18n("Cheat mode"), statusBar());
- statusBar()->addWidget(m_gameCheatLabel.get());
+ m_gameCheatLabel = new QLabel(i18n("Cheat mode"), statusBar());
+ statusBar()->addWidget(m_gameCheatLabel);
m_gameCheatLabel->hide();
}
diff --git a/src/app.h b/src/app.h
index 8ab7ec9..664c52c 100644
--- a/src/app.h
+++ b/src/app.h
@@ -139,10 +139,10 @@ private:
void setCheatModeEnabled(bool enabled);
private:
- std::unique_ptr<QLabel> m_gameTipLabel; ///< Status bar area for game tips
- std::unique_ptr<QLabel> m_gameTimerLabel; ///< Status bar area for the timer
- std::unique_ptr<QLabel> m_gameTilesLabel; ///< Status bar area for the tile counter
- std::unique_ptr<QLabel> m_gameCheatLabel; ///< Status bar area for the cheat mode
+ QLabel * m_gameTipLabel; ///< Status bar area for game tips
+ QLabel * m_gameTimerLabel; ///< Status bar area for the timer
+ QLabel * m_gameTilesLabel; ///< Status bar area for the tile counter
+ QLabel * m_gameCheatLabel; ///< Status bar area for the cheat mode
Board * m_board; ///< Holds the game board
};
} // namespace KShisen