我使用以下代码在 Gtk::TreeView 上捕获运动通知事件。
// This is the Gtk::Builder from which i read my tree view.
builder_ptr->get_widget("treeview", m_treeview_ptr);
// Connecting that event.
m_treeview_ptr->add_events(Gdk::POINTER_MOTION_MASK |
Gdk::POINTER_MOTION_HINT_MASK);
m_treeview_ptr->signal_motion_notify_event().connect(
sigc::mem_fun(this, &LayoutEditorDialog::_on_motion_notify));
我的插槽函数如下所示:
bool LayoutEditorDialog::_on_motion_notify(GdkEventMotion* event) const
{
// Just a test.
std::cout << event->x << " " << event->y << std::endl;
}
Somhow 不会从树视图发送任何运动通知事件。有人可以在这里帮助我吗?谢谢!