summaryrefslogtreecommitdiff
path: root/src/apps/qcam
diff options
context:
space:
mode:
authorLuca Weiss <luca@z3ntu.xyz>2023-01-28 17:24:03 +0100
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2024-09-11 18:23:59 +0300
commit13645ab0abe5ff15b0883c7afd690de57bf48828 (patch)
treeeb1651814cfcebb86e24c96911be2351d9666daf /src/apps/qcam
parent5456e02d3f5bafca1ac76e75eb5a1b5c56c042b5 (diff)
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 <luca@z3ntu.xyz> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Milan Zamazal <mzamazal@redhat.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Diffstat (limited to 'src/apps/qcam')
-rw-r--r--src/apps/qcam/cam_select_dialog.cpp10
1 files changed, 10 insertions, 0 deletions
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 <QComboBox>
#include <QDialogButtonBox>
#include <QFormLayout>
+#include <QGuiApplication>
#include <QLabel>
+#include <QScreen>
#include <QString>
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;