I had not thought of trying an empty string, though it's good to know
that this is the usual answer to nullptr's that have become objects. I
have tried it and it does indeed work as expected when I pass an empty
string.
On a side note, I had already got it working the way I wanted by using
Gtk::Entry::set_icon_from_pixbuf and passing an empty Glib::RefPtr to
it. I noticed that it does have a default constructor that creates an
empty object, so the following works:
entry.set_icon_from_pixbuf({});
However, it does not have a constructor taking an std::nullptr_t, which
would be a more obvious way to do it, one could then call:
entry.set_icon_from_pixbuf(nullptr);
This models the way that std::shared_ptr works, and IMHO it's more
declarative. It should be a simple one-liner to fix this, I'll see
about creating a patch for this later.
On di, 2017-07-25 at 14:58 +0100, Daniel Boles wrote:
> The documentation is auto generated from the C documentation, which
> does not always work very well, especially for conversions from char*
> to Glib::ustring as you saw.
> 
> Did you try just passing an empty string? That's usually how you need
> to mentally translate "nullptr".
> 
> I wonder if the documentation converter can possibly do this
> conversion for us...
> 
> _______________________________________________
> gtkmm-list mailing list
> gtkmm-list@gnome.org
> https://mail.gnome.org/mailman/listinfo/gtkmm-list
_______________________________________________
gtkmm-list mailing list
gtkmm-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtkmm-list

Reply via email to