我有一个带有垂直框布局的窗口。在布局中,我放置了三个小部件:菜单栏、笔记本和状态栏。菜单栏和状态栏正常工作。但是笔记本不能按预期工作:无论我添加多少标签,它既不会显示任何内容,也不会附加标签(即:_notebook->get_n_pages() 始终为 1)。
添加标签的代码:
Gtk::Label label;
Gtk::TreeView widget;
Gtk::TreeModelColumnRecord colrec;
// Columns are added here to 'colrec'
Glib::RefPtr<Gtk::ListStore> store = Gtk::ListStore::create(colrec);
widget.set_model(store);
_notebook->append_page(widget, label);
我错过了什么吗?UI 是从一个 glade 文件加载的。它在 Glade 中也显示错误,因为我删除了默认选项卡。