Hello,
today I wanted to write a small tool that simply converts decimal to hex an vice versa as I type. Means: Every new digit in a QLineEdit instantly updates the converted number in the other lineEdit.
The decimalLineEdits textChanged() signal is connected to a slot UpdateDecimalChanged().
The hexLineEdits textChanged() signal is connected to a slot UpdateHexChanged().
In UpdateDecimalChanged() the decimal number is converted to a hex representation string an put in the hexLineEdit via setText(). The other slot accordingly.
But every setText() results in a new signal textChanged() which calls the slot, which updates the other lineEdit, which emit textChanged(), which calls the other slot, which updates the first lineEdit etc. etc.
This goes on forever.
Any idea how this infinite loop can be avoided?
I would prefer to avoid the usage of a "Convert" button. As I wrote: "convert as I type" is my goal.
Bookmarks