MCPcopy Create free account
hub / github.com/NatronGitHub/Natron / onOverlayButtonClicked

Method onOverlayButtonClicked

Gui/DockablePanel.cpp:1475–1528  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1473}
1474
1475void
1476DockablePanel::onOverlayButtonClicked()
1477{
1478 NodeSettingsPanel* nodePanel = dynamic_cast<NodeSettingsPanel*>(this);
1479
1480 if (!nodePanel) {
1481 return;
1482 }
1483 NodePtr node = nodePanel->getNode()->getNode();
1484 if (!node) {
1485 return;
1486 }
1487 QColorDialog dialog(this);
1488 dialog.setOption(QColorDialog::DontUseNativeDialog);
1489 dialog.setOption(QColorDialog::ShowAlphaChannel);
1490 QColor oldColor;
1491 bool hadOverlayColor;
1492 {
1493 QMutexLocker locker(&_imp->_currentColorMutex);
1494 dialog.setCurrentColor(_imp->_overlayColor);
1495 oldColor = _imp->_overlayColor;
1496 hadOverlayColor = _imp->_hasOverlayColor;
1497 }
1498 QObject::connect( &dialog, SIGNAL(currentColorChanged(QColor)), this, SLOT(onOverlayColorDialogColorChanged(QColor)) );
1499
1500 if ( dialog.exec() ) {
1501 QColor c = dialog.currentColor();
1502 {
1503 QMutexLocker locker(&_imp->_currentColorMutex);
1504 _imp->_overlayColor = c;
1505 _imp->_hasOverlayColor = true;
1506 }
1507 } else {
1508 if (!hadOverlayColor) {
1509 {
1510 QMutexLocker locker(&_imp->_currentColorMutex);
1511 _imp->_hasOverlayColor = false;
1512 }
1513 QPixmap pixOverlay;
1514 appPTR->getIcon(NATRON_PIXMAP_OVERLAY, NATRON_MEDIUM_BUTTON_ICON_SIZE, &pixOverlay);
1515 _imp->_overlayButton->setIcon( QIcon(pixOverlay) );
1516 }
1517 }
1518 Gui* gui = getGui();
1519 if (gui) {
1520 NodesList overlayNodes;
1521
1522 gui->getNodesEntitledForOverlays(overlayNodes);
1523 NodesList::iterator found = std::find(overlayNodes.begin(), overlayNodes.end(), node);
1524 if ( found != overlayNodes.end() ) {
1525 gui->getApp()->redrawAllViewers();
1526 }
1527 }
1528}
1529
1530QColor
1531DockablePanel::getOverlayColor() const

Callers

nothing calls this directly

Calls 13

QIconClass · 0.85
getGuiFunction · 0.85
setOptionMethod · 0.80
setIconMethod · 0.80
getNodeMethod · 0.45
setCurrentColorMethod · 0.45
execMethod · 0.45
getIconMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
redrawAllViewersMethod · 0.45

Tested by

no test coverage detected