[c++ and UMG] Interact with a UNamedSlot from C++

Hi there.
As it is my first question on the HUB, don’t hesitate to ask for precisions if I missed anything =)

I’m trying to use UMG to toggle an inventory panel in my HUD and I would like to do it from C++. I want to create the widgets from blueprints as it is easier to design that way, but I want to answer to the event “ToggleInventory” from the player character in C++.
My problem is : I would like to create a NamedPanel in my mainHUD and populate it with the inventory widget when i get the event “ToggleInventory”. But If I create the mainHUD Widget and the NamedPanel from blueprints, I cannot access it from C++. My idea was to create a C++ class inheriting from UserWidget and create the UNamedPanel in it so I can access it later after creating a blueprint derived from this class. But it seems I cannot create a UNamedPanel* as a member of my widget class, how am I supposed to do that ? I wrote something like this but it didn’t work (it says UNamedSlot is unidentified) :

	UNamedSlot* InventorySlot;

My design is supposed to look something like this :

I also thought about just creating one function named something like “ToggleInventoryWidget” that I could implement in blueprints. That way I can just get the widget from my controller and call that function, I have not tried it yet so I’m not sure it would work.

Is any of these solutions good ? Are there better ways to toggle a panel if a specific spot other than a NamedSlot ? I am all ears for suggestions. And if you have “best practice” advice on this specific subject, I’m here to learn.

Thanks in advance =)