Every display naming an item now shows that item's production tooltip, not only the selection panel's chips: the header block stock, the total cost of a building multi-selection, the remaining scrap of a debris selection, the icons of every recipe summary, and a blueprint card's cost. ItemTooltip moves out of the selection panel and takes an ItemTooltipContext of its own -- an item is named all over the UI, and the panel's context carries visuals and a debug flag no tooltip reads. A recipe line wraps each icon with its amount so the pair can be pointed at as one statement, and attaches tooltips only where asked: a module button and the item tooltip itself draw the same line and stay silent. Hover only wherever the display sits on something the player clicks, whose click is not free to explain. Note that a recipe line on an option button can no longer be transparent to the mouse -- Qt never looks inside a transparent widget for the cursor -- so it relies on press propagation to keep picking the option. The header block stock loses world.building_blocks_tooltip, showing what every other block icon shows instead. The Expand button keeps no tooltip: its cost is painted into its face with nowhere to hang one, and the button is due to be removed. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Ne3mejABZoLWKLh8fgpM3x
37 lines
1.3 KiB
C++
37 lines
1.3 KiB
C++
#pragma once
|
|
|
|
#include <string>
|
|
|
|
#include "ItemTooltipContext.h"
|
|
#include "Tooltip.h"
|
|
#include "TooltipTrigger.h"
|
|
|
|
// The tooltip an item's name carries: the item, and every way the player can currently
|
|
// produce it, each drawn as a recipe line (REQ-UI-ITEM-TOOLTIP).
|
|
//
|
|
// Its content is drawn -- item squares, building chips and all -- rather than written,
|
|
// which is what it adds to the plain text tooltip it derives from. Rebuilt on every show,
|
|
// because what produces an item changes as the player unlocks recipes
|
|
// (REQ-LOCK-UI-RECIPE).
|
|
class ItemTooltip : public Tooltip
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
// Gives one display the tooltip of the item it names (REQ-UI-ITEM-VALUE-TOOLTIP).
|
|
// The tooltip is parented to the target and dies with it. HoverOnly wherever the
|
|
// target sits on something the player clicks, whose click is not free to explain.
|
|
static void attachTo(QWidget& target, const ItemTooltipContext& context,
|
|
const std::string& itemId, TooltipTrigger::Trigger trigger);
|
|
|
|
ItemTooltip(const ItemTooltipContext& context, const std::string& itemId,
|
|
QWidget* parent = nullptr);
|
|
|
|
protected:
|
|
void refreshContent() override;
|
|
|
|
private:
|
|
ItemTooltipContext m_context;
|
|
std::string m_itemId;
|
|
};
|