This is an automatic generated email to let you know that the following patch 
were queued at the 
http://git.linuxtv.org/cgit.cgi/v4l-utils.git tree:

Subject: qv4l2: support menu controls in updateCtrlRange()
Author:  Hans Verkuil <hverkuil-ci...@xs4all.nl>
Date:    Mon Jan 15 14:15:58 2024 +0100

When a menu (or integer menu) control was updated with a new
range by the driver, then the corresponding combobox was not
updated. Add support for this.

Signed-off-by: Hans Verkuil <hverkuil-ci...@xs4all.nl>

 utils/qv4l2/ctrl-tab.cpp | 20 +++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)

---

http://git.linuxtv.org/cgit.cgi/v4l-utils.git/commit/?id=794987bda0372c9ecc9d61d7f1c780b08b23627b
diff --git a/utils/qv4l2/ctrl-tab.cpp b/utils/qv4l2/ctrl-tab.cpp
index dcf014a86f25..24c11e0897a1 100644
--- a/utils/qv4l2/ctrl-tab.cpp
+++ b/utils/qv4l2/ctrl-tab.cpp
@@ -585,6 +585,8 @@ void ApplicationWindow::updateCtrl(unsigned id)
 void ApplicationWindow::updateCtrlRange(unsigned id, __s32 new_val)
 {
        const v4l2_query_ext_ctrl &qec = m_ctrlMap[id];
+       struct v4l2_querymenu qmenu;
+       QComboBox *combo;
        QLineEdit *edit;
        QIntValidator *val;
        unsigned dif;
@@ -613,9 +615,25 @@ void ApplicationWindow::updateCtrlRange(unsigned id, __s32 
new_val)
                break;
 
        case V4L2_CTRL_TYPE_STRING:
-               QLineEdit *edit = static_cast<QLineEdit *>(m_widgetMap[id]);
+               edit = static_cast<QLineEdit *>(m_widgetMap[id]);
                edit->setMaxLength(qec.maximum);
                break;
+
+       case V4L2_CTRL_TYPE_MENU:
+       case V4L2_CTRL_TYPE_INTEGER_MENU:
+               combo = static_cast<QComboBox *>(m_widgetMap[id]);
+               combo->clear();
+
+               for (int i = (int)qec.minimum; i <= (int)qec.maximum; i++) {
+                       qmenu.id = qec.id;
+                       qmenu.index = i;
+                       if (querymenu(qmenu))
+                               continue;
+                       if (qec.type == V4L2_CTRL_TYPE_MENU)
+                               combo->addItem((char *)qmenu.name);
+                       else
+                               combo->addItem(QString("%1").arg(qmenu.value));
+               }
        }
 }
 
_______________________________________________
linuxtv-commits mailing list -- linuxtv-commits@linuxtv.org
To unsubscribe send an email to linuxtv-commits-le...@linuxtv.org
%(web_page_url)slistinfo/%(_internal_name)s

Reply via email to