glib property
- From: Horváth Imre <blemidon gmail com>
- To: gtkmm-list gnome org
- Subject: glib property
- Date: Fri, 28 Sep 2012 21:56:45 +0200
Hi!
I have problems using Glib::Property in a derived class.
I've got the error:
(a.out:25329): GLib-GObject-CRITICAL **:
g_object_class_install_property: assertion `class->set_property != NULL'
failed
Here is my sample: (gtkmm-2.4)
#include <iostream>
#include <gtkmm.h>
class MyDialog : public Gtk::Dialog
{
public:
MyDialog(BaseObjectType *_baseObject, const Glib::RefPtr<Gtk::Builder>&
_builder);
private:
Glib::Property<int *> prop_;
};
MyDialog::MyDialog(BaseObjectType *_baseObject, const
Glib::RefPtr<Gtk::Builder>& _builder)
: Gtk::Dialog(_baseObject)
, Glib::ObjectBase("MyDialog")
, prop_(*this, "prop", NULL)
{
}
int main(int argc, char **argv)
{
Gtk::Main kit(argc, argv);
Glib::RefPtr<Gtk::Builder> refBuilder = Gtk::Builder::create();
try
{
refBuilder->add_from_file("sample.ui");
}
catch(const Glib::FileError& ex)
{
std::cerr << "FileError: " << ex.what() << std::endl;
return 1;
}
catch(const Gtk::BuilderError& ex)
{
std::cerr << "BuilderError: " << ex.what() << std::endl;
return 1;
}
MyDialog *dlg;
refBuilder->get_widget_derived("dialog1", dlg);
if(dlg)
{
kit.run(*dlg);
}
delete dlg;
return 0;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]