Qt5 Comments in Mainframe regarding QTabBar::setTabEnabled
Since we moved from Qt5 to Qt6 a while ago, this should re visited. If it's not applicable anymore these comments should be removed. Maybe the implementation needs to be adjusted.
Mainframe::Mainframe() : QcrTabWidget{"mainTabs"}
{
setMinimumSize(580, 550);
// layout
setTabPosition(QTabWidget::North);
addTab((dataImageTab_ = new DataImageTab), "Data image");
addTab((corrImageTab_ = new CorrImageTab), "Corr image");
addTab((bigtableTab_ = new BigtableTab), "Table");
addTab((diagramTab_ = new DiagramTab), "Diagram");
addTab((polefigTab_ = new PolefigTab), "Polefig");
setRemake([this]() {
bool active = gSession->activeClusters.size();
bool peakish = gSession->peaksSettings.size();
// Work against unwanted heuristics of QTabBar::setTabEnabled.
// See https://bugreports.qt.io/browse/QTBUG-69930.
// int oldCurrent = currentIndex();
setTabEnabled(0, active);
setTabEnabled(1, gSession->corrset.hasFile());
setTabEnabled(2, active && peakish);
setTabEnabled(3, active && peakish);
setTabEnabled(4, active && peakish);
// setEnabled(anyEnabled());
// if (!currentWidget()->isEnabled())
// setCellValue(0);
show();
});
}