diff options
Diffstat (limited to 'src/declarative')
5 files changed, 46 insertions, 5 deletions
diff --git a/src/declarative/debugger/qmldebugservice.cpp b/src/declarative/debugger/qmldebugservice.cpp index 810fbed..2c9586f 100644 --- a/src/declarative/debugger/qmldebugservice.cpp +++ b/src/declarative/debugger/qmldebugservice.cpp @@ -61,9 +61,11 @@ class QmlDebugServer : public QObject public: static QmlDebugServer *instance(); void wait(); + void registerForStartNotification(QObject *object, const char *receiver); private Q_SLOTS: void readyRead(); + void registeredObjectDestroyed(QObject *object); private: friend class QmlDebugService; @@ -83,6 +85,7 @@ public: QPacketProtocol *protocol; QHash<QString, QmlDebugService *> plugins; QStringList enabledPlugins; + QList<QPair<QObject*, QByteArray> > notifyClients; }; class QmlDebugServicePrivate : public QObjectPrivate @@ -112,6 +115,14 @@ void QmlDebugServerPrivate::wait() qWarning("QmlDebugServer: Waiting for connection on port %d...", port); + for (int i=0; i<notifyClients.count(); i++) { + if (!QMetaObject::invokeMethod(notifyClients[i].first, notifyClients[i].second)) { + qWarning() << "QmlDebugServer: unable to call method" << notifyClients[i].second + << "on object" << notifyClients[i].first << "to notify of debug server start"; + } + } + notifyClients.clear(); + if (!server.waitForNewConnection(-1)) { qWarning("QmlDebugServer: Connection error"); return; @@ -165,6 +176,23 @@ void QmlDebugServer::wait() d->wait(); } +void QmlDebugServer::registerForStartNotification(QObject *object, const char *methodName) +{ + Q_D(QmlDebugServer); + connect(object, SIGNAL(destroyed(QObject*)), SLOT(registeredObjectDestroyed(QObject*))); + d->notifyClients.append(qMakePair(object, QByteArray(methodName))); +} + +void QmlDebugServer::registeredObjectDestroyed(QObject *object) +{ + Q_D(QmlDebugServer); + QMutableListIterator<QPair<QObject*, QByteArray> > i(d->notifyClients); + while (i.hasNext()) { + if (i.next().first == object) + i.remove(); + } +} + QmlDebugServer::QmlDebugServer(int port) : QObject(*(new QmlDebugServerPrivate)) { @@ -367,6 +395,11 @@ void QmlDebugService::waitForClients() QmlDebugServer::instance()->wait(); } +void QmlDebugService::notifyOnServerStart(QObject *object, const char *receiver) +{ + QmlDebugServer::instance()->registerForStartNotification(object, receiver); +} + void QmlDebugService::sendMessage(const QByteArray &message) { Q_D(QmlDebugService); diff --git a/src/declarative/debugger/qmldebugservice_p.h b/src/declarative/debugger/qmldebugservice_p.h index b406a3c..ec90d95 100644 --- a/src/declarative/debugger/qmldebugservice_p.h +++ b/src/declarative/debugger/qmldebugservice_p.h @@ -68,17 +68,19 @@ public: static int idForObject(QObject *); static QObject *objectForId(int); - static bool isDebuggingEnabled(); static QString objectToString(QObject *obj); static void waitForClients(); + static void notifyOnServerStart(QObject *object, const char *receiver); + protected: virtual void enabledChanged(bool); virtual void messageReceived(const QByteArray &); private: + void registerForStartNotification(QObject *object, const char *methodName); friend class QmlDebugServer; }; diff --git a/src/declarative/graphicsitems/qmlgraphicsitemsmodule.cpp b/src/declarative/graphicsitems/qmlgraphicsitemsmodule.cpp index 127aec8..66d62f0 100644 --- a/src/declarative/graphicsitems/qmlgraphicsitemsmodule.cpp +++ b/src/declarative/graphicsitems/qmlgraphicsitemsmodule.cpp @@ -127,9 +127,11 @@ void QmlGraphicsItemModule::defineModule() QML_REGISTER_TYPE(Qt,4,6,PathQuad,QmlGraphicsPathQuad); QML_REGISTER_TYPE(Qt,4,6,PathView,QmlGraphicsPathView); QML_REGISTER_TYPE(Qt,4,6,Pen,QmlGraphicsPen); - QML_REGISTER_TYPE(Qt,4,6,QDoubleValidator,QDoubleValidator); QML_REGISTER_TYPE(Qt,4,6,QIntValidator,QIntValidator); - QML_REGISTER_TYPE(Qt,4,6,QRegExpValidator,QRegExpValidator); +#if (QT_VERSION >= QT_VERSION_CHECK(4,7,0)) + QML_REGISTER_TYPE(Qt,4,7,QDoubleValidator,QDoubleValidator); + QML_REGISTER_TYPE(Qt,4,7,QRegExpValidator,QRegExpValidator); +#endif QML_REGISTER_TYPE(Qt,4,6,Rectangle,QmlGraphicsRectangle); QML_REGISTER_TYPE(Qt,4,6,Repeater,QmlGraphicsRepeater); QML_REGISTER_TYPE(Qt,4,6,Rotation,QGraphicsRotation); diff --git a/src/declarative/graphicsitems/qmlgraphicstextinput.cpp b/src/declarative/graphicsitems/qmlgraphicstextinput.cpp index ea54351..6d9b7b1 100644 --- a/src/declarative/graphicsitems/qmlgraphicstextinput.cpp +++ b/src/declarative/graphicsitems/qmlgraphicstextinput.cpp @@ -646,10 +646,12 @@ void QmlGraphicsTextInput::focusChanged(bool hasFocus) void QmlGraphicsTextInput::keyPressEvent(QKeyEvent* ev) { Q_D(QmlGraphicsTextInput); - if((d->control->cursor() == 0 && ev->key() == Qt::Key_Left) + if(((d->control->cursor() == 0 && ev->key() == Qt::Key_Left) || (d->control->cursor() == d->control->text().length() - && ev->key() == Qt::Key_Right)){ + && ev->key() == Qt::Key_Right)) + && (d->lastSelectionStart == d->lastSelectionEnd)){ //ignore when moving off the end + //unless there is a selection, because then moving will do something (deselect) ev->ignore(); }else{ d->control->processKeyEvent(ev); diff --git a/src/declarative/graphicsitems/qmlgraphicstextinput_p.h b/src/declarative/graphicsitems/qmlgraphicstextinput_p.h index 4708381..a91e71a 100644 --- a/src/declarative/graphicsitems/qmlgraphicstextinput_p.h +++ b/src/declarative/graphicsitems/qmlgraphicstextinput_p.h @@ -222,8 +222,10 @@ QT_END_NAMESPACE QML_DECLARE_TYPE(QmlGraphicsTextInput) QML_DECLARE_TYPE(QValidator) QML_DECLARE_TYPE(QIntValidator) +#if (QT_VERSION >= QT_VERSION_CHECK(4,7,0)) QML_DECLARE_TYPE(QDoubleValidator) QML_DECLARE_TYPE(QRegExpValidator) +#endif QT_END_HEADER |