Try SVG icon for diagram

This commit is contained in:
Vadim Kuznetsov 2023-10-17 17:23:21 +03:00
parent 571b1ee938
commit 6e650c45a1
4 changed files with 172 additions and 4 deletions

156
qucs/bitmaps/svg/rect.svg Normal file
View File

@ -0,0 +1,156 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
height="128"
width="128"
version="1.1"
id="svg487"
sodipodi:docname="rect.svg"
inkscape:version="0.92.3 (2405546, 2018-03-11)">
<metadata
id="metadata491">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1920"
inkscape:window-height="1050"
id="namedview489"
showgrid="true"
inkscape:zoom="4.4138931"
inkscape:cx="4.2461917"
inkscape:cy="71.926064"
inkscape:window-x="1920"
inkscape:window-y="0"
inkscape:window-maximized="1"
inkscape:current-layer="svg487">
<inkscape:grid
type="xygrid"
id="grid1504" />
</sodipodi:namedview>
<defs
id="defs24">
<marker
inkscape:stockid="Arrow1Lend"
orient="auto"
refY="0.0"
refX="0.0"
id="Arrow1Lend"
style="overflow:visible;"
inkscape:isstock="true">
<path
id="path855"
d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z "
style="fill-rule:evenodd;stroke:#000000;stroke-width:1pt;stroke-opacity:1;fill:#000000;fill-opacity:1"
transform="scale(0.8) rotate(180) translate(12.5,0)" />
</marker>
<linearGradient
id="linearGradient7843"
gradientTransform="matrix(.121457 0 0 .1756605 195.18891 503.66043)"
gradientUnits="userSpaceOnUse"
x1="-333.0289"
x2="-333.0289"
y1="-1473.6504"
y2="-776.61371">
<stop
offset="0"
stop-color="#fff"
id="stop2" />
<stop
offset=".49140647"
stop-color="#fff"
id="stop4" />
<stop
offset="1"
stop-color="#dcdcdc"
id="stop6" />
</linearGradient>
<linearGradient
id="linearGradient7912"
gradientTransform="matrix(.121457 0 0 .1756605 75.745932 148.34634)"
gradientUnits="userSpaceOnUse"
x1="399.77466"
x2="399.77466"
y1="727.07941"
y2="480.60214">
<stop
offset="0"
stop-color="#cbcbcd"
id="stop9" />
<stop
offset=".5"
stop-color="#e0e0e2"
id="stop11" />
<stop
offset="1"
stop-color="#f2f2f2"
id="stop13" />
</linearGradient>
<linearGradient
id="linearGradient12912"
gradientUnits="userSpaceOnUse"
x1="1055.3002"
x2="1055.3002"
y1="-468.66934"
y2="-481.76657">
<stop
offset="0"
stop-color="#6f6f6f"
id="stop16" />
<stop
offset="1"
stop-color="#fff"
id="stop18" />
</linearGradient>
<filter
id="filter4400">
<feGaussianBlur
stdDeviation="1.177891"
id="feGaussianBlur21" />
</filter>
</defs>
<path
style="fill:none;stroke:#000000;stroke-width:3;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="M 26,107 C 26,107 42.601058,13.830046 64.937193,56.635128 86,97 106,17 106,17 v 0"
id="path1150"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cscc" />
<path
style="fill:none;stroke:#000000;stroke-width:3;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:none"
d="M 20,23 15,8 10,23"
id="path1156"
inkscape:connector-curvature="0" />
<path
style="fill:none;stroke:#000000;stroke-width:3;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:none"
d="M 15,8 V 118 H 120"
id="path1158"
inkscape:connector-curvature="0" />
<path
style="fill:none;stroke:#000000;stroke-width:3;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:none"
d="m 105,113 15,5 -15,5"
id="path1160"
inkscape:connector-curvature="0" />
</svg>

After

Width:  |  Height:  |  Size: 4.7 KiB

View File

@ -71,10 +71,21 @@ QString misc::getIconPath(const QString &file, int icon_type)
break;
}
QString icon_path =":bitmaps/";
QString icon_path =":bitmaps/svg/"; // look for svg version first
if (loadDark) {
QString icon_path_dark = ":bitmaps/svg/dark/";
if (QFileInfo::exists(icon_path_dark + file + ".svg"))
icon_path = icon_path_dark;
}
icon_path += file + ".svg";
if (QFile::exists(icon_path)) {
return icon_path;
}
icon_path =":bitmaps/";
if (loadDark) {
QString icon_path_dark = ":bitmaps/dark/";
if (QFileInfo::exists(icon_path_dark + file))
if (QFileInfo::exists(icon_path_dark + file + ".png"))
icon_path = icon_path_dark;
}
icon_path += file;

View File

@ -893,7 +893,7 @@ void QucsApp::slotSetCompView (int index)
if (Infos) {
/// \todo warning: expression result unused, can we rewrite this?
(void) *((*it)->info) (Name, File, false);
QString icon_path = misc::getIconPath(QString (File) + ".png", qucs::compIcons);
QString icon_path = misc::getIconPath(QString (File), qucs::compIcons);
QListWidgetItem *icon = new QListWidgetItem(QPixmap(icon_path), Name);
icon->setToolTip(Name);
iconCompInfo = iconCompInfoStruct{catIdx, compIdx};
@ -950,7 +950,7 @@ void QucsApp::slotSearchComponent(const QString &searchText)
if((Name.indexOf(searchText, 0, Qt::CaseInsensitive)) != -1) {
//match
QString icon_path = misc::getIconPath(QString (File) + ".png", qucs::compIcons);
QString icon_path = misc::getIconPath(QString (File), qucs::compIcons);
QListWidgetItem *icon = new QListWidgetItem(QPixmap(icon_path), Name);
icon->setToolTip(it + ": " + Name);
// add component category and module indexes to the icon

View File

@ -498,5 +498,6 @@
<file>bitmaps/svg/marker.svg</file>
<file>bitmaps/svg/ok_apply.svg</file>
<file>bitmaps/svg/error.svg</file>
<file>bitmaps/svg/rect.svg</file>
</qresource>
</RCC>