Skip to content

feat: SG-45798: Add a value box to the text font size dropdown - #1475

Open
cedrik-fuoco-adsk wants to merge 4 commits into
AcademySoftwareFoundation:mainfrom
cedrik-fuoco-adsk:SG-45798-font-size-dropdown-value-box
Open

cedrik-fuoco-adsk wants to merge 4 commits into
AcademySoftwareFoundation:mainfrom
cedrik-fuoco-adsk:SG-45798-font-size-dropdown-value-box

Conversation

@cedrik-fuoco-adsk

@cedrik-fuoco-adsk cedrik-fuoco-adsk commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Linked issues

None

Summarize your change.

The text font size dropdown in the new annotation tools now has a value box under the presets. Users can type any size from 1 to 100, and picking a preset shows its number in the box.

Describe the reason for the change.

The dropdown only offered S, M and L, so there was no way to choose another size or to see which number a preset stood for. The design adds a value box and shows the full preset names while the menu is open.

A size saved by an earlier version as "small", "medium" or "large" is not converted. readSettings reads it back as 0, so it falls back to the default size (48) instead of the size the user had picked.

Describe what you have tested and on which operating system.

Tested on macOS with a debug build:

  • Preset labels and checkmarks, closed and open.
  • Custom size, clamping to 1-100, and text that is not a number.
  • Enter, Escape, clicking away, and Up/Down between the value box and the presets.
  • Clicking away after typing a size applies it, and Escape cancels it. I also checked this with a small offscreen PySide6 script, since I could not click away reliably there.

Add a list of changes, and note any that might need special attention during the review.

  • Added a font size dropdown button: the closed button shows S, M or L (or the number when the size matches no preset), and the open menu lists Small, Medium and Large with a check on the current one.
  • Added a value box below the presets. Enter applies the number and closes the menu. Clicking away also applies it. Escape drops the typed text. Text that is not a number goes back to the current size.
  • font_size is now stored as an integer (24, 48 and 72 for the presets) instead of "small", "medium" or "large", and font_size_changed carries an int.

If possible, provide screenshots.

2026-10-30.10-43-56.mov

The text font size dropdown only offered S, M and L. It now follows the
Figma design: the open menu lists Small, Medium and Large, and a value
box below them shows the current size and accepts any size from 1 to 100.
Picking a preset fills the box with 24, 48 or 72.

The font size setting is now an integer instead of a preset name, and the
engine sizes new text as size / 1080 * screen scale, so the presets render
as before. A size saved by an earlier version as "small", "medium" or
"large" is not converted.

Signed-off-by: Cédrik Fuoco <cedrik.fuoco@autodesk.com>
@cedrik-fuoco-adsk
cedrik-fuoco-adsk force-pushed the SG-45798-font-size-dropdown-value-box branch from 7deb422 to e516a59 Compare October 30, 2026 18:26
@cedrik-fuoco-adsk
cedrik-fuoco-adsk marked this pull request as ready for review November 2, 2026 13:23

@bernie-laberge bernie-laberge left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM


self._size_input = _MenuValueLineEdit()
self._size_input.setObjectName("sliderValue")
self._size_input.setToolTip("Size")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe there is no tooltip for the font size drop-down.

self._size_input = _MenuValueLineEdit()
self._size_input.setObjectName("sliderValue")
self._size_input.setToolTip("Size")
self._size_input.setAlignment(QtCore.Qt.AlignCenter)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be left-aligned to match the Figma design.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, I missed the left align


def set_font_size(self, size):
self._size_button.set_selection(size if self._size_button.has_item(size) else constants.FontSize.MEDIUM)
self._font_size_button.set_font_size(size)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With this change, _MenuToolButton.has_item() is now unused.

Comment on lines +781 to +787
super().__init__(parent)
self.setObjectName("menuToolButton")
self.setProperty("tbstyle", "palette")
self.setToolTip("Size")
self.setSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Fixed)
self.setFixedHeight(30)
self.setPopupMode(QtWidgets.QToolButton.InstantPopup)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lines 782 to 787 are an exact copy of PopupToolButton. You should subclass it inside of duplicating it.

Fall back to the default font size when a saved value is not a number,
which is how a size saved by an earlier version as "small", "medium" or
"large" reads back (as 0).

Make _FontSizeButton subclass _PopupToolButton instead of repeating its
setup, left-align the value box, remove the "Size" tooltips, and delete
the now unused _MenuToolButton.has_item().

Signed-off-by: Cédrik Fuoco <cedrik.fuoco@autodesk.com>
Closing the font size menu by clicking away now applies the typed size
instead of relying on the order Qt emits editingFinished and aboutToHide.
Escape still cancels the edit by reverting the value box before the menu
closes. Text that is not a number reverts to the current size.

Signed-off-by: Cédrik Fuoco <cedrik.fuoco@autodesk.com>
@cedrik-fuoco-adsk

Copy link
Copy Markdown
Contributor Author

Comments have been addressed @eloisebrosseau @bernie-laberge

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants