Vuo 2.4.4
Loading...
Searching...
No Matches
VuoPublishedPortDropBox.cc
Go to the documentation of this file.
1
11#include "VuoRendererColors.hh"
12
17 QLabel(parent)
18{
20 updateStyleSheet();
21}
22
27{
28 QLabel::paintEvent(event);
29}
30
35{
36 this->isHovered = hovered;
37 updateStyleSheet();
38}
39
45{
46 setVisible(acceptingDrops);
47 if (! acceptingDrops)
48 this->isHovered = false;
49
50 updateStyleSheet();
51}
52
56void VuoPublishedPortDropBox::updateStyleSheet()
57{
58 VuoRendererColors colors(VuoNode::TintNone, VuoRendererColors::noSelection, isHovered, VuoRendererColors::noHighlight);
59 QColor fillColor = colors.portFill();
60 setStyleSheet(getBaseStyleSheet() + QString("background-color: rgb(%1, %2, %3);")
61 .arg(fillColor.red())
62 .arg(fillColor.green())
63 .arg(fillColor.blue()));
64}
65
70QString VuoPublishedPortDropBox::getBaseStyleSheet()
71{
72 // Style
73 const int horizontalPadding = 3;
74 const int verticalPadding = 3;
75 const int horizontalMargin = 2;
76 const int verticalMargin = 5;
77
78 return QString(
79 "border-radius: 5px;" // Rounded corners
80 "padding-right: %1px;"
81 "padding-left: %1px;"
82 "padding-top: %2px;"
83 "padding-bottom: %2px;"
84 "margin-left: %3px;"
85 "margin-right: %3px;"
86 "margin-top: %4px;"
87 "margin-bottom: %4px;"
88
89 )
90 .arg(horizontalPadding)
91 .arg(verticalPadding)
92 .arg(horizontalMargin)
93 .arg(verticalMargin);
94}