Skip to content

Improve subjecthierarchy combobox (2)

Created by: agirault

1. Expand subject hierarchy combobox horizontally

Update subject hierarchy combobox size policy to match the layout behavior of the qMRMLNodeComboBox (expands horizontally, fixed vertically)

  • BEFORE:
screen shot 2017-10-18 at 10 59 57 am
  • COMPARED TO qMRMLNodeComboBox:
screen shot 2017-10-18 at 1 19 26 pm
  • AFTER:
screen shot 2017-10-20 at 10 53 43 am

2. Fix treeview popup width in subject hierarchy combobox

The margins from the container and the treeview would make the tree view container wider than the combobox used to select an item (see top right corner). Since the container stretches based on the number of items, the vertical margins are needed to properly embed all items, or else a vertical scrolling bar is needed. However, the combobox/treeview width is fixed and does not vary based on the length of the item labels: therefore, those labels will be cropped (...) at the limit of the container, and a horizontal scroll bar does not appear. Adjusting the width of the container by ignoring the margins of the treeview will therefore not impact how the items are shown.

  • BEFORE:
screen shot 2017-10-20 at 11 53 22 am
  • NO MARGINS:
screen shot 2017-10-20 at 11 38 31 am
  • NO HORIZONTAL MARGINS ONLY:
screen shot 2017-10-20 at 11 46 34 am

3. Fix treeview popup height in subject hierarchy combobox

The computed height of the treeview container - based on the number of items to display - was ignored when inferior to 98 (4 items or less), resulting in a lot of empty white space. Setting a fixed height and width to the container fixes that issue.

  • BEFORE
screen shot 2017-10-18 at 1 01 28 pm
  • AFTER
screen shot 2017-10-21 at 2 26 15 pm

4. Display placeholder label when subject hierarchy tree is empty

Add placeholder message when there are no items to display. Use a QLabel that is shown or hide on top of the TreeView to simplify it (managing a 'None' item in the treeview and its models would have been tricky).

  • BEFORE
screen shot 2017-10-18 at 11 04 16 am
  • AFTER
screen shot 2017-10-21 at 1 52 41 pm screen shot 2017-10-23 at 10 37 54 am screen shot 2017-10-21 at 1 53 11 pm

Merge request reports

Loading