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>
This commit is contained in:
committed by
Laurent Pinchart
parent
5456e02d3f
commit
13645ab0ab
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user