Commit 3c2e9f25 authored by Christoffer Ackelman's avatar Christoffer Ackelman

QT: Fixed rendering artifact when wheel scrolling.

parent c640322b
...@@ -741,6 +741,7 @@ int FlowDrawQt::event_handler(QEvent* event, QWidget* target) ...@@ -741,6 +741,7 @@ int FlowDrawQt::event_handler(QEvent* event, QWidget* target)
} else if (wheelEvent->delta() < 0) { } else if (wheelEvent->delta() < 0) {
sts = basectx->event_handler(flow_eEvent_ScrollDown, 0, 0, 0, 0); sts = basectx->event_handler(flow_eEvent_ScrollDown, 0, 0, 0, 0);
} }
basectx->clear(); // For some reason, flow does not redraw after scrolling
break; break;
} }
default: default:
......
...@@ -86,10 +86,13 @@ QWidget* QtScrollWidgetFlow::initScroll(unsigned int eCtxType, ...@@ -86,10 +86,13 @@ QWidget* QtScrollWidgetFlow::initScroll(unsigned int eCtxType,
QScrollArea* form = new QScrollArea(); QScrollArea* form = new QScrollArea();
scroll_h = form->horizontalScrollBar(); scroll_h = form->horizontalScrollBar();
scroll_v = form->verticalScrollBar(); scroll_v = form->verticalScrollBar();
/*
TODO: this callback resets the scrollbar to 0.
QObject::connect( QObject::connect(
scroll_h, SIGNAL(valueChanged(int)), this, SLOT(scroll_h_action(int))); scroll_h, SIGNAL(valueChanged(int)), this, SLOT(scroll_h_action(int)));
QObject::connect( QObject::connect(
scroll_v, SIGNAL(valueChanged(int)), this, SLOT(scroll_v_action(int))); scroll_v, SIGNAL(valueChanged(int)), this, SLOT(scroll_v_action(int)));
*/
form->setWidget(this); form->setWidget(this);
form->setWidgetResizable(true); form->setWidgetResizable(true);
...@@ -162,28 +165,28 @@ void QtScrollWidgetFlow::scroll_callback_cb() ...@@ -162,28 +165,28 @@ void QtScrollWidgetFlow::scroll_callback_cb()
if (scroll_data->scroll_h_managed) { if (scroll_data->scroll_h_managed) {
scroll_h_ignore = 1; scroll_h_ignore = 1;
scroll_h_value = (double)data->offset_x;
scroll_h_pagesize = data->window_width;
scroll_h_upper = data->total_width;
if (data->window_width != scroll_h_pagesize if (data->window_width != scroll_h_pagesize
|| data->total_width != scroll_h_upper || scroll_configure) { || data->total_width != scroll_h_upper || scroll_configure) {
scroll_data->scroll_h->setMaximum(scroll_h_upper); scroll_data->scroll_h->setMaximum(data->total_width);
scroll_data->scroll_h->setPageStep(scroll_h_pagesize); scroll_data->scroll_h->setPageStep(data->window_width);
} }
scroll_data->scroll_h->setSliderPosition(scroll_h_value); scroll_data->scroll_h->setSliderPosition(data->offset_x);
scroll_h_value = data->offset_x;
scroll_h_pagesize = data->window_width;
scroll_h_upper = data->total_width;
} }
if (scroll_data->scroll_v_managed) { if (scroll_data->scroll_v_managed) {
scroll_v_ignore = 1; scroll_v_ignore = 1;
scroll_v_value = (double)data->offset_y;
scroll_v_pagesize = data->window_height;
scroll_v_upper = data->total_height;
if (data->window_height != scroll_v_pagesize if (data->window_height != scroll_v_pagesize
|| data->total_height != scroll_v_upper || scroll_configure) { || data->total_height != scroll_v_upper || scroll_configure) {
scroll_data->scroll_v->setMaximum(scroll_v_upper); scroll_data->scroll_v->setMaximum(data->total_height);
scroll_data->scroll_v->setPageStep(scroll_v_pagesize); scroll_data->scroll_v->setPageStep(data->window_height);
} }
scroll_data->scroll_v->setSliderPosition(scroll_v_value); scroll_data->scroll_v->setSliderPosition(data->offset_y);
scroll_v_value = data->offset_y;
scroll_v_pagesize = data->window_height;
scroll_v_upper = data->total_height;
} }
scroll_configure = 0; scroll_configure = 0;
} }
......
...@@ -808,6 +808,7 @@ int GlowDrawQt::event_handler(QEvent* event, QWidget* target) ...@@ -808,6 +808,7 @@ int GlowDrawQt::event_handler(QEvent* event, QWidget* target)
sts = ctx->event_handler( sts = ctx->event_handler(
glow_eEvent_ScrollDown, wheelEvent->x(), wheelEvent->y(), 0, 0); glow_eEvent_ScrollDown, wheelEvent->x(), wheelEvent->y(), 0, 0);
} }
basectx->clear(); // For some reason, glow does not redraw after scrolling
break; break;
} }
default: default:
......
...@@ -88,10 +88,13 @@ QWidget* QtScrollWidgetGlow::initScroll(unsigned int eCtxType, ...@@ -88,10 +88,13 @@ QWidget* QtScrollWidgetGlow::initScroll(unsigned int eCtxType,
QScrollArea* form = new QScrollArea(); QScrollArea* form = new QScrollArea();
scroll_h = form->horizontalScrollBar(); scroll_h = form->horizontalScrollBar();
scroll_v = form->verticalScrollBar(); scroll_v = form->verticalScrollBar();
/*
TODO: this callback resets the scrollbar to 0.
QObject::connect( QObject::connect(
scroll_h, SIGNAL(valueChanged(int)), this, SLOT(scroll_h_action(int))); scroll_h, SIGNAL(valueChanged(int)), this, SLOT(scroll_h_action(int)));
QObject::connect( QObject::connect(
scroll_v, SIGNAL(valueChanged(int)), this, SLOT(scroll_v_action(int))); scroll_v, SIGNAL(valueChanged(int)), this, SLOT(scroll_v_action(int)));
*/
form->setWidget(this); form->setWidget(this);
form->setWidgetResizable(true); form->setWidgetResizable(true);
...@@ -164,28 +167,28 @@ void QtScrollWidgetGlow::scroll_callback_cb() ...@@ -164,28 +167,28 @@ void QtScrollWidgetGlow::scroll_callback_cb()
if (scroll_data->scroll_h_managed) { if (scroll_data->scroll_h_managed) {
scroll_h_ignore = 1; scroll_h_ignore = 1;
scroll_h_value = (double)data->offset_x;
scroll_h_pagesize = data->window_width;
scroll_h_upper = data->total_width;
if (data->window_width != scroll_h_pagesize if (data->window_width != scroll_h_pagesize
|| data->total_width != scroll_h_upper || scroll_configure) { || data->total_width != scroll_h_upper || scroll_configure) {
scroll_data->scroll_h->setMaximum(scroll_h_upper); scroll_data->scroll_h->setMaximum(data->total_width);
scroll_data->scroll_h->setPageStep(scroll_h_pagesize); scroll_data->scroll_h->setPageStep(data->window_width);
} }
scroll_data->scroll_h->setSliderPosition(scroll_h_value); scroll_data->scroll_h->setSliderPosition(data->offset_x);
scroll_h_value = data->offset_x;
scroll_h_pagesize = data->window_width;
scroll_h_upper = data->total_width;
} }
if (scroll_data->scroll_v_managed) { if (scroll_data->scroll_v_managed) {
scroll_v_ignore = 1; scroll_v_ignore = 1;
scroll_v_value = (double)data->offset_y;
scroll_v_pagesize = data->window_height;
scroll_v_upper = data->total_height;
if (data->window_height != scroll_v_pagesize if (data->window_height != scroll_v_pagesize
|| data->total_height != scroll_v_upper || scroll_configure) { || data->total_height != scroll_v_upper || scroll_configure) {
scroll_data->scroll_v->setMaximum(scroll_v_upper); scroll_data->scroll_v->setMaximum(data->total_height);
scroll_data->scroll_v->setPageStep(scroll_v_pagesize); scroll_data->scroll_v->setPageStep(data->window_height);
} }
scroll_data->scroll_v->setSliderPosition(scroll_v_value); scroll_data->scroll_v->setSliderPosition(data->offset_y);
scroll_v_value = data->offset_y;
scroll_v_pagesize = data->window_height;
scroll_v_upper = data->total_height;
} }
scroll_configure = 0; scroll_configure = 0;
} }
......
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