mirror of
https://invent.kde.org/network/falkon.git
synced 2024-12-24 12:46:35 +01:00
VerticalTabs: Open new tab with double and middle click in free space
Differential Revision: https://phabricator.kde.org/D11466
This commit is contained in:
parent
0a23bc9145
commit
8e88d43200
@ -130,6 +130,8 @@ Q_SIGNALS:
|
||||
void aboutToClose();
|
||||
|
||||
public Q_SLOTS:
|
||||
void addTab();
|
||||
|
||||
void goHome();
|
||||
void goHomeInNewTab();
|
||||
void goBack();
|
||||
@ -162,7 +164,6 @@ public Q_SLOTS:
|
||||
void showSource(WebView *view = Q_NULLPTR);
|
||||
|
||||
private Q_SLOTS:
|
||||
void addTab();
|
||||
void openLocation();
|
||||
void openFile();
|
||||
void closeWindow();
|
||||
|
@ -22,6 +22,7 @@
|
||||
#include "tabmodel.h"
|
||||
#include "webtab.h"
|
||||
#include "tabcontextmenu.h"
|
||||
#include "browserwindow.h"
|
||||
|
||||
#include <QTimer>
|
||||
#include <QToolTip>
|
||||
@ -200,8 +201,12 @@ bool TabTreeView::viewportEvent(QEvent *event)
|
||||
const QModelIndex index = indexAt(me->pos());
|
||||
updateIndex(index);
|
||||
WebTab *tab = index.data(TabModel::WebTabRole).value<WebTab*>();
|
||||
if (me->buttons() == Qt::MiddleButton && tab) {
|
||||
tab->closeTab();
|
||||
if (me->buttons() == Qt::MiddleButton) {
|
||||
if (tab) {
|
||||
tab->closeTab();
|
||||
} else {
|
||||
m_window->addTab();
|
||||
}
|
||||
}
|
||||
if (me->buttons() != Qt::LeftButton) {
|
||||
m_pressedIndex = QModelIndex();
|
||||
@ -269,6 +274,15 @@ bool TabTreeView::viewportEvent(QEvent *event)
|
||||
break;
|
||||
}
|
||||
|
||||
case QEvent::MouseButtonDblClick: {
|
||||
QMouseEvent *me = static_cast<QMouseEvent*>(event);
|
||||
const QModelIndex index = indexAt(me->pos());
|
||||
if (me->button() == Qt::LeftButton && !index.isValid()) {
|
||||
m_window->addTab();
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case QEvent::HoverEnter:
|
||||
case QEvent::HoverLeave:
|
||||
case QEvent::HoverMove: {
|
||||
|
Loading…
Reference in New Issue
Block a user