ra3xdh / qucs_s

Qucs-S is a circuit simulation program with Qt-based GUI
https://ra3xdh.github.io/
GNU General Public License v2.0
845 stars 109 forks source link

Not possible to clear pin assignment for SpiceLibComp #808

Closed ra3xdh closed 2 months ago

ra3xdh commented 3 months ago

This issue is related to MacOS only. Linux and Windows are not affected. It is not possible to clear pin assignment for new SpiceLibComp Spice library device after redesign #679. See #792 for context. Here are two screencasts illustrating the table behavior on MacOS and Linux. It seems that QTableWidget::setCellWidget works differently on different platforms. I am unable to fix this issue myself, need to wait for someone using Mac.

*Linux (correct)

Screencast_20240704_200738.webm

https://github.com/ra3xdh/qucs_s/assets/4920080/355053d2-9549-4f44-8e20-8a523ff3d80f

dsm commented 3 months ago

I will tried to fixed this issue. I download the same schematic lm335 symbol pin selection is behaving like a text box. selecting all NC give 4 pin but sometimes I double clicked text become 1NC and 1 is became invisible for the other selectin box. I will upload a video later.

dsm commented 2 months ago

windows build also affected. Tested on win11.

Windows_test.webm

dsm commented 2 months ago

I tested on Ubuntu 24.04 wsl2 also same issue.

linux_wsl2.webm

ra3xdh commented 2 months ago

Yes, I understood how to reproduce this.

If you select NC from the drop-down list, it disappears and releases pin.

ra3xdh commented 2 months ago

Please check #824 for the fix

dsm commented 2 months ago

I tested windows and works as expected. I'll test on macOS as soon as possible.

dsm commented 2 months ago

this is macOS test pin selection OK but some rendering artifact ex 1NC or NC but intertwined.

https://github.com/ra3xdh/qucs_s/assets/41967334/e7e68f24-b39e-4303-9b70-f8ad522be5d4

dsm commented 2 months ago

image

ra3xdh commented 2 months ago

I don't know why MacOS inserts random unicode symbols after "N". I didn't add anything in the item string. Maybe Qt has registered some auto-conversion for "NC" string. What is your locale setting?

dsm commented 2 months ago

English(US) I think it writes NC twice but starting on C N(CN)C

ra3xdh commented 2 months ago

Please try the following patch. It clears item text before setCellWidget call.

diff --git a/qucs/extsimkernels/spicelibcompdialog.cpp b/qucs/extsimkernels/spicelibcompdialog.cpp
index d028918f..cc1dd96a 100644
--- a/qucs/extsimkernels/spicelibcompdialog.cpp
+++ b/qucs/extsimkernels/spicelibcompdialog.cpp
@@ -388,6 +388,7 @@ void SpiceLibCompDialog::slotTableCellDoubleClick()
       cbxSelectPin->addItem(QString::number(i));
     }
   }
+  tbwPinsTable->item(r,c)->setText("");
   tbwPinsTable->setCellWidget(r,c,cbxSelectPin);
   connect(cbxSelectPin,SIGNAL(activated(int)),this,SLOT(slotSelectPin()));
dsm commented 2 months ago

I am not accessing my mac right now but I'll try. (about 5 hours)

dsm commented 2 months ago

@ra3xdh Hi, I tested above patch and it's working as expected.

ra3xdh commented 2 months ago

Fixed by #824. Closing as completed.