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:
parent
404bee752c
commit
fbb2ed1505
@ -55,6 +55,8 @@
|
|||||||
#include "imagedelegate.h"
|
#include "imagedelegate.h"
|
||||||
#include "mainwindow.h"
|
#include "mainwindow.h"
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
//! [40]
|
//! [40]
|
||||||
enum { OtherSize = QStyle::PM_CustomBase };
|
enum { OtherSize = QStyle::PM_CustomBase };
|
||||||
//! [40]
|
//! [40]
|
||||||
@ -514,8 +516,8 @@ void MainWindow::checkCurrentStyle()
|
|||||||
const QList<QAction *> actions = styleActionGroup->actions();
|
const QList<QAction *> actions = styleActionGroup->actions();
|
||||||
for (QAction *action : actions) {
|
for (QAction *action : actions) {
|
||||||
const QString styleName = action->data().toString();
|
const QString styleName = action->data().toString();
|
||||||
QScopedPointer<QStyle> candidate(QStyleFactory::create(styleName));
|
const std::unique_ptr<QStyle> candidate{QStyleFactory::create(styleName)};
|
||||||
Q_ASSERT(!candidate.isNull());
|
Q_ASSERT(candidate);
|
||||||
if (candidate->metaObject()->className()
|
if (candidate->metaObject()->className()
|
||||||
== QApplication::style()->metaObject()->className()) {
|
== QApplication::style()->metaObject()->className()) {
|
||||||
action->trigger();
|
action->trigger();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user