Skip to content

Commit

Permalink
Fixed Qt6 build issues
Browse files Browse the repository at this point in the history
  • Loading branch information
githubuser0xFFFF committed Aug 12, 2022
1 parent e65fcb3 commit 0a564dc
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 8 deletions.
9 changes: 6 additions & 3 deletions acss.pri
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@

CONFIG(debug, debug|release){
win32 {
win32-g++ {
versionAtLeast(QT_VERSION, 5.15.0) {
LIBS += -lqtadvancedcss
LIBS += -lqtadvancedcss
}
else {
LIBS += -lqtadvancedcssd
LIBS += -lqtadvancedcssd
}
}
else:msvc {
LIBS += -lqtadvancedcssd
}
else:mac {
LIBS += -lqtadvancedcss_debug
}
Expand Down
15 changes: 10 additions & 5 deletions src/QtAdvancedStylesheet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
#include <QSvgRenderer>
#include <QPainter>
#include <QSet>
#include <QStringView>


namespace acss
Expand Down Expand Up @@ -404,12 +405,16 @@ void QtAdvancedStylesheetPrivate::replaceStylesheetVariables(QString& Content)
QString ValueString;
QString MatchString = match.captured();
// Use only the value inside of the brackets {{ }} without the brackets
auto TemplateVariable = MatchString.midRef(2, MatchString.size() - 4);
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
auto TemplateVariable = QStringView(MatchString).mid(2, MatchString.size() - 4);
#else
auto TemplateVariable = QStringView(MatchString).sliced(2, MatchString.size() - 4);
#endif
bool HasOpacity = TemplateVariable.endsWith(')');

if (HasOpacity)
{
auto Values = TemplateVariable.split("|");
auto Values = TemplateVariable.split(QChar('|'));
ValueString = _this->themeVariableValue(Values[0].toString());
auto OpacityStr = Values[1].mid(OpacityStrSize, Values[1].size() - OpacityStrSize - 1);
bool Ok;
Expand Down Expand Up @@ -525,7 +530,7 @@ bool QtAdvancedStylesheetPrivate::parseVariablesFromXml(
if (s.name() != TagName)
{
setError(QtAdvancedStylesheet::ThemeXmlError, "Malformed theme "
"file - expected tag <" + TagName + "> instead of " + s.name());
"file - expected tag <" + TagName + "> instead of " + s.name().toString());
return false;
}
auto Name = s.attributes().value("name");
Expand Down Expand Up @@ -559,10 +564,10 @@ bool QtAdvancedStylesheetPrivate::parseThemeFile(const QString& Theme)
ThemeFile.open(QIODevice::ReadOnly);
QXmlStreamReader s(&ThemeFile);
s.readNextStartElement();
if (s.name() != "resources")
if (s.name() != QLatin1String("resources"))
{
setError(QtAdvancedStylesheet::ThemeXmlError, "Malformed theme file - "
"expected tag <resources> instead of " + s.name());
"expected tag <resources> instead of " + s.name().toString());
return false;
}

Expand Down

0 comments on commit 0a564dc

Please sign in to comment.