Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sidebar: use item label for tooltip, show id when debugging #4247

Merged
merged 1 commit into from
Aug 28, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 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();
}
// Show the label. Helpful for long names with a narrow sidebar.
return tree_item->getLabel();
} else if (role == TreeItemModel::kDataRole) {
// We use Qt::UserRole to ask for the datapath.
return tree_item->getData();
Expand Down