summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPhilipp Erhardt <Philipp.Erhardt@informatik.stud.uni-erlangen.de>2015-06-19 13:30:40 +0200
committerPhilipp Erhardt <Philipp.Erhardt@informatik.stud.uni-erlangen.de>2015-06-19 13:33:17 +0200
commit36d117a19d10adfd594d79c2b09ccf0e6c35b726 (patch)
treebebbf67d773af873a11e18b889ed8f9b481c5825 /src
parent92711312f40fc548ea6eedd79986a96b64fd7214 (diff)
Implement configurable mouse button (beamerwindow)
Diffstat (limited to 'src')
-rw-r--r--src/beamerwindow.cpp13
-rw-r--r--src/beamerwindow.h2
2 files changed, 13 insertions, 2 deletions
diff --git a/src/beamerwindow.cpp b/src/beamerwindow.cpp
index 78739d8..dbd3c17 100644
--- a/src/beamerwindow.cpp
+++ b/src/beamerwindow.cpp
@@ -22,6 +22,15 @@ BeamerWindow::BeamerWindow(Viewer *v, QWidget *parent) :
CFG *config = CFG::get_instance();
mouse_wheel_factor = config->get_value("mouse_wheel_factor").toInt();
+ switch (config->get_value("click_link_button").toInt()) {
+ case 1: click_link_button = Qt::LeftButton; break;
+ case 2: click_link_button = Qt::RightButton; break;
+ case 3: click_link_button = Qt::MidButton; break;
+ case 4: click_link_button = Qt::XButton1; break;
+ case 5: click_link_button = Qt::XButton2; break;
+ default: click_link_button = Qt::NoButton;
+ }
+
valid = true;
}
@@ -58,14 +67,14 @@ void BeamerWindow::paintEvent(QPaintEvent * /*event*/) {
}
void BeamerWindow::mousePressEvent(QMouseEvent *event) {
- if (event->button() == Qt::LeftButton) {
+ if (click_link_button != Qt::NoButton && event->button() == click_link_button) {
mx_down = event->x();
my_down = event->y();
}
}
void BeamerWindow::mouseReleaseEvent(QMouseEvent *event) {
- if (event->button() == Qt::LeftButton) {
+ if (click_link_button != Qt::NoButton && event->button() == click_link_button) {
if (mx_down == event->x() && my_down == event->y()) {
int page = layout->get_page();
pair<int, QPointF> location = layout->get_location_at(mx_down, my_down);
diff --git a/src/beamerwindow.h b/src/beamerwindow.h
index 94d6efa..56e432a 100644
--- a/src/beamerwindow.h
+++ b/src/beamerwindow.h
@@ -42,6 +42,8 @@ private:
int mouse_wheel_factor;
+ Qt::MouseButton click_link_button;
+
bool valid;
};