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
Hide 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)
}
}
if (event->type() == QEvent::KeyPress) {
debug_print("event_handler: KeyPress!\n");
}
if (windowEvent || event->type() == QEvent::KeyPress) {
switch (event->type()) {
case QEvent::KeyPress : {
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()) {
case Qt::Key_Return:
...
...
xtt/lib/flow/qt/flow_scroll_widget_qt.cqt
View file @
ca677962
...
...
@@ -59,6 +59,7 @@ void QtScrollWidgetFlow::init(
void *client_data))
{
createBuffer(size());
setFocusPolicy(Qt::StrongFocus);
this->ctxType = eCtxType;
this->init_proc = init_proc;
this->init_widget_proc = init_proc2;
...
...
@@ -71,12 +72,12 @@ QWidget *QtScrollWidgetFlow::initScroll(
void *client_data))
{
createBuffer(size());
setFocusPolicy(Qt::StrongFocus);
this->ctxType = eCtxType;
this->init_proc = init_proc;
this->init_widget_proc = init_proc2;
this->client_data = client_data;
QScrollAreaFlow *form = new QScrollAreaFlow();
QScrollArea *form = new QScrollArea();
scroll_h = form->horizontalScrollBar();
scroll_v = form->verticalScrollBar();
QObject::connect(scroll_h, SIGNAL(valueChanged(int)), this,
...
...
@@ -89,20 +90,10 @@ QWidget *QtScrollWidgetFlow::initScroll(
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)
{
createBuffer(size());
setFocusPolicy(Qt::StrongFocus);
this->ctxType = eCtxType;
is_navigator = 1;
main_widget = main;
...
...
@@ -266,8 +257,6 @@ bool QtScrollWidgetFlow::event(QEvent *event)
is_realized = true;
}
handleEvent(event);
lastEvent = event;
time(&t);
return QWidget::event(event);
}
...
...
xtt/lib/flow/qt/flow_scroll_widget_qt.h
View file @
ca677962
...
...
@@ -59,13 +59,6 @@ typedef struct {
int
scroll_v_managed
;
}
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
{
Q_OBJECT
...
...
@@ -105,9 +98,6 @@ public:
QImage
image
;
QEvent
*
lastEvent
;
time_t
t
;
virtual
void
handleEvent
(
QEvent
*
event
);
protected:
...
...
xtt/lib/glow/qt/glow_scroll_widget_qt.cqt
View file @
ca677962
...
...
@@ -59,6 +59,7 @@ void QtScrollWidgetGlow::init(
void *client_data))
{
createBuffer(size());
setFocusPolicy(Qt::StrongFocus);
this->ctxType = eCtxType;
this->init_proc = init_proc;
this->init_widget_proc = init_proc2;
...
...
@@ -71,12 +72,13 @@ QWidget *QtScrollWidgetGlow::initScroll(
void *client_data))
{
createBuffer(size());
setFocusPolicy(Qt::StrongFocus);
this->ctxType = eCtxType;
this->init_proc = init_proc;
this->init_widget_proc = init_proc2;
this->client_data = client_data;
QScrollArea
Glow *form = new QScrollAreaGlow
();
QScrollArea
*form = new QScrollArea
();
scroll_h = form->horizontalScrollBar();
scroll_v = form->verticalScrollBar();
QObject::connect(scroll_h, SIGNAL(valueChanged(int)), this,
...
...
@@ -89,20 +91,10 @@ QWidget *QtScrollWidgetGlow::initScroll(
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)
{
createBuffer(size());
setFocusPolicy(Qt::StrongFocus);
this->ctxType = eCtxType;
is_navigator = 1;
main_widget = main;
...
...
@@ -266,8 +258,6 @@ bool QtScrollWidgetGlow::event(QEvent *event)
is_realized = true;
}
handleEvent(event);
lastEvent = event;
time(&t);
return QWidget::event(event);
}
...
...
xtt/lib/glow/qt/glow_scroll_widget_qt.h
View file @
ca677962
...
...
@@ -59,13 +59,6 @@ typedef struct {
int
scroll_v_managed
;
}
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
{
Q_OBJECT
...
...
@@ -105,9 +98,6 @@ public:
QImage
image
;
QEvent
*
lastEvent
;
time_t
t
;
virtual
void
handleEvent
(
QEvent
*
event
);
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