Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
OpenWalnut
OpenWalnut Core
Commits
b50e3a55
Commit
b50e3a55
authored
Apr 11, 2010
by
Sebastian Eichelbaum
Browse files
[CHANGE] - nav widget sliders now update in GUI thread
parent
6606694a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
38 additions
and
5 deletions
+38
-5
src/gui/qt4/WQtNavGLWidget.cpp
src/gui/qt4/WQtNavGLWidget.cpp
+22
-4
src/gui/qt4/WQtNavGLWidget.h
src/gui/qt4/WQtNavGLWidget.h
+16
-1
No files found.
src/gui/qt4/WQtNavGLWidget.cpp
View file @
b50e3a55
...
...
@@ -28,10 +28,14 @@
#include <QtGui/QDockWidget>
#include <QtGui/QVBoxLayout>
#include <QtGui/QKeyEvent>
#include <QtGui/QApplication>
#include "WQtNavGLWidget.h"
#include "../../graphicsEngine/WGEViewer.h"
#include "../../graphicsEngine/WGEScene.h"
#include "events/WPropertyChangedEvent.h"
#include "events/WEventTypes.h"
#include "WQtNavGLWidget.h"
WQtNavGLWidget
::
WQtNavGLWidget
(
QString
title
,
QWidget
*
parent
,
int
maxValue
,
std
::
string
sliderTitle
)
:
QDockWidget
(
title
,
parent
)
...
...
@@ -149,10 +153,24 @@ void WQtNavGLWidget::setSliderProperty( WPropInt prop )
m_sliderProp
->
getCondition
()
->
subscribeSignal
(
boost
::
bind
(
&
WQtNavGLWidget
::
handleChangedPropertyValue
,
this
)
);
}
void
WQtNavGLWidget
::
handleChangedPropertyValue
(
)
bool
WQtNavGLWidget
::
event
(
QEvent
*
event
)
{
if
(
m_slider
)
// a property changed
if
(
event
->
type
()
==
WQT_PROPERTY_CHANGED_EVENT
)
{
m_slider
->
setValue
(
m_sliderProp
->
get
()
);
if
(
m_slider
)
{
m_slider
->
setValue
(
m_sliderProp
->
get
()
);
}
return
true
;
}
return
QWidget
::
event
(
event
);
}
void
WQtNavGLWidget
::
handleChangedPropertyValue
()
{
// post an event to handle it in the gui thread
QCoreApplication
::
postEvent
(
this
,
new
WPropertyChangedEvent
()
);
}
src/gui/qt4/WQtNavGLWidget.h
View file @
b50e3a55
...
...
@@ -88,6 +88,17 @@ protected:
*/
virtual
void
closeEvent
(
QCloseEvent
*
event
);
/**
* Custom event dispatcher. Gets called by QT's Event system every time an event got sent to this widget. This event handler
* processes property change events.
*
* \note QT Doc says: use event() for custom events.
* \param event the event that got transmitted.
*
* \return true if the event got handled properly.
*/
virtual
bool
event
(
QEvent
*
event
);
private:
/**
...
...
@@ -100,7 +111,11 @@ private:
*/
QString
m_sliderTitle
;
QSlider
*
m_slider
;
//!< A pointer to the slider widget.
/**
* The slider representing the property.
* \todo this has to be replaced by a WPropertyIntWidget!
*/
QSlider
*
m_slider
;
/**
* My GL widget.
...
...
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