#pragma once #include "creeper-qt/utility/trait/widget.hh" #include "creeper-qt/utility/wrapper/common.hh" #include "creeper-qt/utility/wrapper/layout.hh" #include "creeper-qt/utility/wrapper/property.hh" #include #include namespace creeper::stacked::internal { class Stacked : public QStackedLayout { }; } namespace creeper::stacked::pro { using Token = common::Token; /// @note: currentChanged(int index) template using IndexChanged = common::pro::SignalInjection; using CurrentIndex = SetterProp; template concept trait = std::derived_from || layout::pro::trait; template struct Item : Token { T* item_pointer = nullptr; explicit Item(T* pointer) noexcept : item_pointer { pointer } { } explicit Item(auto&&... args) noexcept requires std::constructible_from : item_pointer { new T { std::forward(args)... } } { } void apply(stacked_trait auto& layout) const { if constexpr (widget_trait) { layout.addWidget(item_pointer); } } }; CREEPER_DEFINE_CHECKER(trait); using namespace layout::pro; } namespace creeper { using Stacked = Declarative; using NavHost = Stacked; }