Project

General

Profile

Bootstrap V3 to V5 hints and tips?

Added by Mark Travis about 2 years ago

I'm migrating my project from BS V3 to V5 and it's crashing. I know it's because of the calls to bootstrap javascript tags that have changed with the new implementation in 4.6.1.

I'm really excited to get on V5 as I like the look and feel and capabilities. I'm not excited to go back through the code and figure out all of the templates and tags that need to change.

I might just re-write portions from scratch since I run the risk of tying myself in knots trying to re-factor what I've already written.

Mainly, it's around presentation of WStandardItemModel and WAbstractItemModel in an interactive way (editable) as well as turning visibility of widgets on and off. (My crashing right now is turning widget visibility on and off.)


Replies (3)

RE: Bootstrap V3 to V5 hints and tips? - Added by Mark Travis about 2 years ago

I found the area where I'm crashing. I was using a lot of "collapsible" type of presentations based on what the user needed to see for that particular application state. (menus, widgets, etc.)

I found the note in the code for WPanel:
\note It is possible to make a WPanel collapsible with WBootstrap5Theme,

  • but it's not possible to set the animation.

Any hints for unpacking this are appreciated. Otherwise, I will start wading through it in the meantime.

Are there any other things that Bootstrap 5 broke in the old implementations? I see there are "/note" references in WFileUpload, WInPlaceEdit, WMenuItem, WNavigationBar, WProgressBar, and WSlider.

RE: Bootstrap V3 to V5 hints and tips? - Added by Roel Standaert about 2 years ago

If the Bootstrap 5 theme is causing actual crashes, that may be a bug. I'd need concrete examples to see what's the matter.

RE: Bootstrap V3 to V5 hints and tips? - Added by Mark Travis about 2 years ago

Here's what I've got in a nutshell.

In the application instantiation, I only include WBootstrap5Theme.h.
I create a shared instance of WBootstrap5Theme and set it as the theme. There were no problems accessing and loading the new /resources directories and files to instantiate the v5 theme.

I am able to successfully log in to the app using AuthWidget frameworks. (I like the new look and feel!)
I am able to successfully load a file using the WFileUpload and WProgressBar frameworks.

Later in the app, after I have loaded some data, I call the following:
(This is based on the original charts-example code, which I'm using as a stub until I re-write it.)

This line:
WPanel *p = list->addWidget("Chart properties", std::move(chartConfig));

calls ->
WPanel *PanelList::addWidget(const WString& text, std::unique_ptr w)
{
std::unique_ptr p
= std::make_unique();
WPanel *result = p.get();
p->setTitle(text);
p->setCentralWidget(std::move(w));

addPanel(std::move(p));

addPanel calls ->

void PanelList::addPanel(std::unique_ptr panel)
{
panel->setCollapsible(true);
panel->collapse();

collapse calls ->

void WPanel::collapse()
{
if (isCollapsible()) {
collapseIcon_->showIcon2();

collapseIcon_ calls ->

void WPanel::collapse()
{
if (isCollapsible()) {
collapseIcon_->showIcon2();

which calls ->

void WIconPair::showIcon2()
{
setState(1);
}

and it crashes in the next block:

void WIconPair::setState(int num)
{
if (num == 0) {
icon1_->show();
icon2_->hide();
} else {
icon1_->hide();

At icon1_->hide();

icon1_ and icon2_ are still NULL at this point. num == 1.

I didn't change any of the example code listed above. I just changed the bootstrap theme to only point to version 5. So, this code is identical to what was written as sample code that worked on version 4.5

I'm in the process of completely re-writing this section, I just wanted to see how it worked first.

    (1-3/3)