Commit a485c018 authored by Jule Marcoueille's avatar Jule Marcoueille

Changement mineurs sur la gestion du scroll

parent cf6c118d
......@@ -74,7 +74,13 @@ public:
* false -> key released.
*/
static bool _key_alt;
/*!
* \brief Contains the state of tke CTRL key.
* true -> key pushed.
* false -> key released.
*/
static bool _key_ctrl;
/*!
* \brief To show the x beginning of the trace.
......
......@@ -101,7 +101,8 @@ void Interface_graphic::load_windows(){
*/
QMetaObject::connectSlotsByName(NULL);
// QMetaObject::connectSlotsByName(_ui_time_selection_export);
/* Display the main window */
this->show();
}
......
......@@ -6,7 +6,8 @@
#include "render_opengl.hpp"
extern bool Info::Render::_key_alt;
extern bool Info::Render::_key_alt;
extern bool Info::Render::_key_ctrl;
using namespace std;
......@@ -603,17 +604,21 @@ void Render_opengl::mouseReleaseEvent(QMouseEvent * /*event*/){
}
void Render_opengl::wheelEvent(QWheelEvent * event) {
int num_degrees = event->delta() / 8;
int num_steps = num_degrees / 15;
Element_pos scale_coeff = num_steps;
// cerr << Info::Render::_key_alt << endl;
if (Info::Render::_key_alt) {/* Zoom on height */
change_scale_y(scale_coeff);
}
else { /* Zoom on time */
change_scale(scale_coeff);
}
void Render_opengl::wheelEvent(QWheelEvent * event){
int num_degrees = event->delta() / 8;
int num_steps = num_degrees / 15;
Element_pos scale_coeff = num_steps;
int ctrl_factor = 1;
if (event->modifiers() == Qt::CTRL) ctrl_factor *= _ctrl_zoom_factor;
// cerr << Info::Render::_key_alt << endl;
if (true == Info::Render::_key_alt){/* Zoom on height */
change_scale_y(scale_coeff);
}else{ /* Zoom on time */
change_scale(scale_coeff*ctrl_factor);
}
event->accept();/* accept the event */
}
......@@ -624,12 +629,13 @@ void Render_opengl::keyPressEvent(QKeyEvent * event) {
int ctrl_factor = 1;
if (event->key() == Qt::Key_Alt) {
// cerr << "Push" << endl;
// cerr << "Push" << endl;
Info::Render::_key_alt = true;
}
if (event->modifiers() == Qt::CTRL) {
ctrl_factor *= _ctrl_scroll_factor;
Info::Render::_key_ctrl = true;
}
switch (event->key()) {
......@@ -663,22 +669,6 @@ void Render_opengl::keyPressEvent(QKeyEvent * event) {
*/
change_translate_y(-1*ctrl_factor);
break;
case Qt::Key_Plus:
/*
* Key 'plus' pressed.
*/
if (ctrl_factor != 1)
change_scale(1*ctrl_factor);
break;
case Qt::Key_Minus:
/*
* Key 'minus' pressed.
*/
if (ctrl_factor != 1)
change_scale(-1*ctrl_factor);
break;
default:
/*
* Unknow key pressed.
......@@ -695,6 +685,10 @@ void Render_opengl::keyReleaseEvent(QKeyEvent * event){
// cerr << "Release" << endl;
Info::Render::_key_alt = false;
}
if (event->key() == Qt::Key_Control) {
Info::Render::_key_ctrl = false;
}
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment