Merge pull request #1335 from lioncash/copy
game_list_p: Take map iterator contents by const reference
This commit is contained in:
commit
e833301e4c
|
@ -106,7 +106,7 @@ class GameListItemCompat : public GameListItem {
|
||||||
public:
|
public:
|
||||||
static const int CompatNumberRole = Qt::UserRole + 1;
|
static const int CompatNumberRole = Qt::UserRole + 1;
|
||||||
GameListItemCompat() = default;
|
GameListItemCompat() = default;
|
||||||
explicit GameListItemCompat(const QString& compatiblity) {
|
explicit GameListItemCompat(const QString& compatibility) {
|
||||||
struct CompatStatus {
|
struct CompatStatus {
|
||||||
QString color;
|
QString color;
|
||||||
const char* text;
|
const char* text;
|
||||||
|
@ -123,13 +123,13 @@ public:
|
||||||
{"99", {"#000000", QT_TR_NOOP("Not Tested"), QT_TR_NOOP("The game has not yet been tested.")}}};
|
{"99", {"#000000", QT_TR_NOOP("Not Tested"), QT_TR_NOOP("The game has not yet been tested.")}}};
|
||||||
// clang-format on
|
// clang-format on
|
||||||
|
|
||||||
auto iterator = status_data.find(compatiblity);
|
auto iterator = status_data.find(compatibility);
|
||||||
if (iterator == status_data.end()) {
|
if (iterator == status_data.end()) {
|
||||||
LOG_WARNING(Frontend, "Invalid compatibility number {}", compatiblity.toStdString());
|
LOG_WARNING(Frontend, "Invalid compatibility number {}", compatibility.toStdString());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
CompatStatus status = iterator->second;
|
const CompatStatus& status = iterator->second;
|
||||||
setData(compatiblity, CompatNumberRole);
|
setData(compatibility, CompatNumberRole);
|
||||||
setText(QObject::tr(status.text));
|
setText(QObject::tr(status.text));
|
||||||
setToolTip(QObject::tr(status.tooltip));
|
setToolTip(QObject::tr(status.tooltip));
|
||||||
setData(CreateCirclePixmapFromColor(status.color), Qt::DecorationRole);
|
setData(CreateCirclePixmapFromColor(status.color), Qt::DecorationRole);
|
||||||
|
|
Loading…
Reference in New Issue