From 82a21d314841023f1547302f1a5781bf6c8037cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mustafa=20=C3=87al=C4=B1=C5=9Fkan?= Date: Sat, 19 Apr 2025 12:23:51 +0300 Subject: [PATCH] fritzing: fix build with qt >= 6.9 --- .../science/electronics/fritzing/default.nix | 5 ++ .../fritzing/fix-stricter-types.patch | 57 +++++++++++++++++++ 2 files changed, 62 insertions(+) create mode 100644 pkgs/applications/science/electronics/fritzing/fix-stricter-types.patch diff --git a/pkgs/applications/science/electronics/fritzing/default.nix b/pkgs/applications/science/electronics/fritzing/default.nix index ab0395d14b85..8b0fd62a5564 100644 --- a/pkgs/applications/science/electronics/fritzing/default.nix +++ b/pkgs/applications/science/electronics/fritzing/default.nix @@ -50,6 +50,11 @@ stdenv.mkDerivation { hash = "sha256-a/bWAUeDPj3g8BECOlXuqyCi4JgGLLs1605m380Drt0="; }; + patches = [ + # Fix build with Qt >= 6.9 + ./fix-stricter-types.patch + ]; + nativeBuildInputs = [ qmake pkg-config diff --git a/pkgs/applications/science/electronics/fritzing/fix-stricter-types.patch b/pkgs/applications/science/electronics/fritzing/fix-stricter-types.patch new file mode 100644 index 000000000000..49843e220535 --- /dev/null +++ b/pkgs/applications/science/electronics/fritzing/fix-stricter-types.patch @@ -0,0 +1,57 @@ +diff --git a/src/items/paletteitembase.cpp b/src/items/paletteitembase.cpp +index 49db343e..8760ba55 100644 +--- a/src/items/paletteitembase.cpp ++++ b/src/items/paletteitembase.cpp +@@ -626,7 +626,7 @@ QString PaletteItemBase::retrieveSvg(ViewLayer::ViewLayerID viewLayerID, QHash(m_viewLayerPlacement))), ""); + if (!svg.isEmpty()) return svg; + + SvgFileSplitter splitter; +@@ -657,7 +657,7 @@ QString PaletteItemBase::retrieveSvg(ViewLayer::ViewLayerID viewLayerID, QHash(m_viewLayerPlacement))), svg); + return svg; + } + +diff --git a/src/items/resistor.cpp b/src/items/resistor.cpp +index e2a23fd8..3fb4c669 100644 +--- a/src/items/resistor.cpp ++++ b/src/items/resistor.cpp +@@ -260,7 +260,7 @@ bool Resistor::collectExtraInfo(QWidget * parent, const QString & family, const + validator->setSymbol(OhmSymbol); + validator->setConverter(TextUtils::convertFromPowerPrefix); + validator->setBounds(MIN_RESISTANCE, MAX_RESISTANCE); +- 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')))); ++ 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(TextUtils::MicroSymbolCode), 4, 16, QChar('0')))); + focusOutComboBox->setValidator(validator); + connect(focusOutComboBox->validator(), SIGNAL(sendState(QValidator::State)), this, SLOT(textModified(QValidator::State))); + connect(focusOutComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(resistanceEntry(int))); +diff --git a/src/utils/textutils.cpp b/src/utils/textutils.cpp +index a1a28d51..3d3aa8e0 100644 +--- a/src/utils/textutils.cpp ++++ b/src/utils/textutils.cpp +@@ -79,7 +79,7 @@ const QString TextUtils::AdobeIllustratorIdentifier = "Generator: Adobe Illustra + + QList PowerPrefixes; + QList PowerPrefixValues; +-const QString TextUtils::PowerPrefixesString = QString("pnmkMGTu\\x%1").arg(MicroSymbolCode, 4, 16, QChar('0')); ++const QString TextUtils::PowerPrefixesString = QString("pnmkMGTu\\x%1").arg(static_cast(MicroSymbolCode), 4, 16, QChar('0')); + + typedef QHash FixedFontsHash; + +@@ -763,7 +763,7 @@ QString TextUtils::convertExtendedChars(const QString & str) + result.append(c); + } + else { +- result.append(QString("&#x%1;").arg(c.unicode(), 0, 16)); ++ result.append("&#x" + QString::number(c.unicode(), 16) + ";"); + } + } +