I only want to render a cell for each item indiviually and mark them with a image of active or inactive…
sadly once i activate one in a row all get activated.
please help
I only want to render a cell for each item indiviually and mark them with a image of active or inactive…
sadly once i activate one in a row all get activated.
please help
{ 3 } Comments
Not sure if I understand correctly, but the code you linked to seems to be the code that does the drawing, not the code that sets the items as active/inactive.
It might help if you posted the code that changed the items’ state.
You are doing it backwards. A cell renderer shouldn’t need any knowledge of the tree model it is rendering. Instead, it is the tree view widget (along with the tree view column objects) that is responsible for configuring the cell renderers prior to calling their render method.
So for this case, I’d define a boolean gobject property on your cell renderer called “active”. In your on_render() callback, simply check the value of this property to decide which image to paint.
When adding your cell renderer to the the tree view column, map the active property to model column 3. That way the tree view will set the active property based on the data in the model before calling render() for each row.
Most likely you are keeping state in your cell renderer. You can’t do that, since a the renderer is used to render all the rows (at arbitrary times). All the data (including state like ‘active’) must come from the model via attribute mapping.
Post a Comment