| 148 | |
| 149 | |
| 150 | void UBWidgetUniboardAPI::setPenColor(const QString& penColor) |
| 151 | { |
| 152 | if (UBApplication::boardController->activeScene() != mScene.lock()) |
| 153 | return; |
| 154 | |
| 155 | UBSettings* settings = UBSettings::settings(); |
| 156 | |
| 157 | bool conversionState = false; |
| 158 | |
| 159 | int index = penColor.toInt(&conversionState) - 1; |
| 160 | |
| 161 | if (conversionState && index > 0 && index <= 4) |
| 162 | { |
| 163 | UBApplication::boardController->setPenColorOnDarkBackground(settings->penColors(true).at(index - 1)); |
| 164 | UBApplication::boardController->setPenColorOnLightBackground(settings->penColors(false).at(index - 1)); |
| 165 | } |
| 166 | else |
| 167 | { |
| 168 | #if (QT_VERSION >= QT_VERSION_CHECK(6, 4, 0)) |
| 169 | QColor svgColor = QColor::fromString(penColor); |
| 170 | #else |
| 171 | QColor svgColor; |
| 172 | svgColor.setNamedColor(penColor); |
| 173 | #endif |
| 174 | if (svgColor.isValid()) |
| 175 | { |
| 176 | UBApplication::boardController->setPenColorOnDarkBackground(svgColor); |
| 177 | UBApplication::boardController->setPenColorOnLightBackground(svgColor); |
| 178 | } |
| 179 | } |
| 180 | } |
| 181 | |
| 182 | |
| 183 | void UBWidgetUniboardAPI::setMarkerColor(const QString& penColor) |
no test coverage detected