diff options
author | Jan Arve Sæther <jan-arve.saether@qt.io> | 2019-09-16 14:12:50 +0200 |
---|---|---|
committer | Jan Arve Sæther <jan-arve.saether@qt.io> | 2019-09-16 15:03:05 +0200 |
commit | b7e5b0c25b7c02b40c2072f45a0a0feb8bd2a977 (patch) | |
tree | 3c2d0d52eed3e9c4606464ed0d204ee4ab7b0a3f | |
parent | 43a6970ce328109d9d367978fa09e838bbac8596 (diff) |
Fix qmlobject_{dis}connect macros to require semicolon at the end
Just do the typical
do {
[..stuff..]
} while(0)
in the macros
Fix the places that didn't have semicolons.
This should eliminate some compiler warnings complaining about
excessive semicolons
Change-Id: I6b0e7a55badfd0f80c3cd0e9e1da42dc41945485
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
-rw-r--r-- | src/qml/qml/qqmlglobal_p.h | 8 | ||||
-rw-r--r-- | src/quick/items/qquickborderimage.cpp | 2 | ||||
-rw-r--r-- | src/quick/items/qquickborderimage_p_p.h | 2 | ||||
-rw-r--r-- | src/quick/items/qquickflickable.cpp | 4 | ||||
-rw-r--r-- | src/quick/items/qquickitem.cpp | 2 | ||||
-rw-r--r-- | src/quick/items/qquickpathview.cpp | 4 | ||||
-rw-r--r-- | tests/auto/qml/qqmlcpputils/tst_qqmlcpputils.cpp | 2 |
7 files changed, 12 insertions, 12 deletions
diff --git a/src/qml/qml/qqmlglobal_p.h b/src/qml/qml/qqmlglobal_p.h index 96891af416..3c540a6124 100644 --- a/src/qml/qml/qqmlglobal_p.h +++ b/src/qml/qml/qqmlglobal_p.h @@ -90,7 +90,7 @@ QT_BEGIN_NAMESPACE \endcode */ #define qmlobject_connect(Sender, SenderType, Signal, Receiver, ReceiverType, Method) \ -{ \ +do { \ SenderType *sender = (Sender); \ ReceiverType *receiver = (Receiver); \ const char *signal = (Signal); \ @@ -111,7 +111,7 @@ QT_BEGIN_NAMESPACE } \ Q_ASSERT(signalIdx != -1 && methodIdx != -1); \ QMetaObject::connect(sender, signalIdx, receiver, methodIdx, Qt::DirectConnection); \ -} +} while (0) /*! Disconnect \a Signal of \a Sender from \a Method of \a Receiver. \a Signal must be @@ -129,7 +129,7 @@ QT_BEGIN_NAMESPACE \endcode */ #define qmlobject_disconnect(Sender, SenderType, Signal, Receiver, ReceiverType, Method) \ -{ \ +do { \ SenderType *sender = (Sender); \ ReceiverType *receiver = (Receiver); \ const char *signal = (Signal); \ @@ -150,7 +150,7 @@ QT_BEGIN_NAMESPACE } \ Q_ASSERT(signalIdx != -1 && methodIdx != -1); \ QMetaObject::disconnect(sender, signalIdx, receiver, methodIdx); \ -} +} while (0) /*! This method is identical to qobject_cast<T>() except that it does not require lazy diff --git a/src/quick/items/qquickborderimage.cpp b/src/quick/items/qquickborderimage.cpp index 430fa1b094..462a44634e 100644 --- a/src/quick/items/qquickborderimage.cpp +++ b/src/quick/items/qquickborderimage.cpp @@ -327,7 +327,7 @@ void QQuickBorderImage::load() QNetworkRequest req(d->url); d->sciReply = qmlEngine(this)->networkAccessManager()->get(req); qmlobject_connect(d->sciReply, QNetworkReply, SIGNAL(finished()), - this, QQuickBorderImage, SLOT(sciRequestFinished())) + this, QQuickBorderImage, SLOT(sciRequestFinished())); #endif } } else { diff --git a/src/quick/items/qquickborderimage_p_p.h b/src/quick/items/qquickborderimage_p_p.h index 0f4e7acc05..17dab7d121 100644 --- a/src/quick/items/qquickborderimage_p_p.h +++ b/src/quick/items/qquickborderimage_p_p.h @@ -86,7 +86,7 @@ public: if (!border) { border = new QQuickScaleGrid(q); qmlobject_connect(border, QQuickScaleGrid, SIGNAL(borderChanged()), - q, QQuickBorderImage, SLOT(doUpdate())) + q, QQuickBorderImage, SLOT(doUpdate())); } return border; } diff --git a/src/quick/items/qquickflickable.cpp b/src/quick/items/qquickflickable.cpp index cf3cd9f48e..d9ec7de611 100644 --- a/src/quick/items/qquickflickable.cpp +++ b/src/quick/items/qquickflickable.cpp @@ -266,9 +266,9 @@ void QQuickFlickablePrivate::init() QQml_setParent_noEvent(contentItem, q); contentItem->setParentItem(q); qmlobject_connect(&timeline, QQuickTimeLine, SIGNAL(completed()), - q, QQuickFlickable, SLOT(timelineCompleted())) + q, QQuickFlickable, SLOT(timelineCompleted())); qmlobject_connect(&velocityTimeline, QQuickTimeLine, SIGNAL(completed()), - q, QQuickFlickable, SLOT(velocityTimelineCompleted())) + q, QQuickFlickable, SLOT(velocityTimelineCompleted())); q->setAcceptedMouseButtons(Qt::LeftButton); q->setAcceptTouchEvents(false); // rely on mouse events synthesized from touch q->setFiltersChildMouseEvents(true); diff --git a/src/quick/items/qquickitem.cpp b/src/quick/items/qquickitem.cpp index 52a1d59e77..c1ab8716f3 100644 --- a/src/quick/items/qquickitem.cpp +++ b/src/quick/items/qquickitem.cpp @@ -5083,7 +5083,7 @@ QQuickStateGroup *QQuickItemPrivate::_states() if (!componentComplete) _stateGroup->classBegin(); qmlobject_connect(_stateGroup, QQuickStateGroup, SIGNAL(stateChanged(QString)), - q, QQuickItem, SIGNAL(stateChanged(QString))) + q, QQuickItem, SIGNAL(stateChanged(QString))); } return _stateGroup; diff --git a/src/quick/items/qquickpathview.cpp b/src/quick/items/qquickpathview.cpp index 35b8a872ec..8091a28a6c 100644 --- a/src/quick/items/qquickpathview.cpp +++ b/src/quick/items/qquickpathview.cpp @@ -118,10 +118,10 @@ void QQuickPathViewPrivate::init() q->setFlag(QQuickItem::ItemIsFocusScope); q->setFiltersChildMouseEvents(true); qmlobject_connect(&tl, QQuickTimeLine, SIGNAL(updated()), - q, QQuickPathView, SLOT(ticked())) + q, QQuickPathView, SLOT(ticked())); timer.invalidate(); qmlobject_connect(&tl, QQuickTimeLine, SIGNAL(completed()), - q, QQuickPathView, SLOT(movementEnding())) + q, QQuickPathView, SLOT(movementEnding())); } QQuickItem *QQuickPathViewPrivate::getItem(int modelIndex, qreal z, bool async) diff --git a/tests/auto/qml/qqmlcpputils/tst_qqmlcpputils.cpp b/tests/auto/qml/qqmlcpputils/tst_qqmlcpputils.cpp index 99cabb4b09..13e4d4c53b 100644 --- a/tests/auto/qml/qqmlcpputils/tst_qqmlcpputils.cpp +++ b/tests/auto/qml/qqmlcpputils/tst_qqmlcpputils.cpp @@ -71,7 +71,7 @@ void tst_qqmlcpputils::fastConnect() { MyObject obj; - qmlobject_connect(&obj, MyObject, SIGNAL(signal1()), &obj, MyObject, SLOT(slot1())) + qmlobject_connect(&obj, MyObject, SIGNAL(signal1()), &obj, MyObject, SLOT(slot1())); obj.signal1(); QCOMPARE(obj.slotCount, 1); |