public override string GetData(ModelIndex modelIndex, ItemDataRole role = ItemDataRole.IDR_Text) { if (!IsValidIndex(modelIndex)) { return(""); } var item = (GenericItem)modelIndex.d_modelData; if (role == ItemDataRole.IDR_Text) { return(item.GetText()); } if (role == ItemDataRole.IDR_Icon) { return(item.GetIcon()); } if (role == ItemDataRole.IDR_Tooltip) { return("Tooltip for " + item.GetText()); } return(""); }
public object GetItemData(int index, ItemDataRole role = ItemDataRole.UserRole) { return(qt_combobox_itemdata_get(Handle, index, role)); }
protected static extern object qt_combobox_itemdata_get(IntPtr raw, int index, ItemDataRole role);
public void SetItemData(int index, object data, ItemDataRole role = ItemDataRole.UserRole) { qt_combobox_itemdata_set(Handle, index, data, role); }
protected static extern void qt_combobox_itemdata_set(IntPtr raw, int index, object data, ItemDataRole role);
/*! * \brief * Returns the string representation of the specified ModelIndex based on * the specified role. * It is up to the view to interpret the string based on the role requested. * * \remark * For example, in the case of an image decoration, the name of the image * could be returned, and the view would use ImageManager to retrieve the * specific Image instance by the name and render that. * * An example implementation for the IDR_Icon role could be: * \code{.cpp} * Image* img; // get the image from somewhere * * String getData(const ModelIndex& modelIndex, ItemDataRole role) * { * if (role == IDR_Icon) return img->getName(); * } * \endcode */ public abstract string GetData(ModelIndex modelIndex, ItemDataRole role = ItemDataRole.IDR_Text);