Godot Version
4.4
Question
Trying to create a ToolTip popup and cannot remove the background to the PopUp window.
func _make_custom_tooltip(for_text: String) → Control:
var tooltip_scene = preload(“res://tool_tip.tscn”)
var tooltip = tooltip_scene.instantiate()
if symbol:
tooltip.set_symbol(symbol)
return tooltip
What’s in the tool_tip.tscn file? That’s what’s causing your shadow, not the code you’ve shown. Can you show us a screen shot of that file’s scene tree?
ToolTip (PanelContainer) has a Style applied which sets the solid black border and white background. I’ve removed all children and the issue persists; I’ve tried removing the Theme background and it doesn’t appear to work, but perhaps I’m executing this incorrectly.
What happens if you set panel container’s self modulate alpha to zero?
What do the Stylebox(es) of your two panels look like?
func _ready():
self_modulate.a = 0.0
^This removes the solid black border I have in the PanelContainer Stylebox, but the other background (ie the one I want to remove) remains.
Panel Styles are no border, solid fill (black for header, white for content). I’ve set Shadow to fully transparent for everything just to be sure.
Yes, sorry, just edited my comment. Shadow set to fully transparent for PanelContainer and Panels, though it’s set to 0px anyways.
Just realized your ToolTip is also a PanelContainer. What does its StyleBox look like?
Look at _set_custom_tooltip() reference:
The returned node will be added as child to a PopupPanel, so you should only provide the contents of that panel. That PopupPanel can be themed using Theme.set_stylebox() for the type “TooltipPanel” (see tooltip_text for an example).
Similar to the others. White background with 4px solid black border. Removing this border doesn’t fix the background I’m trying to remove.
Thank you! This code on the ToolTip (PanelContainer) sorted it
func _ready():
var empty := StyleBoxEmpty.new()
ThemeDB.get_default_theme().set_stylebox(“panel”, “TooltipPanel”, empty)