Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
proview
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Esteban Blanc
proview
Commits
852ae8d7
Commit
852ae8d7
authored
Sep 25, 2018
by
Claes Sjofors
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master'
parents
29de8b16
70030222
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
116 additions
and
111 deletions
+116
-111
xtt/lib/flow/qt/flow_draw_qt.cqt
xtt/lib/flow/qt/flow_draw_qt.cqt
+1
-0
xtt/lib/flow/qt/flow_scroll_widget_qt.cqt
xtt/lib/flow/qt/flow_scroll_widget_qt.cqt
+52
-47
xtt/lib/flow/qt/flow_scroll_widget_qt.h
xtt/lib/flow/qt/flow_scroll_widget_qt.h
+5
-8
xtt/lib/glow/qt/glow_draw_qt.cqt
xtt/lib/glow/qt/glow_draw_qt.cqt
+1
-0
xtt/lib/glow/qt/glow_scroll_widget_qt.cqt
xtt/lib/glow/qt/glow_scroll_widget_qt.cqt
+52
-48
xtt/lib/glow/qt/glow_scroll_widget_qt.h
xtt/lib/glow/qt/glow_scroll_widget_qt.h
+5
-8
No files found.
xtt/lib/flow/qt/flow_draw_qt.cqt
View file @
852ae8d7
...
...
@@ -623,6 +623,7 @@ int FlowDrawQt::event_handler(QEvent* event, QWidget* target)
case QEvent::Paint:
case QEvent::UpdateRequest: {
QPaintEvent* paintEvent = ((QPaintEvent*)event);
basectx->clear();
sts = basectx->event_handler(flow_eEvent_Exposure, paintEvent->rect().x(),
paintEvent->rect().y(), paintEvent->rect().width(),
paintEvent->rect().height());
...
...
xtt/lib/flow/qt/flow_scroll_widget_qt.cqt
View file @
852ae8d7
...
...
@@ -71,6 +71,11 @@ void QtScrollWidgetFlow::init(unsigned int eCtxType,
this->scroll_timerid = new QTimer(this);
}
bool QtScrollWidgetFlow::eventFilter(QObject *object, QEvent *event)
{
return (event->type() == QEvent::KeyPress);
}
QWidget* QtScrollWidgetFlow::initScroll(unsigned int eCtxType,
int (*init_proc)(FlowCtx* ctx, void* client_data), void* client_data,
int (*init_proc2)(QWidget* w, FlowCtx* ctx, void* client_data))
...
...
@@ -83,13 +88,22 @@ QWidget* QtScrollWidgetFlow::initScroll(unsigned int eCtxType,
this->init_widget_proc = init_proc2;
this->client_data = client_data;
this->scroll_timerid = new QTimer(this);
QScrollArea* form = new QScrollArea();
form = new QScrollArea();
form->installEventFilter(this);
scroll_h = form->horizontalScrollBar();
scroll_v = form->verticalScrollBar();
scroll_h->setTracking(false);
scroll_v->setTracking(false);
QObject::connect(
scroll_h, SIGNAL(sliderMoved(int)), this, SLOT(scroll_h_action(int)));
QObject::connect(
scroll_v, SIGNAL(sliderMoved(int)), this, SLOT(scroll_v_action(int)));
// These are needed to prevent QT from scrolling the ScrollArea.
QObject::connect(
scroll_h, SIGNAL(valueChanged(int)), this, SLOT(scroll_h_
action
(int)));
scroll_h, SIGNAL(valueChanged(int)), this, SLOT(scroll_h_
released
(int)));
QObject::connect(
scroll_v, SIGNAL(valueChanged(int)), this, SLOT(scroll_v_
action
(int)));
scroll_v, SIGNAL(valueChanged(int)), this, SLOT(scroll_v_
released
(int)));
form->setWidget(this);
form->setWidgetResizable(true);
...
...
@@ -114,31 +128,28 @@ void QtScrollWidgetFlow::scroll_callback_cb()
scroll_timerid->stop();
if (data->total_width <= data->window_width) {
if (data->offset_x == 0) {
data->total_width = data->window_width;
}
if (data->offset_x == 0 && data->total_width <= data->window_width) {
data->total_width = data->window_width;
if (scroll_data->scroll_h_managed) {
// Remove horizontal scrollbar
form->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
}
} else {
if (
!
scroll_data->scroll_h_managed) {
// Insert horizontal scrollbar
if (scroll_data->scroll_h_managed) {
form->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
}
}
if (data->total_height <= data->window_height) {
if (data->offset_y == 0) {
data->total_height = data->window_height;
}
if (data->offset_y == 0 && data->total_height <= data->window_height) {
data->total_height = data->window_height;
if (scroll_data->scroll_v_managed) {
// Remove vertical scrollbar
form->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
}
} else {
if (
!
scroll_data->scroll_v_managed) {
// Insert vertical scrollbar
if (scroll_data->scroll_v_managed) {
form->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
}
}
if (data->offset_x < 0) {
data->total_width += -data->offset_x;
data->offset_x = 0;
...
...
@@ -161,57 +172,51 @@ void QtScrollWidgetFlow::scroll_callback_cb()
}
if (scroll_data->scroll_h_managed) {
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
|| data->total_width != scroll_h_upper || scroll_configure) {
scroll_data->scroll_h->setMaximum(scroll_h_upper);
scroll_data->scroll_h->setPageStep(scroll_h_pagesize);
if (data->window_width != scroll_h->pageStep()
|| data->total_width != scroll_h->maximum() || scroll_configure) {
scroll_h->setMaximum(data->total_width - data->window_width);
scroll_h->setPageStep(data->window_width);
}
scroll_
data->scroll_h->setSliderPosition(scroll_h_value
);
scroll_
h->setSliderPosition(data->offset_x
);
}
if (scroll_data->scroll_v_managed) {
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
|| data->total_height != scroll_v_upper || scroll_configure) {
scroll_data->scroll_v->setMaximum(scroll_v_upper);
scroll_data->scroll_v->setPageStep(scroll_v_pagesize);
if (data->window_height != scroll_v->pageStep()
|| data->total_height != scroll_v->maximum() || scroll_configure) {
scroll_v->setMaximum(data->total_height - data->window_height);
scroll_v->setPageStep(data->window_height);
}
scroll_
data->scroll_v->setSliderPosition(scroll_v_value
);
scroll_
v->setSliderPosition(data->offset_y
);
}
scroll_configure = 0;
}
void QtScrollWidgetFlow::scroll_h_action(int value)
{
if (scroll_h_ignore) {
scroll_h_ignore = 0;
return;
}
scroll_h_value = value;
FlowCtx* ctx = (FlowCtx*)parent_ctx;
flow_scroll_horizontal(ctx, value, 0);
}
void QtScrollWidgetFlow::scroll_
v_action
(int value)
void QtScrollWidgetFlow::scroll_
h_released
(int value)
{
if (scroll_v_ignore) {
scroll_v_ignore = 0
;
return
;
}
// Prevent QT from scrolling the ScrollArea by setting the value to 0.
scroll_h->setValue(0)
;
scroll_h->setSliderPosition(value)
;
}
scroll_v_value = value;
void QtScrollWidgetFlow::scroll_v_action(int value)
{
FlowCtx* ctx = (FlowCtx*)parent_ctx;
flow_scroll_vertical(ctx, value, 0);
}
void QtScrollWidgetFlow::scroll_v_released(int value)
{
// Prevent QT from scrolling the ScrollArea by setting the value to 0.
scroll_v->setValue(0);
scroll_v->setSliderPosition(value);
}
void QtScrollWidgetFlow::paintEvent(QPaintEvent* event)
{
QPainter painter(this);
...
...
xtt/lib/flow/qt/flow_scroll_widget_qt.h
View file @
852ae8d7
...
...
@@ -69,6 +69,8 @@ public:
int
(
*
init_proc2
)(
QWidget
*
w
,
FlowCtx
*
ctx
,
void
*
client_data
));
void
init
(
unsigned
int
eCtxType
,
QWidget
*
main
);
bool
eventFilter
(
QObject
*
object
,
QEvent
*
event
);
void
*
parent_ctx
;
FlowDrawQt
*
draw_ctx
;
int
(
*
init_proc
)(
FlowCtx
*
ctx
,
void
*
clien_data
);
...
...
@@ -78,18 +80,11 @@ public:
QWidget
*
main_widget
;
QScrollBar
*
scroll_h
;
QScrollBar
*
scroll_v
;
int
scroll_h_ignore
;
int
scroll_v_ignore
;
double
scroll_h_value
;
double
scroll_v_value
;
int
scroll_h_pagesize
;
int
scroll_v_pagesize
;
int
scroll_h_upper
;
int
scroll_v_upper
;
QTimer
*
scroll_timerid
;
flow_sScroll
scroll_data
;
int
scroll_configure
;
int
destroyed
;
QScrollArea
*
form
;
QImage
image
;
...
...
@@ -112,6 +107,8 @@ private:
public
slots
:
void
scroll_h_action
(
int
value
);
void
scroll_v_action
(
int
value
);
void
scroll_h_released
(
int
value
);
void
scroll_v_released
(
int
value
);
void
scroll_callback_cb
();
};
...
...
xtt/lib/glow/qt/glow_draw_qt.cqt
View file @
852ae8d7
...
...
@@ -690,6 +690,7 @@ int GlowDrawQt::event_handler(QEvent* event, QWidget* target)
case QEvent::Paint:
case QEvent::UpdateRequest: {
QPaintEvent* paintEvent = ((QPaintEvent*)event);
ctx->clear(&ctx->mw);
sts = ctx->event_handler(glow_eEvent_Exposure, paintEvent->rect().x(),
paintEvent->rect().y(), paintEvent->rect().width(),
paintEvent->rect().height());
...
...
xtt/lib/glow/qt/glow_scroll_widget_qt.cqt
View file @
852ae8d7
...
...
@@ -72,6 +72,11 @@ void QtScrollWidgetGlow::init(unsigned int eCtxType,
this->scroll_timerid = new QTimer(this);
}
bool QtScrollWidgetGlow::eventFilter(QObject *object, QEvent *event)
{
return (event->type() == QEvent::KeyPress);
}
QWidget* QtScrollWidgetGlow::initScroll(unsigned int eCtxType,
int (*init_proc)(GlowCtx* ctx, void* client_data), void* client_data,
int (*init_proc2)(QWidget* w, GlowCtx* ctx, void* client_data))
...
...
@@ -84,14 +89,22 @@ QWidget* QtScrollWidgetGlow::initScroll(unsigned int eCtxType,
this->init_widget_proc = init_proc2;
this->client_data = client_data;
this->scroll_timerid = new QTimer(this);
QScrollArea* form = new QScrollArea(
);
form = new QScrollArea();
form->installEventFilter(this
);
scroll_h = form->horizontalScrollBar();
scroll_v = form->verticalScrollBar();
scroll_h->setTracking(false);
scroll_v->setTracking(false);
QObject::connect(
scroll_h, SIGNAL(sliderMoved(int)), this, SLOT(scroll_h_action(int)));
QObject::connect(
scroll_v, SIGNAL(sliderMoved(int)), this, SLOT(scroll_v_action(int)));
// These are needed to prevent QT from scrolling the ScrollArea.
QObject::connect(
scroll_h, SIGNAL(valueChanged(int)), this, SLOT(scroll_h_
action
(int)));
scroll_h, SIGNAL(valueChanged(int)), this, SLOT(scroll_h_
released
(int)));
QObject::connect(
scroll_v, SIGNAL(valueChanged(int)), this, SLOT(scroll_v_
action
(int)));
scroll_v, SIGNAL(valueChanged(int)), this, SLOT(scroll_v_
released
(int)));
form->setWidget(this);
form->setWidgetResizable(true);
...
...
@@ -116,31 +129,28 @@ void QtScrollWidgetGlow::scroll_callback_cb()
scroll_timerid->stop();
if (data->total_width <= data->window_width) {
if (data->offset_x == 0) {
data->total_width = data->window_width;
}
if (data->offset_x == 0 && data->total_width <= data->window_width) {
data->total_width = data->window_width;
if (scroll_data->scroll_h_managed) {
// Remove horizontal scrollbar
form->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
}
} else {
if (
!
scroll_data->scroll_h_managed) {
// Insert horizontal scrollbar
if (scroll_data->scroll_h_managed) {
form->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
}
}
if (data->total_height <= data->window_height) {
if (data->offset_y == 0) {
data->total_height = data->window_height;
}
if (data->offset_y == 0 && data->total_height <= data->window_height) {
data->total_height = data->window_height;
if (scroll_data->scroll_v_managed) {
// Remove vertical scrollbar
form->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
}
} else {
if (
!
scroll_data->scroll_v_managed) {
// Insert vertical scrollbar
if (scroll_data->scroll_v_managed) {
form->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
}
}
if (data->offset_x < 0) {
data->total_width += -data->offset_x;
data->offset_x = 0;
...
...
@@ -163,57 +173,51 @@ void QtScrollWidgetGlow::scroll_callback_cb()
}
if (scroll_data->scroll_h_managed) {
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
|| data->total_width != scroll_h_upper || scroll_configure) {
scroll_data->scroll_h->setMaximum(scroll_h_upper);
scroll_data->scroll_h->setPageStep(scroll_h_pagesize);
if (data->window_width != scroll_h->pageStep()
|| data->total_width != scroll_h->maximum() || scroll_configure) {
scroll_h->setMaximum(data->total_width - data->window_width);
scroll_h->setPageStep(data->window_width);
}
scroll_
data->scroll_h->setSliderPosition(scroll_h_value
);
scroll_
h->setSliderPosition(data->offset_x
);
}
if (scroll_data->scroll_v_managed) {
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
|| data->total_height != scroll_v_upper || scroll_configure) {
scroll_data->scroll_v->setMaximum(scroll_v_upper);
scroll_data->scroll_v->setPageStep(scroll_v_pagesize);
if (data->window_height != scroll_v->pageStep()
|| data->total_height != scroll_v->maximum() || scroll_configure) {
scroll_v->setMaximum(data->total_height - data->window_height);
scroll_v->setPageStep(data->window_height);
}
scroll_
data->scroll_v->setSliderPosition(scroll_v_value
);
scroll_
v->setSliderPosition(data->offset_y
);
}
scroll_configure = 0;
}
void QtScrollWidgetGlow::scroll_h_action(int value)
{
if (scroll_h_ignore) {
scroll_h_ignore = 0;
return;
}
scroll_h_value = value;
GlowCtx* ctx = (GlowCtx*)parent_ctx;
glow_scroll_horizontal(ctx, value, 0);
}
void QtScrollWidgetGlow::scroll_
v_action
(int value)
void QtScrollWidgetGlow::scroll_
h_released
(int value)
{
if (scroll_v_ignore) {
scroll_v_ignore = 0
;
return
;
}
// Prevent QT from scrolling the ScrollArea by setting the value to 0.
scroll_h->setValue(0)
;
scroll_h->setSliderPosition(value)
;
}
scroll_v_value = value;
void QtScrollWidgetGlow::scroll_v_action(int value)
{
GlowCtx* ctx = (GlowCtx*)parent_ctx;
glow_scroll_vertical(ctx, value, 0);
}
void QtScrollWidgetGlow::scroll_v_released(int value)
{
// Prevent QT from scrolling the ScrollArea by setting the value to 0.
scroll_v->setValue(0);
scroll_v->setSliderPosition(value);
}
void QtScrollWidgetGlow::paintEvent(QPaintEvent* event)
{
QPainter painter(this);
...
...
xtt/lib/glow/qt/glow_scroll_widget_qt.h
View file @
852ae8d7
...
...
@@ -68,6 +68,8 @@ public:
int
(
*
init_proc2
)(
QWidget
*
w
,
GlowCtx
*
ctx
,
void
*
client_data
));
void
init
(
unsigned
int
eCtxType
,
QWidget
*
main
);
bool
eventFilter
(
QObject
*
object
,
QEvent
*
event
);
void
*
parent_ctx
;
GlowDrawQt
*
draw_ctx
;
int
(
*
init_proc
)(
GlowCtx
*
ctx
,
void
*
clien_data
);
...
...
@@ -77,18 +79,11 @@ public:
QWidget
*
main_widget
;
QScrollBar
*
scroll_h
;
QScrollBar
*
scroll_v
;
int
scroll_h_ignore
;
int
scroll_v_ignore
;
double
scroll_h_value
;
double
scroll_v_value
;
int
scroll_h_pagesize
;
int
scroll_v_pagesize
;
int
scroll_h_upper
;
int
scroll_v_upper
;
QTimer
*
scroll_timerid
;
glow_sScroll
scroll_data
;
int
scroll_configure
;
int
destroyed
;
QScrollArea
*
form
;
QImage
image
;
...
...
@@ -111,6 +106,8 @@ private:
public
slots
:
void
scroll_h_action
(
int
value
);
void
scroll_v_action
(
int
value
);
void
scroll_h_released
(
int
value
);
void
scroll_v_released
(
int
value
);
void
scroll_callback_cb
();
signals:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment