Commit 59936450 authored by Alexander A. Maly's avatar Alexander A. Maly

Enchancing Robot redraw

Add update() to stepUp, stepDown, stepLeft, stepRight, reverseColor, reverseMark.
Changed forced redraw timer from 30 ms to 3000 ms.
Add QEventLoop::ExcludeUserInputEvents argument to processEvent,
hoping that we will stop hanging randomly on pult events.
parent f073ff96
Pipeline #1284 passed with stages
in 3 minutes and 5 seconds
......@@ -1636,10 +1636,11 @@ void RoboField::reverseColor(int row, int col)
),
FillColor
);
};
}
if (mode != NORMAL_MODE) {
wasEdit = true;
}
update();
}
void RoboField::reverseColorCurrent()
......@@ -1659,6 +1660,7 @@ void RoboField::reverseMark(int row, int col)
getFieldItem(row, col)->showCharMark(upLeftCorner(row, col).x(), upLeftCorner(row, col).y(), fieldSize);
}
wasEdit = true;
update();
}
void RoboField::setRoboPos(int roboX, int roboY)
......@@ -2783,6 +2785,7 @@ bool RoboField::stepUp()
robot->setPos(QPointF(robot->pos().x(),
robot->pos().y() - fieldSize));
robo_y--;
update();
return true;
} else {
return false;
......@@ -2794,6 +2797,7 @@ bool RoboField::stepDown()
if (getFieldItem(robo_y, robo_x)->canDown()) {
robot->moveBy(0, fieldSize);
robo_y++;
update();
return true;
} else {
return false;
......@@ -2806,6 +2810,7 @@ bool RoboField::stepLeft()
robot->setPos(QPointF(robot->pos().x() - fieldSize,
robot->pos().y()));
robo_x--;
update();
return true;
} else {
return false;
......@@ -2817,6 +2822,7 @@ bool RoboField::stepRight()
if (getFieldItem(robo_y, robo_x)->canRight()) {
robot->moveBy(fieldSize, 0);
robo_x++;
update();
return true;
} else {
return false;
......
......@@ -185,8 +185,8 @@ void RobotModule::changeGlobalState(
msleep(2 * AnimTime);
view->update();
field->update();
qApp->processEvents();//Redraw event fix
};
qApp->processEvents(QEventLoop::ExcludeUserInputEvents);//Redraw event fix
}
void RobotModule::reloadSettings(
ExtensionSystem::SettingsPtr settings,
......@@ -289,7 +289,7 @@ QString RobotModule::initialize(
createGui();
redrawTimer = new QTimer();
connect(redrawTimer, SIGNAL(timeout()), this, SLOT(getTimer()));
redrawTimer->start(30);
redrawTimer->start(3000);
}
if (!fName.isEmpty()) {
......@@ -1340,7 +1340,7 @@ void RobotModule::getTimer()
mutex.lock();
field->update();
view->update();
qApp->processEvents();
qApp->processEvents(QEventLoop::ExcludeUserInputEvents);
mutex.unlock();
}
......
......@@ -58,7 +58,7 @@ void RobotView::mousePressEvent(QMouseEvent *event)
QGraphicsView::mousePressEvent(event);
update();
repaint();
qApp->processEvents();
qApp->processEvents(QEventLoop::ExcludeUserInputEvents);
return;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment