From a44be8b72e92362ddc8853da75a81b59214e4455 Mon Sep 17 00:00:00 2001 From: Daniele Cocca Date: Fri, 14 Oct 2011 23:32:12 +0200 Subject: [PATCH 1/2] Adding the possibility to close a tab by middle-clicking it. --- src/webview/tabbar.cpp | 14 ++++++++++++++ src/webview/tabbar.h | 1 + 2 files changed, 15 insertions(+) diff --git a/src/webview/tabbar.cpp b/src/webview/tabbar.cpp index f7d9f35d8..ea3d56317 100644 --- a/src/webview/tabbar.cpp +++ b/src/webview/tabbar.cpp @@ -230,3 +230,17 @@ void TabBar::mouseDoubleClickEvent(QMouseEvent* event) } QTabBar::mouseDoubleClickEvent(event); } + +void TabBar::mousePressEvent(QMouseEvent* event) +{ + TabWidget* tabWidget = qobject_cast(parentWidget()); + if (!tabWidget) + return; + + int id = tabAt(event->pos()); + if (id != -1 && event->buttons() == Qt::MiddleButton) { + tabWidget->closeTab(id); + return; + } + QTabBar::mousePressEvent(event); +} diff --git a/src/webview/tabbar.h b/src/webview/tabbar.h index a13540ed5..c4614676d 100644 --- a/src/webview/tabbar.h +++ b/src/webview/tabbar.h @@ -70,6 +70,7 @@ private slots: private: void mouseDoubleClickEvent(QMouseEvent* event); + void mousePressEvent(QMouseEvent* event); QSize tabSizeHint(int index) const; // void tabInserted(int index); From 861fe479d44690a80023bd59bc73068f8c55cda8 Mon Sep 17 00:00:00 2001 From: Daniele Cocca Date: Sat, 15 Oct 2011 00:15:29 +0200 Subject: [PATCH 2/2] Selecting all the contents of the WebSearchBar when receiving focus from keyboard (i.e., Ctrl+K). --- src/navigation/websearchbar.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/navigation/websearchbar.cpp b/src/navigation/websearchbar.cpp index e87e674a5..74789e4d2 100644 --- a/src/navigation/websearchbar.cpp +++ b/src/navigation/websearchbar.cpp @@ -104,6 +104,8 @@ void WebSearchBar::focusInEvent(QFocusEvent* e) if (text() == search) { clear(); + } else { + selectAll(); } QLineEdit::focusInEvent(e); }