Skip to content

GtkScale: Update the label size request from set_digits ()

Luca Bacci requested to merge lb90/gtk:gtk-scale-set-digits-update-label into main

Update the label's size_request when setting the GtkScale::digits property by calling the update_label_request () util function.

That util function works by measuring the size request of the label with the lower and upper values of the adjustment, then taking the max. That way the size requisition is constant regardless of the actual displayed value.

Since the util function internally works by setting the text of the label, let it also set the text at last by taking in account the current adjustment's value. Most of its callers do that anyway.

Fixes #5156 (closed)

Here's a test ui file: gtk-scale.ui

Edited by Luca Bacci

Merge request reports