14 const int VuoDialogForInputEditor::popoverArrowHalfWidth = 8;
21 setWindowFlags(Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint);
25 setAttribute(Qt::WA_TranslucentBackground,
true);
27 arrowPixelsFromTopOrLeft = 0;
29 this->_isDark = isDark;
30 this->_showArrow = showArrow;
42 styleSheet += VUO_QSTRINGIFY(
57 border: 2px solid #707070;
60 selection-background-color: #1f365b;
61 selection-color: #ffffff;
64 QPlainTextEdit:disabled,
65 QDoubleSpinBox:disabled,
68 border: 2px solid #606060;
72 QSlider::groove:horizontal {
78 QSlider::groove:horizontal:disabled {
82 QSlider::handle:horizontal {
84 border: 1px solid #808080;
90 QSlider::handle:horizontal:disabled {
92 border: 1px solid #686868;
98 border: 2px solid #707070;
100 padding: 0 22px 0 4px;
115 QComboBox::drop-down {
119 QComboBox::down-arrow {
120 image: url(:/Icons/spinbox-dec.png);
125 QComboBox QAbstractItemView {
126 border-top: 4px solid #404040;
127 border-bottom: 4px solid #404040;
128 background-color: #404040;
136 QComboBox::item:disabled {
139 QComboBox::item:selected {
140 background-color: #1060d0;
143 QComboBox::separator {
148 QComboBox::indicator:checked {
149 image: url(:/Icons/checkmark.svg);
152 QComboBox::indicator:checked,
156 QComboBox::icon:checked,
157 QComboBox::icon:unchecked {
163 styleSheet += VUO_QSTRINGIFY(
170 QDoubleSpinBox::up-button,
171 QSpinBox::up-button {
172 subcontrol-origin: content;
173 subcontrol-position: top right;
176 QDoubleSpinBox::up-arrow,
178 image: url(:/Icons/spinbox-inc.png);
182 QDoubleSpinBox::down-button,
183 QSpinBox::down-button {
184 subcontrol-origin: content;
185 subcontrol-position: bottom right;
188 QDoubleSpinBox::down-arrow,
189 QSpinBox::down-arrow {
190 image: url(:/Icons/spinbox-dec.png);
195 QDoubleSpinBox::up-arrow:hover,
196 QDoubleSpinBox::down-arrow:hover,
197 QSpinBox::up-arrow:hover,
198 QSpinBox::down-arrow:hover {
203 QDoubleSpinBox::up-arrow:disabled,
204 QSpinBox::up-arrow:disabled,
205 QDoubleSpinBox::up-arrow:off,
206 QSpinBox::up-arrow:off {
207 image: url(:/Icons/spinbox-inc-disabled.png);
209 QDoubleSpinBox::down-arrow:disabled,
210 QSpinBox::down-arrow:disabled,
211 QDoubleSpinBox::down-arrow:off,
212 QSpinBox::down-arrow:off {
213 image: url(:/Icons/spinbox-dec-disabled.png);
216 .arg(isDark ?
"#3a3a3a" :
"#c4c4c4");
219 styleSheet += VUO_QSTRINGIFY(
222 border: 1px solid #c9c9c9;
233 QPainterPath VuoDialogForInputEditor::getPopoverPath(
void)
236 int cornerRadius = 8;
238 path.moveTo(width()-popoverArrowHalfWidth-cornerRadius,0);
239 path.cubicTo(width()-popoverArrowHalfWidth,0, width()-popoverArrowHalfWidth,0, width()-popoverArrowHalfWidth,cornerRadius);
240 path.lineTo(width()-popoverArrowHalfWidth,arrowPixelsFromTopOrLeft-popoverArrowHalfWidth);
241 if (_showArrow && arrowPixelsFromTopOrLeft+popoverArrowHalfWidth < height())
242 path.lineTo(width(),arrowPixelsFromTopOrLeft);
243 path.lineTo(width()-popoverArrowHalfWidth,arrowPixelsFromTopOrLeft+popoverArrowHalfWidth);
244 path.lineTo(width()-popoverArrowHalfWidth,height()-cornerRadius);
245 path.cubicTo(width()-popoverArrowHalfWidth,height(), width()-popoverArrowHalfWidth,height(), width()-popoverArrowHalfWidth-cornerRadius,height());
246 path.lineTo(cornerRadius,height());
247 path.cubicTo(0,height(), 0,height(), 0,height()-cornerRadius);
248 path.lineTo(0,cornerRadius);
249 path.cubicTo(0,0, 0,0, cornerRadius,0);
260 return QMargins(5, 5, 5 + popoverArrowHalfWidth, 5);
269 QRect rect = childrenRect();
270 if (rect.width() > 0 && rect.height() > 0)
273 return rectWithMargins.size();
276 return QDialog::sizeHint();
282 void VuoDialogForInputEditor::paintEvent(QPaintEvent *event)
286 QColor backgroundColor = _isDark ? QColor(
"#505050") : QColor(
"#f9f9f9");
288 QPainter painter(
this);
291 painter.setCompositionMode(QPainter::CompositionMode_Clear);
292 painter.setBrush(backgroundColor);
293 painter.drawRect(QRect(0, 0, width(), height()));
294 painter.setCompositionMode(QPainter::CompositionMode_SourceOver);
296 painter.setRenderHint(QPainter::Antialiasing,
true);
298 painter.setPen(Qt::NoPen);
299 painter.fillPath(getPopoverPath(), backgroundColor);
305 void VuoDialogForInputEditor::showEvent(QShowEvent *event)
307 QDialog::showEvent(
event);
309 arrowPixelsFromTopOrLeft = height()/2;
317 if (e->key() == Qt::Key_Return || e->key() == Qt::Key_Enter) {
321 QDialog::keyPressEvent(e);
329 if (e->type() == QEvent::WindowDeactivate)
335 return QDialog::event(e);
343 this->_showArrow = show;