Skip to content

String argument's reset button not shown if re-input same value #7

Description

@davidlatwe

Problem

  1. If the default value of the string argument is "A"
  2. Type "B" and press Enter, reset button shown
  3. Press reset, value fallback to default "A"
  4. Type "B" again, reset button not shown

Is this an expected behavior ?

I found that it's because the self._previous attribute is holding the previous input from user, but not fallback to default when reset pressed.

qargparse.py/qargparse.py

Lines 464 to 470 in 2dcdc17

def onEditingFinished(self):
current = self._read()
if current != self._previous:
self.changed.emit()
self._previous = current

So it's actually :

Steps _previous
Default value of the string argument is "A" _previous == "A"
Type "B" and press Enter, reset button shown _previous == "B", thanks to String.onEditingFinished
Press reset, value fallback to default "A" _previous == "B", because String.write triggered by reset did not update it
Type "B" again, reset button not shown current == self._previous, changed signal not emit

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions