52
52
#include < QComboBox>
53
53
#include < QWebFrame>
54
54
55
+ // graph
56
+ #if defined(QWT_VERSION) && QWT_VERSION<0x060000
57
+ #include < qwt_plot.h>
58
+ #include < qwt_plot_curve.h>
59
+ #include < qwt_symbol.h>
60
+ #endif
61
+
55
62
QgsIdentifyResultsWebView::QgsIdentifyResultsWebView ( QWidget *parent ) : QWebView( parent )
56
63
{
57
64
setSizePolicy ( QSizePolicy::MinimumExpanding, QSizePolicy::Minimum );
@@ -291,6 +298,30 @@ QgsIdentifyResultsDialog::QgsIdentifyResultsDialog( QgsMapCanvas *canvas, QWidge
291
298
cmbIdentifyMode->setCurrentIndex ( cmbIdentifyMode->findData ( identifyMode ) );
292
299
cbxAutoFeatureForm->setChecked ( mySettings.value ( " /Map/identifyAutoFeatureForm" , false ).toBool () );
293
300
301
+ // graph
302
+ mPlot ->setVisible ( false );
303
+ #if defined(QWT_VERSION) && QWT_VERSION<0x060000
304
+ mPlot ->setAutoFillBackground ( false );
305
+ mPlot ->setAutoDelete ( true );
306
+ QSizePolicy sizePolicy = QSizePolicy ( QSizePolicy::Expanding, QSizePolicy::Expanding );
307
+ sizePolicy.setHorizontalStretch ( 0 );
308
+ sizePolicy.setVerticalStretch ( 0 );
309
+ sizePolicy.setHeightForWidth ( mPlot ->sizePolicy ().hasHeightForWidth () );
310
+ mPlot ->setSizePolicy ( sizePolicy );
311
+ mPlot ->updateGeometry ();
312
+
313
+ mPlotCurve = new QwtPlotCurve ( " " );
314
+ mPlotCurve ->setSymbol ( QwtSymbol ( QwtSymbol::Ellipse, QBrush ( Qt::white ),
315
+ QPen ( Qt::red, 2 ), QSize ( 9 , 9 ) ) );
316
+ mPlotCurve ->attach ( mPlot );
317
+ #else
318
+ delete mPlot ;
319
+ mPlot = 0 ;
320
+ tabWidget->removeTab ( 2 );
321
+ #endif
322
+
323
+ connect ( buttonBox, SIGNAL ( rejected () ), this , SLOT ( close () ) );
324
+
294
325
connect ( lstResults, SIGNAL ( itemExpanded ( QTreeWidgetItem* ) ),
295
326
this , SLOT ( itemExpanded ( QTreeWidgetItem* ) ) );
296
327
@@ -315,6 +346,9 @@ QgsIdentifyResultsDialog::~QgsIdentifyResultsDialog()
315
346
316
347
if ( mActionPopup )
317
348
delete mActionPopup ;
349
+ #if defined(QWT_VERSION) && QWT_VERSION<0x060000
350
+ delete mPlotCurve ;
351
+ #endif
318
352
}
319
353
320
354
QTreeWidgetItem *QgsIdentifyResultsDialog::layerItem ( QObject *object )
@@ -705,6 +739,23 @@ void QgsIdentifyResultsDialog::addFeature( QgsRasterLayer *layer,
705
739
}
706
740
tblResults->resizeColumnToContents ( 1 );
707
741
742
+ // graph
743
+ #if defined(QWT_VERSION) && QWT_VERSION<0x060000
744
+ i = mPlotCurveXData .count ();
745
+ for ( QMap<QString, QString>::const_iterator it = attributes.begin (); it != attributes.end (); ++it )
746
+ {
747
+ mPlotCurveXData .append ( double ( ++i ) );
748
+ mPlotCurveYData .append ( double ( it.value ().toDouble () ) );
749
+ }
750
+ mPlotCurve ->setData ( mPlotCurveXData , mPlotCurveYData );
751
+
752
+ mPlot ->setAxisMaxMinor ( QwtPlot::xBottom, 0 );
753
+ // mPlot->setAxisScale( QwtPlot::xBottom, 1, mPlotCurve->dataSize());
754
+ // mPlot->setAxisScale( QwtPlot::yLeft, ymin, ymax );
755
+
756
+ mPlot ->replot ();
757
+ mPlot ->setVisible ( mPlotCurveXData .count () > 0 );
758
+ #endif
708
759
}
709
760
710
761
void QgsIdentifyResultsDialog::editingToggled ()
@@ -978,6 +1029,12 @@ void QgsIdentifyResultsDialog::clear()
978
1029
tblResults->clearContents ();
979
1030
tblResults->setRowCount ( 0 );
980
1031
1032
+ #if defined(QWT_VERSION) && QWT_VERSION<0x060000
1033
+ mPlot ->setVisible ( false );
1034
+ mPlotCurveXData .clear ();
1035
+ mPlotCurveYData .clear ();
1036
+ #endif
1037
+
981
1038
// keep it visible but disabled, it can switch from disabled/enabled
982
1039
// after raster format change
983
1040
mPrintToolButton ->setDisabled ( true );
0 commit comments