mirror of
https://github.com/GoldenCheetah/GoldenCheetah.git
synced 2026-02-13 16:18:42 +00:00
Fix strange behaviour when changing views
The problem was introduce by 3a16d1e, the change in perspectiveSelector
current index triggers currentIndexChanged when the view change has
not been finished, to avoid this we use activated signal and add
a check to do nothing when the index has not changed.
The problem was reported at the forum.
This commit is contained in:
@@ -342,7 +342,8 @@ MainWindow::MainWindow(const QDir &home)
|
||||
perspectiveSelector->setStyle(toolStyle);
|
||||
perspectiveSelector->setFixedWidth(200 * dpiXFactor);
|
||||
perspectiveSelector->setFixedHeight(gl_toolheight * dpiYFactor);
|
||||
connect(perspectiveSelector, SIGNAL(currentIndexChanged(int)), this, SLOT(perspectiveSelected(int)));
|
||||
// activated instead of currentIndexChange signal is used to avoid triggering when changed by code due to 3a16d1e
|
||||
connect(perspectiveSelector, SIGNAL(activated(int)), this, SLOT(perspectiveSelected(int)));
|
||||
HelpWhatsThis *helpPerspectiveSelector = new HelpWhatsThis(perspectiveSelector);
|
||||
perspectiveSelector->setWhatsThis(helpPerspectiveSelector->getWhatsThisText(HelpWhatsThis::ToolBar_PerspectiveSelector));
|
||||
|
||||
@@ -1484,6 +1485,8 @@ MainWindow::perspectiveSelected(int index)
|
||||
// which perspective is currently being shown?
|
||||
int prior = current->perspectives_.indexOf(current->perspective_);
|
||||
|
||||
if (prior == index) return; // activated but nothing changed
|
||||
|
||||
if (index < current->perspectives_.count()) {
|
||||
|
||||
// a perspectives was selected
|
||||
|
||||
Reference in New Issue
Block a user