Feature #7418: Bootstrap 5 theme
Bootstrap themes require an active WApplication upon construction for proper operation
The themes are placed in a
shared_ptr and thus in theory are stateless and can be shared between several instances of
However, the constructor of the Bootstrap themes actually adds builtin XML strings to the active
WApplication, basically requiring them to be
created in the constructor of the
We should probably have some
virtual function that takes care of this, and is automatically called in
Updated by Rathnadhar K V 8 months ago
I noticed this fact.
I read the code and in the constructor and applyValidationStyle()
WApplication *app = WApplication::instance();
Now WApplication::instance() is a static function.
I abhor static functions.
I then modified the WBoostrapTheme where the WApplication pointer is passed as C'tor parameter.
WBootstrapTheme(Wt::WApplication* in_app_ptr, Wt::BootstrapVersion in_bootstrapversion, bool in_responsive, bool in_formControlStyle );
I store the Application* as private member variable.
I tested the above C'tor. It worked beautifully.
Since I set the Bootstrap version, responsiveness and formcontrolstyle in c'tor itself, my code is that much compact and robust.
I dont have to set the WApplication* repeatedly.
Maybe this helps.
Further, I would replace Shared_ptr with unique_ptr& that way the invocation is that much quicker. Please give that a thought.