diff options
Diffstat (limited to 'src/panels/bookmarkstoolbar.cpp')
-rw-r--r-- | src/panels/bookmarkstoolbar.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/panels/bookmarkstoolbar.cpp b/src/panels/bookmarkstoolbar.cpp index 7c3517ec..01a7db30 100644 --- a/src/panels/bookmarkstoolbar.cpp +++ b/src/panels/bookmarkstoolbar.cpp @@ -12,6 +12,8 @@ #include "bookmarks/bookmarkstreemodel.hpp" #include <QShowEvent> +constexpr int elide_width = 100; + BookmarkToolBar::BookmarkToolBar(QWidget *parent) : QToolBar(parent) { /* @@ -36,13 +38,16 @@ void BookmarkToolBar::showEvent(QShowEvent *event) Q_CHECK_PTR(model); clear(); + const auto metrics = fontMetrics(); - const auto *root = model->item(); + const auto *root = model->item(); // TODO get root of Bookmarks Toolbar item Q_CHECK_PTR(root); for (int i = 0; i < root->childCount(); ++i) { const auto *child = root->child(i); if (child->type() != BookmarksTreeItem::Bookmark) continue; - addAction(child->action(this, rekonq::CurrentTab)); + auto *action = child->action(this, rekonq::CurrentTab); + action->setText(metrics.elidedText(action->text(), Qt::ElideRight, elide_width)); + addAction(action); } event->accept(); |