1
/***************************************************************************
2
* Copyright (C) 2020 by santiago González *
3
* santigoro@gmail.com *
5
* This program is free software; you can redistribute it and/or modify *
6
* it under the terms of the GNU General Public License as published by *
7
* the Free Software Foundation; either version 3 of the License, or *
8
* (at your option) any later version. *
10
* This program is distributed in the hope that it will be useful, *
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13
* GNU General Public License for more details. *
15
* You should have received a copy of the GNU General Public License *
16
* along with this program; if not, see <http://www.gnu.org/licenses/>. *
18
***************************************************************************/
20
#include <math.h> // fabs(x,y)
22
#include "dataplotwidget.h"
24
#include "mainwindow.h"
26
#include "simulator.h"
28
DataPlotWidget::DataPlotWidget( QWidget* parent, PlotBase* plotB )
33
this->setVisible( false );
35
for( int i=0; i<2; i++ )
55
m_refCondFlag = false;
58
DataPlotWidget::~DataPlotWidget()
62
void DataPlotWidget::hTickDialChanged( int Hscale ) // Dial changed
64
if( m_auto < 2 ) return;
66
uint64_t delta = m_hTick/10;
67
if( delta < 1 ) delta = 1;
69
if( Hscale < m_prevHscale ) m_hTick += delta;
70
else m_hTick -= delta;
72
if( m_hTick < 1 ) m_hTick = 1;
74
m_prevHscale = Hscale;
79
void DataPlotWidget::hTickBoxChanged() // User entered value
81
if( m_auto < 2 ) return;
83
double val = m_hTickBox->value();
84
QString unit = m_hTickBox->suffix();
86
if ( unit == " ns" ) val *= 1e3;
87
else if( unit == " us") val *= 1e6;
88
else if( unit == " ms" ) val *= 1e9;
89
else if( unit == " s") val *= 1e12;
91
if( val < 1 ) val = 1;
93
if( (uint64_t)val == m_hTick ) return;
95
m_hTick = (uint64_t)val;
100
void DataPlotWidget::setHTick( uint64_t hTick )
106
void DataPlotWidget::updateHTickBox()
108
double val = (double)m_hTick;
110
QString unit = " ps";
113
val /= 1e3; unit = " ns";
116
val /= 1e3; unit = " us";
119
val /= 1e3; unit = " ms";
120
if( val > 999 ) { val /= 1e3; unit = " s"; }
125
if ( val < 10) Vdecimals = 3;
126
else if( val < 100) Vdecimals = 2;
127
else if( val < 1000) Vdecimals = 1;
129
m_hTickBox->setDecimals( Vdecimals );
130
m_hTickBox->setValue( val );
131
m_hTickBox->setSuffix( unit );
132
m_display->setXFrame( m_hTick*10 );
135
void DataPlotWidget::vTickDialChanged( int ch, int Vscale ) // Changed by Dial
137
if( (ch>2) || (ch<0) ) ch = 2;
138
if( m_auto == ch ) return;
140
double vscale = (double)Vscale;
141
if( vscale < m_prevVscale ) m_vTick[ch] *= 1.01;
142
else m_vTick[ch] /= 1.01;
144
if( m_vTick[ch] < 0.001 ) m_vTick[ch] = 0.001;
145
m_prevVscale = vscale;
146
m_display->setVTick( ch, m_vTick[ch] );
148
int activeChan = m_buttonGroup->checkedId();
149
if(( activeChan == 2 )
150
|| ( activeChan == ch ))m_vTickBox->setValue( m_vTick[ch] );
153
void DataPlotWidget::vTickBoxChanged( int ch )
155
if( (ch>2) || (ch<0) ) ch = 2;
156
if( m_auto == ch ) return;
157
m_vTick[ch] = m_vTickBox->value();
158
m_display->setVTick( ch, m_vTick[ch] );
161
void DataPlotWidget::setVTick( int ch, double vTick )
164
m_display->setVTick( ch, vTick );
166
int activeChan = m_buttonGroup->checkedId();
167
if(( activeChan == 2 )
168
|| ( activeChan == ch ))m_vTickBox->setValue( vTick );
171
void DataPlotWidget::hPosDialChanged( int ch, int ihPos ) // Changed by Dial
173
if( (ch>2) || (ch<0) ) ch = 2;
174
if( m_auto == ch ) return;
176
double hPos = (double)ihPos;
178
int delta = m_hTick/10;
179
if( delta < 1 ) delta = 1;
181
if( hPos < m_prevHPos ) m_hPos[ch] += delta;
182
else m_hPos[ch] -= delta;
188
void DataPlotWidget::hPosBoxChanged( int ch )
190
if( (ch>2) || (ch<0) ) ch = 2;
191
if( m_auto == ch ) return;
193
double val = m_hPosBox->value();
194
QString unit = m_hPosBox->suffix();
196
if ( unit == " ns" ) val *= 1e3;
197
else if( unit == " us") val *= 1e6;
198
else if( unit == " ms") val *= 1e9;
199
else if( unit == " s") val *= 1e12;
205
void DataPlotWidget::setHPos( int ch, double hPos )
207
if( (ch>2) || (ch<0) ) ch = 2;
212
void DataPlotWidget::updateHPosBox( int ch )
214
if( (ch>2) || (ch<0) ) ch = 2;
215
int activeChan = m_buttonGroup->checkedId();
216
if(( activeChan == 2 )
217
|| ( activeChan == ch ))
219
double val = m_hPos[ch];
220
/*double halfScreen = (double)m_hTick*5;
221
if ( val > halfScreen ) val = halfScreen;
222
else if( val <-halfScreen ) val =-halfScreen;*/
225
QString unit = " ps";
226
if( fabs( val ) > 999 )
228
val /= 1e3; unit = " ns";
229
if( fabs( val ) > 999 )
231
val /= 1e3; unit = " us";
232
if( fabs( val ) > 999 )
234
val /= 1e3; unit = " ms";
235
if( fabs( val ) > 999 ) { val /= 1e3; unit = " s"; }
241
double fval = fabs( val );
242
if ( fval < 10) Vdecimals = 3;
243
else if( fval < 100) Vdecimals = 2;
244
else if( fval < 1000) Vdecimals = 1;
246
m_hPosBox->setDecimals( Vdecimals );
247
m_hPosBox->setValue( val );
248
m_hPosBox->setSuffix( unit );
249
m_display->setHPos( ch, m_hPos[ch] );
253
void DataPlotWidget::vPosDialChanged( int ch, int ivPos ) // Changed by Dial
255
if( (ch>2) || (ch<0) ) ch = 2;
256
if( m_auto == ch ) return;
258
double vPos = (double)ivPos;
260
if( vPos < m_prevVPos ) m_vPos[ch] -= 0.05*m_vTick[ch];
261
else m_vPos[ch] += 0.05*m_vTick[ch];
264
m_display->setVPos( ch, m_vPos[ch] );
266
int activeChan = m_buttonGroup->checkedId();
267
if(( activeChan == 2 )
268
|| ( activeChan == ch )) m_vPosBox->setValue( m_vPos[ch] );
271
void DataPlotWidget::vPosBoxChanged( int ch )
273
if( (ch>2) || (ch<0) ) ch = 2;
274
if( m_auto == ch ) return;
275
m_vPos[ch] = m_vPosBox->value();
276
m_display->setVPos( ch, m_vPos[ch] );
279
void DataPlotWidget::setVPos( int ch, double vPos )
281
if( (ch>2) || (ch<0) ) ch = 2;
283
m_display->setVPos( ch, vPos );
285
int activeChan = m_buttonGroup->checkedId();
286
if(( activeChan == 2 )
287
|| ( activeChan == ch )) m_vPosBox->setValue( vPos );
290
void DataPlotWidget::setAuto( int ch )
292
if( (ch>2) || (ch<0) ) ch = 2;
293
for( int i=0; i<2; i++ ) m_autoCheck[i]->setChecked( false );
296
if( m_auto == ch ) // disable
298
m_autoCheck[ch]->setChecked( false );
301
else m_autoCheck[ch]->setChecked( true );
305
QString color = m_colorN[ch];
306
if( ch == 2 ) color = m_colorN[3];
307
m_autoLabel->setStyleSheet( "background-color:"+color );
310
void DataPlotWidget::setTrigger( int ch )
312
if( (ch>2) || (ch<0) ) ch = 2;
313
for( int i=0; i<2; i++ ) m_trigCheck[i]->setChecked( false );
316
if( m_trigger == ch ) // disable
318
m_trigCheck[ch]->setChecked( false );
321
else m_trigCheck[ch]->setChecked( true );
325
QString color = m_colorN[ch];
326
if( ch == 2 ) color = m_colorN[3];
327
m_trigLabel->setStyleSheet( "background-color:"+color );
329
m_plotB->updateTrig( ch );
332
void DataPlotWidget::buttonChanged( int ch )
334
if( (ch>2) || (ch<0) ) ch = 2;
335
m_hTickBox->setStyleSheet( "background-color:"+m_colorN[2] );
336
m_hPosBox->setStyleSheet( "background-color:"+m_colorN[ch] );
337
m_vTickBox->setStyleSheet( "background-color:"+m_colorN[ch] );
338
m_vPosBox->setStyleSheet( "background-color:"+m_colorN[ch] );
342
m_vTickBox->setValue( m_vTick[ch] );
343
m_vPosBox->setValue( m_vPos[ch] );
347
void DataPlotWidget::showControlls( bool show )
349
m_hTickDial->setVisible( show );
350
m_hTickBox->setVisible( show );
351
m_hTickLabel->setVisible( show );
352
m_hPosDial->setVisible( show );
353
m_hPosBox->setVisible( show );
354
m_hPosLabel->setVisible( show );
355
m_vTickDial->setVisible( show );
356
m_vTickBox->setVisible( show );
357
m_vTickLabel->setVisible( show );
358
m_vPosDial->setVisible( show );
359
m_vPosBox->setVisible( show );
360
m_vPosLabel->setVisible( show );
361
m_autoLabel->setVisible( show );
362
m_trigLabel->setVisible( show );
364
for( int i=0; i<2; i++ )
366
m_autoCheck[i]->setVisible( show );
367
m_trigCheck[i]->setVisible( show );
370
for( int i=0; i<3; i++ )
372
m_line[i]->setVisible( show );
373
m_button[i]->setVisible( show );
377
void DataPlotWidget::setSize( int width, int height )
381
m_display->setSize( width, height );
384
void DataPlotWidget::updateWidgets()
386
double ws = (double)m_sizeY/200;
387
double sc = (6+4*ws)/10; //qDebug() <<"DataPlotWidget::scale"<<sc;
388
double fs = MainWindow::self()->fontScale();
391
QFont font = this->font();
392
font.setPixelSize( int(9*fs*sc) );
393
font.setBold( true );
395
m_advaCheck->setFixedSize( sc*65, sc*14 );
396
m_advaCheck->setFont( font );
398
m_autoLabel->setFixedSize( sc*42, sc*14 );
399
m_autoLabel->setFont( font );
400
m_trigLabel->setFixedSize( sc*42, sc*14 );
401
m_trigLabel->setFont( font );
403
for( int i=0; i<2; i++ )
405
m_channel[i]->setFixedSize( sc*65, sc*17 );
406
m_channel[i]->setFont( font );
408
m_data1Label[i]->setFixedSize( sc*65, sc*16 );
409
m_data1Label[i]->setFont( font );
410
m_data2Label[i]->setFixedSize( sc*65, sc*16 );
411
m_data2Label[i]->setFont( font );
413
m_autoCheck[i]->setFont( font );
414
m_trigCheck[i]->setFont( font );
417
m_hTickLabel->setFont( font );
418
m_hTickLabel->setFixedSize( sc*25, sc*15 );
419
m_hPosLabel->setFont( font );
420
m_hPosLabel->setFixedSize( sc*25, sc*15 );
421
m_vTickLabel->setFont( font );
422
m_vTickLabel->setFixedSize( sc*25, sc*15 );
423
m_vPosLabel->setFont( font );
424
m_vPosLabel->setFixedSize( sc*25, sc*15 );
426
m_hTickDial->setFixedSize( ds, ds );
427
m_hPosDial->setFixedSize( ds, ds );
428
m_vTickDial->setFixedSize( ds, ds );
429
m_vPosDial->setFixedSize( ds, ds );
431
m_hTickBox->setFixedSize( sc*73, sc*20 );
432
m_hTickBox->setFont( font );
433
m_hPosBox->setFixedSize( sc*73, sc*20 );
434
m_hPosBox->setFont( font );
435
m_vTickBox->setFixedSize( sc*73, sc*20 );
436
m_vTickBox->setFont( font );
437
m_vPosBox->setFixedSize( sc*73, sc*20 );
438
m_vPosBox->setFont( font );
440
for( int i=0; i<3; i++ )
442
if( i!= 1 ) m_line[i]->setFixedHeight( ws*ws*10 );
443
m_button[i]->setFixedSize( sc*38, sc*20);
444
m_button[i]->setFont( font );
446
m_line[1]->setFixedHeight( ws*ws*4 );
449
void DataPlotWidget::setupWidget()
451
//m_palette.setColor( QPalette::Text,Qt::black );
453
m_display = new PlotDisplay( this );
454
for( int i=0; i<3; i++ ) m_colorN[i] = m_display->m_color[i].name() ;
455
m_colorN[3] = m_display->m_scaleColor[2].name() ;
457
m_horizontalLayout = createQHBoxLayout();
458
this->setLayout( m_horizontalLayout );
459
m_horizontalLayout->addStretch();
461
m_vChannelLayout = new QVBoxLayout();
462
m_vChannelLayout->setContentsMargins(0, 0, 0, 0);
463
m_vChannelLayout->setSpacing(0);
464
m_vChannelLayout->setAlignment( Qt::AlignLeft );
466
m_advaCheck = new QCheckBox( "Expand", this );
467
m_advaCheck->setChecked( true );
468
m_vChannelLayout->addWidget( m_advaCheck );
470
m_data2Label[0] = new QLabel( "", this );
471
m_data1Label[0] = new QLabel( "", this );
472
m_vChannelLayout->addWidget( m_data1Label[0] );
473
m_vChannelLayout->addWidget( m_data2Label[0] );
475
for( int i=0; i<2; i++ )
477
//m_palette.setColor( QPalette::Base, m_display->m_color[i] );
478
m_channel[i] = new QLineEdit( this );
479
m_channel[i]->setObjectName( "Channel"+QString::number(i));
480
m_channel[i]->setStyleSheet( "background-color:"+m_colorN[i] );
481
m_channel[i]->setPlaceholderText( "No Probe" );
482
//m_channel[i]->setPalette( m_palette );
483
m_vChannelLayout->addWidget( m_channel[i] );
485
m_data2Label[1] = new QLabel( "", this );
486
m_data1Label[1] = new QLabel( "", this );
487
m_vChannelLayout->addWidget( m_data2Label[1] );
488
m_vChannelLayout->addWidget( m_data1Label[1] );
490
m_horizontalLayout->addLayout( m_vChannelLayout );
492
m_horizontalLayout->addWidget( m_display );
493
m_horizontalLayout->addStretch();
495
m_controllsLayout = new QVBoxLayout();
496
m_controllsLayout->setContentsMargins(0, 0, 0, 0);
497
m_controllsLayout->setSpacing(0);
499
QHBoxLayout* buttonLayout = createQHBoxLayout();
500
buttonLayout->addStretch();
501
m_buttonGroup = new QButtonGroup( this );
502
for( int i=0; i<3; i++ )
505
if( i<2 ) text += QString::number(i+1);
506
else text = tr("All");
508
m_button[i] = new QPushButton( text, this );
509
m_button[i]->setObjectName( "OscButton"+QString::number(i));
510
m_button[i]->setCheckable( true );
511
//m_palette.setColor( QPalette::Button, m_display->m_color[i] );
512
m_button[i]->setStyleSheet( "background-color:"+m_colorN[i] );
513
//m_button[i]->setPalette( m_palette );
515
m_buttonGroup->addButton( m_button[i] );
516
m_buttonGroup->setId( m_button[i], i );
518
buttonLayout->addWidget( m_button[i] );
520
m_line[i] = new QFrame(this);
521
m_line[i]->setFrameShape( QFrame::HLine ) ;
522
m_line[i]->setFrameShadow( QFrame::Sunken );
523
m_line[i]->setLineWidth( 2 );
525
m_button[2]->setChecked( true );
526
buttonLayout->addStretch();
527
m_controllsLayout->addLayout( buttonLayout );
529
QHBoxLayout* hTickLayout = createQHBoxLayout();
530
m_hTickDial = createDial();
531
m_hTickBox = createSpinBox( " S" );
532
m_hTickBox->installEventFilter( this );
533
m_hTickLabel = new QLabel( " Div", this );
534
hTickLayout->addWidget(m_hTickDial );
535
hTickLayout->addWidget( m_hTickBox );
536
hTickLayout->addWidget( m_hTickLabel );
537
QHBoxLayout* hPosLayout = createQHBoxLayout();
538
m_hPosDial = createDial();
539
m_hPosBox = createSpinBox( " S" );
540
m_hPosBox->installEventFilter( this );
541
m_hPosBox->setMinimum( -1000000 );
542
m_hPosBox->setValue( 0 );
543
m_hPosLabel = new QLabel( " Pos", this );
544
hPosLayout->addWidget( m_hPosDial );
545
hPosLayout->addWidget( m_hPosBox );
546
hPosLayout->addWidget( m_hPosLabel );
547
m_line[1]->setLineWidth( 1 );
548
QHBoxLayout* vTickLayout = createQHBoxLayout();
549
m_vTickDial = createDial();
550
m_vTickBox = createSpinBox( " V" );
551
m_vTickBox->installEventFilter( this );
552
m_vTickLabel = new QLabel( " Div", this );
553
vTickLayout->addWidget( m_vTickDial );
554
vTickLayout->addWidget( m_vTickBox );
555
vTickLayout->addWidget( m_vTickLabel );
556
QHBoxLayout* vPosLayout = createQHBoxLayout();
557
m_vPosDial = createDial();
558
m_vPosBox = createSpinBox( " V" );
559
m_vPosBox->installEventFilter( this );
560
m_vPosBox->setMinimum( -1000000 );
561
m_vPosLabel = new QLabel( " Pos", this );
562
vPosLayout->addWidget( m_vPosDial );
563
vPosLayout->addWidget( m_vPosBox );
564
vPosLayout->addWidget( m_vPosLabel );
566
m_controllsLayout->addWidget( m_line[0] );
567
m_controllsLayout->addLayout( hTickLayout );
568
m_controllsLayout->addLayout( hPosLayout );
569
m_controllsLayout->addWidget( m_line[1] );
570
m_controllsLayout->addLayout( vTickLayout );
571
m_controllsLayout->addLayout( vPosLayout );
572
m_controllsLayout->addWidget( m_line[2] );
574
QHBoxLayout* autoLayout = createQHBoxLayout();
575
autoLayout->setSpacing( 5 );
576
m_autoLabel = new QLabel( " Auto", this );
577
m_autoLabel->setObjectName( "autoLabel");
578
autoLayout->addWidget( m_autoLabel );
579
m_autoGroup = new QButtonGroup( this );
580
m_autoGroup->setExclusive( false );
581
for( int i=0; i<2; ++i )
583
m_autoCheck[i] = new QRadioButton( QString::number(i+1), this );
584
m_autoCheck[i]->setObjectName( "autoCheck"+QString::number(i));
585
m_autoCheck[i]->setStyleSheet( "background-color:"+m_colorN[i] );
586
m_autoCheck[i]->setChecked( false );
587
m_autoGroup->addButton( m_autoCheck[i] );
588
m_autoGroup->setId( m_autoCheck[i], i );
589
autoLayout->addWidget( m_autoCheck[i] );
591
//autoLayout->addStretch();
593
QHBoxLayout* triggerLayout = createQHBoxLayout();
594
triggerLayout->setSpacing( 5 );
595
m_trigLabel = new QLabel( " Trigger", this );
596
m_trigLabel->setObjectName( "trigLabel");
597
triggerLayout->addWidget( m_trigLabel );
598
m_trigGroup = new QButtonGroup( this );
599
m_trigGroup->setExclusive( false );
600
for( int i=0; i<2; ++i )
602
m_trigCheck[i] = new QRadioButton( QString::number(i+1), this );
603
m_trigCheck[i]->setObjectName( "trigCheck"+QString::number(i));
604
m_trigCheck[i]->setStyleSheet( "background-color:"+m_colorN[i] );
605
m_trigCheck[i]->setChecked( false );
606
m_trigGroup->addButton( m_trigCheck[i] );
607
m_trigGroup->setId( m_trigCheck[i], i );
608
triggerLayout->addWidget( m_trigCheck[i] );
610
//triggerLayout->addStretch();
612
m_controllsLayout->addLayout( autoLayout );
613
m_controllsLayout->addLayout( triggerLayout );
614
m_horizontalLayout->addLayout( m_controllsLayout );
615
m_horizontalLayout->addStretch();
617
connect( m_advaCheck, SIGNAL( clicked(bool) ),
618
m_plotB, SLOT ( setAdvanc(bool)), Qt::UniqueConnection );
620
connect( m_channel[0], SIGNAL( editingFinished() ),
621
this, SLOT ( channel1Changed()), Qt::UniqueConnection );
623
connect( m_channel[1], SIGNAL( editingFinished() ),
624
this, SLOT ( channel2Changed()), Qt::UniqueConnection );
627
connect( m_hTickDial, SIGNAL( valueChanged(int) ),
628
this, SLOT ( hTickDialChanged(int)), Qt::UniqueConnection );
630
connect( m_vTickDial, SIGNAL( valueChanged(int) ),
631
this, SLOT ( vTickDial1Changed(int)), Qt::UniqueConnection );
633
connect( m_hPosDial, SIGNAL( valueChanged(int) ),
634
this, SLOT ( hPosDial1Changed(int)), Qt::UniqueConnection );
636
connect( m_vPosDial, SIGNAL( valueChanged(int) ),
637
this, SLOT ( vPosDial1Changed(int)), Qt::UniqueConnection );
639
connect( m_hTickBox, &QDoubleSpinBox::editingFinished,
640
this, &DataPlotWidget::hTickBoxChanged, Qt::UniqueConnection );
642
connect( m_vTickBox, &QDoubleSpinBox::editingFinished,
643
this, &DataPlotWidget::vTickBox1Changed, Qt::UniqueConnection );
645
connect( m_hPosBox, &QDoubleSpinBox::editingFinished,
646
this, &DataPlotWidget::hPosBox1Changed, Qt::UniqueConnection );
648
connect( m_vPosBox, &QDoubleSpinBox::editingFinished,
649
this, &DataPlotWidget::vPosBox1Changed, Qt::UniqueConnection );
651
connect( m_buttonGroup, SIGNAL( buttonClicked(int)),
652
this, SLOT ( buttonChanged(int)), Qt::UniqueConnection );
654
connect( m_autoGroup, SIGNAL( buttonClicked(int)),
655
this, SLOT ( setAuto(int)), Qt::UniqueConnection );
657
connect( m_trigGroup, SIGNAL( buttonClicked(int)),
658
this, SLOT ( setTrigger(int)), Qt::UniqueConnection );
665
QDial* DataPlotWidget::createDial()
667
QDial* dial = new QDial(this);
668
dial->setNotchesVisible( true );
669
dial->setWrapping(true);
670
dial->setMinimum( 1 );
671
dial->setMaximum( 20 );
672
dial->setSingleStep( 1 );
676
QDoubleSpinBox* DataPlotWidget::createSpinBox( QString suffix )
678
QDoubleSpinBox* sb = new QDoubleSpinBox( this );
679
sb->setObjectName( "SpinBox"+suffix);
680
sb->setMaximum( 1000000 );
681
sb->setMinimum( 0.001 );
682
sb->setDecimals( 3 );
683
sb->setSuffix( suffix );
688
QHBoxLayout* DataPlotWidget::createQHBoxLayout()
690
QHBoxLayout* hbl = new QHBoxLayout();
691
hbl->setContentsMargins( 0, 0, 0, 0 );
692
hbl->setAlignment( Qt::AlignLeft );
696
bool DataPlotWidget::eventFilter( QObject* object, QEvent* event )
698
if( event->type() == QEvent::FocusIn )
700
if( (object == m_hTickBox)
701
|| (object == m_hPosBox)
702
|| (object == m_vTickBox)
703
|| (object == m_vPosBox) )
705
Circuit::self()->deselectAll();
711
void DataPlotWidget::channel1Changed(){ setProbe( 0 ); }
712
void DataPlotWidget::channel2Changed(){ setProbe( 1 ); }
714
void DataPlotWidget::vTickDial1Changed( int Vscale )
716
int ch = m_buttonGroup->checkedId();
719
vTickDialChanged( 0, Vscale );
720
setVTick( 1, m_vTick[0] );
722
else vTickDialChanged( ch, Vscale );
724
void DataPlotWidget::hPosDial1Changed( int hPos )
726
int ch = m_buttonGroup->checkedId();
729
hPosDialChanged( 0, hPos );
730
setHPos( 1, m_hPos[0] );
732
else hPosDialChanged( ch, hPos );
734
void DataPlotWidget::vPosDial1Changed( int vPos )
736
int ch = m_buttonGroup->checkedId();
739
vPosDialChanged( 0, vPos );
740
setVPos( 1, m_vPos[0] );
742
else vPosDialChanged( ch, vPos );
745
void DataPlotWidget::vTickBox1Changed()
747
int ch = m_buttonGroup->checkedId();
750
vTickBoxChanged( 0 );
751
setVTick( 1, m_vTick[0] );
753
else vTickBoxChanged( ch );
756
void DataPlotWidget::hPosBox1Changed()
758
int ch = m_buttonGroup->checkedId();
762
setHPos( 1, m_hPos[0] );
764
else hPosBoxChanged( ch );
767
void DataPlotWidget::vPosBox1Changed()
769
int ch = m_buttonGroup->checkedId();
773
setVPos( 1, m_vPos[0] );
775
else vPosBoxChanged( ch );
778
void DataPlotWidget::setProbe( int ch )
781
Probe* oldProbe = m_probe[ch];
782
QString nam = m_channel[ch]->text();
784
Component* comp = Circuit::self()->getComponent( nam );
785
if( comp ) probe = static_cast<Probe*>( comp );
788
m_plotB->connectProbe( ch, probe!= 0l );
789
m_plotB->m_probe[ch] = nam;
791
if( oldProbe ) disconnect( oldProbe, SIGNAL( removed( Probe* ) ),
792
this, SLOT ( probeRemoved( Probe* )) );
794
if( probe ) connect( probe, SIGNAL( removed( Probe* ) ),
795
this, SLOT ( probeRemoved( Probe* )), Qt::UniqueConnection );
798
void DataPlotWidget::probeRemoved( Probe* p )
800
for( int i=0; i<2; i++ )
802
if( m_probe[i] == p )
804
m_channel[i]->setText( "" );
810
#include "moc_dataplotwidget.cpp"