summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorOlivier Goffart <olivier.goffart@nokia.com>2011-04-21 11:12:18 (GMT)
committerOlivier Goffart <olivier.goffart@nokia.com>2011-04-21 11:12:18 (GMT)
commit1b95c4e6502ede5a980aaf5a2ed9dad283b3eadd (patch)
tree066bdf995360981ebb645383b93866133c1ca000 /src
parenta334ad303d2763cd53fc5bd62945d08d3555b8a7 (diff)
parent43bce78bd5a41115ab5a541243cc3edcecd2904e (diff)
downloadQt-1b95c4e6502ede5a980aaf5a2ed9dad283b3eadd.zip
Qt-1b95c4e6502ede5a980aaf5a2ed9dad283b3eadd.tar.gz
Qt-1b95c4e6502ede5a980aaf5a2ed9dad283b3eadd.tar.bz2
Merge remote-tracking branch 'origin/4.7' into qt-4.8-from-4.7
Conflicts: src/plugins/qmltooling/qmldbg_ost/qostdevice.h
Diffstat (limited to 'src')
-rw-r--r--src/corelib/kernel/qeventdispatcher_symbian.cpp27
-rw-r--r--src/corelib/kernel/qeventdispatcher_symbian_p.h2
-rw-r--r--src/declarative/debugger/qdeclarativedebugserver.cpp2
-rw-r--r--src/declarative/graphicsitems/qdeclarativemousearea.cpp16
-rw-r--r--src/declarative/graphicsitems/qdeclarativemousearea_p.h3
-rw-r--r--src/declarative/graphicsitems/qdeclarativemousearea_p_p.h17
-rw-r--r--src/declarative/qml/qdeclarativeenginedebug.cpp12
-rw-r--r--src/gui/styles/qs60style.cpp11
-rw-r--r--src/gui/styles/qs60style_s60.cpp11
-rw-r--r--src/gui/widgets/qlinecontrol.cpp2
-rw-r--r--src/plugins/qmltooling/qmldbg_ost/qostdevice.h2
11 files changed, 83 insertions, 22 deletions
diff --git a/src/corelib/kernel/qeventdispatcher_symbian.cpp b/src/corelib/kernel/qeventdispatcher_symbian.cpp
index 471028e..e0eeb08 100644
--- a/src/corelib/kernel/qeventdispatcher_symbian.cpp
+++ b/src/corelib/kernel/qeventdispatcher_symbian.cpp
@@ -234,8 +234,10 @@ void QWakeUpActiveObject::RunL()
QTimerActiveObject::QTimerActiveObject(QEventDispatcherSymbian *dispatcher, SymbianTimerInfo *timerInfo)
: QActiveObject((timerInfo->interval) ? TIMER_PRIORITY : NULLTIMER_PRIORITY , dispatcher),
- m_timerInfo(timerInfo)
+ m_timerInfo(timerInfo), m_expectedTimeSinceLastEvent(0)
{
+ // start the timeout timer to ensure initialisation
+ m_timeoutTimer.start();
}
QTimerActiveObject::~QTimerActiveObject()
@@ -279,10 +281,23 @@ void QTimerActiveObject::StartTimer()
m_rTimer.After(iStatus, MAX_SYMBIAN_TIMEOUT_MS * 1000);
m_timerInfo->msLeft -= MAX_SYMBIAN_TIMEOUT_MS;
} else {
- //HighRes gives the 1ms accuracy expected by Qt, the +1 is to ensure that
- //"Timers will never time out earlier than the specified timeout value"
- //condition is always met.
- m_rTimer.HighRes(iStatus, (m_timerInfo->msLeft + 1) * 1000);
+ // this algorithm implements drift correction for repeating timers
+ // calculate how late we are for this event
+ int timeSinceLastEvent = m_timeoutTimer.restart();
+ int overshoot = timeSinceLastEvent - m_expectedTimeSinceLastEvent;
+ if (overshoot > m_timerInfo->msLeft) {
+ // we skipped a whole timeout, restart from here
+ overshoot = 0;
+ }
+ // calculate when the next event should happen
+ int waitTime = m_timerInfo->msLeft - overshoot;
+ m_expectedTimeSinceLastEvent = waitTime;
+ // limit the actual ms wait time to avoid wild corrections
+ // this will cause the real event time to slowly drift back to the expected event time
+ // measurements show that Symbian timers always fire 1 or 2 ms late
+ const int limit = 4;
+ waitTime = qMax(m_timerInfo->msLeft - limit, waitTime);
+ m_rTimer.HighRes(iStatus, waitTime * 1000);
m_timerInfo->msLeft = 0;
}
SetActive();
@@ -329,6 +344,8 @@ void QTimerActiveObject::Start()
if (!m_rTimer.Handle()) {
qt_symbian_throwIfError(m_rTimer.CreateLocal());
}
+ m_timeoutTimer.start();
+ m_expectedTimeSinceLastEvent = 0;
StartTimer();
} else {
iStatus = KRequestPending;
diff --git a/src/corelib/kernel/qeventdispatcher_symbian_p.h b/src/corelib/kernel/qeventdispatcher_symbian_p.h
index 6e04bb1..6fdd4b2 100644
--- a/src/corelib/kernel/qeventdispatcher_symbian_p.h
+++ b/src/corelib/kernel/qeventdispatcher_symbian_p.h
@@ -150,6 +150,8 @@ private:
private:
SymbianTimerInfo *m_timerInfo;
+ QElapsedTimer m_timeoutTimer;
+ int m_expectedTimeSinceLastEvent;
RTimer m_rTimer;
};
diff --git a/src/declarative/debugger/qdeclarativedebugserver.cpp b/src/declarative/debugger/qdeclarativedebugserver.cpp
index 75e9a09..6f46354 100644
--- a/src/declarative/debugger/qdeclarativedebugserver.cpp
+++ b/src/declarative/debugger/qdeclarativedebugserver.cpp
@@ -202,7 +202,7 @@ QDeclarativeDebugServer *QDeclarativeDebugServer::instance()
connection->setServer(server);
connection->setPort(port, block);
} else {
- qWarning() << QString::fromAscii("QDeclarativeDebugServer: Ignoring\"-qmljsdebugger=%1\". "
+ qWarning() << QString::fromAscii("QDeclarativeDebugServer: Ignoring \"-qmljsdebugger=%1\". "
"Remote debugger plugin has not been found.").arg(appD->qmljsDebugArgumentsString());
}
diff --git a/src/declarative/graphicsitems/qdeclarativemousearea.cpp b/src/declarative/graphicsitems/qdeclarativemousearea.cpp
index f5145d0..d4e7f7b 100644
--- a/src/declarative/graphicsitems/qdeclarativemousearea.cpp
+++ b/src/declarative/graphicsitems/qdeclarativemousearea.cpp
@@ -496,6 +496,9 @@ void QDeclarativeMouseArea::mousePressEvent(QGraphicsSceneMouseEvent *event)
d->pressAndHoldTimer.start(PressAndHoldDelay, this);
setKeepMouseGrab(d->stealMouse);
event->setAccepted(setPressed(true));
+
+ if(!event->isAccepted() && d->forwardToList.count())
+ d->forwardEvent(event);
}
}
@@ -573,6 +576,9 @@ void QDeclarativeMouseArea::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
me.setX(d->lastPos.x());
me.setY(d->lastPos.y());
emit positionChanged(&me);
+
+ if(!event->isAccepted() && d->forwardToList.count())
+ d->forwardEvent(event);
}
@@ -594,6 +600,9 @@ void QDeclarativeMouseArea::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
if (s && s->mouseGrabberItem() == this)
ungrabMouse();
setKeepMouseGrab(false);
+
+ if(!event->isAccepted() && d->forwardToList.count())
+ d->forwardEvent(event);
}
d->doubleClick = false;
}
@@ -959,4 +968,11 @@ QDeclarativeDrag *QDeclarativeMouseArea::drag()
*/
+QDeclarativeListProperty<QGraphicsObject> QDeclarativeMouseArea::forwardTo()
+{
+ Q_D(QDeclarativeMouseArea);
+ return d->forwardTo;
+}
+
+
QT_END_NAMESPACE
diff --git a/src/declarative/graphicsitems/qdeclarativemousearea_p.h b/src/declarative/graphicsitems/qdeclarativemousearea_p.h
index 985f27e..351d4de 100644
--- a/src/declarative/graphicsitems/qdeclarativemousearea_p.h
+++ b/src/declarative/graphicsitems/qdeclarativemousearea_p.h
@@ -130,6 +130,7 @@ class Q_AUTOTEST_EXPORT QDeclarativeMouseArea : public QDeclarativeItem
Q_PROPERTY(bool hoverEnabled READ hoverEnabled WRITE setHoverEnabled NOTIFY hoverEnabledChanged)
Q_PROPERTY(QDeclarativeDrag *drag READ drag CONSTANT) //### add flicking to QDeclarativeDrag or add a QDeclarativeFlick ???
Q_PROPERTY(bool preventStealing READ preventStealing WRITE setPreventStealing NOTIFY preventStealingChanged REVISION 1)
+ Q_PROPERTY(QDeclarativeListProperty<QGraphicsObject> forwardTo READ forwardTo);
public:
QDeclarativeMouseArea(QDeclarativeItem *parent=0);
@@ -157,6 +158,8 @@ public:
bool preventStealing() const;
void setPreventStealing(bool prevent);
+ QDeclarativeListProperty<QGraphicsObject> forwardTo();
+
Q_SIGNALS:
void hoveredChanged();
void pressedChanged();
diff --git a/src/declarative/graphicsitems/qdeclarativemousearea_p_p.h b/src/declarative/graphicsitems/qdeclarativemousearea_p_p.h
index 67694fb..7248c92 100644
--- a/src/declarative/graphicsitems/qdeclarativemousearea_p_p.h
+++ b/src/declarative/graphicsitems/qdeclarativemousearea_p_p.h
@@ -70,6 +70,8 @@ public:
: absorb(true), hovered(false), pressed(false), longPress(false),
moved(false), stealMouse(false), doubleClick(false), preventStealing(false), drag(0)
{
+ Q_Q(QDeclarativeMouseArea);
+ forwardTo = QDeclarativeListProperty<QGraphicsObject>(q, forwardToList);
}
~QDeclarativeMouseAreaPrivate();
@@ -89,6 +91,18 @@ public:
lastModifiers = event->modifiers();
}
+ void forwardEvent(QGraphicsSceneMouseEvent* event)
+ {
+ Q_Q(QDeclarativeMouseArea);
+ for(int i=0; i < forwardToList.count(); i++){
+ event->setPos(forwardToList[i]->mapFromScene(event->scenePos()));
+ forwardToList[i]->scene()->sendEvent(forwardToList[i], event);
+ if(event->isAccepted())
+ break;
+ }
+ event->setPos(q->mapFromScene(event->scenePos()));
+ }
+
bool isPressAndHoldConnected() {
Q_Q(QDeclarativeMouseArea);
static int idx = QObjectPrivate::get(q)->signalIndex("pressAndHold(QDeclarativeMouseEvent*)");
@@ -121,6 +135,9 @@ public:
Qt::MouseButtons lastButtons;
Qt::KeyboardModifiers lastModifiers;
QBasicTimer pressAndHoldTimer;
+
+ QDeclarativeListProperty<QGraphicsObject> forwardTo;
+ QList<QGraphicsObject*> forwardToList;
};
QT_END_NAMESPACE
diff --git a/src/declarative/qml/qdeclarativeenginedebug.cpp b/src/declarative/qml/qdeclarativeenginedebug.cpp
index 31fd516..b2a05c3 100644
--- a/src/declarative/qml/qdeclarativeenginedebug.cpp
+++ b/src/declarative/qml/qdeclarativeenginedebug.cpp
@@ -249,10 +249,16 @@ void QDeclarativeEngineDebugServer::buildObjectDump(QDataStream &message,
return;
}
- message << (object->metaObject()->propertyCount() + fakeProperties.count());
+ QList<int> propertyIndexes;
+ for (int ii = 0; ii < object->metaObject()->propertyCount(); ++ii) {
+ if (object->metaObject()->property(ii).isScriptable())
+ propertyIndexes << ii;
+ }
+
+ message << propertyIndexes.size() + fakeProperties.count();
- for (int ii = 0; ii < object->metaObject()->propertyCount(); ++ii)
- message << propertyData(object, ii);
+ for (int ii = 0; ii < propertyIndexes.size(); ++ii)
+ message << propertyData(object, propertyIndexes.at(ii));
for (int ii = 0; ii < fakeProperties.count(); ++ii)
message << fakeProperties[ii];
diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp
index 3a7672f..fa6eeb7 100644
--- a/src/gui/styles/qs60style.cpp
+++ b/src/gui/styles/qs60style.cpp
@@ -963,6 +963,17 @@ bool QS60StylePrivate::isWidgetPressed(const QWidget *widget)
return (widget && widget == m_pressedWidget);
}
+// Generates 1*1 white pixmap as a placeholder for real texture.
+// The actual theme texture is drawn in qt_s60_fill_background().
+QPixmap QS60StylePrivate::placeHolderTexture()
+{
+ if (!m_placeHolderTexture) {
+ m_placeHolderTexture = new QPixmap(1,1);
+ m_placeHolderTexture->fill(Qt::green);
+ }
+ return *m_placeHolderTexture;
+}
+
/*!
\class QS60Style
\brief The QS60Style class provides a look and feel suitable for applications on S60.
diff --git a/src/gui/styles/qs60style_s60.cpp b/src/gui/styles/qs60style_s60.cpp
index 60e20cd..1e374cb 100644
--- a/src/gui/styles/qs60style_s60.cpp
+++ b/src/gui/styles/qs60style_s60.cpp
@@ -1432,17 +1432,6 @@ QPixmap QS60StylePrivate::backgroundTexture(bool skipCreation)
return *m_background;
}
-// Generates 1*1 white pixmap as a placeholder for real texture.
-// The actual theme texture is drawn in qt_s60_fill_background().
-QPixmap QS60StylePrivate::placeHolderTexture()
-{
- if (!m_placeHolderTexture) {
- m_placeHolderTexture = new QPixmap(1,1);
- m_placeHolderTexture->fill(Qt::white);
- }
- return *m_placeHolderTexture;
-}
-
QSize QS60StylePrivate::screenSize()
{
return QSize(S60->screenWidthInPixels, S60->screenHeightInPixels);
diff --git a/src/gui/widgets/qlinecontrol.cpp b/src/gui/widgets/qlinecontrol.cpp
index 3eac64a..606ba05 100644
--- a/src/gui/widgets/qlinecontrol.cpp
+++ b/src/gui/widgets/qlinecontrol.cpp
@@ -435,7 +435,7 @@ void QLineControl::processInputMethodEvent(QInputMethodEvent *event)
removeSelectedText();
}
if (!event->commitString().isEmpty()) {
- insert(event->commitString());
+ internalInsert(event->commitString());
cursorPositionChanged = true;
}
diff --git a/src/plugins/qmltooling/qmldbg_ost/qostdevice.h b/src/plugins/qmltooling/qmldbg_ost/qostdevice.h
index e33cf2d..2c26ff7 100644
--- a/src/plugins/qmltooling/qmldbg_ost/qostdevice.h
+++ b/src/plugins/qmltooling/qmldbg_ost/qostdevice.h
@@ -42,7 +42,7 @@
#ifndef QOSTDEVICE_H
#define QOSTDEVICE_H
-#include <qiodevice.h>
+#include <QtCore/QIODevice>
QT_BEGIN_NAMESPACE