I’m not sure what I ask for is even possible, but here it goes:
I have a list(view) row of a fixed height and variable width which contains a box with two labels: a title and a small summary. The title should occupy up to 3 lines and then ellipsize.
The summary should fill the remaining space depending on how much height the title needs. Could be to hide the summary completely if the title needs all the space. Or to show 1 to 2 lines of the summary if there is enough empty space.
title needs two rows which leaves one for the summary:
Tweaking the line & visible properties manually in inspector yields the desired results. But I struggle to automate the layout. As far as I can see there is no way to react to the size allocation of a label in Gtk4 anymore (Gtk3 had the “size-allocate” signal). Being inside a listview makes things even more confusing since the rows are created but everything still has an allocation of 0x0 as long as they are not in the current viewport of the listview.
Ah, when you said this I thought “maximum number of lines” was what you intended. I suppose you could create a custom widget and do something in measure(), but I’m not sure otherwise.
Never mind: was missing the text-overflow property. With this and min-lines at 0 there is still clipping text. But turning min-lines up to 1 and limiting the title label works for me I guess.