Any idea what this means?
-
void Canvas::paintEvent(QPaintEvent* event) { canvasSizeX = width(); canvasSizeY = height(); QPainter painter(this); //painter.drawImage(0, 704, *straightHImage); if (*canvasChosen == Mode::SETTRACKLENGTHSPEED) { for (std::shared_ptr<StraightTrack> currentElement : drawnLayout->getStraightTrackList()) { //Get the stored location of track relative to the canvas widget. int currentX = currentElement->getLocationX(); int currentY = currentElement->getLocationY();
For some reason this line stops the debugger, but on normal run through without debugger, the program works fine.
if (*canvasChosen == Mode::SETTRACKLENGTHSPEED)
I feel like this means it's not me, but any ideas ?
-
I'm fairly sure, because I have another class called window, and it contains the canvas class, and before the first PaintEvent is called using the timer at the last 2 line, drawingSurface->setMode(modeChosen) makes the canvasChosen = to modeChosen.
drawingSurface = new Canvas; drawingSurface->setMode(modeChosen); windowOffsetX = 0; windowOffsetY = 0; drawingSurface->setOffsetX(windowOffsetX); drawingSurface->setOffsetY(windowOffsetY); QTimer *timer = new QTimer(this); connect(timer, SIGNAL(timeout()), this, SLOT(timerRun()));
-
@jkwok678 said in Any idea what this means?:
For some reason this line stops the debugger, but on normal run through without debugger, the program works fine.
If this really is the case, put in console print statements between each line, to find where you get to.
-
@jkwok678 said in Any idea what this means?:
I'm fairly sure
If the debugger stops the application, you can also check the current value of
canvasChosen
and verify if it value is correctly set.
I suppose that you initialize it to0
inCanvas
constructor?But, by the way, I don't understand why you use a pointer to store an enum value?
-
@KroMignon said in Any idea what this means?:
pointer
Hmm, changing the canvasChosen to not being a pointer seems to fix it.
Any idea why though?