-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathpqCheckEventOverlay.cxx
More file actions
35 lines (30 loc) · 923 Bytes
/
pqCheckEventOverlay.cxx
File metadata and controls
35 lines (30 loc) · 923 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
// SPDX-FileCopyrightText: Copyright (c) Kitware Inc.
// SPDX-FileCopyrightText: Copyright (c) Sandia Corporation
// SPDX-License-Identifier: BSD-3-Clause
#include "pqCheckEventOverlay.h"
#include <QPainter>
pqCheckEventOverlay::pqCheckEventOverlay(QWidget* parent)
: QWidget(parent)
{
setAttribute(Qt::WA_NoSystemBackground);
setAttribute(Qt::WA_TransparentForMouseEvents);
this->Valid = false;
this->GlWidget = false;
this->Specific = false;
this->setObjectName("Overlay");
}
void pqCheckEventOverlay::paintEvent(QPaintEvent*)
{
QPainter p(this);
// Draw red on invalid widget
QPen pen(Qt::red, pqCheckEventOverlay::OVERLAY_PEN_WIDTH);
if (this->Valid)
{
// Draw green on valid widget
pen.setColor(Qt::green);
}
p.setPen(pen);
// Remove the margins to draw
p.drawRect(0, 0, width() - pqCheckEventOverlay::OVERLAY_MARGIN,
height() - pqCheckEventOverlay::OVERLAY_MARGIN);
}