`GtkListBoxRow` widget will not respect `vexpand` property

Hello,
I am having trouble configuring a GtkListBoxRow to vertically expand to the maximum height allowed (or left) in it’s parent widget (GtkListBox) (which expands vertically perfectly fine).

I opened GTK Inspector and captured the window while the GtkListBoxRow was hightlighted:

I have tried using the vexpand and vexpand-set properties of the widget to achieve the behavior I want, but it does not seem to follow. I have also made sure that the parent widgets also allow vexpand so as to not limit the GtkListBoxRow widget from expanding.

<object class="GtkListBox">
  <property name="vexpand-set">True</property>
  <property name="vexpand">True</property>
  <property name="valign">fill</property>
  ...
  <child> <!-- GtkListBoxRow -->
    <object class="AdwPreferencesPage">
      <property name="height-request">475</property>
      <property name="vexpand-set">True</property>
      <property name="vexpand">True</property>
      <property name="valign">fill</property>
...

Removing the height-request property from GtkListBoxRow only results in the Widget collapsing to a tiny height with the entire AdwPreferencesPage in a GtkScrolledWindow.

The source code for my project is available below:

Any help would be greatly appreciated. Thank you! :slight_smile:

That’s unsupported, but… why is a preferences page in a listbox? That is broken on many levels.

1 Like

Also don’t do this, heights are not fixed but depend on the font and font size/scale.

1 Like

Got it. In that case, my question is why does the content inside AdwPreferencesView not expand its widget, and instead leads to a small scrolled window?I am new to widget toolkits in general, so I may be missing something.

I am confused: The font and size/scale of what exactly? I would have thought the height depends on the minimum height required by its child widget.

Because it’s inside a list row. Don’t do that and it will be fine.

1 Like

of the text inside the page. It is the minimum height, but that height is dynamic. Moreover, it also changes depending on width, since the text can wrap.

Ah, GtkBox is the widget I need to replace my GtkListBox with. I assumed GtkBox only aligned widgets horizontally for some reason. Using this fixed my issue. Thank you very much! I appreciate your help.

I mean I don’t really understand why you need anything at all there, instead of just pref page directly?

Currently GTK4 has an issue on mobile devices (afaik Danctnix ALARM + Phosh, but not sure about other mobile platform distributions) where additional windows, such as dialogs, fail to fully render on the screen making them unusable.

I thought, just as a precaution for the future and current state of mobile, to keep the preferences view in the main window without having to render a dialog or popup.

  1. Use AdwDialog, that’s a part of why it exists.
  2. that doesn’t explain why there is a box, just have a pref page inside the stack page. But really it was an X/Y problem all along so use dialogs.

I am using a box to display the label above the pref page, and also an item is shown in between the label and the pref page when on mobile.

…you really want to talk to designers before continuing. And please just use standard widgets and don’t invent things.