```
GLib-GObject-CRITICAL **: validate_and_install_class_property: assertion 'class->set_property != NULL' failed
```I have created a simplified example, as per this page: https://developer-old.gnome.org/gtkmm-tutorial/stable/sec-builder-using-derived-widgets.html.en, using a derived Gtk::Button and still see the error.
I have included Glib::ObjectBase() in the initializer list of the derived widget and called the default constructor which also has a the Glib::ObjectBase() to initialize the Gtype (), but I still see the error.
Additionally, the property appears to work, in that I can connect to the signal_changed and set/get the property value as expected, but still receive the error at runtime.
Simplified example: ``` #include <iostream> #include <gtkmm.h> Glib::ustring glade_str ="<?xml version=\"1.0\"encoding=\"UTF-8\"?>\n" "<!-- Generated with glade 3.38.2 -->\n" "<interface>\n" " <requires lib=\"gtk+\"version=\"3.24\"/>\n" " <object class=\"GtkWindow\"id=\"mainwindow\">\n" " <property name=\"can-focus\">False</property>\n" " <child>\n" " <object class=\"GtkButton\"id=\"btn\">\n" " <property name=\"label\"translatable=\"yes\">button</property>\n" " <property name=\"visible\">True</property>\n" " <property name=\"can-focus\">True</property>\n" " <property name=\"receives-default\">True</property>\n" " </object>\n" " </child>\n" " </object>\n" "</interface>"; class DerivedButtonProp :public Gtk::Button {
public:
static void ensure_type()
{
std::cout<< __PRETTY_FUNCTION__ << std::endl;
static_cast<void>(DerivedButtonProp()); }
DerivedButtonProp(BaseObjectType *obj, Glib::RefPtr<Gtk::Builder> const
&builder)
:Glib::ObjectBase(s_type_name), Gtk::Button(obj), prop_mynum(*this,
"mynumprop")
{
std::cout<< __PRETTY_FUNCTION__ << std::endl; }
virtual ~DerivedButtonProp() =default; Glib::PropertyProxy<int> mynum()
{return prop_mynum.get_proxy(); }; private:
DerivedButtonProp()
:Glib::ObjectBase(s_type_name), prop_mynum(*this, "mynumprop")
{
std::cout<< __PRETTY_FUNCTION__ << std::endl; }; static constexpr auto s_type_name
="DerivedButtonProp"; Glib::Property<int> prop_mynum; }; class App :public Gtk::Window {
public:
App()
{
}
App(BaseObjectType *obj, Glib::RefPtr<Gtk::Builder> const & builder)
:Gtk::Window(obj)
{
builder->get_widget_derived("btn", btn_derprop); }
virtual ~App() =default; protected:
DerivedButtonProp *btn_derprop =nullptr; }; App* pWindow =nullptr;
Glib::RefPtr<Gtk::Application> app; int main(int argc, char *argv[])
{
Glib::RefPtr<Gtk::Application> app = Gtk::Application::create(); DerivedButtonProp::ensure_type();
Glib::RefPtr<Gtk::Builder> builder = Gtk::Builder::create_from_string(glade_str); App *pWindow
=nullptr; builder->get_widget_derived("mainwindow", pWindow); app->run(*pWindow); }
```
_______________________________________________ gtkmm-list mailing list [email protected] https://mail.gnome.org/mailman/listinfo/gtkmm-list
