Cairo未在GtkTreeView顶部绘制

Cairo未在GtkTreeView顶部绘制,gtk,gtk3,Gtk,Gtk3,我正试图通过连接到draw信号,在cairo的GtkTreeView上绘制 此代码适用于GtkBox,它在其上绘制了一个红色矩形: box.setApplicationPaintable(true); 连接(“绘制”、“GUserFunctionCallback”)(自身、目标、数据)->{ GtkAllocation allocation=tree.getAllocation(); 新建CairoContext(目标).newOperation() .setColor(255,0,0) .ad

我正试图通过连接到
draw
信号,在cairo的GtkTreeView上绘制

此代码适用于GtkBox,它在其上绘制了一个红色矩形:

box.setApplicationPaintable(true);
连接(“绘制”、“GUserFunctionCallback”)(自身、目标、数据)->{
GtkAllocation allocation=tree.getAllocation();
新建CairoContext(目标).newOperation()
.setColor(255,0,0)
.addRectangle(0,0,allocation.width,allocation.height)
.fill();
});

但是,当我使用与上述代码相同的GtkTreeView时,它只呈现TreeView,而不是红色覆盖。

可能在默认处理程序之前调用。你试过在之后呼叫
connect\u而不是
connect
吗?是的,在@liberforce工作,谢谢。