Skip to content

Commit

Permalink
viewer: default to black background
Browse files Browse the repository at this point in the history
Fixes theme background no null frame in full screen.
  • Loading branch information
itsmattkc committed Apr 13, 2021
1 parent 7b4e709 commit f9c145b
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
1 change: 1 addition & 0 deletions app/widget/viewer/viewer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
5 changes: 3 additions & 2 deletions app/widget/viewer/viewerdisplay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down Expand Up @@ -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
Expand Down
8 changes: 8 additions & 0 deletions app/widget/viewer/viewerdisplay.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,12 @@ class ViewerDisplayWidget : public ManagedDisplayWidget, public TimeTargetObject
void SetVideoParams(const VideoParams &params);
void SetTime(const rational& time);

void SetShowWidgetBackground(bool e)
{
show_widget_background_ = e;
update();
}

FramePtr last_loaded_buffer() const;

/**
Expand Down Expand Up @@ -288,6 +294,8 @@ protected slots:
QVector<double> frame_rate_averages_;
int frame_rate_average_count_;

bool show_widget_background_;

private slots:
void EmitColorAtCursor(QMouseEvent* e);

Expand Down

0 comments on commit f9c145b

Please sign in to comment.