1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2024-11-24 03:35:53 +01:00

Clean up the splitter/graph tabs logic

This commit is contained in:
Martin Tůma 2024-09-21 11:36:51 +02:00
parent 762e374adf
commit b01dcc4569
2 changed files with 6 additions and 10 deletions

View File

@ -1171,8 +1171,7 @@ void GUI::loadData(const Data &data)
for (int i = 0; i < _tabs.count(); i++) for (int i = 0; i < _tabs.count(); i++)
graphs.append(_tabs.at(i)->loadData(data, _map)); graphs.append(_tabs.at(i)->loadData(data, _map));
if (updateGraphTabs()) updateGraphTabs();
_splitter->refresh();
paths = _mapView->loadData(data); paths = _mapView->loadData(data);
GraphTab *gt = static_cast<GraphTab*>(_graphTabWidget->currentWidget()); GraphTab *gt = static_cast<GraphTab*>(_graphTabWidget->currentWidget());
@ -1620,7 +1619,7 @@ void GUI::closeAll()
void GUI::showGraphs(bool show) void GUI::showGraphs(bool show)
{ {
_graphTabWidget->setHidden(!show); _graphTabWidget->setVisible(show);
} }
#ifdef Q_OS_ANDROID #ifdef Q_OS_ANDROID
@ -2220,11 +2219,10 @@ void GUI::updateNavigationActions()
#endif // Q_OS_ANDROID #endif // Q_OS_ANDROID
} }
bool GUI::updateGraphTabs() void GUI::updateGraphTabs()
{ {
int index; int index;
GraphTab *tab; GraphTab *tab;
bool hidden = _graphTabWidget->isHidden();
for (int i = 0; i < _tabs.size(); i++) { for (int i = 0; i < _tabs.size(); i++) {
tab = _tabs.at(i); tab = _tabs.at(i);
@ -2242,14 +2240,12 @@ bool GUI::updateGraphTabs()
((_showTracksAction->isChecked() && _trackCount) ((_showTracksAction->isChecked() && _trackCount)
|| (_showRoutesAction->isChecked() && _routeCount))) { || (_showRoutesAction->isChecked() && _routeCount))) {
if (_showGraphsAction->isChecked()) if (_showGraphsAction->isChecked())
_graphTabWidget->setHidden(false); _graphTabWidget->show();
_showGraphsAction->setEnabled(true); _showGraphsAction->setEnabled(true);
} else { } else {
_graphTabWidget->setHidden(true); _graphTabWidget->hide();
_showGraphsAction->setEnabled(false); _showGraphsAction->setEnabled(false);
} }
return (hidden != _graphTabWidget->isHidden());
} }
void GUI::updateDataDEMDownloadAction() void GUI::updateDataDEMDownloadAction()

View File

@ -165,7 +165,7 @@ private:
QMenu *menu, const QList<QAction*> &existingActions, int &showError); QMenu *menu, const QList<QAction*> &existingActions, int &showError);
void updateStatusBarInfo(); void updateStatusBarInfo();
void updateWindowTitle(); void updateWindowTitle();
bool updateGraphTabs(); void updateGraphTabs();
void updateDataDEMDownloadAction(); void updateDataDEMDownloadAction();
void updateMapDEMDownloadAction(); void updateMapDEMDownloadAction();
#ifndef Q_OS_ANDROID #ifndef Q_OS_ANDROID