Icons example: use std::unique_ptr instead of QScopedPointer

There's talk that QScopedPointer may be deprecated. Don't use it
in examples anymore.

Change-Id: Ia50ef66de84dae2885f71a9dd83c5909bfa253f0
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
This commit is contained in:
Marc Mutz 2019-05-14 20:42:01 +02:00
parent 404bee752c
commit fbb2ed1505

View File

@ -55,6 +55,8 @@
#include "imagedelegate.h"
#include "mainwindow.h"
#include <memory>
//! [40]
enum { OtherSize = QStyle::PM_CustomBase };
//! [40]
@ -514,8 +516,8 @@ void MainWindow::checkCurrentStyle()
const QList<QAction *> actions = styleActionGroup->actions();
for (QAction *action : actions) {
const QString styleName = action->data().toString();
QScopedPointer<QStyle> candidate(QStyleFactory::create(styleName));
Q_ASSERT(!candidate.isNull());
const std::unique_ptr<QStyle> candidate{QStyleFactory::create(styleName)};
Q_ASSERT(candidate);
if (candidate->metaObject()->className()
== QApplication::style()->metaObject()->className()) {
action->trigger();