forked from ShuriZma/suyu
1
0
Fork 0

Fix a few warnings

- configure_input_player_widget.cpp: always better to use `const auto &`
  whenever possible
- profiler.cpp: `ev->pos()` is deprecated, replace with
  `ev->position()`, which returns floats, thus the addition of
  `.toPoint()` (same as what's happening in `pos()`)
- game_list.cpp: `QString::SplitBehavior` is deprecate, use `Qt::`
  namespace instead
This commit is contained in:
Romain Failliot 2021-10-11 10:43:39 -04:00
parent 97452b9558
commit 818651909f
3 changed files with 5 additions and 6 deletions

View File

@ -1837,7 +1837,7 @@ void PlayerControlPreview::DrawLeftBody(QPainter& p, const QPointF center) {
const float led_size = 5.0f;
const QPointF led_position = sideview_center + QPointF(0, -36);
int led_count = 0;
for (const auto color : led_color) {
for (const auto& color : led_color) {
p.setBrush(color);
DrawRectangle(p, led_position + QPointF(0, 12 * led_count++), led_size, led_size);
}
@ -1933,7 +1933,7 @@ void PlayerControlPreview::DrawRightBody(QPainter& p, const QPointF center) {
const float led_size = 5.0f;
const QPointF led_position = sideview_center + QPointF(0, -36);
int led_count = 0;
for (const auto color : led_color) {
for (const auto& color : led_color) {
p.setBrush(color);
DrawRectangle(p, led_position + QPointF(0, 12 * led_count++), led_size, led_size);
}

View File

@ -160,8 +160,8 @@ void MicroProfileWidget::mouseReleaseEvent(QMouseEvent* ev) {
}
void MicroProfileWidget::wheelEvent(QWheelEvent* ev) {
MicroProfileMousePosition(ev->pos().x() / x_scale, ev->pos().y() / y_scale,
ev->angleDelta().y() / 120);
MicroProfileMousePosition(ev->position().toPoint().x() / x_scale,
ev->position().toPoint().y() / y_scale, ev->angleDelta().y() / 120);
ev->accept();
}

View File

@ -159,8 +159,7 @@ GameListSearchField::GameListSearchField(GameList* parent) : QWidget{parent} {
* @return true if the haystack contains all words of userinput
*/
static bool ContainsAllWords(const QString& haystack, const QString& userinput) {
const QStringList userinput_split =
userinput.split(QLatin1Char{' '}, QString::SplitBehavior::SkipEmptyParts);
const QStringList userinput_split = userinput.split(QLatin1Char{' '}, Qt::SkipEmptyParts);
return std::all_of(userinput_split.begin(), userinput_split.end(),
[&haystack](const QString& s) { return haystack.contains(s); });