MCPcopy Create free account
hub / github.com/cpvrlab/ImagePlay / paintEvent

Method paintEvent

ImagePlay/src/IPMorphologyCheckbox.cpp:29–58  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

27
28
29void IPMorphologyCheckbox::paintEvent(QPaintEvent*)
30{
31 QPainter painter(this);
32 painter.setRenderHint(QPainter::Antialiasing);
33
34 QColor fillColor = Qt::black; // 0
35 if(checkState() == Qt::PartiallyChecked)
36 {
37 fillColor = Qt::lightGray; // 1
38 }
39 else if(checkState() == Qt::Checked)
40 {
41 fillColor = Qt::white; // 2
42 }
43
44 // invisible if disabled
45 if(isEnabled())
46 {
47 QBrush brush(fillColor);
48
49 painter.fillRect(0, 0, width(), height(), brush);
50 painter.drawRect(0, 0, width(), height());
51 }
52 else
53 {
54 QPen pen(Qt::lightGray);
55 painter.setPen(pen);
56 painter.drawRect(0, 0, width(), height());
57 }
58}
59
60
61// enhance weird click behaviour

Callers

nothing calls this directly

Calls 2

widthFunction · 0.50
heightFunction · 0.50

Tested by

no test coverage detected