diff --git a/src/lib/bookmarks/bookmarkstreeview.cpp b/src/lib/bookmarks/bookmarkstreeview.cpp index 369a0ea6e..1a2984bc6 100644 --- a/src/lib/bookmarks/bookmarkstreeview.cpp +++ b/src/lib/bookmarks/bookmarkstreeview.cpp @@ -61,10 +61,12 @@ void BookmarksTreeView::setViewType(BookmarksTreeView::ViewType type) case BookmarksManagerViewType: setColumnHidden(1, false); setHeaderHidden(false); + setMouseTracking(false); break; case BookmarksSidebarViewType: setColumnHidden(1, true); setHeaderHidden(true); + setMouseTracking(true); break; default: break; @@ -175,6 +177,22 @@ void BookmarksTreeView::rowsInserted(const QModelIndex &parent, int start, int e QTreeView::rowsInserted(parent, start, end); } +void BookmarksTreeView::mouseMoveEvent(QMouseEvent* event) +{ + if (m_type == BookmarksSidebarViewType) { + QCursor cursor = Qt::ArrowCursor; + if (event->buttons() == Qt::NoButton) { + QModelIndex index = indexAt(event->pos()); + if (index.isValid() && index.data(BookmarksModel::TypeRole).toInt() == BookmarkItem::Url) { + cursor = Qt::PointingHandCursor; + } + } + setCursor(cursor); + } + + QTreeView::mouseMoveEvent(event); +} + void BookmarksTreeView::mousePressEvent(QMouseEvent* event) { QTreeView::mousePressEvent(event); @@ -193,6 +211,11 @@ void BookmarksTreeView::mousePressEvent(QMouseEvent* event) else if (buttons == Qt::MiddleButton || modifiers == Qt::ControlModifier) { emit bookmarkCtrlActivated(item); } + + // Activate bookmarks with single mouse click in Sidebar + if (m_type == BookmarksSidebarViewType && buttons == Qt::LeftButton && modifiers == Qt::NoModifier) { + emit bookmarkActivated(item); + } } } } diff --git a/src/lib/bookmarks/bookmarkstreeview.h b/src/lib/bookmarks/bookmarkstreeview.h index 15f081ab0..b7e6b41a0 100644 --- a/src/lib/bookmarks/bookmarkstreeview.h +++ b/src/lib/bookmarks/bookmarkstreeview.h @@ -77,6 +77,7 @@ private: void restoreExpandedState(const QModelIndex &parent); void rowsInserted(const QModelIndex &parent, int start, int end); + void mouseMoveEvent(QMouseEvent* event); void mousePressEvent(QMouseEvent* event); void mouseDoubleClickEvent(QMouseEvent* event); void keyPressEvent(QKeyEvent* event);