[vlc-commits] qt: add 'count' property to PlayerControlbarModel
Fatih Uzunoglu
git at videolan.org
Mon Nov 16 10:04:11 CET 2020
vlc | branch: master | Fatih Uzunoglu <fuzun54 at outlook.com> | Fri Aug 14 16:09:26 2020 +0300| [5fc36e5b638dd5e94ce693cc17afb5ebb3a75289] | committer: Pierre Lamot
qt: add 'count' property to PlayerControlbarModel
Signed-off-by: Pierre Lamot <pierre at videolabs.io>
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=5fc36e5b638dd5e94ce693cc17afb5ebb3a75289
---
modules/gui/qt/player/playercontrolbarmodel.cpp | 4 ++++
modules/gui/qt/player/playercontrolbarmodel.hpp | 3 +++
2 files changed, 7 insertions(+)
diff --git a/modules/gui/qt/player/playercontrolbarmodel.cpp b/modules/gui/qt/player/playercontrolbarmodel.cpp
index cea05e97a4..a6a9e4eefc 100644
--- a/modules/gui/qt/player/playercontrolbarmodel.cpp
+++ b/modules/gui/qt/player/playercontrolbarmodel.cpp
@@ -74,6 +74,10 @@ static const QVector<PlayerControlBarModel::IconToolButton> MINI_TB_DEFAULT[defa
PlayerControlBarModel::PlayerControlBarModel(QObject *_parent) : QAbstractListModel(_parent)
{
configName = "MainPlayerToolbar";
+
+ connect(this, &QAbstractListModel::rowsInserted, this, &PlayerControlBarModel::countChanged);
+ connect(this, &QAbstractListModel::rowsRemoved, this, &PlayerControlBarModel::countChanged);
+ connect(this, &QAbstractListModel::modelReset, this, &PlayerControlBarModel::countChanged);
}
void PlayerControlBarModel::saveConfig()
diff --git a/modules/gui/qt/player/playercontrolbarmodel.hpp b/modules/gui/qt/player/playercontrolbarmodel.hpp
index 0d5e382767..43c85df938 100644
--- a/modules/gui/qt/player/playercontrolbarmodel.hpp
+++ b/modules/gui/qt/player/playercontrolbarmodel.hpp
@@ -29,6 +29,8 @@ class PlayerControlBarModel : public QAbstractListModel
Q_OBJECT
Q_PROPERTY(QmlMainContext* mainCtx READ getMainCtx WRITE setMainCtx NOTIFY ctxChanged)
Q_PROPERTY(QString configName READ getConfigName WRITE setConfigName NOTIFY configNameChanged)
+ Q_PROPERTY(int count READ rowCount NOTIFY countChanged)
+
public:
explicit PlayerControlBarModel(QObject *_parent = nullptr);
@@ -104,6 +106,7 @@ public:
signals:
void ctxChanged(QmlMainContext*);
void configNameChanged(QString);
+ void countChanged();
protected:
intf_thread_t *p_intf = nullptr;
More information about the vlc-commits
mailing list