kradwhite
@kradwhite
https://github.com/kradwhite

Как добавить Box в TreeView?

Не понимаю как добавить Box в ячейку TreeView. Точнее он добавляется, но не отрисовывается.
Как это сделать правильно?
auto treeView = new TreeView();
auto header = new TreeModel::ColumnRecord();

auto iconColumn = new TreeModelColumn<RefPtr<Pixbuf>>();
auto labelColumn = new TreeModelColumn<string>();
auto boxColumn = new TreeModelColumn<RefPtr<Box>>();

header->add(*iconColumn);
header->add(*labelColumn);
header->add(*boxColumn);

treeStore = TreeStore::create(*header);
treeView->set_model(treeStore);

auto row = *(treeStore->append());
auto icon = Gdk::Pixbuf::create_from_file(Icons::getPath("icon-18"));
auto text = "name 1";
auto box = RefPtr<Box>(new Box());

box->pack_start(*new Image(Icons::getPath("icon-18")));
box->pack_start(*new Gtk::Label("name 2"));
box->show_all();

row[*iconColumn] = icon;
row[*labelColumn] = text;
row[*boxColumn] = box;

treeView->append_column("icon", *iconColumn);
treeView->append_column("label", *labelColumn);
treeView->append_column("box", *boxColumn);

treeView->show_all_children();
  • Вопрос задан
  • 20 просмотров
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы