@Santosh Reddy:
The tabs I may be removing may no longer be in the tabs QList. That is why I remove everything in the layout, not just from the tabs QList.
I have modified my code a bit so it only adds/takes one at a time. I can't edit my previous posts now for whatever odd reason, so here is the new code:
void TabBar::updateLayout(int index, TabButton *tab)
{
tabLayoutScroller->setUpdatesEnabled(false);
if (index == -1)
tabLayout->removeWidget(tab);
else {
tabLayout->addWidget(tab, 0, index);
}
tabLayoutScroller->setUpdatesEnabled(true);
tabLayoutScroller->update();
tabLayoutScroller->repaint();
}
void TabBar::updateLayout(int index, TabButton *tab)
{
tabLayoutScroller->setUpdatesEnabled(false);
if (index == -1)
tabLayout->removeWidget(tab);
else {
tabLayout->addWidget(tab, 0, index);
}
tabLayoutScroller->setUpdatesEnabled(true);
tabLayoutScroller->update();
tabLayoutScroller->repaint();
}
To copy to clipboard, switch view to plain text mode
Code for adding a tab:
TabButton *button = new TabButton(this, tab);
button->setMouseTracking(true);
connect(button, SIGNAL(pressed()), SLOT(changeTab()));
updateLayout(index, button);
tabs.insert(index, button);
TabButton *button = new TabButton(this, tab);
button->setMouseTracking(true);
connect(button, SIGNAL(pressed()), SLOT(changeTab()));
updateLayout(index, button);
tabs.insert(index, button);
To copy to clipboard, switch view to plain text mode
Code for removing a tab:
TabButton *button = tabs.at(index);
updateLayout(-1, tabs.at(index));
tabs.removeAt(index);
TabButton *button = tabs.at(index);
updateLayout(-1, tabs.at(index));
tabs.removeAt(index);
To copy to clipboard, switch view to plain text mode
The original visual glitch still occurs though, even when it is removing/adding so simplistically =/. As always, any help is highly appreciated; thanks.
Bookmarks