Skip to content

Commit

Permalink
Don't leak memory in bookmarks delegate
Browse files Browse the repository at this point in the history
  • Loading branch information
elpaso committed Dec 4, 2017
1 parent 57dc9de commit e4dabe5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/app/qgsbookmarks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ QgsBookmarks::QgsBookmarks( QWidget *parent )
mProxyModel->setSourceModel( mModel );

lstBookmarks->setModel( mProxyModel );
lstBookmarks->setItemDelegate( new QgsDoubleSpinBoxBookmarksDelegate );
lstBookmarks->setItemDelegate( new QgsDoubleSpinBoxBookmarksDelegate( this ) );

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

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

QgsDoubleSpinBoxBookmarksDelegate::QgsDoubleSpinBoxBookmarksDelegate( QObject *parent )
: QStyledItemDelegate( parent )
{

}

QString QgsDoubleSpinBoxBookmarksDelegate::displayText( const QVariant &value, const QLocale &locale ) const
{
if ( value.userType() == QVariant::Double )
Expand Down
2 changes: 2 additions & 0 deletions src/app/qgsbookmarks.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ class QgsDoubleSpinBoxBookmarksDelegate : public QStyledItemDelegate

public:

explicit QgsDoubleSpinBoxBookmarksDelegate( QObject *parent = nullptr );

QString displayText( const QVariant &value, const QLocale &locale ) const override;

QWidget *createEditor( QWidget *parent,
Expand Down

0 comments on commit e4dabe5

Please sign in to comment.