Gtkmm 4 textview doesnt apply css c++

hi
in gtkmm4 i have different widgets in grid …i want odd and even rows to have different styling and specific styling for selected row

textview has this css class names:

view rhea_gridCellEven rhea_gridCellWdg 
view rhea_gridCellOdd rhea_gridCellWdg
cssData += ".rhea_gridCellEven {background-color: #FFFFFF; border-color: black; border-style: none none solid solid;border-width: 1px;}";
cssData += ".rhea_gridCellOdd {background-color: #E0E0E0; border-color: black; border-style: none none solid solid;border-width: 1px;}";

widget->get_style_context()->add_provider(cssProvider,GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);

but textview nor other widgets apply css styling for background…label seems to work fine …

Any style provider applied to a single widget will not cascade into its children. The whole API has been deprecated for a reason.

You must always add a style provider to the display: Gtk.StyleContext.add_provider_for_display

first thank you for reply and help.
cascade styling is not what i intended …textview has several css classes as shown above. i changed the code and and textview doesnt change background …but i was able (even with code before) to change font color …but not background. here is new code but no success:

auto display = Gdk::Display::get_default();

widget->get_style_context()->add_provider_for_display(display,cssProvider,GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);

i didnt properly understand css structure of text view. to apply background to textview css element “text” must be included.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.