open-pulse / OpenPulse

OpenPulse: Open Source Software for Pulsation Analysis of Pipeline Systems
https://open-pulse.readthedocs.io
MIT License
36 stars 18 forks source link

Update automatically the widgets order #257

Open andrefpf opened 1 month ago

andrefpf commented 1 month ago

For some reason QT messes with the ordering of the widgets according to the last selection. This behaviour is very annoying, specially with line edits, because the user may want to navigate between them using "tab" or "shift + tab" for improved productivity.

Usually we update every file by hand before every release, but it is a very tedious and error prone method that can be easily automated.

As far as I know, the ordering of these tabs is given by the <tabstops> label in the .ui files as shown in the example bellow:

 ...
 <tabstops>
  <tabstop>unit_combobox</tabstop>
  <tabstop>structure_combobox</tabstop>
  <tabstop>configure_button</tabstop>
  <tabstop>set_material_button</tabstop>
  <tabstop>bending_options_combobox</tabstop>
  <tabstop>bending_radius_line_edit</tabstop>
  <tabstop>x_line_edit</tabstop>
  <tabstop>y_line_edit</tabstop>
  <tabstop>z_line_edit</tabstop>
  <tabstop>delete_button</tabstop>
  <tabstop>attach_button</tabstop>
  <tabstop>add_button</tabstop>
  <tabstop>division_combobox</tabstop>
  <tabstop>division_slider</tabstop>
  <tabstop>division_amount_spinbox</tabstop>
  <tabstop>cancel_division_button</tabstop>
  <tabstop>apply_division_button</tabstop>
  <tabstop>cancel_button</tabstop>
  <tabstop>finalize_button</tabstop>
  <tabstop>scrollArea</tabstop>
 </tabstops>
 ...

The correct order seems to be given by the order of appearance of these widgets in the file as a whole. We could create a script that automatically updates this ordering for every file in the project.