fritzing: fix build with qt >= 6.9 (#400019)

authored by

K900 and committed by
GitHub
cfbc694c da8f0e94

+62
+5
pkgs/applications/science/electronics/fritzing/default.nix
··· 50 50 hash = "sha256-a/bWAUeDPj3g8BECOlXuqyCi4JgGLLs1605m380Drt0="; 51 51 }; 52 52 53 + patches = [ 54 + # Fix build with Qt >= 6.9 55 + ./fix-stricter-types.patch 56 + ]; 57 + 53 58 nativeBuildInputs = [ 54 59 qmake 55 60 pkg-config
+57
pkgs/applications/science/electronics/fritzing/fix-stricter-types.patch
··· 1 + diff --git a/src/items/paletteitembase.cpp b/src/items/paletteitembase.cpp 2 + index 49db343e..8760ba55 100644 3 + --- a/src/items/paletteitembase.cpp 4 + +++ b/src/items/paletteitembase.cpp 5 + @@ -626,7 +626,7 @@ QString PaletteItemBase::retrieveSvg(ViewLayer::ViewLayerID viewLayerID, QHash<Q 6 + 7 + //DebugDialog::debug(QString("path: %1").arg(path)); 8 + 9 + - QString svg = svgHash.value(path + xmlName + QString(QChar(m_viewLayerPlacement)), ""); 10 + + QString svg = svgHash.value(path + xmlName + QString(QChar(static_cast<ushort>(m_viewLayerPlacement))), ""); 11 + if (!svg.isEmpty()) return svg; 12 + 13 + SvgFileSplitter splitter; 14 + @@ -657,7 +657,7 @@ QString PaletteItemBase::retrieveSvg(ViewLayer::ViewLayerID viewLayerID, QHash<Q 15 + return ""; 16 + } 17 + svg = splitter.elementString(xmlName); 18 + - svgHash.insert(path + xmlName + QString(QChar(m_viewLayerPlacement)), svg); 19 + + svgHash.insert(path + xmlName + QString(QChar(static_cast<ushort>(m_viewLayerPlacement))), svg); 20 + return svg; 21 + } 22 + 23 + diff --git a/src/items/resistor.cpp b/src/items/resistor.cpp 24 + index e2a23fd8..3fb4c669 100644 25 + --- a/src/items/resistor.cpp 26 + +++ b/src/items/resistor.cpp 27 + @@ -260,7 +260,7 @@ bool Resistor::collectExtraInfo(QWidget * parent, const QString & family, const 28 + validator->setSymbol(OhmSymbol); 29 + validator->setConverter(TextUtils::convertFromPowerPrefix); 30 + validator->setBounds(MIN_RESISTANCE, MAX_RESISTANCE); 31 + - validator->setRegularExpression(QRegularExpression(QString("((\\d{1,10})|(\\d{1,10}\\.)|(\\d{1,10}\\.\\d{1,5}))[\\x%1umkMG]{0,1}[\\x03A9]{0,1}").arg(TextUtils::MicroSymbolCode, 4, 16, QChar('0')))); 32 + + validator->setRegularExpression(QRegularExpression(QString("((\\d{1,10})|(\\d{1,10}\\.)|(\\d{1,10}\\.\\d{1,5}))[\\x%1umkMG]{0,1}[\\x03A9]{0,1}").arg(static_cast<int>(TextUtils::MicroSymbolCode), 4, 16, QChar('0')))); 33 + focusOutComboBox->setValidator(validator); 34 + connect(focusOutComboBox->validator(), SIGNAL(sendState(QValidator::State)), this, SLOT(textModified(QValidator::State))); 35 + connect(focusOutComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(resistanceEntry(int))); 36 + diff --git a/src/utils/textutils.cpp b/src/utils/textutils.cpp 37 + index a1a28d51..3d3aa8e0 100644 38 + --- a/src/utils/textutils.cpp 39 + +++ b/src/utils/textutils.cpp 40 + @@ -79,7 +79,7 @@ const QString TextUtils::AdobeIllustratorIdentifier = "Generator: Adobe Illustra 41 + 42 + QList<QString> PowerPrefixes; 43 + QList<double> PowerPrefixValues; 44 + -const QString TextUtils::PowerPrefixesString = QString("pnmkMGTu\\x%1").arg(MicroSymbolCode, 4, 16, QChar('0')); 45 + +const QString TextUtils::PowerPrefixesString = QString("pnmkMGTu\\x%1").arg(static_cast<int>(MicroSymbolCode), 4, 16, QChar('0')); 46 + 47 + typedef QHash<QString /*brokenFont*/, QString /*replacementFont*/> FixedFontsHash; 48 + 49 + @@ -763,7 +763,7 @@ QString TextUtils::convertExtendedChars(const QString & str) 50 + result.append(c); 51 + } 52 + else { 53 + - result.append(QString("&#x%1;").arg(c.unicode(), 0, 16)); 54 + + result.append("&#x" + QString::number(c.unicode(), 16) + ";"); 55 + } 56 + } 57 +