[Kst] kdeextragear-2/kst/kst
George Staikos
staikos at kde.org
Tue Jul 15 21:44:07 CEST 2003
CVS commit by staikos:
don't access elements of the list that don't exist
M +19 -16 kstview.cpp 1.22
--- kdeextragear-2/kst/kst/kstview.cpp #1.21:1.22
@@ -427,6 +427,6 @@ void KstView::mousePressEvent(QMouseEven
if (e->button() == Qt::LeftButton) {
/* search through the plots */
- for (i=0; i < KST::plotList.count(); i++) {
- plot = (KST::plotList.at(i));
+ for (i = 0; i < KST::plotList.count(); i++) {
+ plot = KST::plotList.at(i);
win_rect = plot->GetWinRegion();
plot_rect = plot->GetPlotRegion();
@@ -453,6 +453,6 @@ void KstView::mousePressEvent(QMouseEven
}
} else if (e->button() == Qt::RightButton) {
- for (i=0; i < KST::plotList.count(); i++) {
- win_rect = (KST::plotList.at(i))->GetPlotRegion();
+ for (i = 0; i < KST::plotList.count(); i++) {
+ win_rect = KST::plotList.at(i)->GetPlotRegion();
if (win_rect.contains(e->pos())) {
MouseInfo->setMode(INACTIVE);
@@ -488,4 +488,8 @@ void KstView::mouseReleaseEvent(QMouseEv
unsigned int count;
+ if (KST::plotList.isEmpty()) {
+ return;
+ }
+
i_plot = MouseInfo->getPlotNum();
plot = KST::plotList.at(i_plot);
@@ -500,5 +503,5 @@ void KstView::mouseReleaseEvent(QMouseEv
plot->getLScale(xmin, ymin, xmax, ymax);
- plotregion = plot -> GetPlotRegion();
+ plotregion = plot->GetPlotRegion();
new_xmin = (double)(MouseInfo->getMouseRect().left() -
plotregion.left())/
@@ -515,11 +518,11 @@ void KstView::mouseReleaseEvent(QMouseEv
count = KST::plotList.count();
- for (i_plot=0; i_plot<count; i_plot++) {
+ for (i_plot = 0; i_plot < count; i_plot++) {
iplot = KST::plotList.at(i_plot);
- if ((plot==iplot) || (iplot->isTied())) {
- iplot -> setXScaleMode(FIXED);
- iplot -> setYScaleMode(FIXED);
- iplot -> setLScale(new_xmin, new_ymin, new_xmax, new_ymax);
- iplot -> pushScale();
+ if (plot == iplot || iplot->isTied()) {
+ iplot->setXScaleMode(FIXED);
+ iplot->setYScaleMode(FIXED);
+ iplot->setLScale(new_xmin, new_ymin, new_xmax, new_ymax);
+ iplot->pushScale();
}
}
@@ -540,7 +543,7 @@ void KstView::mouseReleaseEvent(QMouseEv
count = KST::plotList.count();
- for (i_plot=0; i_plot<count; i_plot++) {
+ for (i_plot = 0; i_plot < count; i_plot++) {
iplot = KST::plotList.at(i_plot);
- if ((plot==iplot) || (iplot->isTied())) {
+ if (plot == iplot || iplot->isTied()) {
iplot->setYScaleMode(FIXED);
iplot->setLYScale(new_ymin, new_ymax);
@@ -565,7 +568,7 @@ void KstView::mouseReleaseEvent(QMouseEv
count = KST::plotList.count();
- for (i_plot=0; i_plot<count; i_plot++) {
+ for (i_plot = 0; i_plot < count; i_plot++) {
iplot = KST::plotList.at(i_plot);
- if ((plot==iplot) || (iplot->isTied())) {
+ if (plot == iplot || iplot->isTied()) {
iplot->setXScaleMode(FIXED);
iplot->setLXScale(new_xmin, new_xmax);
More information about the Kst
mailing list