Add count property to ImageResolutionModel and VideoResolutionModel
authorMohammed Sameer <msameer@foolab.org>
Sun, 7 Apr 2013 17:35:08 +0000 (20:35 +0300)
committerMohammed Sameer <msameer@foolab.org>
Fri, 2 Aug 2013 21:09:43 +0000 (00:09 +0300)
Conflicts:
declarative/imageresolutionmodel.cpp
declarative/videoresolutionmodel.cpp

declarative/imageresolutionmodel.cpp
declarative/imageresolutionmodel.h
declarative/videoresolutionmodel.cpp
declarative/videoresolutionmodel.h

index 2d9ad14..54f8043 100644 (file)
@@ -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<int, QByteArray> ImageResolutionModel::roleNames() const {
   return m_roles;
index dcc7b8b..4db3c94 100644 (file)
@@ -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;
index 9741bb2..1cd0981 100644 (file)
@@ -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<int, QByteArray> VideoResolutionModel::roleNames() const {
   return m_roles;
index 9d25967..96d7596 100644 (file)
@@ -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;