From 8b446fd852f3427efd37c5104207dafea1089934 Mon Sep 17 00:00:00 2001 From: Mohammed Sameer Date: Sun, 7 Apr 2013 20:35:08 +0300 Subject: [PATCH] Add count property to ImageResolutionModel and VideoResolutionModel Conflicts: declarative/imageresolutionmodel.cpp declarative/videoresolutionmodel.cpp --- declarative/imageresolutionmodel.cpp | 5 +++++ declarative/imageresolutionmodel.h | 4 ++++ declarative/videoresolutionmodel.cpp | 9 +++++++-- declarative/videoresolutionmodel.h | 4 ++++ 4 files changed, 20 insertions(+), 2 deletions(-) diff --git a/declarative/imageresolutionmodel.cpp b/declarative/imageresolutionmodel.cpp index 2d9ad14..54f8043 100644 --- a/declarative/imageresolutionmodel.cpp +++ b/declarative/imageresolutionmodel.cpp @@ -105,9 +105,14 @@ void ImageResolutionModel::setAspectRatio(const QString& aspectRatio) { endResetModel(); emit aspectRatioChanged(); + emit countChanged(); } } +int ImageResolutionModel::count() const { + return rowCount(); +} + #if defined(QT5) QHash ImageResolutionModel::roleNames() const { return m_roles; diff --git a/declarative/imageresolutionmodel.h b/declarative/imageresolutionmodel.h index dcc7b8b..4db3c94 100644 --- a/declarative/imageresolutionmodel.h +++ b/declarative/imageresolutionmodel.h @@ -32,6 +32,7 @@ class ImageResolutionModel : public QAbstractListModel { Q_OBJECT Q_PROPERTY(QString aspectRatio READ aspectRatio WRITE setAspectRatio NOTIFY aspectRatioChanged); + Q_PROPERTY(int count READ count NOTIFY countChanged); public: @@ -56,8 +57,11 @@ public: QString aspectRatio() const; void setAspectRatio(const QString& aspectRatio); + int count() const; + signals: void aspectRatioChanged(); + void countChanged(); private: QString m_aspectRatio; diff --git a/declarative/videoresolutionmodel.cpp b/declarative/videoresolutionmodel.cpp index 9741bb2..1cd0981 100644 --- a/declarative/videoresolutionmodel.cpp +++ b/declarative/videoresolutionmodel.cpp @@ -98,16 +98,21 @@ void VideoResolutionModel::setAspectRatio(const QString& aspectRatio) { m_aspectRatio = aspectRatio; - emit aspectRatioChanged(); - beginResetModel(); m_resolutions = m_settings->resolutions(m_aspectRatio); endResetModel(); + + emit aspectRatioChanged(); + emit countChanged(); } } +int VideoResolutionModel::count() const { + return rowCount(); +} + #if defined(QT5) QHash VideoResolutionModel::roleNames() const { return m_roles; diff --git a/declarative/videoresolutionmodel.h b/declarative/videoresolutionmodel.h index 9d25967..96d7596 100644 --- a/declarative/videoresolutionmodel.h +++ b/declarative/videoresolutionmodel.h @@ -32,6 +32,7 @@ class VideoResolutionModel : public QAbstractListModel { Q_OBJECT Q_PROPERTY(QString aspectRatio READ aspectRatio WRITE setAspectRatio NOTIFY aspectRatioChanged); + Q_PROPERTY(int count READ count NOTIFY countChanged); public: @@ -56,8 +57,11 @@ public: QString aspectRatio() const; void setAspectRatio(const QString& aspectRatio); + int count() const; + signals: void aspectRatioChanged(); + void countChanged(); private: QString m_aspectRatio; -- 2.25.1