[vlc-commits] Qt(menu): fix CheckablelistMenu

Erwan Tulou git at videolan.org
Fri Nov 29 14:34:01 CET 2019


vlc | branch: master | Erwan Tulou <erwan10 at videolan.org> | Fri Nov 29 11:52:32 2019 +0100| [d613d7d670db24ce01102cc14b864d2a74373b58] | committer: Erwan Tulou

Qt(menu): fix CheckablelistMenu

Using an actionGroup is wrong, because the checkableListMenu just needs to
comply with the model. For some models (Crop, Zoom, Aspect, ..), it is exclusive (one and only one check), for others (audio, video, subtitle), it may not be exclusive(zero check or multiple checks allowed). But, anyway, the models manage that accordingly and there is not need to also want to manage it locally. Furthermore, for audio, video, subtitle, this breaks everything

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=d613d7d670db24ce01102cc14b864d2a74373b58
---

 modules/gui/qt/components/custom_menus.cpp | 2 --
 modules/gui/qt/components/custom_menus.hpp | 2 --
 2 files changed, 4 deletions(-)

diff --git a/modules/gui/qt/components/custom_menus.cpp b/modules/gui/qt/components/custom_menus.cpp
index 099ff06572..80dba7db89 100644
--- a/modules/gui/qt/components/custom_menus.cpp
+++ b/modules/gui/qt/components/custom_menus.cpp
@@ -207,7 +207,6 @@ CheckableListMenu::CheckableListMenu(QString title, QAbstractListModel* model ,
     , m_model(model)
 {
     this->setTitle(title);
-    m_actionGroup = new QActionGroup( this );
 
     connect(m_model, &QAbstractListModel::rowsAboutToBeRemoved, this, &CheckableListMenu::onRowsAboutToBeRemoved);
     connect(m_model, &QAbstractListModel::rowsInserted, this, &CheckableListMenu::onRowInserted);
@@ -237,7 +236,6 @@ void CheckableListMenu::onRowInserted(const QModelIndex &, int first, int last)
         bool checked = m_model->data(index, Qt::CheckStateRole).toBool();
 
         QAction *choiceAction = new QAction(title, this);
-        m_actionGroup->addAction(choiceAction);
         addAction(choiceAction);
         connect(choiceAction, &QAction::triggered, [this, i](bool checked){
             QModelIndex dataIndex = m_model->index(i);
diff --git a/modules/gui/qt/components/custom_menus.hpp b/modules/gui/qt/components/custom_menus.hpp
index 80316fdc6a..63185177c0 100644
--- a/modules/gui/qt/components/custom_menus.hpp
+++ b/modules/gui/qt/components/custom_menus.hpp
@@ -90,8 +90,6 @@ private slots:
 private:
     QAbstractListModel* m_model;
     QMenu * m_submenu;
-
-    QActionGroup* m_actionGroup;
 };
 
 



More information about the vlc-commits mailing list