From a4cf4641828b03f9a67a1fcd55c3f1f6fe9658a7 Mon Sep 17 00:00:00 2001 From: Krasilnikov Sergey Date: Mon, 23 Oct 2023 10:15:56 +0300 Subject: [PATCH 1/2] transparent background + small fixes --- qucs/components/component.cpp | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/qucs/components/component.cpp b/qucs/components/component.cpp index 421863ecb..350698196 100644 --- a/qucs/components/component.cpp +++ b/qucs/components/component.cpp @@ -349,13 +349,11 @@ void Component::paint(ViewPainter *p) { // paint device icon for left panel list void Component::paintIcon(QPixmap *pixmap) { - pixmap->fill(Qt::white); - QPainter *pp = new QPainter(pixmap); - ViewPainter *p = new ViewPainter(pp); - int bx1,by1,bx2,by2; - Bounding(bx1,by1,bx2,by2); - int h = std::abs(bx1-bx2)+10; - int w = std::abs(by1-by2)+10; + pixmap->fill(Qt::transparent); + QPainter *painter = new QPainter(pixmap); + ViewPainter *p = new ViewPainter(painter); + int h = std::abs(x2 - x1) + 10; + int w = std::abs(y2 - y1) + 10; int ph = pixmap->size().height(); p->Scale = (float) ph / std::max(w,h); @@ -415,7 +413,6 @@ void Component::paintIcon(QPixmap *pixmap) newFont.setUnderline(pt->under); p->Painter->setFont(newFont); p->Painter->setPen(pt->Color); - int w, h; w = p->drawTextMapped(pt->s, 0, 0, &h); Q_UNUSED(w) Q_UNUSED(h) From de3f57fae67e265a001a97bb5600afea1c15fa0e Mon Sep 17 00:00:00 2001 From: Krasilnikov Sergey Date: Mon, 23 Oct 2023 10:44:26 +0300 Subject: [PATCH 2/2] port size --- qucs/components/component.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/qucs/components/component.cpp b/qucs/components/component.cpp index 350698196..025c56235 100644 --- a/qucs/components/component.cpp +++ b/qucs/components/component.cpp @@ -364,12 +364,12 @@ void Component::paintIcon(QPixmap *pixmap) cy += c_sc + icon_dy*p->Scale; if (Model.at(0) != '.' && !isEquation) { // normal components go here // paint all lines + QPen portPen; + portPen.setWidth(3); + portPen.setColor(Qt::red); + p->Painter->setPen(portPen); for (auto pp: Ports) { - QPen pa; - pa.setWidth(3); - pa.setColor(Qt::red); - p->Painter->setPen(pa); - p->drawEllipse(cx+pp->x-4,cy+pp->y-4,8,8); + p->drawEllipse(cx+pp->x-2,cy+pp->y-2,4,4); } for (qucs::Line *p1: Lines) {