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
ca677962
Commit
ca677962
authored
Jul 12, 2018
by
Christoffer Ackelman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed scroll widgets event handling.
parent
d26c7731
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
9 additions
and
54 deletions
+9
-54
xtt/lib/flow/qt/flow_draw_qt.cqt
xtt/lib/flow/qt/flow_draw_qt.cqt
+1
-5
xtt/lib/flow/qt/flow_scroll_widget_qt.cqt
xtt/lib/flow/qt/flow_scroll_widget_qt.cqt
+4
-15
xtt/lib/flow/qt/flow_scroll_widget_qt.h
xtt/lib/flow/qt/flow_scroll_widget_qt.h
+0
-10
xtt/lib/glow/qt/glow_scroll_widget_qt.cqt
xtt/lib/glow/qt/glow_scroll_widget_qt.cqt
+4
-14
xtt/lib/glow/qt/glow_scroll_widget_qt.h
xtt/lib/glow/qt/glow_scroll_widget_qt.h
+0
-10
No files found.
xtt/lib/flow/qt/flow_draw_qt.cqt
View file @
ca677962
...
@@ -320,15 +320,11 @@ int FlowDrawQt::event_handler(QEvent *event)
...
@@ -320,15 +320,11 @@ int FlowDrawQt::event_handler(QEvent *event)
}
}
}
}
if (event->type() == QEvent::KeyPress) {
debug_print("event_handler: KeyPress!\n");
}
if (windowEvent || event->type() == QEvent::KeyPress) {
if (windowEvent || event->type() == QEvent::KeyPress) {
switch (event->type()) {
switch (event->type()) {
case QEvent::KeyPress : {
case QEvent::KeyPress : {
QKeyEvent *keyEvent = ((QKeyEvent *) event);
QKeyEvent *keyEvent = ((QKeyEvent *) event);
debug_print("event_handler: KeyPress key=%
d\n", keyEvent->key
());
debug_print("event_handler: KeyPress key=%
s\n", QKeySequence(keyEvent->key()).toString().toAscii().data
());
switch (keyEvent->key()) {
switch (keyEvent->key()) {
case Qt::Key_Return:
case Qt::Key_Return:
...
...
xtt/lib/flow/qt/flow_scroll_widget_qt.cqt
View file @
ca677962
...
@@ -59,6 +59,7 @@ void QtScrollWidgetFlow::init(
...
@@ -59,6 +59,7 @@ void QtScrollWidgetFlow::init(
void *client_data))
void *client_data))
{
{
createBuffer(size());
createBuffer(size());
setFocusPolicy(Qt::StrongFocus);
this->ctxType = eCtxType;
this->ctxType = eCtxType;
this->init_proc = init_proc;
this->init_proc = init_proc;
this->init_widget_proc = init_proc2;
this->init_widget_proc = init_proc2;
...
@@ -71,12 +72,12 @@ QWidget *QtScrollWidgetFlow::initScroll(
...
@@ -71,12 +72,12 @@ QWidget *QtScrollWidgetFlow::initScroll(
void *client_data))
void *client_data))
{
{
createBuffer(size());
createBuffer(size());
setFocusPolicy(Qt::StrongFocus);
this->ctxType = eCtxType;
this->ctxType = eCtxType;
this->init_proc = init_proc;
this->init_proc = init_proc;
this->init_widget_proc = init_proc2;
this->init_widget_proc = init_proc2;
this->client_data = client_data;
this->client_data = client_data;
QScrollArea *form = new QScrollArea();
QScrollAreaFlow *form = new QScrollAreaFlow();
scroll_h = form->horizontalScrollBar();
scroll_h = form->horizontalScrollBar();
scroll_v = form->verticalScrollBar();
scroll_v = form->verticalScrollBar();
QObject::connect(scroll_h, SIGNAL(valueChanged(int)), this,
QObject::connect(scroll_h, SIGNAL(valueChanged(int)), this,
...
@@ -89,20 +90,10 @@ QWidget *QtScrollWidgetFlow::initScroll(
...
@@ -89,20 +90,10 @@ QWidget *QtScrollWidgetFlow::initScroll(
return form;
return form;
}
}
bool QScrollAreaFlow::event(QEvent *event)
{
QtScrollWidgetFlow *child = ((QtScrollWidgetFlow *) widget());
time_t t;
time(&t);
if (event->type() != child->lastEvent->type() || difftime(t, child->t) > 0.000001) {
child->handleEvent(event);
}
return QScrollArea::event(event);
}
void QtScrollWidgetFlow::init(unsigned int eCtxType, QWidget *main)
void QtScrollWidgetFlow::init(unsigned int eCtxType, QWidget *main)
{
{
createBuffer(size());
createBuffer(size());
setFocusPolicy(Qt::StrongFocus);
this->ctxType = eCtxType;
this->ctxType = eCtxType;
is_navigator = 1;
is_navigator = 1;
main_widget = main;
main_widget = main;
...
@@ -266,8 +257,6 @@ bool QtScrollWidgetFlow::event(QEvent *event)
...
@@ -266,8 +257,6 @@ bool QtScrollWidgetFlow::event(QEvent *event)
is_realized = true;
is_realized = true;
}
}
handleEvent(event);
handleEvent(event);
lastEvent = event;
time(&t);
return QWidget::event(event);
return QWidget::event(event);
}
}
...
...
xtt/lib/flow/qt/flow_scroll_widget_qt.h
View file @
ca677962
...
@@ -59,13 +59,6 @@ typedef struct {
...
@@ -59,13 +59,6 @@ typedef struct {
int
scroll_v_managed
;
int
scroll_v_managed
;
}
widget_sScroll
;
}
widget_sScroll
;
// QScrollArea does not forward events to its child widget
// So we subclass QScrollArea and override the event() handler
class
QScrollAreaFlow
:
public
QScrollArea
{
protected:
bool
event
(
QEvent
*
event
);
};
class
QtScrollWidgetFlow
:
public
QWidget
{
class
QtScrollWidgetFlow
:
public
QWidget
{
Q_OBJECT
Q_OBJECT
...
@@ -105,9 +98,6 @@ public:
...
@@ -105,9 +98,6 @@ public:
QImage
image
;
QImage
image
;
QEvent
*
lastEvent
;
time_t
t
;
virtual
void
handleEvent
(
QEvent
*
event
);
virtual
void
handleEvent
(
QEvent
*
event
);
protected:
protected:
...
...
xtt/lib/glow/qt/glow_scroll_widget_qt.cqt
View file @
ca677962
...
@@ -59,6 +59,7 @@ void QtScrollWidgetGlow::init(
...
@@ -59,6 +59,7 @@ void QtScrollWidgetGlow::init(
void *client_data))
void *client_data))
{
{
createBuffer(size());
createBuffer(size());
setFocusPolicy(Qt::StrongFocus);
this->ctxType = eCtxType;
this->ctxType = eCtxType;
this->init_proc = init_proc;
this->init_proc = init_proc;
this->init_widget_proc = init_proc2;
this->init_widget_proc = init_proc2;
...
@@ -71,12 +72,13 @@ QWidget *QtScrollWidgetGlow::initScroll(
...
@@ -71,12 +72,13 @@ QWidget *QtScrollWidgetGlow::initScroll(
void *client_data))
void *client_data))
{
{
createBuffer(size());
createBuffer(size());
setFocusPolicy(Qt::StrongFocus);
this->ctxType = eCtxType;
this->ctxType = eCtxType;
this->init_proc = init_proc;
this->init_proc = init_proc;
this->init_widget_proc = init_proc2;
this->init_widget_proc = init_proc2;
this->client_data = client_data;
this->client_data = client_data;
QScrollArea
Glow *form = new QScrollAreaGlow
();
QScrollArea
*form = new QScrollArea
();
scroll_h = form->horizontalScrollBar();
scroll_h = form->horizontalScrollBar();
scroll_v = form->verticalScrollBar();
scroll_v = form->verticalScrollBar();
QObject::connect(scroll_h, SIGNAL(valueChanged(int)), this,
QObject::connect(scroll_h, SIGNAL(valueChanged(int)), this,
...
@@ -89,20 +91,10 @@ QWidget *QtScrollWidgetGlow::initScroll(
...
@@ -89,20 +91,10 @@ QWidget *QtScrollWidgetGlow::initScroll(
return form;
return form;
}
}
bool QScrollAreaGlow::event(QEvent *event)
{
QtScrollWidgetGlow *child = ((QtScrollWidgetGlow *) widget());
time_t t;
time(&t);
if (event->type() != child->lastEvent->type() || difftime(t, child->t) > 0.000001) {
child->handleEvent(event);
}
return QScrollArea::event(event);
}
void QtScrollWidgetGlow::init(unsigned int eCtxType, QWidget *main)
void QtScrollWidgetGlow::init(unsigned int eCtxType, QWidget *main)
{
{
createBuffer(size());
createBuffer(size());
setFocusPolicy(Qt::StrongFocus);
this->ctxType = eCtxType;
this->ctxType = eCtxType;
is_navigator = 1;
is_navigator = 1;
main_widget = main;
main_widget = main;
...
@@ -266,8 +258,6 @@ bool QtScrollWidgetGlow::event(QEvent *event)
...
@@ -266,8 +258,6 @@ bool QtScrollWidgetGlow::event(QEvent *event)
is_realized = true;
is_realized = true;
}
}
handleEvent(event);
handleEvent(event);
lastEvent = event;
time(&t);
return QWidget::event(event);
return QWidget::event(event);
}
}
...
...
xtt/lib/glow/qt/glow_scroll_widget_qt.h
View file @
ca677962
...
@@ -59,13 +59,6 @@ typedef struct {
...
@@ -59,13 +59,6 @@ typedef struct {
int
scroll_v_managed
;
int
scroll_v_managed
;
}
widget_sScroll
;
}
widget_sScroll
;
// QScrollArea does not forward events to its child widget
// So we subclass QScrollArea and override the event() handler
class
QScrollAreaGlow
:
public
QScrollArea
{
protected:
bool
event
(
QEvent
*
event
);
};
class
QtScrollWidgetGlow
:
public
QWidget
{
class
QtScrollWidgetGlow
:
public
QWidget
{
Q_OBJECT
Q_OBJECT
...
@@ -105,9 +98,6 @@ public:
...
@@ -105,9 +98,6 @@ public:
QImage
image
;
QImage
image
;
QEvent
*
lastEvent
;
time_t
t
;
virtual
void
handleEvent
(
QEvent
*
event
);
virtual
void
handleEvent
(
QEvent
*
event
);
protected:
protected:
...
...
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