~showard314/ubuntu/natty/qtiplot/Python2.7_fix

« back to all changes in this revision

Viewing changes to qtiplot/src/PlotDialog.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Fathi Boudra
  • Date: 2008-04-04 15:11:55 UTC
  • mfrom: (1.1.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20080404151155-rjp12ziov4tryj0o
Tags: 0.9.4-1
* New upstream release.
* Refresh patches.
* Remove 04_homepage_url patch. Merged upstream.

Show diffs side-by-side

added added

removed removed

Lines of Context:
73
73
{
74
74
    setName( "PlotDialog" );
75
75
        setWindowTitle( tr( "QtiPlot - Plot details" ) );
 
76
        setModal(true);
 
77
        setSizeGripEnabled(true);
76
78
 
77
79
        listBox = new QTreeWidget();
78
80
    listBox->setColumnCount(1);
80
82
    listBox->setIndentation(15);
81
83
 
82
84
    QGridLayout *gl = new QGridLayout(this);
83
 
        gl->setSizeConstraint(QLayout::SetFixedSize);
84
85
    gl->addWidget(listBox, 0, 0);
85
86
 
86
87
        privateTabWidget = new QTabWidget();
104
105
        initBoxPage();
105
106
        initPercentilePage();
106
107
        initSpectrogramPage();
107
 
        initPiePage();
 
108
        initPiePage();
 
109
        initPieGeometryPage();
 
110
        initPieLabelsPage();
108
111
        initLayerPage();
109
112
        initLayerGeometryPage();
110
113
        initFontsPage();
136
139
 
137
140
        connect(btnMore, SIGNAL(toggled(bool)), this, SLOT(showAll(bool)));
138
141
 
139
 
        connect( buttonOk, SIGNAL(clicked()), this, SLOT(quit() ) );
 
142
        connect( buttonOk, SIGNAL(clicked()), this, SLOT(quit()));
140
143
        connect( buttonCancel, SIGNAL(clicked()), this, SLOT(close()));
141
 
        connect( buttonApply, SIGNAL(clicked() ), this, SLOT(acceptParams() ) );
 
144
        connect( buttonApply, SIGNAL(clicked() ), this, SLOT(acceptParams()));
142
145
        connect( btnWorksheet, SIGNAL(clicked()), this, SLOT(showWorksheet()));
143
146
        connect( btnEditCurve, SIGNAL(clicked()), this, SLOT(editCurve()));
144
147
        connect(listBox, SIGNAL(itemDoubleClicked( QTreeWidgetItem *, int)),
195
198
        return;
196
199
    }
197
200
 
198
 
        if (((PlotCurve *)it)->type() == Graph::Function)
199
 
        {
200
 
            close();
201
 
            app->showFunctionDialog(((CurveTreeItem *)item)->graph(), ((CurveTreeItem *)item)->plotItemIndex());
202
 
        }
203
 
        else
204
 
        {
205
 
            close();
206
 
        app->showPlotAssociations(((CurveTreeItem *)item)->plotItemIndex());
 
201
        hide();
 
202
        if (((PlotCurve *)it)->type() == Graph::Function){
 
203
            FunctionDialog *fd = app->showFunctionDialog(((CurveTreeItem *)item)->graph(), ((CurveTreeItem *)item)->plotItemIndex());
 
204
                if (fd)
 
205
                        connect((QObject *)fd, SIGNAL(destroyed()), this, SLOT(show()));
 
206
        } else {
 
207
        AssociationsDialog* ad = app->showPlotAssociations(((CurveTreeItem *)item)->plotItemIndex());
 
208
                if (ad)
 
209
                        connect((QObject *)ad, SIGNAL(destroyed()), this, SLOT(show()));
207
210
        }
208
211
}
209
212
 
220
223
        int index = item->plotItemIndex();
221
224
        int curveType = ((PlotCurve *)item->plotItem())->type();
222
225
 
223
 
        close();
 
226
        hide();
224
227
 
225
 
        if (app)
226
 
        {
227
 
                if (curveType == Graph::Function)
228
 
                        app->showFunctionDialog(item->graph(), index);
229
 
                else
230
 
                        app->showPlotAssociations(index);
 
228
        if (app){
 
229
                if (curveType == Graph::Function){
 
230
                        FunctionDialog *fd = app->showFunctionDialog(item->graph(), index);
 
231
                        if (fd)
 
232
                                connect((QObject *)fd, SIGNAL(destroyed()), this, SLOT(show()));
 
233
                } else {
 
234
                        AssociationsDialog* ad = app->showPlotAssociations(index);
 
235
                        if (ad)
 
236
                                connect((QObject *)ad, SIGNAL(destroyed()), this, SLOT(show()));
 
237
                }
231
238
        }
232
239
}
233
240
 
472
479
        gl1->addWidget(boxPieLineStyle);
473
480
 
474
481
        gl1->addWidget(new QLabel(tr( "Width")), 2, 0);
475
 
        boxPieLineWidth = new QSpinBox();
 
482
        boxPieLineWidth = new DoubleSpinBox('f');
 
483
        boxPieLineWidth->setSingleStep(0.1);
 
484
        boxPieLineWidth->setLocale(((ApplicationWindow *)this->parent())->locale());
476
485
        gl1->addWidget(boxPieLineWidth, 2, 1);
477
486
        gl1->setRowStretch(3,1);
478
487
 
488
497
        gl2->addWidget(new QLabel( tr( "Pattern" )), 1, 0);
489
498
        boxPiePattern = new PatternBox(false);
490
499
        gl2->addWidget(boxPiePattern, 1, 1);
491
 
        gl2->addWidget(new QLabel( tr( "Pie radius" )), 2, 0);
492
 
 
493
 
        boxRadius = new QSpinBox();
494
 
        boxRadius->setRange(0, 10000);
495
 
        boxRadius->setSingleStep(10);
496
 
 
497
 
        gl2->addWidget(boxRadius, 2, 1);
498
 
        gl2->setRowStretch(3,1);
 
500
        gl2->setRowStretch(2, 1);
499
501
 
500
502
        QGroupBox *gb2 = new QGroupBox(tr( "Fill" ));
501
503
        gb2->setLayout(gl2);
505
507
        hl->addWidget(gb2);
506
508
        piePage->setLayout(hl);
507
509
 
508
 
        privateTabWidget->addTab(piePage, tr( "Pie" ) );
 
510
        privateTabWidget->addTab(piePage, tr( "Pattern" ) );
509
511
}
 
512
 
 
513
void PlotDialog::initPieGeometryPage()
 
514
{
 
515
    pieGeometryPage = new QWidget();
 
516
 
 
517
        QLocale locale = ((ApplicationWindow *)this->parent())->locale();
 
518
 
 
519
        QGroupBox *gb3 = new QGroupBox(tr( "3D View" ));
 
520
        QGridLayout *gl3 = new QGridLayout(gb3);
 
521
        gl3->addWidget(new QLabel( tr( "View Angle (deg)" )), 0, 0);
 
522
        boxPieViewAngle = new DoubleSpinBox('f');
 
523
        boxPieViewAngle->setWrapping(true);
 
524
        boxPieViewAngle->setRange(0.0, 90.0);
 
525
        boxPieViewAngle->setLocale(locale);
 
526
        gl3->addWidget(boxPieViewAngle, 0, 1);
 
527
 
 
528
    gl3->addWidget(new QLabel( tr( "Thickness (% of radius)" )), 1, 0);
 
529
        boxPieThickness = new DoubleSpinBox('f');
 
530
        boxPieThickness->setLocale(locale);
 
531
        boxPieThickness->setRange(0.0, 300.0);
 
532
        gl3->addWidget(boxPieThickness, 1, 1);
 
533
        gl3->setRowStretch(2, 1);
 
534
 
 
535
        QGroupBox *gb1 = new QGroupBox(tr( "Rotation" ));
 
536
        QGridLayout *gl1 = new QGridLayout(gb1);
 
537
        gl1->addWidget(new QLabel( tr( "Starting Azimuth (deg)" )), 0, 0);
 
538
        boxPieStartAzimuth = new DoubleSpinBox('f');
 
539
        boxPieStartAzimuth->setRange(0.0, 360.0);
 
540
        boxPieStartAzimuth->setWrapping(true);
 
541
        boxPieStartAzimuth->setSingleStep(10.0);
 
542
        boxPieStartAzimuth->setLocale(locale);
 
543
        gl1->addWidget(boxPieStartAzimuth, 0, 1);
 
544
 
 
545
    boxPieConterClockwise = new QCheckBox(tr("Counter cloc&kwise"));
 
546
        gl1->addWidget(boxPieConterClockwise, 1, 0);
 
547
        gl1->setRowStretch(2, 1);
 
548
 
 
549
        QGroupBox *gb2 = new QGroupBox(tr( "Radius/Center" ));
 
550
        QGridLayout *gl2 = new QGridLayout(gb2);
 
551
        gl2->addWidget(new QLabel( tr( "Radius (% of frame)" )), 0, 0);
 
552
        boxRadius = new QSpinBox();
 
553
        boxRadius->setRange(0, 300);
 
554
        boxRadius->setSingleStep(5);
 
555
        gl2->addWidget(boxRadius, 0, 1);
 
556
    gl2->addWidget(new QLabel( tr( "Horizontal Offset (% of frame)" )), 1, 0);
 
557
    boxPieOffset = new QSpinBox();
 
558
        boxPieOffset->setRange(-100, 100);
 
559
        gl2->addWidget(boxPieOffset, 1, 1);
 
560
        gl2->setRowStretch(2, 1);
 
561
 
 
562
        QVBoxLayout* vl = new QVBoxLayout(pieGeometryPage);
 
563
        vl->addWidget(gb3);
 
564
        vl->addWidget(gb1);
 
565
        vl->addWidget(gb2);
 
566
 
 
567
        privateTabWidget->addTab(pieGeometryPage, tr( "Pie Geometry" ) );
 
568
 
 
569
    connect(boxPieConterClockwise, SIGNAL(toggled(bool)), this, SLOT(acceptParams()));
 
570
    connect(boxPieViewAngle, SIGNAL(valueChanged(double)), this, SLOT(acceptParams()));
 
571
    connect(boxPieThickness, SIGNAL(valueChanged(double)), this, SLOT(acceptParams()));
 
572
    connect(boxPieStartAzimuth, SIGNAL(valueChanged(double)), this, SLOT(acceptParams()));
 
573
    connect(boxRadius, SIGNAL(valueChanged(int)), this, SLOT(acceptParams()));
 
574
    connect(boxPieOffset, SIGNAL(valueChanged(int)), this, SLOT(acceptParams()));
 
575
}
 
576
 
 
577
void PlotDialog::initPieLabelsPage()
 
578
{
 
579
        pieLabelsPage = new QWidget();
 
580
 
 
581
    pieAutoLabelsBox = new QGroupBox(tr("Automatic &Format"));
 
582
        pieAutoLabelsBox->setCheckable(true);
 
583
 
 
584
        QGridLayout *gl1 = new QGridLayout(pieAutoLabelsBox);
 
585
        boxPieValues = new QCheckBox(tr("&Values"));
 
586
        gl1->addWidget(boxPieValues, 0, 0);
 
587
 
 
588
        boxPiePercentages = new QCheckBox(tr("&Percentages"));
 
589
        gl1->addWidget(boxPiePercentages, 1, 0);
 
590
 
 
591
        boxPieCategories = new QCheckBox(tr("Categories/&Rows"));
 
592
        gl1->addWidget(boxPieCategories, 2, 0);
 
593
 
 
594
        gl1->setRowStretch(3, 1);
 
595
 
 
596
    boxPieWedge = new QGroupBox(tr( "Associate Position with &Wedge" ));
 
597
        boxPieWedge->setCheckable(true);
 
598
 
 
599
        QGridLayout *gl2 = new QGridLayout(boxPieWedge);
 
600
        gl2->addWidget(new QLabel( tr( "Dist. from Pie Edge" )), 0, 0);
 
601
        boxPieEdgeDist = new DoubleSpinBox('f');
 
602
        boxPieEdgeDist->setRange(-100, 100);
 
603
        boxPieEdgeDist->setLocale(((ApplicationWindow *)this->parent())->locale());
 
604
        gl2->addWidget(boxPieEdgeDist, 0, 1);
 
605
        gl2->setRowStretch(1, 1);
 
606
 
 
607
        QVBoxLayout* vl = new QVBoxLayout(pieLabelsPage);
 
608
        vl->addWidget(pieAutoLabelsBox);
 
609
        vl->addWidget(boxPieWedge);
 
610
 
 
611
        privateTabWidget->addTab(pieLabelsPage, tr( "Labels" ) );
 
612
 
 
613
    connect(boxPieEdgeDist, SIGNAL(valueChanged(double)), this, SLOT(acceptParams()));
 
614
}
510
615
 
511
616
void PlotDialog::initPrintPage()
512
617
{
638
743
        gl1->addWidget(boxLineStyle, 1, 1);
639
744
 
640
745
        gl1->addWidget(new QLabel(tr( "Width" )), 2, 0);
641
 
        boxLineWidth = new QSpinBox();
642
 
        boxLineWidth->setMinValue( 1 );
 
746
        boxLineWidth = new DoubleSpinBox('f');
 
747
        boxLineWidth->setLocale(((ApplicationWindow *)this->parent())->locale());
 
748
        boxLineWidth->setSingleStep(0.1);
 
749
        boxLineWidth->setMinimum(0.1);
643
750
        boxLineWidth->setValue( 1 );
644
751
        gl1->addWidget(boxLineWidth, 2, 1);
645
752
 
665
772
        hlayout->addWidget(fillGroupBox);
666
773
        privateTabWidget->addTab( linePage, tr( "Line" ) );
667
774
 
 
775
        connect(boxLineWidth, SIGNAL(valueChanged(double)), this, SLOT(acceptParams()));
668
776
        connect(boxLineColor, SIGNAL(activated(int)), this, SLOT(acceptParams()));
669
777
        connect(boxConnect, SIGNAL(activated(int)), this, SLOT(acceptParams()));
670
778
        connect(boxLineStyle, SIGNAL(activated(int)), this, SLOT(acceptParams()));
694
802
        boxSymbolColor = new ColorBox( false);
695
803
    gl->addWidget(boxSymbolColor, 3, 1);
696
804
    gl->addWidget(new QLabel(tr( "Edge Width" )), 4, 0);
697
 
        boxPenWidth = new QSpinBox();
698
 
    boxPenWidth->setRange(1, 100);
 
805
        boxPenWidth = new DoubleSpinBox('f');
 
806
        boxPenWidth->setLocale(((ApplicationWindow *)this->parent())->locale());
 
807
        boxPenWidth->setSingleStep(0.1);
 
808
    boxPenWidth->setRange(0.1, 100);
699
809
    gl->addWidget(boxPenWidth, 4, 1);
700
810
    gl->setRowStretch (5, 1);
701
811
 
857
967
    gl2->addWidget(boxEdgeColor, 2, 1);
858
968
 
859
969
    gl2->addWidget(new QLabel(tr( "Edge Width" )), 3, 0);
860
 
        boxEdgeWidth = new QSpinBox();
 
970
        boxEdgeWidth = new DoubleSpinBox('f');
 
971
        boxEdgeWidth->setLocale(((ApplicationWindow *)parent())->locale());
 
972
        boxEdgeWidth->setSingleStep(0.1);
861
973
    boxEdgeWidth->setRange(0, 100);
862
974
    gl2->addWidget(boxEdgeWidth, 3, 1);
863
975
    gl2->setRowStretch(4, 1);
935
1047
    gl1->addWidget(levelsColorBox, 0, 1);
936
1048
 
937
1049
    gl1->addWidget(new QLabel(tr( "Width" )), 1, 0);
938
 
        contourWidthBox = new QSpinBox();
 
1050
        contourWidthBox = new DoubleSpinBox('f');
 
1051
        contourWidthBox->setLocale(((ApplicationWindow *)parent())->locale());
 
1052
        contourWidthBox->setSingleStep(0.1);
 
1053
    contourWidthBox->setRange(0, 100);
939
1054
    gl1->addWidget(contourWidthBox, 1, 1);
940
1055
 
941
1056
    gl1->addWidget(new QLabel(tr( "Style" )), 2, 0);
1010
1125
    gl->addWidget(colorBox, 0, 1);
1011
1126
 
1012
1127
    gl->addWidget(new QLabel(tr( "Line Width" )), 1, 0);
1013
 
        widthBox = new QComboBox();
1014
 
        widthBox->addItem( tr( "1" ) );
1015
 
        widthBox->addItem( tr( "2" ) );
1016
 
        widthBox->addItem( tr( "3" ) );
1017
 
        widthBox->addItem( tr( "4" ) );
1018
 
        widthBox->addItem( tr( "5" ) );
1019
 
        widthBox->setEditable (true);
 
1128
        widthBox = new DoubleSpinBox('f');
 
1129
        widthBox->setLocale(((ApplicationWindow *)parent())->locale());
 
1130
        widthBox->setSingleStep(0.1);
 
1131
    widthBox->setRange(0, 100);
1020
1132
    gl->addWidget(widthBox, 1, 1);
1021
1133
 
1022
1134
    gl->addWidget(new QLabel(tr( "Cap Width" )), 2, 0);
1039
1151
        hl->addWidget(gb2);
1040
1152
    privateTabWidget->insertTab( errorsPage, tr( "Error Bars" ) );
1041
1153
 
 
1154
        connect(widthBox, SIGNAL(valueChanged(double)), this, SLOT(acceptParams()));
1042
1155
        connect(colorBox, SIGNAL(colorChanged()), this, SLOT(pickErrorBarsColor()));
1043
1156
        connect(xBox, SIGNAL(clicked()), this, SLOT(changeErrorBarsType()));
1044
1157
        connect(plusBox, SIGNAL(clicked()), this, SLOT(changeErrorBarsPlus()));
1107
1220
        vectColorBox = new ColorBox(false);
1108
1221
    gl1->addWidget(vectColorBox, 0, 1);
1109
1222
    gl1->addWidget(new QLabel(tr( "Line Width" )), 1, 0);
1110
 
        vectWidthBox = new QSpinBox();
 
1223
        vectWidthBox = new DoubleSpinBox('f');
 
1224
        vectWidthBox->setLocale(((ApplicationWindow *)parent())->locale());
 
1225
        vectWidthBox->setSingleStep(0.1);
1111
1226
    vectWidthBox->setRange(0, 100);
1112
1227
    gl1->addWidget(vectWidthBox, 1, 1);
1113
1228
 
1174
1289
    listBox->addTopLevelItem(item);
1175
1290
    listBox->setCurrentItem(item);
1176
1291
 
1177
 
    QWidgetList plots = ml->graphPtrs();
1178
 
    for (int i = 0; i < plots.count(); ++i){
1179
 
        Graph* g = (Graph*)plots.at(i);
1180
 
        if (!g)
1181
 
            continue;
1182
 
 
1183
 
        LayerItem *layer = new LayerItem(g, item, tr("Layer") + QString::number(i+1));
 
1292
    QList<Graph *> layers = ml->layersList();
 
1293
    int i = 0;
 
1294
    foreach(Graph *g, layers){
 
1295
        LayerItem *layer = new LayerItem(g, item, tr("Layer") + QString::number(++i));
1184
1296
        item->addChild(layer);
1185
1297
 
1186
1298
        if (g == ml->activeGraph()){
1325
1437
    if (!graph)
1326
1438
        return;
1327
1439
 
1328
 
        graph->updateErrorBars((QwtErrorPlotCurve *)item->plotItem(), xBox->isChecked(),widthBox->currentText().toInt(),
 
1440
        graph->updateErrorBars((QwtErrorPlotCurve *)item->plotItem(), xBox->isChecked(),widthBox->value(),
1329
1441
                        capBox->currentText().toInt(),colorBox->color(), plusBox->isChecked(),minusBox->isChecked(),
1330
1442
                        throughBox->isChecked());
1331
1443
}
1342
1454
    if (!graph)
1343
1455
        return;
1344
1456
 
1345
 
        graph->updateErrorBars((QwtErrorPlotCurve *)item->plotItem(), xBox->isChecked(),widthBox->currentText().toInt(),
 
1457
        graph->updateErrorBars((QwtErrorPlotCurve *)item->plotItem(), xBox->isChecked(),widthBox->value(),
1346
1458
                        capBox->currentText().toInt(), colorBox->color(),plusBox->isChecked(),minusBox->isChecked(),
1347
1459
                        throughBox->isChecked());
1348
1460
}
1359
1471
    if (!graph)
1360
1472
        return;
1361
1473
 
1362
 
        graph->updateErrorBars((QwtErrorPlotCurve *)item->plotItem(), xBox->isChecked(),widthBox->currentText().toInt(),
 
1474
        graph->updateErrorBars((QwtErrorPlotCurve *)item->plotItem(), xBox->isChecked(),widthBox->value(),
1363
1475
                        capBox->currentText().toInt(), colorBox->color(),plusBox->isChecked(),minusBox->isChecked(),
1364
1476
                        throughBox->isChecked());
1365
1477
}
1376
1488
    if (!graph)
1377
1489
        return;
1378
1490
 
1379
 
        graph->updateErrorBars((QwtErrorPlotCurve *)item->plotItem(), xBox->isChecked(), widthBox->currentText().toInt(),
 
1491
        graph->updateErrorBars((QwtErrorPlotCurve *)item->plotItem(), xBox->isChecked(), widthBox->value(),
1380
1492
                        capBox->currentText().toInt(), colorBox->color(), plusBox->isChecked(), minusBox->isChecked(),
1381
1493
                        throughBox->isChecked());
1382
1494
}
1393
1505
    if (!graph)
1394
1506
        return;
1395
1507
 
1396
 
        graph->updateErrorBars((QwtErrorPlotCurve *)item->plotItem(), xBox->isChecked(),widthBox->currentText().toInt(),
 
1508
        graph->updateErrorBars((QwtErrorPlotCurve *)item->plotItem(), xBox->isChecked(), widthBox->value(),
1397
1509
                        capBox->currentText().toInt(), colorBox->color(), plusBox->isChecked(), minusBox->isChecked(),
1398
1510
                        throughBox->isChecked());
1399
1511
}
1418
1530
 
1419
1531
    if (currentItem->type() == CurveTreeItem::PlotCurveTreeItem)
1420
1532
    {
1421
 
        CurveTreeItem *curveItem = (CurveTreeItem *)currentItem;
1422
 
        setActiveCurve(curveItem);
1423
 
 
 
1533
        CurveTreeItem *curveItem = (CurveTreeItem *)currentItem;                
1424
1534
        if (previousItem->type() != CurveTreeItem::PlotCurveTreeItem ||
1425
1535
           ((CurveTreeItem *)previousItem)->plotItemType() != curveItem->plotItemType())
1426
1536
        {
1431
1541
            if (!curvePlotTypeBox->isVisible())
1432
1542
                curvePlotTypeBox->show();
1433
1543
        }
 
1544
                setActiveCurve(curveItem);
1434
1545
    }
1435
1546
    else if (currentItem->type() == LayerItem::LayerTreeItem)
1436
1547
    {
1461
1572
{
1462
1573
    if (plot_type == Graph::Pie)
1463
1574
        {
1464
 
                privateTabWidget->addTab (piePage, tr("Pie"));
 
1575
                privateTabWidget->addTab (piePage, tr("Pattern"));
 
1576
                privateTabWidget->addTab (pieGeometryPage, tr("Pie Geometry"));
 
1577
                privateTabWidget->addTab (pieLabelsPage, tr("Labels"));
1465
1578
                privateTabWidget->showPage(piePage);
1466
 
                btnEditCurve->hide();
1467
1579
                return;
1468
1580
        }
1469
1581
 
1557
1669
        privateTabWidget->removeTab(privateTabWidget->indexOf(boxPage));
1558
1670
        privateTabWidget->removeTab(privateTabWidget->indexOf(percentilePage));
1559
1671
        privateTabWidget->removeTab(privateTabWidget->indexOf(spectrogramPage));
1560
 
    privateTabWidget->removeTab(privateTabWidget->indexOf(piePage));
1561
 
 
 
1672
    privateTabWidget->removeTab(privateTabWidget->indexOf(piePage));
 
1673
    privateTabWidget->removeTab(privateTabWidget->indexOf(pieGeometryPage));
 
1674
    privateTabWidget->removeTab(privateTabWidget->indexOf(pieLabelsPage));
1562
1675
        privateTabWidget->removeTab(privateTabWidget->indexOf(layerPage));
1563
1676
        privateTabWidget->removeTab(privateTabWidget->indexOf(layerGeometryPage));
1564
1677
        privateTabWidget->removeTab(privateTabWidget->indexOf(fontsPage));
1590
1703
int PlotDialog::setPlotType(CurveTreeItem *item)
1591
1704
{
1592
1705
        int curveType = item->plotItemType();
1593
 
        if (curveType >= 0)
1594
 
        {
 
1706
        if (curveType >= 0){
1595
1707
                boxPlotType->clear();
1596
1708
 
1597
1709
                if (curveType == Graph::ErrorBars)
1604
1716
                        boxPlotType->addItem( tr( "Horizontal Bars" ) );
1605
1717
                else if (curveType == Graph::Histogram)
1606
1718
                        boxPlotType->addItem( tr( "Histogram" ) );
1607
 
                else if (curveType == Graph::VectXYXY || curveType == Graph::VectXYAM)
1608
 
                {
 
1719
                else if (curveType == Graph::VectXYXY || curveType == Graph::VectXYAM){
1609
1720
                        boxPlotType->addItem( tr( "Vector XYXY" ) );
1610
1721
                        boxPlotType->addItem( tr( "Vector XYAM" ) );
1611
1722
                        if (curveType == Graph::VectXYAM)
1612
1723
                                boxPlotType->setCurrentIndex(1);
1613
 
                }
1614
 
                else if (curveType == Graph::Box)
 
1724
                } else if (curveType == Graph::Box)
1615
1725
                        boxPlotType->addItem( tr( "Box" ) );
1616
1726
                else if (curveType == Graph::ColorMap || curveType == Graph::GrayScale || curveType == Graph::Contour)
1617
1727
                boxPlotType->insertItem(tr("Contour") + " / " + tr("Image"));
1618
 
                else
1619
 
                {
 
1728
                else {
1620
1729
                        boxPlotType->addItem( tr( "Line" ) );
1621
1730
                        boxPlotType->addItem( tr( "Scatter" ) );
1622
1731
                        boxPlotType->addItem( tr( "Line + Symbol" ) );
1626
1735
                                return -1;
1627
1736
 
1628
1737
                        QwtSymbol s = c->symbol();
1629
 
                        if (s.style() == QwtSymbol::NoSymbol)
1630
 
                        {
 
1738
                        if (s.style() == QwtSymbol::NoSymbol){
1631
1739
                                boxPlotType->setCurrentIndex(0);
1632
1740
                                return Graph::Line;
1633
 
                        }
1634
 
                        else if (c->style() == QwtPlotCurve::NoCurve)
1635
 
                        {
 
1741
                        } else if (c->style() == QwtPlotCurve::NoCurve) {
1636
1742
                                boxPlotType->setCurrentIndex(1);
1637
1743
                                return Graph::Scatter;
1638
 
                        }
1639
 
                        else
1640
 
                        {
 
1744
                        } else {
1641
1745
                                boxPlotType->setCurrentIndex(2);
1642
1746
                                return Graph::LineSymbols;
1643
1747
                        }
1714
1818
        btnWorksheet->show();
1715
1819
    btnEditCurve->show();
1716
1820
 
1717
 
    int curveType = item->plotItemType();
1718
 
    if (curveType == Graph::Pie){
1719
 
        QwtPieCurve *pie = (QwtPieCurve*)i;
1720
 
        boxRadius->setValue(pie->ray());
1721
 
        boxPiePattern->setPattern(pie->pattern());
1722
 
        boxPieLineWidth->setValue(pie->pen().width());
1723
 
        boxPieLineColor->setColor(pie->pen().color());
1724
 
        setPiePenStyle(pie->pen().style());
1725
 
        boxFirstColor->setCurrentItem(pie->firstColor());
1726
 
        return;
1727
 
    }
1728
 
 
1729
1821
    //axes page
1730
 
    boxXAxis->setCurrentItem(i->xAxis()-2);
1731
 
    boxYAxis->setCurrentItem(i->yAxis());
 
1822
    boxXAxis->setCurrentIndex(i->xAxis()-2);
 
1823
    boxYAxis->setCurrentIndex(i->yAxis());
1732
1824
 
1733
1825
    if (i->rtti() == QwtPlotItem::Rtti_PlotSpectrogram){
1734
1826
        btnEditCurve->hide();
1749
1841
        defaultContourBox->setChecked(sp->defaultContourPen().style() != Qt::NoPen);
1750
1842
 
1751
1843
        levelsColorBox->setColor(sp->defaultContourPen().color());
1752
 
        contourWidthBox->setValue(sp->defaultContourPen().width());
 
1844
        contourWidthBox->setValue(sp->defaultContourPen().widthF());
1753
1845
        if (sp->defaultContourPen().style() != Qt::NoPen)
1754
1846
            boxContourStyle->setCurrentIndex(sp->defaultContourPen().style() - 1);
1755
1847
        else
1762
1854
    }
1763
1855
 
1764
1856
    PlotCurve *c = (PlotCurve*)i;
 
1857
        if (c->type() == Graph::Function)
 
1858
        btnEditCurve->setText(tr("&Edit..."));
 
1859
    else
 
1860
        btnEditCurve->setText(tr("&Plot Associations..."));
 
1861
 
 
1862
        int curveType = item->plotItemType();
 
1863
    if (curveType == Graph::Pie){
 
1864
        QwtPieCurve *pie = (QwtPieCurve*)i;
 
1865
        boxPiePattern->setPattern(pie->pattern());
 
1866
        boxPieLineWidth->setValue(pie->pen().widthF());
 
1867
        boxPieLineColor->setColor(pie->pen().color());
 
1868
        setPiePenStyle(pie->pen().style());
 
1869
        boxFirstColor->setCurrentIndex(pie->firstColor());
 
1870
 
 
1871
        boxPieViewAngle->blockSignals(true);
 
1872
                boxPieViewAngle->setValue(pie->viewAngle());
 
1873
                boxPieViewAngle->blockSignals(false);
 
1874
                boxPieThickness->blockSignals(true);
 
1875
                boxPieThickness->setValue(pie->thickness());
 
1876
                boxPieThickness->blockSignals(false);
 
1877
                boxPieStartAzimuth->blockSignals(true);
 
1878
                boxPieStartAzimuth->setValue(pie->startAzimuth());
 
1879
                boxPieStartAzimuth->blockSignals(false);
 
1880
                boxPieConterClockwise->blockSignals(true);
 
1881
                boxPieConterClockwise->setChecked(pie->counterClockwise());
 
1882
                boxPieConterClockwise->blockSignals(false);
 
1883
                boxRadius->blockSignals(true);
 
1884
        boxRadius->setValue(pie->radius());
 
1885
        boxRadius->blockSignals(false);
 
1886
        boxPieOffset->blockSignals(true);
 
1887
        boxPieOffset->setValue((int)pie->horizontalOffset());
 
1888
        boxPieOffset->blockSignals(false);
 
1889
 
 
1890
                pieAutoLabelsBox->setChecked(pie->labelsAutoFormat());
 
1891
                boxPieValues->setChecked(pie->labelsValuesFormat());
 
1892
                boxPiePercentages->setChecked(pie->labelsPercentagesFormat());
 
1893
                boxPieCategories->setChecked(pie->labelCategories());
 
1894
                boxPieEdgeDist->blockSignals(true);
 
1895
                boxPieEdgeDist->setValue(pie->labelsEdgeDistance());
 
1896
                boxPieEdgeDist->blockSignals(false);
 
1897
                boxPieWedge->setChecked(pie->fixedLabelsPosition());
 
1898
        return;
 
1899
    }
1765
1900
 
1766
1901
    //line page
1767
1902
    int style = c->style();
1773
1908
 
1774
1909
    setPenStyle(c->pen().style());
1775
1910
    boxLineColor->setColor(c->pen().color());
1776
 
    boxLineWidth->setValue(c->pen().width());
 
1911
        boxLineWidth->blockSignals(true);
 
1912
    boxLineWidth->setValue(c->pen().widthF());
 
1913
        boxLineWidth->blockSignals(false);
1777
1914
    fillGroupBox->blockSignals(true);
1778
1915
    fillGroupBox->setChecked(c->brush().style() != Qt::NoBrush );
1779
1916
    fillGroupBox->blockSignals(false);
1785
1922
    boxSymbolSize->setValue(s.size().width()/2);
1786
1923
    boxSymbolStyle->setStyle(s.style());
1787
1924
    boxSymbolColor->setColor(s.pen().color());
1788
 
    boxPenWidth->setValue(s.pen().width());
 
1925
    boxPenWidth->setValue(s.pen().widthF());
1789
1926
    boxFillSymbol->setChecked(s.brush() != Qt::NoBrush);
1790
1927
    boxFillColor->setEnabled(s.brush() != Qt::NoBrush);
1791
1928
    boxFillColor->setColor(s.brush().color());
1792
 
 
 
1929
 
 
1930
    if (c->type() == Graph::Function)
 
1931
        return;
 
1932
 
1793
1933
    if (curveType == Graph::VerticalBars || curveType == Graph::HorizontalBars ||
1794
1934
                                curveType == Graph::Histogram){//spacing page
1795
1935
        QwtBarCurve *b = (QwtBarCurve*)i;
1826
1966
    if (curveType == Graph::ErrorBars){
1827
1967
        QwtErrorPlotCurve *err = (QwtErrorPlotCurve*)i;
1828
1968
        if (err){
1829
 
            xBox->setChecked(err->xErrors());
1830
 
            widthBox->setEditText(QString::number(err->width()));
 
1969
                        widthBox->blockSignals(true);
 
1970
            widthBox->setValue(err->width());
 
1971
                        widthBox->blockSignals(false);
1831
1972
            capBox->setEditText(QString::number(err->capLength()));
 
1973
 
 
1974
                        colorBox->blockSignals(true);
1832
1975
            colorBox->setColor(err->color());
 
1976
                        colorBox->blockSignals(false);
 
1977
 
 
1978
                        throughBox->blockSignals(true);
1833
1979
            throughBox->setChecked(err->throughSymbol());
 
1980
                        throughBox->blockSignals(false);
 
1981
                        plusBox->blockSignals(true);
1834
1982
            plusBox->setChecked(err->plusSide());
 
1983
                        plusBox->blockSignals(false);
 
1984
                        minusBox->blockSignals(true);
1835
1985
            minusBox->setChecked(err->minusSide());
 
1986
                        minusBox->blockSignals(false);
 
1987
                        xBox->blockSignals(true);
 
1988
                        xBox->setChecked(err->xErrors());
 
1989
                        xBox->blockSignals(false);
1836
1990
        }
1837
1991
                return;
1838
1992
    }
1851
2005
            boxPercFillColor->setEnabled(s.brush() != Qt::NoBrush);
1852
2006
            boxPercFillColor->setColor(s.brush().color());
1853
2007
            boxEdgeColor->setColor(s.pen().color());
1854
 
            boxEdgeWidth->setValue(s.pen().width());
 
2008
            boxEdgeWidth->setValue(s.pen().widthF());
1855
2009
 
1856
2010
            boxRange->setCurrentIndex (b->boxRangeType()-1);
1857
2011
            boxType->setCurrentIndex (b->boxStyle());
1872
2026
        }
1873
2027
                return;
1874
2028
    }
1875
 
 
1876
 
        if (c->type() == Graph::Function){
1877
 
        btnEditCurve->setText(tr("&Edit..."));
 
2029
 
 
2030
    DataCurve *dc = (DataCurve *)i;
 
2031
        if (!dc->table()){
 
2032
                privateTabWidget->removeTab(privateTabWidget->indexOf(labelsPage));
1878
2033
                return;
1879
 
    } else
1880
 
        btnEditCurve->setText(tr("&Plot Associations..."));
1881
 
 
1882
 
    DataCurve *dc = (DataCurve *)i;
 
2034
        }
1883
2035
    labelsGroupBox->blockSignals(true);
1884
2036
    labelsGroupBox->setChecked(dc->hasLabels());
1885
2037
 
1946
2098
                if (!boxAll->isChecked())
1947
2099
                        return true;
1948
2100
 
1949
 
                QWidgetList allPlots = d_ml->graphPtrs();
1950
 
                for (int i=0; i<allPlots.count();i++){
1951
 
                        Graph* g = (Graph*)allPlots.at(i);
1952
 
                        if (g){
1953
 
                                g->setFrame(boxBorderWidth->value(), boxBorderColor->color());
1954
 
                                g->setMargin(boxMargin->value());
1955
 
 
1956
 
                                QColor c = boxBackgroundColor->color();
1957
 
                                c.setAlpha(boxBackgroundTransparency->value());
1958
 
                                g->setBackgroundColor(c);
1959
 
 
1960
 
                                c = boxCanvasColor->color();
1961
 
                                c.setAlpha(boxCanvasTransparency->value());
1962
 
                                g->setCanvasBackground(c);
1963
 
 
1964
 
                                g->setAntialiasing(boxAntialiasing->isChecked());
1965
 
                        }
 
2101
                QList<Graph *> layers = d_ml->layersList();
 
2102
        foreach(Graph *g, layers){
 
2103
            g->setFrame(boxBorderWidth->value(), boxBorderColor->color());
 
2104
            g->setMargin(boxMargin->value());
 
2105
 
 
2106
            QColor c = boxBackgroundColor->color();
 
2107
            c.setAlpha(boxBackgroundTransparency->value());
 
2108
            g->setBackgroundColor(c);
 
2109
 
 
2110
            c = boxCanvasColor->color();
 
2111
            c.setAlpha(boxCanvasTransparency->value());
 
2112
            g->setCanvasBackground(c);
 
2113
 
 
2114
            g->setAntialiasing(boxAntialiasing->isChecked());
1966
2115
                }
1967
2116
                return true;
1968
2117
        } else if (privateTabWidget->currentWidget() == layerGeometryPage){
2059
2208
            if (h->autoBinning() == automaticBox->isChecked() &&
2060
2209
                h->binSize() == binSizeBox->text().toDouble() &&
2061
2210
                h->begin() == histogramBeginBox->text().toDouble() &&
2062
 
                h->end() == histogramEndBox->text().toDouble()) return false;
 
2211
                h->end() == histogramEndBox->text().toDouble()) return true;
2063
2212
 
2064
2213
            h->setBinning(automaticBox->isChecked(), binSizeBox->text().toDouble(),
2065
2214
                         histogramBeginBox->text().toDouble(), histogramEndBox->text().toDouble());
2106
2255
                }
2107
2256
                return true;
2108
2257
        } else if (privateTabWidget->currentPage() == errorsPage){
2109
 
                graph->updateErrorBars((QwtErrorPlotCurve *)item->plotItem(), xBox->isChecked(), widthBox->currentText().toInt(),
 
2258
                graph->updateErrorBars((QwtErrorPlotCurve *)item->plotItem(), xBox->isChecked(), widthBox->value(),
2110
2259
                                capBox->currentText().toInt(), colorBox->color(), plusBox->isChecked(), minusBox->isChecked(),
2111
2260
                                throughBox->isChecked());
2112
2261
        return true;
2114
2263
                QwtPieCurve *pie = (QwtPieCurve*)plotItem;
2115
2264
                pie->setPen(QPen(boxPieLineColor->color(), boxPieLineWidth->value(),
2116
2265
                    Graph::getPenStyle(boxPieLineStyle->currentIndex())));
2117
 
        pie->setRay(boxRadius->value());
2118
2266
        pie->setBrushStyle(boxPiePattern->getSelectedPattern());
2119
2267
        pie->setFirstColor(boxFirstColor->currentIndex());
 
2268
        } else if (privateTabWidget->currentPage() == pieGeometryPage){
 
2269
                QwtPieCurve *pie = (QwtPieCurve*)plotItem;
 
2270
                pie->setViewAngle(boxPieViewAngle->value());
 
2271
                pie->setThickness(boxPieThickness->value());
 
2272
                pie->setRadius(boxRadius->value());
 
2273
        pie->setHorizontalOffset(boxPieOffset->value());
 
2274
        pie->setStartAzimuth(boxPieStartAzimuth->value());
 
2275
                pie->setCounterClockwise(boxPieConterClockwise->isChecked());
 
2276
        } else if (privateTabWidget->currentPage() == pieLabelsPage){
 
2277
                QwtPieCurve *pie = (QwtPieCurve*)plotItem;
 
2278
                pie->setLabelsAutoFormat(pieAutoLabelsBox->isChecked());
 
2279
        pie->setLabelValuesFormat(boxPieValues->isChecked());
 
2280
        pie->setLabelPercentagesFormat(boxPiePercentages->isChecked());
 
2281
                pie->setLabelCategories(boxPieCategories->isChecked());
 
2282
        pie->setFixedLabelsPosition(boxPieWedge->isChecked());
 
2283
        pie->setLabelsEdgeDistance(boxPieEdgeDist->value());
 
2284
        graph->replot();
2120
2285
        } else if (privateTabWidget->currentPage() == percentilePage){
2121
2286
                BoxCurve *b = (BoxCurve*)plotItem;
2122
2287
                if (b){
2459
2624
void PlotDialog::updateBackgroundTransparency(int alpha)
2460
2625
{
2461
2626
        boxBackgroundColor->setEnabled(alpha);
 
2627
    QColor c = boxBackgroundColor->color();
 
2628
    c.setAlpha(boxBackgroundTransparency->value());
2462
2629
 
2463
 
        if (boxAll->isChecked())
2464
 
        {
2465
 
                QWidgetList allPlots = d_ml->graphPtrs();
2466
 
                for (int i=0; i<allPlots.count();i++)
2467
 
                {
2468
 
                        Graph* g = (Graph*)allPlots.at(i);
2469
 
                        if (g)
2470
 
                        {
2471
 
                                QColor c = boxBackgroundColor->color();
2472
 
                                c.setAlpha(boxBackgroundTransparency->value());
2473
 
                                g->setBackgroundColor(c);
2474
 
                        }
2475
 
                }
2476
 
        }
2477
 
        else
2478
 
        {
 
2630
        if (boxAll->isChecked()){
 
2631
                QList<Graph *> layers = d_ml->layersList();
 
2632
        foreach(Graph *g, layers)
 
2633
            g->setBackgroundColor(c);
 
2634
        } else {
2479
2635
            LayerItem *item = (LayerItem *)listBox->currentItem();
2480
2636
        if (!item)
2481
2637
            return;
2482
2638
        Graph *g = item->graph();
2483
2639
                if (g)
2484
 
                {
2485
 
                        QColor c = boxBackgroundColor->color();
2486
 
                        c.setAlpha(boxBackgroundTransparency->value());
2487
2640
                        g->setBackgroundColor(c);
2488
 
                }
2489
2641
        }
2490
2642
}
2491
2643
 
2492
2644
void PlotDialog::updateCanvasTransparency(int alpha)
2493
2645
{
2494
2646
    boxCanvasColor->setEnabled(alpha);
 
2647
    QColor c = boxCanvasColor->color();
 
2648
    c.setAlpha(boxCanvasTransparency->value());
2495
2649
 
2496
 
        if (boxAll->isChecked())
2497
 
        {
2498
 
                QWidgetList allPlots = d_ml->graphPtrs();
2499
 
                for (int i=0; i<allPlots.count();i++)
2500
 
                {
2501
 
                        Graph* g = (Graph*)allPlots.at(i);
2502
 
                        if (g)
2503
 
                        {
2504
 
                                QColor c = boxCanvasColor->color();
2505
 
                                c.setAlpha(boxCanvasTransparency->value());
2506
 
                                g->setCanvasBackground(c);
2507
 
                        }
2508
 
                }
2509
 
        }
2510
 
        else
2511
 
        {
 
2650
        if (boxAll->isChecked()){
 
2651
                QList<Graph *> layers = d_ml->layersList();
 
2652
        foreach(Graph *g, layers)
 
2653
            g->setCanvasBackground(c);
 
2654
        } else {
2512
2655
                LayerItem *item = (LayerItem *)listBox->currentItem();
2513
2656
        if (!item)
2514
2657
            return;
2515
2658
        Graph *g = item->graph();
2516
2659
                if (g)
2517
 
                {
2518
 
                        QColor c = boxCanvasColor->color();
2519
 
                        c.setAlpha(boxCanvasTransparency->value());
2520
2660
                        g->setCanvasBackground(c);
2521
 
                }
2522
2661
        }
2523
2662
}
2524
2663
 
2525
2664
void PlotDialog::pickCanvasColor()
2526
2665
{
2527
 
        QColor c = boxCanvasColor->color();
 
2666
        QColor c = boxCanvasColor->color();
 
2667
    c.setAlpha(boxCanvasTransparency->value());
 
2668
 
2528
2669
        if (boxAll->isChecked()){
2529
 
                QWidgetList allPlots = d_ml->graphPtrs();
2530
 
                for (int i=0; i<allPlots.count();i++){
2531
 
                        Graph* g=(Graph*)allPlots.at(i);
2532
 
                        if (g){
2533
 
                                c.setAlpha(boxCanvasTransparency->value());
2534
 
                                g->setCanvasBackground(c);
2535
 
                                g->replot();
2536
 
                        }
2537
 
                }
 
2670
                QList<Graph *> layers = d_ml->layersList();
 
2671
        foreach(Graph *g, layers){
 
2672
            g->setCanvasBackground(c);
 
2673
            g->replot();
 
2674
        }
2538
2675
        } else {
2539
2676
                LayerItem *item = (LayerItem *)listBox->currentItem();
2540
2677
        if (!item)
2541
2678
            return;
2542
2679
        Graph *g = item->graph();
2543
2680
                if (g){
2544
 
                        c.setAlpha(boxCanvasTransparency->value());
2545
2681
                        g->setCanvasBackground(c);
2546
2682
                        g->replot();
2547
2683
                }
2550
2686
 
2551
2687
void PlotDialog::pickBackgroundColor()
2552
2688
{
2553
 
        QColor c = boxBackgroundColor->color();
 
2689
        QColor c = boxBackgroundColor->color();
 
2690
    c.setAlpha(boxBackgroundTransparency->value());
 
2691
 
2554
2692
        if (boxAll->isChecked()){
2555
 
                QWidgetList allPlots = d_ml->graphPtrs();
2556
 
                for (int i=0; i<(int)allPlots.count();i++){
2557
 
                        Graph* g=(Graph*)allPlots.at(i);
2558
 
                        if (g){
2559
 
                                c.setAlpha(boxBackgroundTransparency->value());
2560
 
                                g->setBackgroundColor(c);
2561
 
                                g->replot();
2562
 
                        }
 
2693
                QList<Graph *> layers = d_ml->layersList();
 
2694
        foreach(Graph *g, layers){
 
2695
            g->setBackgroundColor(c);
 
2696
            g->replot();
2563
2697
                }
2564
2698
        } else {
2565
2699
                LayerItem *item = (LayerItem *)listBox->currentItem();
2567
2701
            return;
2568
2702
        Graph *g = item->graph();
2569
2703
                if (g){
2570
 
                        c.setAlpha(boxBackgroundTransparency->value());
2571
2704
                        g->setBackgroundColor(c);
2572
2705
                        g->replot();
2573
2706
                }
2577
2710
void PlotDialog::pickBorderColor()
2578
2711
{
2579
2712
        if (boxAll->isChecked()){
2580
 
                QWidgetList allPlots = d_ml->graphPtrs();
2581
 
                for (int i=0; i<allPlots.count();i++){
2582
 
                        Graph* g=(Graph*)allPlots.at(i);
2583
 
                        if (g)
2584
 
                                g->setFrame(boxBorderWidth->value(), boxBorderColor->color());
2585
 
                }
 
2713
                QList<Graph *> layers = d_ml->layersList();
 
2714
        foreach(Graph *g, layers)
 
2715
            g->setFrame(boxBorderWidth->value(), boxBorderColor->color());
2586
2716
        } else {
2587
2717
                LayerItem *item = (LayerItem *)listBox->currentItem();
2588
2718
        if (!item)
2601
2731
 
2602
2732
        if (boxAll->isChecked())
2603
2733
        {
2604
 
                QWidgetList allPlots = d_ml->graphPtrs();
2605
 
                for (int i=0; i<allPlots.count();i++)
2606
 
                {
2607
 
                        Graph* g = (Graph*)allPlots.at(i);
2608
 
                        if (g)
2609
 
                                g->setAntialiasing(on);
2610
 
                }
 
2734
                QList<Graph *> layers = d_ml->layersList();
 
2735
        foreach(Graph *g, layers)
 
2736
            g->setAntialiasing(on);
2611
2737
        }
2612
2738
        else
2613
2739
        {
2627
2753
 
2628
2754
        if (boxAll->isChecked())
2629
2755
        {
2630
 
                QWidgetList allPlots = d_ml->graphPtrs();
2631
 
                for (int i=0; i<allPlots.count();i++)
2632
 
                {
2633
 
                        Graph* g=(Graph*)allPlots.at(i);
2634
 
                        if (g)
2635
 
                                g->setFrame(width, boxBorderColor->color());
2636
 
                }
 
2756
                QList<Graph *> layers = d_ml->layersList();
 
2757
        foreach(Graph *g, layers)
 
2758
            g->setFrame(width, boxBorderColor->color());
2637
2759
        }
2638
2760
        else
2639
2761
        {
2654
2776
 
2655
2777
    if (boxAll->isChecked())
2656
2778
    {
2657
 
        QWidgetList allPlots = d_ml->graphPtrs();
2658
 
        for (int i=0; i<allPlots.count();i++)
2659
 
        {
2660
 
            Graph* g=(Graph*)allPlots.at(i);
2661
 
            if (g)
2662
 
                g->setMargin(width);
2663
 
        }
 
2779
        QList<Graph *> layers = d_ml->layersList();
 
2780
        foreach(Graph *g, layers)
 
2781
            g->setMargin(width);
2664
2782
    }
2665
2783
    else
2666
2784
    {