89 return QMetaEnum::fromType<Gesture>().valueToKey(
m_gesture);
94 return QMetaEnum::fromType<Qt::MouseButtons>().valueToKey(
static_cast<int>(
m_button));
117 size_t MaxSequence,
int ScaleRatio,
119 : m_maxPoints(MaxPoints),
120 m_minPoints(MinPoints),
121 m_maxSequence(MaxSequence),
122 m_scaleRatio(ScaleRatio),
123 m_binPercent(BinPercent)
172 const QString gesture =
Translate(Timeout);
219 auto total_points =
static_cast<size_t>(
m_points.count());
240 size_t sequence_count = 0;
248 bool first_bin =
true;
255 int bound_x_1 =
m_minX + (delta_x / 3);
256 int bound_x_2 =
m_minX + (2 * (delta_x / 3));
258 int bound_y_1 =
m_minY + (delta_y / 3);
259 int bound_y_2 =
m_minY + (2 * (delta_y / 3));
263 bound_y_1 = (
m_maxY +
m_minY - delta_x) / 2 + (delta_x / 3);
264 bound_y_2 = (
m_maxY +
m_minY - delta_x) / 2 + 2 * (delta_x / 3);
268 bound_x_1 = (
m_maxX +
m_minX - delta_y) / 2 + (delta_y / 3);
269 bound_x_2 = (
m_maxX +
m_minX - delta_y) / 2 + 2 * (delta_y / 3);
281 current_bin =
determineBin(pt, bound_x_1, bound_x_2, bound_y_1,
285 prev_bin = (prev_bin == 0) ? current_bin : prev_bin;
287 if (prev_bin == current_bin)
294 if ((bin_count > (total_points *
m_binPercent)) || first_bin)
297 sequence +=
'0' + QChar(prev_bin);
303 prev_bin = current_bin;
308 sequence +=
'0' + QChar(current_bin);
346 int delx = Point.x() -
m_points.back().x();
347 int dely = Point.y() -
m_points.back().y();
350 if (abs(delx) > abs(dely))
357 (delx > 0) ? (ix < Point.x()) : (ix > Point.x());
358 ix += (delx > 0) ? 1 : -1)
361 fy += std::fabs(
static_cast<float>(dely) /
static_cast<float>(delx))
362 * ((dely < 0) ? -1.0F : 1.0F);
363 int iy =
static_cast<int>(fy);
377 (dely > 0) ? (iy < Point.y()) : (iy > Point.y());
378 iy += (dely > 0) ? 1 : -1)
381 fx += std::fabs(
static_cast<float>(delx) /
static_cast<float>(dely))
382 * ((delx < 0) ? -1.0F : 1.0F);
383 int ix =
static_cast<int>(fx);