diff options
author | VaL Doroshchuk <valentyn.doroshchuk@qt.io> | 2017-09-14 09:56:30 +0200 |
---|---|---|
committer | VaL Doroshchuk <valentyn.doroshchuk@qt.io> | 2017-09-28 14:00:26 +0000 |
commit | 62d72daf70fed1d7fa1c38bd52468b6536ec6cad (patch) | |
tree | 867428c277ac8cc0fcfa5c15003d6ad5b43f03cd /examples/multimediawidgets/player/playlistmodel.h | |
parent | 61b0771e832cad41c726995aafd7bea705909bdd (diff) |
Modernize the Player example
Fixed memory leak.
Renamed members, avoided passing args by copy.
Changed the style of member initialization.
Changed 0 to nullptr.
Changed to new signal/slot style if possible.
Removed Q_WS_SIMULATOR ifdef.
Changed signal/slot connection style.
Task-number: QTBUG-60627
Change-Id: I85bd6e56fe87f4e17f3c9964d6d1fdcb8202c519
Reviewed-by: Christian Stromme <christian.stromme@qt.io>
Diffstat (limited to 'examples/multimediawidgets/player/playlistmodel.h')
-rw-r--r-- | examples/multimediawidgets/player/playlistmodel.h | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/examples/multimediawidgets/player/playlistmodel.h b/examples/multimediawidgets/player/playlistmodel.h index 960943f1c..827312d9f 100644 --- a/examples/multimediawidgets/player/playlistmodel.h +++ b/examples/multimediawidgets/player/playlistmodel.h @@ -42,6 +42,7 @@ #define PLAYLISTMODEL_H #include <QAbstractItemModel> +#include <QScopedPointer> QT_BEGIN_NAMESPACE class QMediaPlaylist; @@ -58,7 +59,8 @@ public: ColumnCount }; - PlaylistModel(QObject *parent = 0); + explicit PlaylistModel(QObject *parent = nullptr); + ~PlaylistModel(); int rowCount(const QModelIndex &parent = QModelIndex()) const override; int columnCount(const QModelIndex &parent = QModelIndex()) const override; @@ -81,7 +83,7 @@ private slots: void changeItems(int start, int end); private: - QMediaPlaylist *m_playlist; + QScopedPointer<QMediaPlaylist> m_playlist; QMap<QModelIndex, QVariant> m_data; }; |