aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnton Arbring <aarbring@cisco.com>2014-07-22 10:25:42 +0200
committerHans Verkuil <hans.verkuil@cisco.com>2014-07-22 11:08:59 +0200
commit2420a34a2d7dfc6d0a549bde022b242d4db6b325 (patch)
tree546321e8a86f0ae2daf7185c6268882d85ff0a3b
parentcc2356cfc1187205fbfe99278b178082f075e49e (diff)
qv4l2: removed redundant set size
The widgets individual minimum sizes are enough and the height calculation causes problems on high dpi screens. Signed-off-by: Anton Arbring <aarbring@cisco.com> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
-rw-r--r--utils/qv4l2/ctrl-tab.cpp16
-rw-r--r--utils/qv4l2/general-tab.cpp8
-rw-r--r--utils/qv4l2/general-tab.h1
-rw-r--r--utils/qv4l2/qv4l2.cpp8
-rw-r--r--utils/qv4l2/qv4l2.h3
5 files changed, 7 insertions, 29 deletions
diff --git a/utils/qv4l2/ctrl-tab.cpp b/utils/qv4l2/ctrl-tab.cpp
index 5ff3acc6..2277607d 100644
--- a/utils/qv4l2/ctrl-tab.cpp
+++ b/utils/qv4l2/ctrl-tab.cpp
@@ -64,8 +64,6 @@ void ApplicationWindow::addWidget(QGridLayout *grid, QWidget *w, Qt::Alignment a
w->setMinimumWidth(m_minWidth);
if (w->sizeHint().width() > m_maxw[m_col])
m_maxw[m_col] = w->sizeHint().width();
- if (w->sizeHint().height() > m_maxh)
- m_maxh = w->sizeHint().height();
grid->addWidget(w, m_row, m_col, align | Qt::AlignVCenter);
m_col++;
if (m_col == m_cols) {
@@ -74,7 +72,7 @@ void ApplicationWindow::addWidget(QGridLayout *grid, QWidget *w, Qt::Alignment a
}
}
-void ApplicationWindow::addTabs(int size[])
+void ApplicationWindow::addTabs(int m_winWidth)
{
v4l2_query_ext_ctrl qec = { 0 };
unsigned ctrl_class;
@@ -160,22 +158,16 @@ void ApplicationWindow::addTabs(int size[])
fixWidth(grid);
int totalw = 0;
- int totalh = 0;
int diff = 0;
for (int i = 0; i < m_cols; i++) {
totalw += m_maxw[i] + m_pxw;
}
- totalh = grid->rowCount() * m_maxh;
- if (totalw > size[0])
- size[0] = totalw;
+ if (totalw > m_winWidth)
+ m_winWidth = totalw;
else {
- diff = size[0] - totalw;
+ diff = m_winWidth - totalw;
grid->setHorizontalSpacing(diff/5);
}
- if (totalh > size[1])
- size[1] = totalh;
- setMinimumSize(size[0], size[1]);
-
grid = new QGridLayout(w);
finishGrid(grid, ctrl_class);
}
diff --git a/utils/qv4l2/general-tab.cpp b/utils/qv4l2/general-tab.cpp
index 76de7834..f4ff8f50 100644
--- a/utils/qv4l2/general-tab.cpp
+++ b/utils/qv4l2/general-tab.cpp
@@ -64,7 +64,6 @@ GeneralTab::GeneralTab(const QString &device, cv4l_fd *fd, int n, QWidget *paren
m_pxw(25.0),
m_vMargin(10),
m_hMargin(20),
- m_maxh(0),
m_isRadio(false),
m_isSDR(false),
m_isVbi(false),
@@ -1077,8 +1076,6 @@ void GeneralTab::addWidget(QWidget *w, Qt::Alignment align)
w->setMinimumWidth(m_minWidth);
if (w->sizeHint().width() > m_maxw[m_col])
m_maxw[m_col] = w->sizeHint().width();
- if (w->sizeHint().height() > m_maxh)
- m_maxh = w->sizeHint().height();
QGridLayout::addWidget(w, m_row, m_col, align | Qt::AlignVCenter);
m_col++;
if (m_col == m_cols) {
@@ -1116,11 +1113,6 @@ int GeneralTab::getWidth()
return total;
}
-int GeneralTab::getHeight()
-{
- return rowCount() * m_maxh;
-}
-
bool GeneralTab::isSlicedVbi() const
{
return m_vbiMethods && m_vbiMethods->currentText() == "Sliced";
diff --git a/utils/qv4l2/general-tab.h b/utils/qv4l2/general-tab.h
index 84955f0c..afa380fc 100644
--- a/utils/qv4l2/general-tab.h
+++ b/utils/qv4l2/general-tab.h
@@ -83,7 +83,6 @@ public:
unsigned getDisplayColorspace() const;
unsigned getColorspace() const;
int getWidth();
- int getHeight();
public slots:
void showAllAudioDevices(bool use);
diff --git a/utils/qv4l2/qv4l2.cpp b/utils/qv4l2/qv4l2.cpp
index 472f2035..dffacc05 100644
--- a/utils/qv4l2/qv4l2.cpp
+++ b/utils/qv4l2/qv4l2.cpp
@@ -68,7 +68,6 @@ ApplicationWindow::ApplicationWindow() :
m_minWidth(175),
m_vMargin(15),
m_hMargin(5),
- m_maxh(0),
m_genTab(NULL),
m_sigMapper(NULL)
{
@@ -246,10 +245,7 @@ void ApplicationWindow::setDevice(const QString &device, bool rawOpen)
QWidget *w = new QWidget(m_tabs);
m_genTab = new GeneralTab(device, this, 4, w);
- int size[2];
- size[0] = m_genTab->getWidth();
- size[1] = m_genTab->getHeight();
- setMinimumSize(size[0], size[1]);
+ int m_winWidth = m_genTab->getWidth();
#ifdef HAVE_ALSA
if (m_genTab->hasAlsaAudio()) {
@@ -268,7 +264,7 @@ void ApplicationWindow::setDevice(const QString &device, bool rawOpen)
connect(m_genTab, SIGNAL(displayColorspaceChanged()), this, SLOT(updateDisplayColorspace()));
connect(m_genTab, SIGNAL(clearBuffers()), this, SLOT(clearBuffers()));
m_tabs->addTab(w, "General Settings");
- addTabs(size);
+ addTabs(m_winWidth);
m_vbiTab = NULL;
if (has_vbi_cap()) {
w = new QWidget(m_tabs);
diff --git a/utils/qv4l2/qv4l2.h b/utils/qv4l2/qv4l2.h
index f90c6c92..d8ab2316 100644
--- a/utils/qv4l2/qv4l2.h
+++ b/utils/qv4l2/qv4l2.h
@@ -169,7 +169,7 @@ private:
addWidget(grid, new QLabel(text, parentWidget()), align);
}
void fixWidth(QGridLayout *grid);
- void addTabs(int size[]);
+ void addTabs(int m_winWidth);
void finishGrid(QGridLayout *grid, unsigned ctrl_class);
void addCtrl(QGridLayout *grid, const struct v4l2_query_ext_ctrl &qec);
void updateCtrl(unsigned id);
@@ -204,7 +204,6 @@ private:
const int m_vMargin;
const int m_hMargin;
int m_maxw[4];
- int m_maxh;
int m_increment;
GeneralTab *m_genTab;
VbiTab *m_vbiTab;

Privacy Policy