Commit ff1e1f10 authored by Frederik Schwarzer's avatar Frederik Schwarzer

Do not use smart pointers here with QStatusBar.

QStatusBar reparents the QLabels handed over by the caller, so they are
deleted twice.
parent dffedc7a
......@@ -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();
}
......
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment