MCPcopy Create free account
hub / github.com/Tencent/libpag / QStringToColor

Function QStringToColor

viewer/src/utils/StringUtils.cpp:87–105  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

85}
86
87pag::Color QStringToColor(const QString& color) {
88 Color pagColor{};
89 auto strColor = color.toStdString();
90 auto strColor12 = strColor.substr(1, 2);
91 auto r = strColor12.c_str();
92 auto strColor34 = strColor.substr(3, 2);
93 auto g = strColor34.c_str();
94 auto strColor56 = strColor.substr(5, 2);
95 auto b = strColor56.c_str();
96
97 char* str;
98 uint8_t red = strtol(r, &str, 16);
99 uint8_t green = strtol(g, &str, 16);
100 uint8_t blue = strtol(b, &str, 16);
101 pagColor.red = red;
102 pagColor.green = green;
103 pagColor.blue = blue;
104 return pagColor;
105}
106
107QString ColorToQString(const Color& color) {
108 char hexColor[8] = {0};

Callers 2

changeFillColorMethod · 0.85
changeStrokeColorMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected