Re: Tooltips don't appear on menuitems made with UImanager.



On Sun, 26 Jul 2009 18:45:17 +0300
sledge hammer <sledgehammer_999 hotmail com> wrote:

> 
> What the title says. The tooltips don't appear on the menuitems even though they are provided in the Gtk::Action. I suppose I am missing something. Can you help me? Below is an example program that shows the behaviour I mention. The menuitem "OPEN" should have a tooltip "THIS IS A TOOLTIP.".

Hello,

AFAIK, tooltips are explicitly disabled for menu items.

There's probably an easier way to do it, but I used the following workaround:


// Set tooltips on menu items - gtk does that only on toolbar items.
Glib::ustring tooltip_text;
std::vector<Glib::RefPtr<Gtk::ActionGroup> > groups = ui_manager->get_action_groups();
for (unsigned int i = 0; i < groups.size(); ++i) {
	std::vector<Glib::RefPtr<Gtk::Action> > actions = groups[i]->get_actions();
	for (unsigned int j = 0; j < actions.size(); ++j) {
		std::vector<Gtk::Widget*> widgets = actions[j]->get_proxies();
		if (!(tooltip_text = actions[j]->property_tooltip()).empty()) {
			for (unsigned int k = 0; k < widgets.size(); ++k) {
				widgets[k]->set_tooltip_markup(tooltip_text);
			}
		}
	}
}


Alexander


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]