From patchwork Thu Sep 5 14:10:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 21163 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 4D80FBF415 for ; Thu, 5 Sep 2024 14:10:51 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id BF1E4634CB; Thu, 5 Sep 2024 16:10:49 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="szm2ItS+"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id DEAD36345D for ; Thu, 5 Sep 2024 16:10:47 +0200 (CEST) Received: from pendragon.ideasonboard.com (81-175-209-231.bb.dnainternet.fi [81.175.209.231]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 5299A3E6; Thu, 5 Sep 2024 16:09:34 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1725545374; bh=ADVx6BuVXNL6Xk6Oej7Ha3pcd6ktU+Sc9YCEcP4dubE=; h=From:To:Cc:Subject:Date:From; b=szm2ItS+ID7yO4szt11LB16vQ6T7fnsrdY0hf1ltEpk+/k0rh+UIDePtSIDjdijAr 0KMvLxX6naQ2Fqhg/p40Sef71EoV2mFiQzEW1O9KJGMkgeYumgiXcxtjCp3wXhEWu8 +BsJo1Dm4rNsix6HUvxvblMnK3wrKKy5RG9Ncrx0= From: Laurent Pinchart To: libcamera-devel@lists.libcamera.org Cc: Luca Weiss Subject: [PATCH v2] qcam: Decrease minimum width of selector dialog Date: Thu, 5 Sep 2024 17:10:45 +0300 Message-ID: <20240905141045.26165-1-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.44.2 MIME-Version: 1.0 X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" From: Luca Weiss 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 --- I found this patch in a branch in my tree. The v2 incorporates the change I proposed in the review of v1. The discussion died out after that, so I thought posting a new version could help getting it merged. I've dropped the R-b tags as the implementation has changed. --- Changes since v1: - Make the minimum width depend on the screen geometry - Only decrease the width --- src/apps/qcam/cam_select_dialog.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) base-commit: f75b8dd26feaca86701704390dea18c71e2f0350 diff --git a/src/apps/qcam/cam_select_dialog.cpp b/src/apps/qcam/cam_select_dialog.cpp index c51f59745e48..6b6d0713cc3d 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;