Get a string with all values of the QPen
| 42 | |
| 43 | // Get a string with all values of the QPen |
| 44 | QString convertPenToString(const LineDrawStyle &style) |
| 45 | { |
| 46 | auto colorHex = QString::fromStdString(style.color.toHex()); |
| 47 | auto patternIt = std::find(AllPatterns.begin(), AllPatterns.end(), style.pattern); |
| 48 | if (patternIt == AllPatterns.end()) |
| 49 | return {}; |
| 50 | auto patternIdx = std::distance(AllPatterns.begin(), patternIt); |
| 51 | return QString("%1 %2 %3").arg(colorHex).arg(style.width).arg(patternIdx); |
| 52 | } |
| 53 | |
| 54 | // The inverse functio to get a QPen from the string |
| 55 | LineDrawStyle convertStringToPen(const QString &str) |