Gtk4 - Blueprint as default .ui format?

Blueprint is much more clear and simple.

For example, defining a simple stack page in Blueprint:

using Gtk 4.0;

Stack {
  StackPage {
    name: "page1";
    child: Label {
      label: "test";
    };
  }
  StackPage {
    name: "page2";
    child: Label {
      label: "test";
    };
  }
}

But in XML:

<object class="GtkStack" id="stack1">
    <child>
        <object class="GtkStackPage">
            <property name="name">page1</property>
            <property name="child">
                <object class="GtkLabel">
                    <property name="label">test</property>
                </object>
            </property>
        </object>
    </child>
    <child>
        <object class="GtkStackPage">
            <property name="name">page2</property>
            <property name="child">
                <object class="GtkLabel">
                    <property name="label">test</property>
                </object>
            </property>
        </object>
    </child>
</object>

It is very ugly compared to Blueprint. Both new and major platforms use this kind of UI definition syntax (like QML and SwiftUI)

When GTK is deprecating XML file format and use Blueprint format as default? (actually it is ok to support both xml and blueprint in GtkBuilder)

Thanks!

FWIW, I’m still comfortable working with XML, but that might just be a result of doing web stuff in the olden days (ie. my brain parses XML just fine).

I think the real question is, does Blueprint have feature-parity with GtkBuilder XML? Is there anything that might be added to GtkBuilder that Blueprint can’t in principle support?

There have been discussions about improving/changing the syntax used by UI definition files—likely for GTK5.

Blueprint is still in development, with its syntax and features set yet in flux. Once we have a better understanding of the problem space, we’ll figure out how to include what Blueprint will become inside GTK itself.

1 Like

In the meantime I’d guess it wouldn’t be too hard to write a “compiler” transforming that Blueprint syntax to GtkBuilder XML with a little time and drive :slight_smile:

That’s exactly what Blueprint is: it “compiles” a DSL into XML.

Is there anything that might be added to GtkBuilder that Blueprint can’t in principle support?

GtkBuildable custom tags - they need to be hardcoded in Blueprint atm.

1 Like

…and that’s exactly why one (like me here) shouldn’t ever answer to a subject he barely heard of from his phone in-between other things. Just a recipe for embarrassment and noise. Sorry – and feel free to delete my message(s) :slight_smile:.

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