From e5121b5d554a4d7dea8db45f5123ec47c5215469 Mon Sep 17 00:00:00 2001 From: Jan Holthuis Date: Sat, 14 Nov 2020 12:59:17 +0100 Subject: CueDAO: Inline constant that is only used in a single location --- src/library/dao/cuedao.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'src/library/dao') diff --git a/src/library/dao/cuedao.cpp b/src/library/dao/cuedao.cpp index 30ba885082..fb76e915c6 100644 --- a/src/library/dao/cuedao.cpp +++ b/src/library/dao/cuedao.cpp @@ -19,18 +19,17 @@ namespace { const mixxx::Logger kLogger = mixxx::Logger("CueDAO"); -// The label column is not nullable! -const QVariant kEmptyLabel = QVariant(QLatin1String("")); - +/// Wrap a `QString` label in a `QVariant`. The label column is not nullable, +/// so this function also makes sure that the label an empty string, not null. inline const QVariant labelToQVariant(const QString& label) { if (label.isNull()) { - return kEmptyLabel; // null -> empty + return QLatin1String(""); // null -> empty } else { return label; } } -// Empty labels are read as null strings +/// Empty labels are read as null strings inline QString labelFromQVariant(const QVariant& value) { const auto label = value.toString(); if (label.isEmpty()) { -- cgit v1.2.3