diff options
Diffstat (limited to 'src/corelib/kernel')
-rw-r--r-- | src/corelib/kernel/qeventdispatcher_win.cpp | 22 | ||||
-rw-r--r-- | src/corelib/kernel/qeventdispatcher_win_p.h | 2 | ||||
-rw-r--r-- | src/corelib/kernel/qobject.cpp | 8 | ||||
-rw-r--r-- | src/corelib/kernel/qvariant_p.h | 22 |
4 files changed, 28 insertions, 26 deletions
diff --git a/src/corelib/kernel/qeventdispatcher_win.cpp b/src/corelib/kernel/qeventdispatcher_win.cpp index 75ac104155..79146dac34 100644 --- a/src/corelib/kernel/qeventdispatcher_win.cpp +++ b/src/corelib/kernel/qeventdispatcher_win.cpp @@ -97,9 +97,7 @@ QEventDispatcherWin32Private::QEventDispatcherWin32Private() : threadId(GetCurrentThreadId()), interrupt(false), closingDown(false), internalHwnd(0), getMessageHook(0), serialNumber(0), lastSerialNumber(0), sendPostedEventsWindowsTimerId(0), wakeUps(0) -#ifndef Q_OS_WINCE , activateNotifiersPosted(false) -#endif { } @@ -180,11 +178,9 @@ LRESULT QT_WIN_CALLBACK qt_internal_proc(HWND hwnd, UINT message, WPARAM wp, LPA QSockNot *sn = dict ? dict->value(wp) : 0; if (sn) { -#ifndef Q_OS_WINCE d->doWsaAsyncSelect(sn->fd, 0); d->active_fd[sn->fd].selected = false; d->postActivateSocketNotifiers(); -#endif if (type < 3) { QEvent event(QEvent::SockAct); QCoreApplication::sendEvent(sn->obj, &event); @@ -195,7 +191,6 @@ LRESULT QT_WIN_CALLBACK qt_internal_proc(HWND hwnd, UINT message, WPARAM wp, LPA } } return 0; -#ifndef Q_OS_WINCE } else if (message == WM_QT_ACTIVATENOTIFIERS) { Q_ASSERT(d != 0); @@ -210,7 +205,6 @@ LRESULT QT_WIN_CALLBACK qt_internal_proc(HWND hwnd, UINT message, WPARAM wp, LPA } d->activateNotifiersPosted = false; return 0; -#endif // !Q_OS_WINCE } else if (message == WM_QT_SENDPOSTEDEVENTS // we also use a Windows timer to send posted events when the message queue is full || (message == WM_TIMER @@ -445,13 +439,11 @@ void QEventDispatcherWin32Private::doWsaAsyncSelect(int socket, long event) WSAAsyncSelect(socket, internalHwnd, event ? int(WM_QT_SOCKETNOTIFIER) : 0, event); } -#ifndef Q_OS_WINCE void QEventDispatcherWin32Private::postActivateSocketNotifiers() { if (!activateNotifiersPosted) activateNotifiersPosted = PostMessage(internalHwnd, WM_QT_ACTIVATENOTIFIERS, 0, 0); } -#endif // !Q_OS_WINCE void QEventDispatcherWin32::createInternalHwnd() { @@ -705,22 +697,16 @@ void QEventDispatcherWin32::registerSocketNotifier(QSocketNotifier *notifier) QSFDict::iterator it = d->active_fd.find(sockfd); if (it != d->active_fd.end()) { QSockFd &sd = it.value(); -#ifndef Q_OS_WINCE if (sd.selected) { d->doWsaAsyncSelect(sockfd, 0); sd.selected = false; } -#endif // !Q_OS_WINCE sd.event |= event; } else { d->active_fd.insert(sockfd, QSockFd(event)); } -#ifndef Q_OS_WINCE d->postActivateSocketNotifiers(); -#else - d->doWsaAsyncSelect(sockfd, event); -#endif } void QEventDispatcherWin32::unregisterSocketNotifier(QSocketNotifier *notifier) @@ -749,7 +735,6 @@ void QEventDispatcherWin32::doUnregisterSocketNotifier(QSocketNotifier *notifier QSFDict::iterator it = d->active_fd.find(sockfd); if (it != d->active_fd.end()) { QSockFd &sd = it.value(); -#ifndef Q_OS_WINCE if (sd.selected) d->doWsaAsyncSelect(sockfd, 0); const long event[3] = { FD_READ | FD_CLOSE | FD_ACCEPT, FD_WRITE | FD_CONNECT, FD_OOB }; @@ -760,13 +745,6 @@ void QEventDispatcherWin32::doUnregisterSocketNotifier(QSocketNotifier *notifier sd.selected = false; d->postActivateSocketNotifiers(); } -#else - const long event[3] = { FD_READ | FD_CLOSE | FD_ACCEPT, FD_WRITE | FD_CONNECT, FD_OOB }; - sd.event ^= event[type]; - d->doWsaAsyncSelect(sockfd, sd.event); - if (sd.event == 0) - d->active_fd.erase(it); -#endif // !Q_OS_WINCE } QSNDict *sn_vec[3] = { &d->sn_read, &d->sn_write, &d->sn_except }; diff --git a/src/corelib/kernel/qeventdispatcher_win_p.h b/src/corelib/kernel/qeventdispatcher_win_p.h index 227fcf89ff..423dc5b169 100644 --- a/src/corelib/kernel/qeventdispatcher_win_p.h +++ b/src/corelib/kernel/qeventdispatcher_win_p.h @@ -187,10 +187,8 @@ public: QSNDict sn_write; QSNDict sn_except; QSFDict active_fd; -#ifndef Q_OS_WINCE bool activateNotifiersPosted; void postActivateSocketNotifiers(); -#endif void doWsaAsyncSelect(int socket, long event); QList<QWinEventNotifier *> winEventNotifierList; diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp index 5e6c44fb13..8088b18ef4 100644 --- a/src/corelib/kernel/qobject.cpp +++ b/src/corelib/kernel/qobject.cpp @@ -2636,6 +2636,9 @@ static inline void check_and_warn_compat(const QMetaObject *sender, const QMetaM (exact same signal to the exact same slot on the same objects), the connection will fail and connect will return an invalid QMetaObject::Connection. + \note Qt::UniqueConnections do not work for lambdas, non-member functions + and functors; they only apply to connecting to member functions. + The optional \a type parameter describes the type of connection to establish. In particular, it determines whether a particular signal is delivered to a slot immediately or queued for delivery @@ -4705,7 +4708,10 @@ void qDeleteInEventHandler(QObject *o) Creates a connection of a given \a type from \a signal in \a sender object to \a functor to be placed in a specific event - loop of \a context, and returns a handle to the connection + loop of \a context, and returns a handle to the connection. + + \note Qt::UniqueConnections do not work for lambdas, non-member functions + and functors; they only apply to connecting to member functions. The signal must be a function declared as a signal in the header. The slot function can be any function or functor that can be connected diff --git a/src/corelib/kernel/qvariant_p.h b/src/corelib/kernel/qvariant_p.h index bf88def438..487949431c 100644 --- a/src/corelib/kernel/qvariant_p.h +++ b/src/corelib/kernel/qvariant_p.h @@ -177,6 +177,26 @@ inline void v_clear(QVariant::Private *d, T* = 0) } +template <typename T> +struct PrimitiveIsNull +{ +public: + static bool isNull(const QVariant::Private *d) + { + return d->is_null; + } +}; + +template <> +struct PrimitiveIsNull<std::nullptr_t> +{ +public: + static bool isNull(const QVariant::Private *) + { + return true; + } +}; + template<class Filter> class QVariantComparator { template<typename T, bool IsAcceptedType = Filter::template Acceptor<T>::IsAccepted> @@ -268,7 +288,7 @@ class QVariantIsNull { static bool isNull(const QVariant::Private *d) { - return d->is_null; + return PrimitiveIsNull<T>::isNull(d); } }; |