mirror of
https://invent.kde.org/network/falkon.git
synced 2024-12-24 12:46:35 +01:00
MouseGestures: Added 2 new gestures for switching tabs
- up + right and up + left
This commit is contained in:
parent
398c1ffdd6
commit
14c2166e57
@ -16,8 +16,9 @@
|
|||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
* ============================================================ */
|
* ============================================================ */
|
||||||
#include "mousegestures.h"
|
#include "mousegestures.h"
|
||||||
#include "webview.h"
|
|
||||||
#include "webpage.h"
|
#include "webpage.h"
|
||||||
|
#include "tabbedwebview.h"
|
||||||
|
#include "tabwidget.h"
|
||||||
#include "mainapplication.h"
|
#include "mainapplication.h"
|
||||||
#include "qupzilla.h"
|
#include "qupzilla.h"
|
||||||
#include "mousegesturessettingsdialog.h"
|
#include "mousegesturessettingsdialog.h"
|
||||||
@ -54,6 +55,12 @@ MouseGestures::MouseGestures(QObject* parent) :
|
|||||||
QjtMouseGesture* upDownGesture = new QjtMouseGesture(DirectionList() << Up << Down, m_filter);
|
QjtMouseGesture* upDownGesture = new QjtMouseGesture(DirectionList() << Up << Down, m_filter);
|
||||||
connect(upDownGesture, SIGNAL(gestured()), this, SLOT(upDownGestured()));
|
connect(upDownGesture, SIGNAL(gestured()), this, SLOT(upDownGestured()));
|
||||||
|
|
||||||
|
QjtMouseGesture* upLeftGesture = new QjtMouseGesture(DirectionList() << Up << Left, m_filter);
|
||||||
|
connect(upLeftGesture, SIGNAL(gestured()), this, SLOT(upLeftGestured()));
|
||||||
|
|
||||||
|
QjtMouseGesture* upRightGesture = new QjtMouseGesture(DirectionList() << Up << Right, m_filter);
|
||||||
|
connect(upRightGesture, SIGNAL(gestured()), this, SLOT(upRightGestured()));
|
||||||
|
|
||||||
m_filter->addGesture(upGesture);
|
m_filter->addGesture(upGesture);
|
||||||
m_filter->addGesture(downGesture);
|
m_filter->addGesture(downGesture);
|
||||||
m_filter->addGesture(leftGesture);
|
m_filter->addGesture(leftGesture);
|
||||||
@ -62,6 +69,8 @@ MouseGestures::MouseGestures(QObject* parent) :
|
|||||||
m_filter->addGesture(downRightGesture);
|
m_filter->addGesture(downRightGesture);
|
||||||
m_filter->addGesture(downLeftGesture);
|
m_filter->addGesture(downLeftGesture);
|
||||||
m_filter->addGesture(upDownGesture);
|
m_filter->addGesture(upDownGesture);
|
||||||
|
m_filter->addGesture(upLeftGesture);
|
||||||
|
m_filter->addGesture(upRightGesture);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MouseGestures::mousePress(QObject* obj, QMouseEvent* event)
|
bool MouseGestures::mousePress(QObject* obj, QMouseEvent* event)
|
||||||
@ -165,6 +174,26 @@ void MouseGestures::upDownGestured()
|
|||||||
m_view.data()->reload();
|
m_view.data()->reload();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MouseGestures::upLeftGestured()
|
||||||
|
{
|
||||||
|
TabbedWebView* view = qobject_cast<TabbedWebView*>(m_view.data());
|
||||||
|
if (!view) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
view->tabWidget()->previousTab();
|
||||||
|
}
|
||||||
|
|
||||||
|
void MouseGestures::upRightGestured()
|
||||||
|
{
|
||||||
|
TabbedWebView* view = qobject_cast<TabbedWebView*>(m_view.data());
|
||||||
|
if (!view) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
view->tabWidget()->nextTab();
|
||||||
|
}
|
||||||
|
|
||||||
MouseGestures::~MouseGestures()
|
MouseGestures::~MouseGestures()
|
||||||
{
|
{
|
||||||
m_filter->clearGestures(true);
|
m_filter->clearGestures(true);
|
||||||
|
@ -49,8 +49,8 @@ private slots:
|
|||||||
void downLeftGestured();
|
void downLeftGestured();
|
||||||
|
|
||||||
void upDownGestured();
|
void upDownGestured();
|
||||||
// void upLeftGestured();
|
void upLeftGestured();
|
||||||
// void upRightGestured();
|
void upRightGestured();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QjtMouseGestureFilter* m_filter;
|
QjtMouseGestureFilter* m_filter;
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>502</width>
|
<width>502</width>
|
||||||
<height>355</height>
|
<height>420</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
@ -140,20 +140,6 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="3" column="0">
|
|
||||||
<widget class="QLabel" name="label_6">
|
|
||||||
<property name="pixmap">
|
|
||||||
<pixmap resource="mousegestures.qrc">:/mousegestures/data/right.gif</pixmap>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="3" column="1">
|
|
||||||
<widget class="QLabel" name="label_9">
|
|
||||||
<property name="text">
|
|
||||||
<string><b>Forward</b><br/>Go forward in history</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="2">
|
<item row="0" column="2">
|
||||||
<widget class="QLabel" name="label_8">
|
<widget class="QLabel" name="label_8">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
@ -189,19 +175,61 @@
|
|||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="2">
|
<item row="2" column="2">
|
||||||
|
<widget class="QLabel" name="label_6">
|
||||||
|
<property name="pixmap">
|
||||||
|
<pixmap resource="mousegestures.qrc">:/mousegestures/data/right.gif</pixmap>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="3">
|
||||||
|
<widget class="QLabel" name="label_9">
|
||||||
|
<property name="text">
|
||||||
|
<string><b>Forward</b><br/>Go forward in history</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="3" column="1">
|
||||||
|
<widget class="QLabel" name="label_19">
|
||||||
|
<property name="text">
|
||||||
|
<string><b>Previous tab</b><br/>Switch to previous tab</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="4" column="0">
|
||||||
<widget class="QLabel" name="label_14">
|
<widget class="QLabel" name="label_14">
|
||||||
<property name="pixmap">
|
<property name="pixmap">
|
||||||
<pixmap resource="mousegestures.qrc">:/mousegestures/data/down-left.gif</pixmap>
|
<pixmap resource="mousegestures.qrc">:/mousegestures/data/down-left.gif</pixmap>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="3">
|
<item row="4" column="1">
|
||||||
<widget class="QLabel" name="label_16">
|
<widget class="QLabel" name="label_16">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string><b>Home</b><br/>Go to homepage</string>
|
<string><b>Home</b><br/>Go to homepage</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="3" column="2">
|
||||||
|
<widget class="QLabel" name="label_20">
|
||||||
|
<property name="pixmap">
|
||||||
|
<pixmap resource="mousegestures.qrc">:/mousegestures/data/up-right.gif</pixmap>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="3" column="3">
|
||||||
|
<widget class="QLabel" name="label_21">
|
||||||
|
<property name="text">
|
||||||
|
<string><b>Next tab</b><br/>Switch to next tab</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="3" column="0">
|
||||||
|
<widget class="QLabel" name="label_18">
|
||||||
|
<property name="pixmap">
|
||||||
|
<pixmap resource="mousegestures.qrc">:/mousegestures/data/up-left.gif</pixmap>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
|
Loading…
Reference in New Issue
Block a user