I'm sure that the data in the vector is OK. but I can not draw line.
I'm sure that the data in the vector is OK. but I can not draw line.
can you show us code where you use this method?
Qt Assistant -- rocks!
please, use tags [CODE] & [/CODE].
what is the size of avgPoints?
Qt Code:
void GenePlotter::refreshPixmap() { pixmap.fill(this, 0, 0); painter.initFrom(this); drawGrid(&painter); // This line works perfectly good if(couter!=0) drawPlotterLine(&painter); // here can't draw line update(); }To copy to clipboard, switch view to plain text mode
stupid question, but maybe couter == 0?![]()
Qt Assistant -- rocks!
please, use tags [CODE] & [/CODE].
No, the couter will increase. I make it draw only couter >0 ;
Qt Code:
// In the construtor function connect(oneStepButton,SIGNAL(clicked()),this,SLOT(oneStep())); connect(runAllButton,SIGNAL(clicked()),this,SLOT(runAll()));To copy to clipboard, switch view to plain text mode
Qt Code:
// perform one generaion evolution and update the points of the plotter void GenePlotter::execOnce() { geneGroup.performEvolution(); QPointF point; point.setX(couter); point.setY(((geneGroup.getGroup())+GeneGroup::popSize)->getfitness()); bestPoints.push_back(point); point.setY(geneGroup.getAvg()); // x are the same of these two point. avgPoints.push_back(point); refreshPixmap(); } void GenePlotter::oneStep() { ++couter; if(couter<generation) { execOnce(); } } void GenePlotter::runAll() { settingButton->setEnabled(false); oneStepButton->setEnabled(false); runAllButton->setEnabled(false); qApp->processEvents(); if(couter==0) ++couter; while(couter<generation) { ++couter; execOnce(); repaint(); } settingButton->setEnabled(true); oneStepButton->setEnabled(true); runAllButton->setEnabled(true); }To copy to clipboard, switch view to plain text mode
More code
if you do this
is something changed?Qt Code:
void GenePlotter::refreshPixmap() { pixmap.fill(this, 0, 0); painter.initFrom(this); drawGrid(&painter); // This line works perfectly good drawPlotterLine(&painter); // here can't draw line update(); }To copy to clipboard, switch view to plain text mode
Qt Assistant -- rocks!
please, use tags [CODE] & [/CODE].
to #9
Fail, the same
Bookmarks