qv4l2: fix layout issues related to stacked widgets
authorHans Verkuil <hans.verkuil@cisco.com>
Wed, 23 Jul 2014 13:47:50 +0000 (15:47 +0200)
committerHans Verkuil <hans.verkuil@cisco.com>
Wed, 23 Jul 2014 13:47:50 +0000 (15:47 +0200)
I've been digging into why on my laptop the stacked frames in the Input section
appear shifted to the right.

The reason is that the initial loop in fixWidth() sets the minimumwidth
without looking at what the widget is. After some debugging I found out that it
was setting the minimumwidth for the wFrameSR widget.

So I added checks that it only changes it for comboboxes, spinboxes and sliders.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
utils/qv4l2/general-tab.cpp

index 74534d0..d7c4ea4 100644 (file)
@@ -855,6 +855,11 @@ void GeneralTab::fixWidth()
        QList<QWidget *> list = parentWidget()->findChildren<QWidget *>();
        QList<QWidget *>::iterator it;
        for (it = list.begin(); it != list.end(); ++it) {
+               if (!qobject_cast<QComboBox *>(*it) &&
+                   !qobject_cast<QSpinBox *>(*it) &&
+                   !qobject_cast<QSlider *>(*it))
+                       continue;
+
                if (((*it)->sizeHint().width()) > m_minWidth) {
                        m_increment = (int) ceil(((*it)->sizeHint().width() - m_minWidth) / m_pxw);
                        (*it)->setMinimumWidth(m_minWidth + m_increment * m_pxw); // for stepsize expansion of widgets