diff --git a/app/widget/viewer/viewer.cpp b/app/widget/viewer/viewer.cpp index f22eab8c95..2264052870 100644 --- a/app/widget/viewer/viewer.cpp +++ b/app/widget/viewer/viewer.cpp @@ -72,6 +72,7 @@ ViewerWidget::ViewerWidget(QWidget *parent) : display_widget_ = new ViewerDisplayWidget(); display_widget_->setAcceptDrops(true); + display_widget_->SetShowWidgetBackground(true); connect(display_widget_, &ViewerDisplayWidget::customContextMenuRequested, this, &ViewerWidget::ShowContextMenu); connect(display_widget_, &ViewerDisplayWidget::CursorColor, this, &ViewerWidget::CursorColor); connect(display_widget_, &ViewerDisplayWidget::ColorProcessorChanged, this, &ViewerWidget::ColorProcessorChanged); diff --git a/app/widget/viewer/viewerdisplay.cpp b/app/widget/viewer/viewerdisplay.cpp index d7524c3e39..12a6305c4d 100644 --- a/app/widget/viewer/viewerdisplay.cpp +++ b/app/widget/viewer/viewerdisplay.cpp @@ -49,7 +49,8 @@ ViewerDisplayWidget::ViewerDisplayWidget(QWidget *parent) : hand_dragging_(false), deinterlace_(false), show_fps_(false), - frames_skipped_(0) + frames_skipped_(0), + show_widget_background_(false) { connect(Core::instance(), &Core::ToolChanged, this, &ViewerDisplayWidget::UpdateCursor); @@ -301,7 +302,7 @@ void ViewerDisplayWidget::dropEvent(QDropEvent *event) void ViewerDisplayWidget::OnPaint() { // Clear background to empty - QColor bg_color = palette().window().color(); + QColor bg_color = show_widget_background_ ? palette().window().color() : Qt::black; renderer()->ClearDestination(bg_color.redF(), bg_color.greenF(), bg_color.blueF()); // We only draw if we have a pipeline diff --git a/app/widget/viewer/viewerdisplay.h b/app/widget/viewer/viewerdisplay.h index 811c8a8d79..f7598d8f68 100644 --- a/app/widget/viewer/viewerdisplay.h +++ b/app/widget/viewer/viewerdisplay.h @@ -71,6 +71,12 @@ class ViewerDisplayWidget : public ManagedDisplayWidget, public TimeTargetObject void SetVideoParams(const VideoParams ¶ms); void SetTime(const rational& time); + void SetShowWidgetBackground(bool e) + { + show_widget_background_ = e; + update(); + } + FramePtr last_loaded_buffer() const; /** @@ -288,6 +294,8 @@ protected slots: QVector frame_rate_averages_; int frame_rate_average_count_; + bool show_widget_background_; + private slots: void EmitColorAtCursor(QMouseEvent* e);