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

Method colorFontButtonClicked

Gui/KnobGuiString.cpp:956–973  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

954}
955
956void
957KnobGuiString::colorFontButtonClicked()
958{
959 assert(_textEdit);
960 KnobStringPtr knob = _knob.lock();
961 QColorDialog dialog(_textEdit);
962 dialog.setOption(QColorDialog::DontUseNativeDialog);
963 QObject::connect( &dialog, SIGNAL(currentColorChanged(QColor)), this, SLOT(updateFontColorIcon(QColor)) );
964 dialog.setCurrentColor(_fontColor);
965 if ( dialog.exec() ) {
966 _fontColor = dialog.currentColor();
967
968 QString text = QString::fromUtf8( knob->getValue(0).c_str() );
969 findReplaceColorName( text, _fontColor.name() );
970 pushUndoCommand( new KnobUndoCommand<std::string>( shared_from_this(), knob->getValue(0), text.toStdString() ) );
971 }
972 updateFontColorIcon(_fontColor);
973}
974
975void
976KnobGuiString::findReplaceColorName(QString& text,

Callers

nothing calls this directly

Calls 8

pushUndoCommandFunction · 0.85
setOptionMethod · 0.80
nameMethod · 0.80
toStdStringMethod · 0.80
lockMethod · 0.45
setCurrentColorMethod · 0.45
execMethod · 0.45
getValueMethod · 0.45

Tested by

no test coverage detected