From 64d0d6b00d99227fae55d851ab70318cf41675e4 Mon Sep 17 00:00:00 2001 From: karliss Date: Mon, 29 Jul 2019 07:56:23 +0300 Subject: [PATCH] Allow returning to top level in sdb widget. (#1696) --- src/widgets/SdbWidget.cpp | 10 +++++----- src/widgets/SdbWidget.h | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/widgets/SdbWidget.cpp b/src/widgets/SdbWidget.cpp index f52712b0..21c39f7f 100644 --- a/src/widgets/SdbWidget.cpp +++ b/src/widgets/SdbWidget.cpp @@ -17,14 +17,12 @@ SdbWidget::SdbWidget(MainWindow *main, QAction *action) : path.clear(); connect(Core(), SIGNAL(refreshAll()), this, SLOT(reload())); - reload(nullptr); + reload(); } void SdbWidget::reload(QString _path) { - if (!_path.isNull()) { - path = _path; - } + path = _path; ui->lineEdit->setText(path); /* insert root sdb keyvalue pairs */ @@ -44,7 +42,9 @@ void SdbWidget::reload(QString _path) qhelpers::adjustColumns(ui->treeWidget, 0); /* namespaces */ keys = Core()->sdbList(path); - keys.append(".."); + if (!path.isEmpty()) { + keys.append(".."); + } for (const QString &key : keys) { QTreeWidgetItem *tempItem = new QTreeWidgetItem(); tempItem->setText(0, key + "/"); diff --git a/src/widgets/SdbWidget.h b/src/widgets/SdbWidget.h index 5840e212..f763aad1 100644 --- a/src/widgets/SdbWidget.h +++ b/src/widgets/SdbWidget.h @@ -25,7 +25,7 @@ private slots: void on_lockButton_clicked(); void on_treeWidget_itemChanged(QTreeWidgetItem *item, int column); - void reload(QString _path = nullptr); + void reload(QString _path = QString()); private: std::unique_ptr ui;