fritzing / fritzing-app

Fritzing desktop application
http://fritzing.org
Other
3.97k stars 826 forks source link

hard to change capacitance values (probably incorrectly bailing on intermediate states) #1262

Open davidperrenoud opened 10 years ago

davidperrenoud commented 10 years ago

From irasc...@gmail.com on October 07, 2010 10:50:35

What steps will reproduce the problem? 1. 2. 3. What is the expected output? What do you see instead? Please use labels and text to provide additional information.

Original issue: http://code.google.com/p/fritzing/issues/detail?id=1262

davidperrenoud commented 10 years ago

From irasc...@gmail.com on January 21, 2012 23:28:37

But, it is hard to change a value from 100kΩ [on a resistor], because Fritzing tryes to verify the value while I'm changing it.

I can't delete the textfield and type something new in. If I would like to change the 100kΩ to 4.7Ω, I have to click after the 100 and can delete the two zeros, than, I type in 4.7, then I have to go to the 1 and delete it, too. Then, I go go the Ω and backspace the k. Very hard way. I think, we talked about it earlier ...

failiz commented 3 years ago

I could change the resistance without problems. However, it was extremely difficult to change the capacitance. So, this is still a bug in 0.9.4 (Windows).

failiz commented 2 years ago

This is fixed in the simulator branch.

failiz commented 2 years ago

Fixed and released in 0.9.10. Close.

failiz commented 1 year ago

Any reason to keep this open?

KjellMorgenstern commented 2 weeks ago

I can enter 0.12pF or 0.12mF, but not 0.12µF . Checked on Friting 1.0.3

failiz commented 1 week ago

I can introduce 0.12u, but not 0.12µ (copy and paste that number). The issue seems to be that the microsymbol is not recognized as power prefix. This is not related with the original bug and it happens for the resistor too. I think this bug was introduced when we changed from qregexp to qregularexpresion, see porting section:

In other cases, a pattern ported from QRegExp to QRegularExpression may silently change semantics. Therefore, it is necessary to review the patterns used. The most notable cases of silent incompatibility are:

  • Curly braces are needed to use a hexadecimal escape like \xHHHH with more than 2 digits. A pattern like \x2022 needs to be ported to \x{2022}, or it will match a space (0x20) followed by the string "22". In general, it is highly recommended to always use curly braces with the \x escape, no matter the number of digits specified.

Changing this line in TextUtils from : const QString TextUtils::PowerPrefixesString = QString("pnmkMGTu\\x%1").arg(MicroSymbolCode, 4, 16, QChar('0')); to const QString TextUtils::PowerPrefixesString = QString("pnmkMGTu\\x{%1}").arg(MicroSymbolCode, 4, 16, QChar('0')); fixes the problem. In any case, the alternative symbol should also be added to the list of aceptable power prefixes. In any case, I think that a hexadecimal representation should be preferable.

In any case, the fix should be ported to all validators. For example, the resistor will not be fixed by changing the code in textutils as the pattern that it uses is specified differently in the resistor class. Thus, we should address #3954 and homogenize all the validators to make the code nicer and easier to maintain.

failiz commented 1 week ago

By the way, this is also related to https://github.com/fritzing/fritzing-app/issues/1943, which is about allowing more than three digits and change the color of the textbox´s background to inform if a number is acceptable (withing the allowed range of the property).