Use empty qstring instead of nullptr
https://github.com/ubports/unity8/pull/356#pullrequestreview-572324879
commitac69b162683ecd80d4bcfe877d4444797f1f6930
authorDalton Durst <dalton@ubports.com>
dateWed 20 Jan 2021, 09:59 (6 years ago)
parent5bed8a1
plugins/Utils/windowstatestorage.cpp+1−1
@@ -275,7 +275,7 @@ WindowStateStorage::WindowStateStorage(const QString &dbName, QObject *parent):
275275{
276276 qRegisterMetaType<WindowStateStorage::WindowState>("WindowStateStorage::WindowState");
277277 QString dbFile;
278− if (dbName == nullptr) {
278+ if (dbName.isEmpty()) {
279279 const QString dbPath = QStandardPaths::writableLocation(QStandardPaths::GenericCacheLocation) + QStringLiteral("/unity8/");
280280 QDir dir;
281281 dir.mkpath(dbPath);
plugins/Utils/windowstatestorage.h+1−1
@@ -50,7 +50,7 @@ public:
5050 Q_DECLARE_FLAGS(WindowStates, WindowState)
5151 Q_FLAG(WindowStates)
5252
53− WindowStateStorage(const QString &dbName = nullptr, QObject *parent = nullptr);
53+ WindowStateStorage(const QString &dbName = QString(), QObject *parent = nullptr);
5454 virtual ~WindowStateStorage();
5555
5656 Q_INVOKABLE WindowState getState(const QString &windowId, WindowState defaultValue) const;
tests/plugins/Utils/WindowStateStorageTest.cpp+1−1
@@ -46,7 +46,7 @@ private Q_SLOTS:
4646 // copy the old database or risk the wrath of long-time users.
4747 void testDbNameDefault() {
4848 delete storage;
49− storage = new WindowStateStorage(nullptr, this);
49+ storage = new WindowStateStorage(QString(), this);
5050 QCOMPARE(storage->getDbName(), QStandardPaths::writableLocation(QStandardPaths::GenericCacheLocation) + QStringLiteral("/unity8/windowstatestorage.sqlite"));
5151 }
5252