Selecting a new default location results in "New Location"

Bug #881613 reported by Bogdan Marinov on 2011-10-25
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Bogdan Marinov

Bug Description

In the Location window, clicking on the "Use as default [location]" checkbox changes the value of the "Name/City:" field to "New Location". This is also reflected in the location display in the bottom bar.

To reproduce:
1. Open the location window.
2. Select in the list a city different from the current default location.
3. (At this point the "Name" field should correctly display the name of the city.)
4. Click on the "Use as default" checkbox.
5. The "Name" field and the location display in the bottom bar at this point will change to "New Location". Nevertheless, the default location in the configuration file is set to the correct name, so restarting Stellarium will result with the correct location used and displayed at the start.
6. If at this point a user uses the "Save configuration" button in the Configuration window, "New Location, Country-of-the-newly-selected-default-location" will be saved as default location. The next time Stellarium starts, it will (most probably) default to Paris, because it will be unable to find "New Location, Some Country" in the location list.

Originally reported by Khalid AlAjaji on the mailing list:

Related branches

Bogdan Marinov (daggerstab) wrote :

The problem seems to stem from the behavior of the "Uses as default" checkbox - when it is checked, it is disabled. Apparently at some point Qt decided that disabled controls can't hold input focus, so the focus is passed to the next controls in the "tab stop" order. These are the "Delete" and "Add to list" buttons (tab stop numbers 3 and 4), but for locations in the default list, they are also disabled at this point. Thus, the focus is set to tab stop number 5, the "Latitude" spin box. The spin box for some reason interprets receiving the focus as having its value changed and triggers the LocationDialog::valueChanged() slot, which overwrites the Name field with "New Location".

Possible solutions:
a) use LocationDialog::disconnectSignals() and connectSignals() before and after disabling the checkbox.
b) modify the custom AngleSpinBox code or just use in LocationDialog another type of signal that is not triggered by receiving the focus.
c) change the tab stop order.

Bogdan Marinov (daggerstab) wrote :

Apparently, putting the disabling method call between disconnectSignals()/connectSignals() was not enough, because closing the Location window also caused the name to reset to "New Location" - apparently closing the window while the focus is in the spin box also triggers an AngleSpinBox::valueChanged() signal. Someone has to look into the code of AngleSpinBox.

For this case, I solved this with putting the focus on the location search box after "Use as default" is disabled.

Bogdan Marinov (daggerstab) wrote :

A fix has been committed as revision 4872 to the trunk branch in the repository:

Changed in stellarium:
milestone: none → 0.11.1
status: Triaged → Fix Committed
Changed in stellarium:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers