Qt: ConfigController::getOption now has a default argument
Vicki Pfau vi@endrift.com
Thu, 03 Aug 2017 22:20:32 -0700
2 files changed,
10 insertions(+),
6 deletions(-)
M
src/platform/qt/ConfigController.cpp
→
src/platform/qt/ConfigController.cpp
@@ -158,12 +158,16 @@ }
m_optionSet[optionName]->setValue(mCoreConfigGetValue(&m_config, key)); } -QString ConfigController::getOption(const char* key) const { - return QString(mCoreConfigGetValue(&m_config, key)); +QString ConfigController::getOption(const char* key, const QVariant& defaultVal) const { + const char* val = mCoreConfigGetValue(&m_config, key); + if (val) { + return QString(val); + } + return defaultVal.toString(); } -QString ConfigController::getOption(const QString& key) const { - return getOption(key.toUtf8().constData()); +QString ConfigController::getOption(const QString& key, const QVariant& defaultVal) const { + return getOption(key.toUtf8().constData(), defaultVal); } QVariant ConfigController::getQtOption(const QString& key, const QString& group) const {
M
src/platform/qt/ConfigController.h
→
src/platform/qt/ConfigController.h
@@ -70,8 +70,8 @@
ConfigOption* addOption(const char* key); void updateOption(const char* key); - QString getOption(const char* key) const; - QString getOption(const QString& key) const; + QString getOption(const char* key, const QVariant& defaultVal = QVariant()) const; + QString getOption(const QString& key, const QVariant& defaultVal = QVariant()) const; QVariant getQtOption(const QString& key, const QString& group = QString()) const;