summaryrefslogtreecommitdiffstats
path: root/demos/embedded/anomaly
diff options
context:
space:
mode:
authorJoerg Bornemann <joerg.bornemann@nokia.com>2009-09-09 10:45:31 (GMT)
committerJoerg Bornemann <joerg.bornemann@nokia.com>2009-09-09 10:47:09 (GMT)
commit0e5baf40a7897e7f06456683fe11be6ceacd5ee0 (patch)
tree7b7d958ff1a044ca06873dbb393ce2c339581571 /demos/embedded/anomaly
parentd04d67e146bce3d407f992c283d7ab3d0c25d428 (diff)
downloadQt-0e5baf40a7897e7f06456683fe11be6ceacd5ee0.zip
Qt-0e5baf40a7897e7f06456683fe11be6ceacd5ee0.tar.gz
Qt-0e5baf40a7897e7f06456683fe11be6ceacd5ee0.tar.bz2
demos/embedded/anomaly compile fix for non-RTTI settings
Reviewed-by: mauricek Reviewed-by: thartman
Diffstat (limited to 'demos/embedded/anomaly')
-rw-r--r--demos/embedded/anomaly/src/flickcharm.cpp28
1 files changed, 18 insertions, 10 deletions
diff --git a/demos/embedded/anomaly/src/flickcharm.cpp b/demos/embedded/anomaly/src/flickcharm.cpp
index 3fa5d8a..0b9e68e 100644
--- a/demos/embedded/anomaly/src/flickcharm.cpp
+++ b/demos/embedded/anomaly/src/flickcharm.cpp
@@ -84,7 +84,7 @@ FlickCharm::~FlickCharm()
void FlickCharm::activateOn(QWidget *widget)
{
- QAbstractScrollArea *scrollArea = dynamic_cast<QAbstractScrollArea*>(widget);
+ QAbstractScrollArea *scrollArea = qobject_cast<QAbstractScrollArea*>(widget);
if (scrollArea) {
scrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
scrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
@@ -102,7 +102,7 @@ void FlickCharm::activateOn(QWidget *widget)
return;
}
- QWebView *webView = dynamic_cast<QWebView*>(widget);
+ QWebView *webView = qobject_cast<QWebView*>(widget);
if (webView) {
QWebFrame *frame = webView->page()->mainFrame();
frame->setScrollBarPolicy(Qt::Vertical, Qt::ScrollBarAlwaysOff);
@@ -124,7 +124,7 @@ void FlickCharm::activateOn(QWidget *widget)
void FlickCharm::deactivateFrom(QWidget *widget)
{
- QAbstractScrollArea *scrollArea = dynamic_cast<QAbstractScrollArea*>(widget);
+ QAbstractScrollArea *scrollArea = qobject_cast<QAbstractScrollArea*>(widget);
if (scrollArea) {
QWidget *viewport = scrollArea->viewport();
@@ -137,7 +137,7 @@ void FlickCharm::deactivateFrom(QWidget *widget)
return;
}
- QWebView *webView = dynamic_cast<QWebView*>(widget);
+ QWebView *webView = qobject_cast<QWebView*>(widget);
if (webView) {
webView->removeEventFilter(this);
@@ -152,13 +152,13 @@ static QPoint scrollOffset(QWidget *widget)
{
int x = 0, y = 0;
- QAbstractScrollArea *scrollArea = dynamic_cast<QAbstractScrollArea*>(widget);
+ QAbstractScrollArea *scrollArea = qobject_cast<QAbstractScrollArea*>(widget);
if (scrollArea) {
x = scrollArea->horizontalScrollBar()->value();
y = scrollArea->verticalScrollBar()->value();
}
- QWebView *webView = dynamic_cast<QWebView*>(widget);
+ QWebView *webView = qobject_cast<QWebView*>(widget);
if (webView) {
QWebFrame *frame = webView->page()->mainFrame();
x = frame->evaluateJavaScript("window.scrollX").toInt();
@@ -170,13 +170,13 @@ static QPoint scrollOffset(QWidget *widget)
static void setScrollOffset(QWidget *widget, const QPoint &p)
{
- QAbstractScrollArea *scrollArea = dynamic_cast<QAbstractScrollArea*>(widget);
+ QAbstractScrollArea *scrollArea = qobject_cast<QAbstractScrollArea*>(widget);
if (scrollArea) {
scrollArea->horizontalScrollBar()->setValue(p.x());
scrollArea->verticalScrollBar()->setValue(p.y());
}
- QWebView *webView = dynamic_cast<QWebView*>(widget);
+ QWebView *webView = qobject_cast<QWebView*>(widget);
QWebFrame *frame = webView ? webView->page()->mainFrame() : 0;
if (frame)
frame->evaluateJavaScript(QString("window.scrollTo(%1,%2);").arg(p.x()).arg(p.y()));
@@ -202,11 +202,19 @@ bool FlickCharm::eventFilter(QObject *object, QEvent *event)
type != QEvent::MouseMove)
return false;
- QMouseEvent *mouseEvent = dynamic_cast<QMouseEvent*>(event);
+ QMouseEvent *mouseEvent = 0;
+ switch (event->type()) {
+ case QEvent::MouseButtonPress:
+ case QEvent::MouseButtonRelease:
+ case QEvent::MouseMove:
+ mouseEvent = static_cast<QMouseEvent*>(event);
+ break;
+ }
+
if (!mouseEvent || mouseEvent->modifiers() != Qt::NoModifier)
return false;
- QWidget *viewport = dynamic_cast<QWidget*>(object);
+ QWidget *viewport = qobject_cast<QWidget*>(object);
FlickData *data = d->flickData.value(viewport);
if (!viewport || !data || data->ignored.removeAll(event))
return false;