[libcamera-devel] [PATCH 2/2] qcam: main_window: Fix combo-box entry selection on startup

Laurent Pinchart laurent.pinchart at ideasonboard.com
Thu Apr 30 17:36:45 CEST 2020


Hi Umang,

On Thu, Apr 30, 2020 at 04:07:41PM +0100, Kieran Bingham wrote:
> On 30/04/2020 15:15, Umang Jain wrote:
> > When one of the camera is selected and opened from the
> > "Select Cameras" items list, the entry of the combo-box
> > in the main-window doesn't update its item index to reflect
> > the camera which was earlier selected. Fix that.
> 
> Ohh - nice catch - thanks, tested with and without this patch and I see
> what you mean!
> 
> Reviewed-by: Kieran Bingham <kieran.bingham at ideasonboard.com>
> Tested-by: Kieran Bingham <kieran.bingham at ideasonboard.com>
> 
> > Signed-off-by: Umang Jain <email at uajain.com>
> > ---
> >  src/qcam/main_window.cpp | 4 ++++
> >  1 file changed, 4 insertions(+)
> > 
> > diff --git a/src/qcam/main_window.cpp b/src/qcam/main_window.cpp
> > index 344b7ec..fa05515 100644
> > --- a/src/qcam/main_window.cpp
> > +++ b/src/qcam/main_window.cpp
> > @@ -249,6 +249,10 @@ int MainWindow::openCamera()
> >  		return -EBUSY;
> >  	}
> >  
> > +	/* Set the combo-box with the current selected Camera */
> > +	int camIndex = cameraCombo_->findText(QString::fromStdString(cameraName));
> > +	cameraCombo_->setCurrentIndex(camIndex);

How about

	cameraCombo_->setCurrentText(QString::fromStdString(cameraName));

?

With that change, or without it if it doesn't work,

Reviewed-by: Laurent Pinchart <laurent.pinchart at ideasonboard.com>

> > +
> >  	return 0;
> >  }
> >  

-- 
Regards,

Laurent Pinchart


More information about the libcamera-devel mailing list