Untitled
unknown
plain_text
4 years ago
3.4 kB
11
Indexable
ViewInit.h
#include <FSEKeyLogin/ViewInitializer.h>
namespace CZM
{
namespace FSEKeyLogin
{
/// @name Operations
/// @{
void
InitializeViewComponent(misc::Structure data);
/// @}
}
}
--------------------------------------------------------------------
viewinit.cpp
namespace CZM
{
namespace FSEKeyLogin
{
/** @internal
*/
class ViewInit : public ViewInitializer
{
public:
void
registerResources(misc::Structure const&) const noexcept
{
initComponentsRes();
}
void
registerTypes (misc::Structure const&) const
{
qmlRegisterType<FSELoginAgent>("Zeiss.Components.AdminLogin"
, 1
, 0
, "FSELoginAgent"
);
}
};
std::once_flag inited;
void
InitializeViewComponent(misc::Structure data)
{
std::call_once(
inited
, [](auto&& _data)
{
InitializeViewComponent(std::forward<decltype(_data)>(_data)
, ViewInit{}
);
}
, std::move(data)
);
}
}
--------------------------------------------------------------------------------------
viewintialiser.h
namespace CZM
{
namespace FSEKeyLogin
{
/**
* @class ViewInitializer ViewInitializer.h "FSEKeyLogin/ViewInitializer.h"
* @brief The primary contract to implement an ordered initialization of front-end components
* and dependents.
*/
class ViewInitializer
{
public:
/// @name Construction
/// @{
constexpr ViewInitializer() noexcept = default;
/// @}
/// @name Overloads
/// @{
constexpr void
registerResources(misc::Structure const&) const noexcept
{ // no-op by default
}
constexpr void
registerTypes(misc::Structure const&) const noexcept
{ // no-op by default
}
constexpr void
registerContextProperties(misc::Structure const&) const noexcept
{ // no-op by default
}
/// @}
};
/// @name Operations
/// @{
template<typename U>
void
InitializeViewComponent(misc::Structure data
, U&& unit
)
{
// --- (1) ---
unit.registerResources(data);
// --- (2) ---
unit.registerTypes(data);
// --- (3) ---
unit.registerContextProperties(data);
}
/// @}
}
}
------------------------------
Actual code call
// initialize/ register view components of Admin Login
CZM::FSEKeyLogin::InitializeViewComponent({
{"QMLEngine" , m_engine}
, {"QMLContext", m_engine->rootContext()}
});
--- This throws linker error. Do you know why??Editor is loading...