Fix SEGV on add chart with Qt5

.. and also selects the first chart on the chartbar at startup.
This commit is contained in:
Mark Liversedge
2014-03-12 13:28:01 +00:00
parent 9ff760feed
commit 14031a0063
3 changed files with 13 additions and 3 deletions

View File

@@ -251,6 +251,12 @@ ChartBar::removeWidget(int index)
}
void
ChartBar::setCurrentIndex(int index)
{
clicked(index);
}
void
ChartBar::clicked(int index)
{

View File

@@ -58,7 +58,7 @@ public slots:
void clicked(int);
void removeWidget(int);
void setText(int index, QString);
//void setCurrentIndex(int index);
void setCurrentIndex(int index);
void scrollLeft();
void scrollRight();
void tidy();

View File

@@ -176,7 +176,9 @@ HomeWindow::addChartFromMenu(QAction*action)
}
}
if (id != GcWindowTypes::None) appendChart(id); // called from Context to inset chart
if (id != GcWindowTypes::None) {
appendChart(id); // called from Context to inset chart
}
}
void
@@ -281,6 +283,7 @@ HomeWindow::tabSelected(int index)
controlStack->setCurrentIndex(index);
titleEdit->setText(charts[index]->property("title").toString());
tabbed->setCurrentIndex(index);
chartbar->setCurrentIndex(index);
}
active = false;
@@ -427,7 +430,7 @@ HomeWindow::appendChart(GcWinID id)
// returns null if cancelled or closed
if (newone) {
addChart(newone);
newone->show();
//newone->show() //Crash on QT5
}
// now wipe it
@@ -579,6 +582,7 @@ HomeWindow::addChart(GcWindow* newone)
titleEdit->setText("");
}
// select the last tab just added
active = false;
}