various minor style and code improvements

This commit is contained in:
NeatNit 2018-10-06 13:18:20 +03:00
parent de0d6f6791
commit 1341b47242

View file

@ -257,23 +257,22 @@ void GRenderWindow::touchBeginEvent(QTouchEvent* event) {
} }
void GRenderWindow::touchUpdateEvent(QTouchEvent* event) { void GRenderWindow::touchUpdateEvent(QTouchEvent* event) {
qreal x = 0.0, y = 0.0; qreal x = 0.0;
int activePoints = 0; qreal y = 0.0;
auto points = event->touchPoints(); int active_points = 0;
const auto points = event->touchPoints();
for (int i = 0; i < points.count(); i++) {
auto tp = points[i];
for (const auto tp : event->touchPoints()) {
if (tp.state() & (Qt::TouchPointPressed | Qt::TouchPointMoved | Qt::TouchPointStationary)) { if (tp.state() & (Qt::TouchPointPressed | Qt::TouchPointMoved | Qt::TouchPointStationary)) {
activePoints++; active_points++;
x += tp.pos().x(); x += tp.pos().x();
y += tp.pos().y(); y += tp.pos().y();
} }
} }
x /= activePoints; x /= active_points;
y /= activePoints; y /= active_points;
// Copied from mouseMoveEvent: // Copied from mouseMoveEvent:
qreal pixelRatio = windowPixelRatio(); qreal pixelRatio = windowPixelRatio();