@@ -148,7 +148,7 @@ void TimeFrequencyView::initQMLView()
148148
149149void TimeFrequencyView::paintEvent (QPaintEvent *event)
150150{
151- if (m_pEvokedSetModel){
151+ // if (m_pEvokedSetModel){
152152 QPainter painter (this );
153153
154154 painter.save ();
@@ -170,68 +170,81 @@ void TimeFrequencyView::paintEvent(QPaintEvent *event)
170170
171171 // paint gradient bar
172172
173- painter.save ();
174- painter.setPen (QPen (Qt::black, 1 , Qt::SolidLine));
175- QRect gradientBar (chartBound.topRight ().x () + m_iChartBorderSpacing, chartBound.topRight ().y (), m_iChartBorderSpacing, chartBound.height ());
176- painter.drawRect (gradientBar);
177- painter.restore ();
173+ // painter.save();
174+ // painter.setPen(QPen(Qt::black, 1, Qt::SolidLine));
175+ // QRect gradientBar(chartBound.topRight().x() + m_iChartBorderSpacing, chartBound.topRight().y(), m_iChartBorderSpacing, chartBound.height());
176+ // painter.drawRect(gradientBar);
177+ // painter.restore();
178+
179+ // painter.save();
180+ // painter.drawPixmap(gradientBar, m_CoefficientPixmap);
181+ // painter.restore();
178182
179183 painter.save ();
180- painter.drawPixmap (gradientBar, m_CoefficientPixmap);
184+
185+ painter.drawPixmap (chartBound.topRight ().x () + m_iChartBorderSpacing, chartBound.topRight ().y (), m_iChartBorderSpacing, chartBound.height (), m_CoefficientPixmap);
186+
181187 painter.restore ();
182188
183- // paint axis labels
184- // test
185- if (m_pEvokedSetModel->getNumSamples () > 0 ) {
186- painter.save ();
187- painter.setPen (QPen (Qt::red, 1 , Qt::DashLine));
189+ // QLinearGradient linGrad(this->width() - m_iChartBorderSpacing * 1.5f, chartBound.topRight().y(), this->width() - m_iChartBorderSpacing * 1.5f, chartBound.bottomRight().y());
190+ // painter.save();
191+ // painter.setBrush(linGrad);
192+ // painter.drawRect(chartBound.topRight().x() + m_iChartBorderSpacing, chartBound.topRight().y(), m_iChartBorderSpacing, chartBound.height());
188193
189- float fDx = (float )(chartBound.width ()) / ((float )m_pEvokedSetModel->getNumSamples ());
190- float posX = fDx * ((float )m_pEvokedSetModel->getNumPreStimSamples ());
191- painter.drawLine (chartBound.bottomLeft ().x ()+posX, chartBound.bottomRight ().y (), chartBound.bottomLeft ().x () + posX, chartBound.topRight ().y ());
192194
193- painter.drawText (QPointF (posX+chartBound.bottomLeft ().x (),chartBound.bottomRight ().y ()-5 ), QString (" 0ms / Stimulus" ));
194195
195- painter.restore ();
196+ // //paint axis labels
197+ // //test
198+ // if(m_pEvokedSetModel->getNumSamples() > 0) {
199+ // painter.save();
200+ // painter.setPen(QPen(Qt::red, 1, Qt::DashLine));
196201
197- painter.save ();
198- QColor colorTimeSpacer = Qt::black;
199- colorTimeSpacer.setAlphaF (0.5 );
200- painter.setPen (QPen (colorTimeSpacer, 1 , Qt::DashLine));
202+ // float fDx = (float)(chartBound.width()) / ((float)m_pEvokedSetModel->getNumSamples());
203+ // float posX = fDx * ((float)m_pEvokedSetModel->getNumPreStimSamples());
204+ // painter.drawLine(chartBound.bottomLeft().x()+posX, chartBound.bottomRight().y(), chartBound.bottomLeft().x() + posX, chartBound.topRight().y());
201205
202- float yStart = chartBound.topLeft ().y ();
203- float yEnd = chartBound.bottomRight ().y ();
206+ // painter.drawText(QPointF(posX+chartBound.bottomLeft().x(),chartBound.bottomRight().y()-5), QString("0ms / Stimulus"));
204207
205- float sampleCounter = m_pEvokedSetModel->getNumPreStimSamples ();
206- int counter = 1 ;
207- float timeDistanceMSec = 50.0 ;
208- float timeDistanceSamples = (timeDistanceMSec/1000.0 )*m_pEvokedSetModel->getSamplingFrequency (); // time distance corresponding to sampling frequency
208+ // painter.restore();
209209
210- // spacers before stim
211- while (sampleCounter-timeDistanceSamples>0 ) {
212- sampleCounter-=timeDistanceSamples;
213- float x = chartBound.bottomLeft ().x () + fDx *sampleCounter;
214- painter.drawLine (x, yStart, x, yEnd);
215- painter.drawText (QPointF (x - m_iChartBorderSpacing/3 , yEnd + m_iChartBorderSpacing/2 ), QString (" -%1ms" ).arg (timeDistanceMSec*counter));
216- counter++;
217- }
210+ // painter.save();
211+ // QColor colorTimeSpacer = Qt::black;
212+ // colorTimeSpacer.setAlphaF(0.5);
213+ // painter.setPen(QPen(colorTimeSpacer, 1, Qt::DashLine));
218214
219- // spacers after stim
220- counter = 1 ;
221- sampleCounter = m_pEvokedSetModel->getNumPreStimSamples ();
222- while (sampleCounter+timeDistanceSamples<m_pEvokedSetModel->getNumSamples ()) {
223- sampleCounter+=timeDistanceSamples;
224- float x = chartBound.bottomLeft ().x () + fDx *sampleCounter;
225- painter.drawLine (x, yStart, x, yEnd);
226- painter.drawText (QPointF (x - m_iChartBorderSpacing/3 , yEnd + m_iChartBorderSpacing/2 ), QString (" %1ms" ).arg (timeDistanceMSec*counter));
227- counter++;
228- }
215+ // float yStart = chartBound.topLeft().y();
216+ // float yEnd = chartBound.bottomRight().y();
229217
230- painter.restore ();
218+ // float sampleCounter = m_pEvokedSetModel->getNumPreStimSamples();
219+ // int counter = 1;
220+ // float timeDistanceMSec = 50.0;
221+ // float timeDistanceSamples = (timeDistanceMSec/1000.0)*m_pEvokedSetModel->getSamplingFrequency(); //time distance corresponding to sampling frequency
231222
232- }
223+ // //spacers before stim
224+ // while(sampleCounter-timeDistanceSamples>0) {
225+ // sampleCounter-=timeDistanceSamples;
226+ // float x = chartBound.bottomLeft().x() + fDx*sampleCounter;
227+ // painter.drawLine(x, yStart, x, yEnd);
228+ // painter.drawText(QPointF(x - m_iChartBorderSpacing/3, yEnd + m_iChartBorderSpacing/2), QString("-%1ms").arg(timeDistanceMSec*counter));
229+ // counter++;
230+ // }
233231
234- }
232+ // //spacers after stim
233+ // counter = 1;
234+ // sampleCounter = m_pEvokedSetModel->getNumPreStimSamples();
235+ // while(sampleCounter+timeDistanceSamples<m_pEvokedSetModel->getNumSamples()) {
236+ // sampleCounter+=timeDistanceSamples;
237+ // float x = chartBound.bottomLeft().x() + fDx*sampleCounter;
238+ // painter.drawLine(x, yStart, x, yEnd);
239+ // painter.drawText(QPointF(x - m_iChartBorderSpacing/3, yEnd + m_iChartBorderSpacing/2), QString("%1ms").arg(timeDistanceMSec*counter));
240+ // counter++;
241+ // }
242+
243+ // painter.restore();
244+
245+ // }
246+
247+ // }
235248
236249 return QWidget::paintEvent (event);
237250}
0 commit comments