[2/2] qcam: viewfinder_qt: Render stopped icon on a black background
diff mbox series

Message ID 20240905162508.4169-3-laurent.pinchart@ideasonboard.com
State Rejected
Headers show
Series
  • qcam: Use black background
Related show

Commit Message

Laurent Pinchart Sept. 5, 2024, 4:25 p.m. UTC
To match the black letterboxes, render the stoppid icon on a black
background.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
 src/apps/qcam/assets/feathericons/camera-off.svg | 2 +-
 src/apps/qcam/viewfinder_qt.cpp                  | 5 +++--
 2 files changed, 4 insertions(+), 3 deletions(-)

Comments

Kieran Bingham Sept. 9, 2024, 12:39 p.m. UTC | #1
Quoting Laurent Pinchart (2024-09-05 17:25:08)
> To match the black letterboxes, render the stoppid icon on a black

s/stoppid/stopped/

> background.
> 
> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> ---
>  src/apps/qcam/assets/feathericons/camera-off.svg | 2 +-
>  src/apps/qcam/viewfinder_qt.cpp                  | 5 +++--
>  2 files changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/src/apps/qcam/assets/feathericons/camera-off.svg b/src/apps/qcam/assets/feathericons/camera-off.svg
> index daa3e25f0c1d..2d36b59c8b52 100644
> --- a/src/apps/qcam/assets/feathericons/camera-off.svg
> +++ b/src/apps/qcam/assets/feathericons/camera-off.svg
> @@ -1 +1 @@
> -<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-camera-off"><line x1="1" y1="1" x2="23" y2="23"></line><path d="M21 21H3a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h3m3-3h6l2 3h4a2 2 0 0 1 2 2v9.34m-7.72-2.06a4 4 0 1 1-5.56-5.56"></path></svg>
> \ No newline at end of file
> +<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="#c0c0c0" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-camera-off"><line x1="1" y1="1" x2="23" y2="23"></line><path d="M21 21H3a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h3m3-3h6l2 3h4a2 2 0 0 1 2 2v9.34m-7.72-2.06a4 4 0 1 1-5.56-5.56"></path></svg>
> diff --git a/src/apps/qcam/viewfinder_qt.cpp b/src/apps/qcam/viewfinder_qt.cpp
> index 62b6f27fa23e..b0d63f3fa5ea 100644
> --- a/src/apps/qcam/viewfinder_qt.cpp
> +++ b/src/apps/qcam/viewfinder_qt.cpp
> @@ -48,6 +48,8 @@ ViewFinderQt::ViewFinderQt(QWidget *parent)
>         QPalette pal = palette();
>         pal.setColor(QPalette::Window, Qt::black);
>         setPalette(pal);
> +
> +       setAttribute(Qt::WA_OpaquePaintEvent, true);
>  }
>  
>  ViewFinderQt::~ViewFinderQt()
> @@ -122,7 +124,6 @@ void ViewFinderQt::render(libcamera::FrameBuffer *buffer, Image *image)
>                 }
>         }
>  
> -       setAttribute(Qt::WA_OpaquePaintEvent, true);
>         update();
>  
>         if (buffer)
> @@ -138,7 +139,6 @@ void ViewFinderQt::stop()
>                 buffer_ = nullptr;
>         }
>  
> -       setAttribute(Qt::WA_OpaquePaintEvent, false);

Oh - so now these are redundant... Probably not worth adding the
comments in the previous patch if they'll just be removed here then.


I find this version a bit ... garish ? I'm not sure. Slight personal
preference on the original without this patch - but no objection to this
one either.

Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>

>         update();
>  }
>  
> @@ -194,6 +194,7 @@ void ViewFinderQt::paintEvent(QPaintEvent *)
>         else
>                 point.setY((height() - pixmap_.height()) / 2);
>  
> +       painter.drawRect(rect());
>         painter.drawPixmap(point, pixmap_);
>  }
>  
> -- 
> Regards,
> 
> Laurent Pinchart
>

Patch
diff mbox series

diff --git a/src/apps/qcam/assets/feathericons/camera-off.svg b/src/apps/qcam/assets/feathericons/camera-off.svg
index daa3e25f0c1d..2d36b59c8b52 100644
--- a/src/apps/qcam/assets/feathericons/camera-off.svg
+++ b/src/apps/qcam/assets/feathericons/camera-off.svg
@@ -1 +1 @@ 
-<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-camera-off"><line x1="1" y1="1" x2="23" y2="23"></line><path d="M21 21H3a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h3m3-3h6l2 3h4a2 2 0 0 1 2 2v9.34m-7.72-2.06a4 4 0 1 1-5.56-5.56"></path></svg>
\ No newline at end of file
+<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="#c0c0c0" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-camera-off"><line x1="1" y1="1" x2="23" y2="23"></line><path d="M21 21H3a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h3m3-3h6l2 3h4a2 2 0 0 1 2 2v9.34m-7.72-2.06a4 4 0 1 1-5.56-5.56"></path></svg>
diff --git a/src/apps/qcam/viewfinder_qt.cpp b/src/apps/qcam/viewfinder_qt.cpp
index 62b6f27fa23e..b0d63f3fa5ea 100644
--- a/src/apps/qcam/viewfinder_qt.cpp
+++ b/src/apps/qcam/viewfinder_qt.cpp
@@ -48,6 +48,8 @@  ViewFinderQt::ViewFinderQt(QWidget *parent)
 	QPalette pal = palette();
 	pal.setColor(QPalette::Window, Qt::black);
 	setPalette(pal);
+
+	setAttribute(Qt::WA_OpaquePaintEvent, true);
 }
 
 ViewFinderQt::~ViewFinderQt()
@@ -122,7 +124,6 @@  void ViewFinderQt::render(libcamera::FrameBuffer *buffer, Image *image)
 		}
 	}
 
-	setAttribute(Qt::WA_OpaquePaintEvent, true);
 	update();
 
 	if (buffer)
@@ -138,7 +139,6 @@  void ViewFinderQt::stop()
 		buffer_ = nullptr;
 	}
 
-	setAttribute(Qt::WA_OpaquePaintEvent, false);
 	update();
 }
 
@@ -194,6 +194,7 @@  void ViewFinderQt::paintEvent(QPaintEvent *)
 	else
 		point.setY((height() - pixmap_.height()) / 2);
 
+	painter.drawRect(rect());
 	painter.drawPixmap(point, pixmap_);
 }