mirror of
https://invent.kde.org/network/falkon.git
synced 2024-11-11 09:32:12 +01:00
AddTab button: Middle click opens tab with text/url from X11 clipboard
This commit is contained in:
parent
033bfa246b
commit
07e4b7d559
|
@ -47,6 +47,8 @@ public:
|
||||||
|
|
||||||
void disconnectObjects();
|
void disconnectObjects();
|
||||||
|
|
||||||
|
void wheelEvent(QWheelEvent* event);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void reloadTab(int index);
|
void reloadTab(int index);
|
||||||
void stopTab(int index);
|
void stopTab(int index);
|
||||||
|
@ -82,7 +84,6 @@ private:
|
||||||
void mousePressEvent(QMouseEvent* event);
|
void mousePressEvent(QMouseEvent* event);
|
||||||
void mouseMoveEvent(QMouseEvent* event);
|
void mouseMoveEvent(QMouseEvent* event);
|
||||||
void mouseReleaseEvent(QMouseEvent* event);
|
void mouseReleaseEvent(QMouseEvent* event);
|
||||||
void wheelEvent(QWheelEvent* event);
|
|
||||||
bool event(QEvent* event);
|
bool event(QEvent* event);
|
||||||
|
|
||||||
void dragEnterEvent(QDragEnterEvent* event);
|
void dragEnterEvent(QDragEnterEvent* event);
|
||||||
|
|
|
@ -36,6 +36,7 @@
|
||||||
#include <QMenu>
|
#include <QMenu>
|
||||||
#include <QStackedWidget>
|
#include <QStackedWidget>
|
||||||
#include <QWebHistory>
|
#include <QWebHistory>
|
||||||
|
#include <QClipboard>
|
||||||
#include <QFile>
|
#include <QFile>
|
||||||
|
|
||||||
AddTabButton::AddTabButton(TabWidget* tabWidget, TabBar* tabBar)
|
AddTabButton::AddTabButton(TabWidget* tabWidget, TabBar* tabBar)
|
||||||
|
@ -50,6 +51,25 @@ AddTabButton::AddTabButton(TabWidget* tabWidget, TabBar* tabBar)
|
||||||
setToolTip(TabWidget::tr("New Tab"));
|
setToolTip(TabWidget::tr("New Tab"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AddTabButton::wheelEvent(QWheelEvent* event)
|
||||||
|
{
|
||||||
|
m_tabBar->wheelEvent(event);
|
||||||
|
}
|
||||||
|
|
||||||
|
void AddTabButton::mouseReleaseEvent(QMouseEvent* event)
|
||||||
|
{
|
||||||
|
if (event->button() == Qt::MiddleButton && rect().contains(event->pos())) {
|
||||||
|
QString selectionClipboard = QApplication::clipboard()->text(QClipboard::Selection);
|
||||||
|
QUrl guessedUrl = WebView::guessUrlFromString(selectionClipboard);
|
||||||
|
|
||||||
|
if (!guessedUrl.isEmpty()) {
|
||||||
|
m_tabWidget->addView(guessedUrl, Qz::NT_SelectedTabAtTheEnd);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ToolButton::mouseReleaseEvent(event);
|
||||||
|
}
|
||||||
|
|
||||||
void AddTabButton::dragEnterEvent(QDragEnterEvent* event)
|
void AddTabButton::dragEnterEvent(QDragEnterEvent* event)
|
||||||
{
|
{
|
||||||
const QMimeData* mime = event->mimeData();
|
const QMimeData* mime = event->mimeData();
|
||||||
|
|
|
@ -41,6 +41,8 @@ public:
|
||||||
explicit AddTabButton(TabWidget* tabWidget, TabBar* tabBar);
|
explicit AddTabButton(TabWidget* tabWidget, TabBar* tabBar);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void wheelEvent(QWheelEvent* event);
|
||||||
|
void mouseReleaseEvent(QMouseEvent* event);
|
||||||
void dragEnterEvent(QDragEnterEvent* event);
|
void dragEnterEvent(QDragEnterEvent* event);
|
||||||
void dropEvent(QDropEvent* event);
|
void dropEvent(QDropEvent* event);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user