GtkFrame corners style

I agree that in some cases the rounded corners of GtkFrame is the appropiate style, but when the squared ones, how to make it (in Gtk4) ?

Sorry. I just found the property “border-radius” and I’ll try to set an apropiate value. Hope that solves my question…

I don’t know if there is a suitable better solution, but I wrote,

Glib::RefPtr<Gtk::CssProvider> refCssProvider;
refCssProvider  = Gtk::CssProvider::create();
refCssProvider->load_from_data (".squared {border-radius: 0;}");
Gtk::StyleContext::add_provider_for_display (
    Gdk::Display::get_default(), refCssProvider, GTK_STYLE_PROVIDER_PRIORITY_USER);
Gtk::Frame frame;
frame.set_css_class ("squared");

That is the expected use for custom CSS shipped by your application, yes.

You probably want to use GTK_STYLE_PROVIDER_PRIORITY_APPLICATION for the provider’s priority.

1 Like

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