How to use GtkConstraintLayout?

How to use gtkconstraintlayout properly?? When I add it to my parent gtkbox widget as a property in ui file, it breaks the whole layout. Help…

You cannot add a layout manager to a random widget that already has one and expect things to work. GtkBox already has a layout manager—that’s how the “box” layout is implemented.

If you want to use the constraint-based layout manager then you’ll have to create your own custom GtkWidget subclass and add the layout manager to that class. Then you’ll need to add the children and their constraints.

So there is currently no widget with inbuilt constraint layout functionality? I have to make it myself?

Yes, that’s correct.

The ConstraintLayout layout manager is kind of new, in terms of user base when compared to older/more established layout managers like BoxLayout or GridLayout; additionally, it’s geared towards custom layouts that are not easily achievable with the “boxes inside boxes” approach.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.