Skip to content

Commit

Permalink
add support for platform-dependent styles
Browse files Browse the repository at this point in the history
This will allow us to work around platform-dependent quirks
in styling. For 2.1 this is needed to work around the issue of
the checkmark pushing text to the right and getting cut off
in WEffectSelector only on macOS.
  • Loading branch information
Be-ing committed Apr 4, 2018
1 parent ac9b40f commit dd1b0df
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/skin/legacyskinparser.cpp
Expand Up @@ -1873,6 +1873,26 @@ QString LegacySkinParser::getStyleFromNode(const QDomNode& node) {
fileBytes.length());
}

QString platformSpecificAttribute;
#if defined(Q_OS_MAC)
platformSpecificAttribute = "src-mac";
#elif defined(__WINDOWS__)
platformSpecificAttribute = "src-windows";
#else
platformSpecificAttribute = "src-linux";
#endif

if (styleElement.hasAttribute(platformSpecificAttribute)) {
QString platformSpecificSrc = styleElement.attribute(platformSpecificAttribute);
QFile platformSpecificFile(platformSpecificSrc);
if (platformSpecificFile.open(QIODevice::ReadOnly)) {
QByteArray fileBytes = platformSpecificFile.readAll();

style += QString::fromLocal8Bit(fileBytes.constData(),
fileBytes.length());
}
}

// This section can be enabled on demand. It is useful to tweak
// pixel sized values for different scalings. But we should know if this is
// actually used when migrating to Qt5
Expand Down

0 comments on commit dd1b0df

Please sign in to comment.