Skip to content

Commit e4dabe5

Browse files
committedDec 4, 2017
Don't leak memory in bookmarks delegate
1 parent 57dc9de commit e4dabe5

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed
 

‎src/app/qgsbookmarks.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ QgsBookmarks::QgsBookmarks( QWidget *parent )
109109
mProxyModel->setSourceModel( mModel );
110110

111111
lstBookmarks->setModel( mProxyModel );
112-
lstBookmarks->setItemDelegate( new QgsDoubleSpinBoxBookmarksDelegate );
112+
lstBookmarks->setItemDelegate( new QgsDoubleSpinBoxBookmarksDelegate( this ) );
113113

114114
connect( mModel, &QgsMergedBookmarksTableModel::layoutChanged, mProxyModel, &QgsBookmarksProxyModel::_resetModel );
115115

@@ -760,6 +760,12 @@ QVariant QgsBookmarksProxyModel::headerData( int section, Qt::Orientation orient
760760
return sourceModel()->headerData( section, orientation, role );
761761
}
762762

763+
QgsDoubleSpinBoxBookmarksDelegate::QgsDoubleSpinBoxBookmarksDelegate( QObject *parent )
764+
: QStyledItemDelegate( parent )
765+
{
766+
767+
}
768+
763769
QString QgsDoubleSpinBoxBookmarksDelegate::displayText( const QVariant &value, const QLocale &locale ) const
764770
{
765771
if ( value.userType() == QVariant::Double )

‎src/app/qgsbookmarks.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,8 @@ class QgsDoubleSpinBoxBookmarksDelegate : public QStyledItemDelegate
8282

8383
public:
8484

85+
explicit QgsDoubleSpinBoxBookmarksDelegate( QObject *parent = nullptr );
86+
8587
QString displayText( const QVariant &value, const QLocale &locale ) const override;
8688

8789
QWidget *createEditor( QWidget *parent,

0 commit comments

Comments
 (0)
Please sign in to comment.