diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/widgets/kernel/qwidget.cpp | 16 | ||||
-rw-r--r-- | src/widgets/kernel/qwidget_p.h | 2 |
2 files changed, 4 insertions, 14 deletions
diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp index 78a8af62df..aa93ee6be2 100644 --- a/src/widgets/kernel/qwidget.cpp +++ b/src/widgets/kernel/qwidget.cpp @@ -1824,9 +1824,6 @@ void QWidgetPrivate::createExtra() #if QT_CONFIG(graphicsview) extra->proxyWidget = 0; #endif -#ifndef QT_NO_CURSOR - extra->curs = 0; -#endif extra->minw = 0; extra->minh = 0; extra->maxw = QWIDGETSIZE_MAX; @@ -1860,9 +1857,6 @@ void QWidgetPrivate::createSysExtra() void QWidgetPrivate::deleteExtra() { if (extra) { // if exists -#ifndef QT_NO_CURSOR - delete extra->curs; -#endif deleteSysExtra(); #ifndef QT_NO_STYLE_STYLESHEET // dereference the stylesheet style @@ -5019,9 +5013,7 @@ void QWidget::setCursor(const QCursor &cursor) #endif { d->createExtra(); - QCursor *newCursor = new QCursor(cursor); - delete d->extra->curs; - d->extra->curs = newCursor; + d->extra->curs = qt_make_unique<QCursor>(cursor); } setAttribute(Qt::WA_SetCursor); d->setCursor_sys(cursor); @@ -5040,10 +5032,8 @@ void QWidgetPrivate::setCursor_sys(const QCursor &cursor) void QWidget::unsetCursor() { Q_D(QWidget); - if (d->extra) { - delete d->extra->curs; - d->extra->curs = 0; - } + if (d->extra) + d->extra->curs.reset(); if (!isWindow()) setAttribute(Qt::WA_SetCursor, false); d->unsetCursor_sys(); diff --git a/src/widgets/kernel/qwidget_p.h b/src/widgets/kernel/qwidget_p.h index b43489a98f..03b09f2ca8 100644 --- a/src/widgets/kernel/qwidget_p.h +++ b/src/widgets/kernel/qwidget_p.h @@ -244,7 +244,7 @@ struct QWExtra { QGraphicsProxyWidget *proxyWidget; // if the widget is embedded #endif #ifndef QT_NO_CURSOR - QCursor *curs; + std::unique_ptr<QCursor> curs; #endif QPointer<QStyle> style; QPointer<QWidget> focus_proxy; |