From 236eec3d890737d3affda1709057e85ad746df2d Mon Sep 17 00:00:00 2001 From: MiroslavR Date: Sat, 16 Aug 2014 13:24:44 +0200 Subject: [PATCH] Allow widgets with layout-type tooltip to change user data of widgets from tooltip layout --- apps/openmw/mwgui/tooltips.cpp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/apps/openmw/mwgui/tooltips.cpp b/apps/openmw/mwgui/tooltips.cpp index 2cd86c7b79..154d33d528 100644 --- a/apps/openmw/mwgui/tooltips.cpp +++ b/apps/openmw/mwgui/tooltips.cpp @@ -238,12 +238,23 @@ namespace MWGui size_t underscorePos = it->first.find("_"); if (underscorePos == std::string::npos) continue; - std::string propertyKey = it->first.substr(0, underscorePos); + std::string key = it->first.substr(0, underscorePos); std::string widgetName = it->first.substr(underscorePos+1, it->first.size()-(underscorePos+1)); + std::string type = "Property"; + size_t caretPos = key.find("^"); + if (caretPos != std::string::npos) + { + type = key.substr(0, caretPos); + key.erase(key.begin(), key.begin() + caretPos + 1); + } + MyGUI::Widget* w; getWidget(w, widgetName); - w->setProperty(propertyKey, it->second); + if (type == "Property") + w->setProperty(key, it->second); + else if (type == "UserData") + w->setUserString(key, it->second); } tooltipSize = tooltip->getSize();