On 16-05-2019 13:59, Ron Tarrant wrote:
Hi Mike,
I'm piecing together how to get non-string/non-number entities from a ListStore/TreeStore. In this demo code, all sorts of items are stuffed into the model, but I'm unclear on how they'd be retrieved as individual items (as opposed to grabbing the whole row or column).
Only the font description is retrieved (line 136) and it seems like a very specialized case and I'm getting confused trying to track down all the bits and pieces of information that explains how it's done.
So... is there any documentation on how to use getValue() to retrieve such things as the RGBA, Color, or (to pull another out of the air) a Pixbuf? This type of thing seems to involve Value, but finding comprehensive docs for that class is eluding me. The only thing I've really found so far is Value.get() which only seems capable of handling pre-determined types.
Or is this one of those cases where I'd have to roll my own for each type?
Value.get
should support all the possible types, if it doesn't that
would be a bug.
TreeModelIF.gatValue
returns a Value
, gobjects version of
std.variant. You can then retrieve the value using the get
template
function.
For RGBA:
Value val = model.getValue(iter, MY_COLUMN);
RGBA bg = val.get!RGBA();