CaptureWin's setMinimumSize() sets the minimum size for the video frame viewport and not for the window itself. If the minimum size is larger than the monitor resolution, it will reduce the minimum size to match this. Signed-off-by: Bård Eirik Winther <bwinther@xxxxxxxxx> --- utils/qv4l2/capture-win.cpp | 29 +++++++++++++++++++++++++++++ utils/qv4l2/capture-win.h | 1 + 2 files changed, 30 insertions(+) diff --git a/utils/qv4l2/capture-win.cpp b/utils/qv4l2/capture-win.cpp index a94c73d..68dc9ed 100644 --- a/utils/qv4l2/capture-win.cpp +++ b/utils/qv4l2/capture-win.cpp @@ -21,6 +21,8 @@ #include <QImage> #include <QVBoxLayout> #include <QCloseEvent> +#include <QApplication> +#include <QDesktopWidget> #include "qv4l2.h" #include "capture-win.h" @@ -45,6 +47,33 @@ CaptureWin::~CaptureWin() delete hotkeyClose; } +void CaptureWin::setMinimumSize(int minw, int minh) +{ + QDesktopWidget *screen = QApplication::desktop(); + QRect resolution = screen->screenGeometry(); + QSize maxSize = maximumSize(); + + int l, t, r, b; + layout()->getContentsMargins(&l, &t, &r, &b); + minw += l + r; + minh += t + b + m_msg->minimumSizeHint().height() + layout()->spacing(); + + if (minw > resolution.width()) + minw = resolution.width(); + if (minw < 150) + minw = 150; + + if (minh > resolution.height()) + minh = resolution.height(); + if (minh < 100) + minh = 100; + + QWidget::setMinimumSize(minw, minh); + QWidget::setMaximumSize(minw, minh); + updateGeometry(); + QWidget::setMaximumSize(maxSize.width(), maxSize.height()); +} + void CaptureWin::setImage(const QImage &image, const QString &status) { m_label->setPixmap(QPixmap::fromImage(image)); diff --git a/utils/qv4l2/capture-win.h b/utils/qv4l2/capture-win.h index 4115d56..3925757 100644 --- a/utils/qv4l2/capture-win.h +++ b/utils/qv4l2/capture-win.h @@ -35,6 +35,7 @@ public: CaptureWin(); ~CaptureWin(); + void setMinimumSize(int minw, int minh); void setImage(const QImage &image, const QString &status); protected: -- 1.8.3.2 -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html