mirror of
https://github.com/GoldenCheetah/GoldenCheetah.git
synced 2026-02-14 08:38:45 +00:00
IntervalItem::name removed
The class member IntervalItem::name is redundant since it is a duplicate of the text() member of the base class QTreeWidgetItem. By removing it we both simplify the code and remove the need to keep name and text in sync when renaming and creating intervals. As a result the itemChanged signal that was connected for renames and then disconnected when the items are cleared can be connected once and no disconnect is neccessary. This connect/disconnect oddity was originally to avoid a SEGV that resulted from accessing text() whilst the QTreeWidgetItem was being destroyed. The code for removing intervals when a new ride is selected no longer destroys and recreats MainWindow::allIntervals (which was also an artefact of the original code to avoid a SEGV).
This commit is contained in:
committed by
Sean Rhea
parent
0dc9f6a4c0
commit
bfc0d1575a
@@ -399,7 +399,7 @@ AllPlotWindow::setEndSelection(double xValue, bool newInterval, QString name)
|
||||
// are we adjusting an existing interval? - if so delete it and readd it
|
||||
if (count > 0) {
|
||||
IntervalItem *bottom = (IntervalItem *) allIntervals->child(count-1);
|
||||
if (bottom->name == name) delete allIntervals->takeChild(count-1);
|
||||
if (bottom->text(0) == name) delete allIntervals->takeChild(count-1);
|
||||
}
|
||||
|
||||
QTreeWidgetItem *last = new IntervalItem(ride->ride, name, duration1, duration2, distance1, distance2);
|
||||
|
||||
Reference in New Issue
Block a user