Skip to content

Commit

Permalink
Sidebar: use item label for tooltip, show id when debugging
Browse files Browse the repository at this point in the history
  • Loading branch information
ronso0 committed Aug 27, 2021
1 parent c8c0df4 commit 02e8198
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/library/sidebarmodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include "library/treeitem.h"
#include "moc_sidebarmodel.cpp"
#include "util/assert.h"
#include "util/cmdlineargs.h"

namespace {

Expand Down Expand Up @@ -234,13 +235,14 @@ QVariant SidebarModel::data(const QModelIndex& index, int role) const {
if (tree_item) {
if (role == Qt::DisplayRole) {
return tree_item->getLabel();

} else if (role == Qt::ToolTipRole) {
// If it's the "Quick Links" node, display it's name
if (tree_item->getData().toString() == QUICK_LINK_NODE) {
return tree_item->getLabel();
} else {
if (CmdlineArgs::Instance().getDeveloper()) {
// Display the internal data for debugging
return tree_item->getData();
}
return tree_item->getLabel();
} else if (role == TreeItemModel::kDataRole) {
// We use Qt::UserRole to ask for the datapath.
return tree_item->getData();
Expand Down

0 comments on commit 02e8198

Please sign in to comment.