I m programming in c++ with gtkmm3. I want to change some fonts in my program. I read all the things about CssStyleProvider, StyleContext in gtkmm documentation and also in gtk+ documentaion but i couldn t make it work and couldn t find any tutorial about that. I m trying like that
Glib::ustring data;
data="GtkMenuBar, GtkMenuItem {font-name: Sans 6}"; /*tried with semi-colon, too*/
Glib::RefPtr<Gtk::CssProvider> asd = Gtk::CssProvider::create();
Glib::RefPtr<Gtk::StyleContext> asd2 = Gtk::StyleContext::create();
asd->load_from_data(data);
asd2->add_provider(asd, 0); /*also tried different priorities*/
also tried like that
Glib::ustring data;
data="GtkMenuBar, GtkMenuItem {font-name: Sans 6}"; /*tried with semi-colon, too*/
Glib::RefPtr<Gtk::CssProvider> asd = Gtk::CssProvider::create();
Glib::RefPtr<Gdk::Screen> screen;
Glib::RefPtr<Gtk::StyleContext> asd2 = Gtk::StyleContext::create();
asd->load_from_data(data);
(mainWindow.get())->get_property("screen", screen);
asd2->add_provider(screen, asd, 0); /*also tried different priorities*/
And I tried these before running my main window and after running it but i have no luck. Any help is appreciated.