diff --git a/indra/newview/llinventorylistitem.cpp b/indra/newview/llinventorylistitem.cpp index 74452fc32b..8e0ae7b4f1 100644 --- a/indra/newview/llinventorylistitem.cpp +++ b/indra/newview/llinventorylistitem.cpp @@ -41,6 +41,10 @@ #include "llinventorymodel.h" #include "llviewerinventory.h" +#include "llinspecttexture.h" +#include "lltooltip.h" +#include "llviewercontrol.h" + static LLWidgetNameRegistry::StaticRegistrar sRegisterPanelInventoryListItemBaseParams(&typeid(LLPanelInventoryListItemBase::Params), "inventory_list_item"); static const S32 WIDGET_SPACING = 3; @@ -419,6 +423,34 @@ void LLPanelInventoryListItemBase::setTitle(const std::string& title, BOOL LLPanelInventoryListItemBase::handleToolTip( S32 x, S32 y, MASK mask) { LLRect text_box_rect = mTitleCtrl->getRect(); + + // Make inventory thumbnail tooltips work with inventory lists + static LLCachedControl showInventoryThumbnailTooltips(gSavedSettings, "FSShowInventoryThumbnailTooltips"); + if (showInventoryThumbnailTooltips && text_box_rect.pointInRect(x, y)) + { + if (auto inventoryItem = gInventory.getItem(mInventoryItemUUID); inventoryItem) + { + static LLCachedControl inventoryThumbnailTooltipsDelay(gSavedSettings, "FSInventoryThumbnailTooltipsDelay"); + static LLCachedControl tooltip_fast_delay(gSavedSettings, "ToolTipFastDelay"); + F32 tooltipDelay = LLToolTipMgr::instance().toolTipVisible() ? tooltip_fast_delay() : inventoryThumbnailTooltipsDelay(); + + if (const LLUUID& thumbnailUUID = inventoryItem->getThumbnailUUID(); !thumbnailUUID.isNull()) + { + LLSD params; + params["thumbnail_id"] = thumbnailUUID; + + LLToolTipMgr::instance().show(LLToolTip::Params() + .message(inventoryItem->getName()) + .sticky_rect(calcScreenRect()) + .delay_time(tooltipDelay) + .create_callback(boost::bind(&LLInspectTextureUtil::createInventoryToolTip, _1)) + .create_params(params)); + return TRUE; + } + } + } + // + if (text_box_rect.pointInRect(x, y) && mTitleCtrl->getTextPixelWidth() <= text_box_rect.getWidth()) {