From 13645ab0abe5ff15b0883c7afd690de57bf48828 Mon Sep 17 00:00:00 2001 From: Luca Weiss Date: Sat, 28 Jan 2023 17:24:03 +0100 Subject: qcam: Decrease minimum width of selector dialog On phone screens the default width is too wide, so the OK button cannot be clicked. Fix this by decreasing the minimum size of the dialog so it fits nicely. Signed-off-by: Luca Weiss Signed-off-by: Laurent Pinchart Reviewed-by: Milan Zamazal Reviewed-by: Kieran Bingham --- src/apps/qcam/cam_select_dialog.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/apps') diff --git a/src/apps/qcam/cam_select_dialog.cpp b/src/apps/qcam/cam_select_dialog.cpp index c51f5974..6b6d0713 100644 --- a/src/apps/qcam/cam_select_dialog.cpp +++ b/src/apps/qcam/cam_select_dialog.cpp @@ -15,7 +15,9 @@ #include #include #include +#include #include +#include #include CameraSelectorDialog::CameraSelectorDialog(libcamera::CameraManager *cameraManager, @@ -53,6 +55,14 @@ CameraSelectorDialog::CameraSelectorDialog(libcamera::CameraManager *cameraManag layout->addRow("Location:", cameraLocation_); layout->addRow("Model:", cameraModel_); layout->addWidget(buttonBox); + + /* + * Decrease the minimum width of dialog to fit on narrow screens, with a + * 20 pixels margin. + */ + QRect screenGeometry = qGuiApp->primaryScreen()->availableGeometry(); + if (screenGeometry.width() < minimumWidth()) + setMinimumWidth(screenGeometry.width() - 20); } CameraSelectorDialog::~CameraSelectorDialog() = default; -- cgit v1.2.1