Did not find any example on the internet for Gtk::iconview in gtkmm

I already know how to use Gtk::TreeView with ListStore , and IconView is supposed to to use the same model with first column being Gdk::PixBuf and the second column std::string , the problem is that the constructor is deleted and the only way to create Gdk::PixBuf is by Gdk::PixBuf::create() , which is not usable in this example and I’ve no work around that.
Here is my code:
`
#include <gtkmm.h>

using namespace Gtk;

int main(){

auto app = Application::create();

Window window;

HeaderBar titlebar;
window.set_titlebar(titlebar);
titlebar.set_title("IconView");

TreeModelColumnRecord record;
TreeModelColumn<Gdk::Pixbuf> icons;
TreeModelColumn<std::string> labels; 
record.add(icons);
record.add(labels);

auto liststore = ListStore::create(record);

IconView iconview;
window.add(iconview);
iconview.set_model(liststore);

window.show_all_children();

return app->run(window);

}`

and the important part of the error when I try to compile it is:
error: use of deleted function ‘Gdk::Pixbuf::Pixbuf(const Gdk::Pixbuf&)’ 287 | dest_value->data[0].v_pointer = new (std::nothrow) T(source);

How can I get around this? And apart from that , what is the proper way to use gtkmm IconView?

This is it:

TreeModelColumn<Glib::RefPtr<Gdk::Pixbuf>> icons;

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