Bug 475499

Summary: Confusing behavior when setting Az/Alt coordinates manually
Product: [Applications] kstars Reporter: Brett <bgottula>
Component: generalAssignee: Jasem Mutlaq <mutlaqja>
Status: RESOLVED FIXED    
Severity: normal    
Priority: NOR    
Version First Reported In: 3.6.7   
Target Milestone: ---   
Platform: Mint (Ubuntu based)   
OS: Linux   
Latest Commit: Version Fixed/Implemented In: 3.6.8
Sentry Crash Report:

Description Brett 2023-10-12 05:43:53 UTC
SUMMARY
If there are valid values in the RA/Dec tab of the "Set Coordinates Manually" dialog it will *always* use those ones, even when the Az/Alt tab has focus when the "OK" button is clicked. Only if the RA/Dec values can’t be parsed correctly (e.g., because they are blank) will it use the Az/Alt tab values. This is a very unintuitive behavior; I had to inspect the source code to figure out how to use Az/Alt coordinates.

STEPS TO REPRODUCE
1. Open Pointing > Set Coordinates Manually
2. Note or set the RA/Dec coordinates
3. Switch to Az/Alt tab
4. Set Az/Alt coordinates (choose something that is obviously a different location in the sky from the RA/Dec coordinates)
5. Click OK

OBSERVED RESULT
The display is centered at the RA/Dec coordinates (even though that tab was not active when "OK" was clicked).

EXPECTED RESULT
The display is centered at the Az/Alt coordinates entered.

SOFTWARE/OS VERSIONS
Linux Mint 21.2
KDE Frameworks Version: 5.92.0
Qt Version: 5.15.3

ADDITIONAL INFORMATION
I think the check at this if statement is not the best condition to check: https://invent.kde.org/education/kstars/-/blob/master/kstars/dialogs/focusdialog.cpp#L123 

If I understand correctly, that condition just checks that the values in the RA and Dec text boxes were parseable. So the code path that uses the Az/Alt coordinates is only executed if the RA and Dec values could not be parsed successfully. It would be more intuitive if the if statement checked which tab in the dialog is active when the user clicks OK.

I'm not fluent in KDE / Qt GUI programming but if desired I can try to come up with a fix.
Comment 1 Brett 2023-10-17 06:42:39 UTC
Merge request: https://invent.kde.org/education/kstars/-/merge_requests/1021
Comment 2 Brett 2023-12-17 19:42:54 UTC
My merge request was accepted. I've tested on Version 3.6.8 Stable and it works.