QWidget: replace manual memory management with unique_ptr [4/N]: extra->curs
Change-Id: Id65ead5563321b8edbe0055ad1531c2442d4d597 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>bb10
parent
19ccbdabfe
commit
45c5cc6199
|
|
@ -1823,9 +1823,6 @@ void QWidgetPrivate::createExtra()
|
|||
extra->topextra = 0;
|
||||
#if QT_CONFIG(graphicsview)
|
||||
extra->proxyWidget = 0;
|
||||
#endif
|
||||
#ifndef QT_NO_CURSOR
|
||||
extra->curs = 0;
|
||||
#endif
|
||||
extra->minw = 0;
|
||||
extra->minh = 0;
|
||||
|
|
@ -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();
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Reference in New Issue