diff options
Diffstat (limited to 'src/corelib/kernel')
23 files changed, 11 insertions, 793 deletions
diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp index e00db5e01a..c134881f31 100644 --- a/src/corelib/kernel/qcoreapplication.cpp +++ b/src/corelib/kernel/qcoreapplication.cpp @@ -176,9 +176,6 @@ extern QString qAppFileName(); #endif int QCoreApplicationPrivate::app_compile_version = 0x040000; //we don't know exactly, but it's at least 4.0.0 -#if defined(QT3_SUPPORT) -bool QCoreApplicationPrivate::useQt3Support = true; -#endif #if !defined(Q_OS_WIN) #ifdef Q_OS_MAC @@ -337,9 +334,6 @@ QCoreApplicationPrivate::QCoreApplicationPrivate(int &aargc, char **aargv, uint in_exec(false), aboutToQuitEmitted(false), threadData_clean(false) { app_compile_version = flags & 0xffffff; -#if defined(QT3_SUPPORT) - useQt3Support = !(flags & 0x01000000); -#endif static const char *const empty = ""; if (argc == 0 || argv == 0) { argc = 0; @@ -1261,20 +1255,7 @@ void QCoreApplication::postEvent(QObject *receiver, QEvent *event, int priority) // delete the event on exceptions to protect against memory leaks till the event is // properly owned in the postEventList QScopedPointer<QEvent> eventDeleter(event); - if (data->postEventList.isEmpty() || data->postEventList.last().priority >= priority) { - // optimization: we can simply append if the last event in - // the queue has higher or equal priority - data->postEventList.append(QPostEvent(receiver, event, priority)); - } else { - // insert event in descending priority order, using upper - // bound for a given priority (to ensure proper ordering - // of events with the same priority) - QPostEventList::iterator begin = data->postEventList.begin() - + data->postEventList.insertionOffset, - end = data->postEventList.end(); - QPostEventList::iterator at = qUpperBound(begin, end, priority); - data->postEventList.insert(at, QPostEvent(receiver, event, priority)); - } + data->postEventList.addEvent(QPostEvent(receiver, event, priority)); eventDeleter.take(); event->posted = true; ++receiver->d_func()->postedEvents; @@ -1372,20 +1353,6 @@ void QCoreApplicationPrivate::sendPostedEvents(QObject *receiver, int event_type ++data->postEventList.recursion; -#ifdef QT3_SUPPORT - if (event_type == QEvent::ChildInserted) { - if (receiver) { - // optimize sendPostedEvents(w, QEvent::ChildInserted) calls away - receiver->d_func()->sendPendingChildInsertedEvents(); - --data->postEventList.recursion; - return; - } - - // ChildInserted events are sent in response to *Request - event_type = QEvent::ChildInsertedRequest; - } -#endif - QMutexLocker locker(&data->postEventList.mutex); // by default, we assume that the event dispatcher can go to sleep after @@ -1434,7 +1401,7 @@ void QCoreApplicationPrivate::sendPostedEvents(QObject *receiver, int event_type // cannot send deferred delete if (!event_type && !receiver) { // don't lose the event - data->postEventList.append(pe); + data->postEventList.addEvent(pe); const_cast<QPostEvent &>(pe).event = 0; } continue; @@ -1536,11 +1503,6 @@ void QCoreApplication::removePostedEvents(QObject *receiver) void QCoreApplication::removePostedEvents(QObject *receiver, int eventType) { -#ifdef QT3_SUPPORT - if (eventType == QEvent::ChildInserted) - eventType = QEvent::ChildInsertedRequest; -#endif - QThreadData *data = receiver ? receiver->d_func()->threadData : QThreadData::current(); QMutexLocker locker(&data->postEventList.mutex); @@ -1563,10 +1525,6 @@ void QCoreApplication::removePostedEvents(QObject *receiver, int eventType) if ((!receiver || pe.receiver == receiver) && (pe.event && (eventType == 0 || pe.event->type() == eventType))) { --pe.receiver->d_func()->postedEvents; -#ifdef QT3_SUPPORT - if (pe.event->type() == QEvent::ChildInsertedRequest) - pe.receiver->d_func()->pendingChildInsertedEvents.clear(); -#endif pe.event->posted = false; events.append(pe.event); const_cast<QPostEvent &>(pe).event = 0; @@ -2558,109 +2516,6 @@ bool QCoreApplication::hasPendingEvents() return false; } -#ifdef QT3_SUPPORT -/*! \fn void QCoreApplication::lock() - - In Qt 3, this function locked the Qt library mutex, allowing - non-GUI threads to perform basic printing operations using - QPainter. - - In Qt 4, this is no longer supported, since painting is only - supported from within a paint event handler. This function does - nothing. - - \sa QWidget::paintEvent() -*/ - -/*! \fn void QCoreApplication::unlock(bool wakeUpGui) - - In Qt 3, this function unlocked the Qt library mutex. The mutex - allowed non-GUI threads to perform basic printing operations - using QPainter. - - In Qt 4, this is no longer supported, since painting is only - supported from within a paint event handler. This function does - nothing. -*/ - -/*! \fn bool QCoreApplication::locked() - - This function does nothing. It is there to keep old code working. - It always returns false. - - See lock() for details. -*/ - -/*! \fn bool QCoreApplication::tryLock() - - This function does nothing. It is there to keep old code working. - It always returns false. - - See lock() for details. -*/ - -/*! \fn void QCoreApplication::processOneEvent() - \obsolete - - Waits for an event to occur, processes it, then returns. - - This function is useful for adapting Qt to situations where the - event processing must be grafted onto existing program loops. - - Using this function in new applications may be an indication of design - problems. - - \sa processEvents(), exec(), QTimer -*/ - -/*! \obsolete - - This function enters the main event loop (recursively). Do not call - it unless you really know what you are doing. -*/ -int QCoreApplication::enter_loop() -{ - if (!QCoreApplicationPrivate::checkInstance("enter_loop")) - return -1; - if (QThreadData::current() != self->d_func()->threadData) { - qWarning("QCoreApplication::enter_loop: Must be called from the main thread"); - return -1; - } - QEventLoop eventLoop; - int returnCode = eventLoop.exec(); - return returnCode; -} - -/*! \obsolete - - This function exits from a recursive call to the main event loop. - Do not call it unless you are an expert. -*/ -void QCoreApplication::exit_loop() -{ - if (!QCoreApplicationPrivate::checkInstance("exit_loop")) - return; - QThreadData *data = QThreadData::current(); - if (data != self->d_func()->threadData) { - qWarning("QCoreApplication::exit_loop: Must be called from the main thread"); - return; - } - if (!data->eventLoops.isEmpty()) - data->eventLoops.top()->exit(); -} - -/*! \obsolete - - Returns the current loop level. -*/ -int QCoreApplication::loopLevel() -{ - if (!QCoreApplicationPrivate::checkInstance("loopLevel")) - return -1; - return self->d_func()->threadData->eventLoops.size(); -} -#endif - /* \fn void QCoreApplication::watchUnixSignal(int signal, bool watch) \internal diff --git a/src/corelib/kernel/qcoreapplication.h b/src/corelib/kernel/qcoreapplication.h index c3d174d878..04d538d1b3 100644 --- a/src/corelib/kernel/qcoreapplication.h +++ b/src/corelib/kernel/qcoreapplication.h @@ -46,10 +46,6 @@ #include <QtCore/qcoreevent.h> #include <QtCore/qeventloop.h> -#ifdef QT_INCLUDE_COMPAT -#include <QtCore/qstringlist.h> -#endif - #if defined(Q_OS_WIN) && !defined(tagMSG) typedef struct tagMSG MSG; #endif @@ -79,9 +75,6 @@ class Q_CORE_EXPORT QCoreApplication : public QObject Q_DECLARE_PRIVATE(QCoreApplication) public: enum { ApplicationFlags = QT_VERSION -#if !defined(QT3_SUPPORT) - | 0x01000000 -#endif }; QCoreApplication(int &argc, char **argv, int = ApplicationFlags); @@ -155,19 +148,6 @@ public: static void flush(); -#if defined(QT3_SUPPORT) - inline QT3_SUPPORT void lock() {} - inline QT3_SUPPORT void unlock(bool = true) {} - inline QT3_SUPPORT bool locked() { return false; } - inline QT3_SUPPORT bool tryLock() { return false; } - - static inline QT3_SUPPORT void processOneEvent() - { processEvents(QEventLoop::WaitForMoreEvents); } - static QT3_SUPPORT int enter_loop(); - static QT3_SUPPORT void exit_loop(); - static QT3_SUPPORT int loopLevel(); -#endif - #if defined(Q_OS_WIN) virtual bool winEventFilter(MSG *message, long *result); #endif diff --git a/src/corelib/kernel/qcoreapplication_p.h b/src/corelib/kernel/qcoreapplication_p.h index 22585a1ce9..62026141a1 100644 --- a/src/corelib/kernel/qcoreapplication_p.h +++ b/src/corelib/kernel/qcoreapplication_p.h @@ -141,9 +141,6 @@ public: static uint attribs; static inline bool testAttribute(uint flag) { return attribs & (1 << flag); } static int app_compile_version; -#if defined(QT3_SUPPORT) - static bool useQt3Support; -#endif static QSettings *trolltechConf(); }; diff --git a/src/corelib/kernel/qcoreevent.cpp b/src/corelib/kernel/qcoreevent.cpp index 49c6da42c6..0c3a3b8777 100644 --- a/src/corelib/kernel/qcoreevent.cpp +++ b/src/corelib/kernel/qcoreevent.cpp @@ -505,65 +505,6 @@ QChildEvent::~QChildEvent() false. */ -/*! - \class QCustomEvent - \brief The QCustomEvent class provides support for custom events. - - \compat - - QCustomEvent has a \c{void *} that can be used to store custom - data. - - In Qt 3, QObject::customEvent() took a QCustomEvent pointer. We - found out that this approach was unsatisfactory, because - there was often no safe way of deleting the data held in the - \c{void *}. - - In Qt 4, QObject::customEvent() takes a plain QEvent pointer. - You can add custom data by subclassing. - - \sa QObject::customEvent(), QCoreApplication::notify() -*/ - -/*! - \fn QCustomEvent::QCustomEvent(int type, void *data) - - Constructs a custom event object with the event \a type and a - pointer to \a data. The value of \a type must be at least as - large as QEvent::User. By default, the data pointer is set to 0. -*/ -#ifdef QT3_SUPPORT -QCustomEvent::QCustomEvent(int type, void *data) - : QEvent(static_cast<Type>(type)) -{ - d = reinterpret_cast<QEventPrivate *>(data); -} - -/*! \internal -*/ -QCustomEvent::~QCustomEvent() -{ -} -#endif -/*! - \fn void QCustomEvent::setData(void *data) - - \compat - - Sets the generic data pointer to \a data. - - \sa data() -*/ - -/*! - \fn void *QCustomEvent::data() const - - \compat - - Returns a pointer to the generic event data. - - \sa setData() -*/ /*! \fn bool QChildEvent::inserted() const diff --git a/src/corelib/kernel/qcoreevent.h b/src/corelib/kernel/qcoreevent.h index 791b207dea..831a403975 100644 --- a/src/corelib/kernel/qcoreevent.h +++ b/src/corelib/kernel/qcoreevent.h @@ -89,9 +89,6 @@ public: Quit = 20, // request to quit application ParentChange = 21, // widget has been reparented ParentAboutToChange = 131, // sent just before the parent change is done -#ifdef QT3_SUPPORT - Reparent = ParentChange, -#endif ThreadChange = 22, // object has changed threads WindowActivate = 24, // window was activated WindowDeactivate = 25, // window was deactivated @@ -118,11 +115,6 @@ public: DragResponse = 64, // drag accepted/rejected ChildAdded = 68, // new child widget ChildPolished = 69, // polished child widget -#ifdef QT3_SUPPORT - ChildInsertedRequest = 67, // send ChildInserted compatibility events to receiver - ChildInserted = 70, // compatibility child inserted - LayoutHint = 72, // compatibility relayout request -#endif ChildRemoved = 71, // deleted child widget ShowWindowRequest = 73, // widget's window should be mapped PolishRequest = 74, // widget should be polished @@ -174,18 +166,8 @@ public: Shortcut = 117, // shortcut triggered ShortcutOverride = 51, // shortcut override request -#ifdef QT3_SUPPORT - Accel = 30, // accelerator event - AccelAvailable = 32, // accelerator available event - AccelOverride = ShortcutOverride, // accelerator override event -#endif - WhatsThisClicked = 118, -#ifdef QT3_SUPPORT - CaptionChange = WindowTitleChange, - IconChange = WindowIconChange, -#endif ToolBarChange = 120, // toolbar visibility toggled ApplicationActivate = 121, // application has been changed to active @@ -297,6 +279,7 @@ public: Expose = 208, InputMethodQuery = 209, + OrientationChange = 210, // Screen orientation has changed // 512 reserved for Qt Jambi's MetaCall event // 513 reserved for Qt Jambi's DeleteOnMainThread event @@ -364,26 +347,12 @@ public: ~QChildEvent(); QObject *child() const { return c; } bool added() const { return type() == ChildAdded; } -#ifdef QT3_SUPPORT - QT3_SUPPORT bool inserted() const { return type() == ChildInserted; } -#endif bool polished() const { return type() == ChildPolished; } bool removed() const { return type() == ChildRemoved; } protected: QObject *c; }; -#ifdef QT3_SUPPORT -class Q_CORE_EXPORT QCustomEvent : public QEvent -{ -public: - QT3_SUPPORT_CONSTRUCTOR QCustomEvent(int type, void *data = 0); - ~QCustomEvent(); - QT3_SUPPORT void *data() const { return d; } - QT3_SUPPORT void setData(void* aData) { d = reinterpret_cast<QEventPrivate *>(aData); } -}; -#endif - class Q_CORE_EXPORT QDynamicPropertyChangeEvent : public QEvent { public: diff --git a/src/corelib/kernel/qeventloop.h b/src/corelib/kernel/qeventloop.h index 46ee118ce5..5bd4146352 100644 --- a/src/corelib/kernel/qeventloop.h +++ b/src/corelib/kernel/qeventloop.h @@ -66,10 +66,6 @@ public: ExcludeUserInputEvents = 0x01, ExcludeSocketNotifiers = 0x02, WaitForMoreEvents = 0x04, -#ifdef QT3_SUPPORT - ExcludeUserInput = ExcludeUserInputEvents, - WaitForMore = WaitForMoreEvents, -#endif X11ExcludeTimers = 0x08 #ifdef QT_DEPRECATED , DeferredDeletion = 0x10 diff --git a/src/corelib/kernel/qmetaobject.cpp b/src/corelib/kernel/qmetaobject.cpp index b4c37f4778..c8ac15c1fa 100644 --- a/src/corelib/kernel/qmetaobject.cpp +++ b/src/corelib/kernel/qmetaobject.cpp @@ -2283,11 +2283,7 @@ bool QMetaProperty::write(QObject *object, const QVariant &value) const QVariant v = value; uint t = QVariant::Invalid; if (isEnumType()) { - if (v.type() == QVariant::String -#ifdef QT3_SUPPORT - || v.type() == QVariant::CString -#endif - ) { + if (v.type() == QVariant::String) { if (isFlagType()) v = QVariant(menum.keysToValue(value.toByteArray())); else diff --git a/src/corelib/kernel/qmetatype.cpp b/src/corelib/kernel/qmetatype.cpp index e5ef021ed1..c97f9d260e 100644 --- a/src/corelib/kernel/qmetatype.cpp +++ b/src/corelib/kernel/qmetatype.cpp @@ -765,9 +765,6 @@ bool QMetaType::save(QDataStream &stream, int type, const void *data) stream << *static_cast<const NS(QEasingCurve)*>(data); break; #endif -#ifdef QT3_SUPPORT - case QMetaType::QColorGroup: -#endif case QMetaType::QFont: case QMetaType::QPixmap: case QMetaType::QBrush: @@ -974,9 +971,6 @@ bool QMetaType::load(QDataStream &stream, int type, void *data) stream >> *static_cast< NS(QEasingCurve)*>(data); break; #endif -#ifdef QT3_SUPPORT - case QMetaType::QColorGroup: -#endif case QMetaType::QFont: case QMetaType::QPixmap: case QMetaType::QBrush: diff --git a/src/corelib/kernel/qmetatype.h b/src/corelib/kernel/qmetatype.h index da59a8fa2b..5df7658a13 100644 --- a/src/corelib/kernel/qmetatype.h +++ b/src/corelib/kernel/qmetatype.h @@ -72,6 +72,7 @@ public: QVariantHash = 28, QEasingCurve = 29, LastCoreType = QEasingCurve, FirstGuiType = 64 /* QFont */, + QFont = 64, QPixmap = 65, QBrush = 66, QColor = 67, QPalette = 68, QImage = 69, QPolygon = 70, QRegion = 71, QBitmap = 72, QCursor = 73, QKeySequence = 74, QPen = 75, @@ -314,9 +315,6 @@ class QEasingCurve; class QWidget; class QObject; -#ifdef QT3_SUPPORT -class QColorGroup; -#endif class QFont; class QPixmap; class QBrush; @@ -384,9 +382,6 @@ Q_DECLARE_BUILTIN_METATYPE(QRegExp, QRegExp) #endif Q_DECLARE_BUILTIN_METATYPE(QEasingCurve, QEasingCurve) -#ifdef QT3_SUPPORT -Q_DECLARE_BUILTIN_METATYPE(QColorGroup, QColorGroup) -#endif Q_DECLARE_BUILTIN_METATYPE(QFont, QFont) Q_DECLARE_BUILTIN_METATYPE(QPixmap, QPixmap) Q_DECLARE_BUILTIN_METATYPE(QBrush, QBrush) diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp index a958efd64f..d573741654 100644 --- a/src/corelib/kernel/qobject.cpp +++ b/src/corelib/kernel/qobject.cpp @@ -203,22 +203,6 @@ void QObjectPrivate::resetDeleteWatch(QObjectPrivate *d, int *oldWatch, int dele } #endif -#ifdef QT3_SUPPORT -void QObjectPrivate::sendPendingChildInsertedEvents() -{ - Q_Q(QObject); - for (int i = 0; i < pendingChildInsertedEvents.size(); ++i) { - QObject *c = pendingChildInsertedEvents.at(i).data(); - if (!c || c->parent() != q) - continue; - QChildEvent childEvent(QEvent::ChildInserted, c); - QCoreApplication::sendEvent(q, &childEvent); - } - pendingChildInsertedEvents.clear(); -} - -#endif - /*!\internal For a given metaobject, compute the signal offset, and the method offset (including signals) @@ -737,29 +721,6 @@ QObject::QObject(QObject *parent) qt_addObject(this); } -#ifdef QT3_SUPPORT -/*! - \overload QObject() - \obsolete - - Creates a new QObject with the given \a parent and object \a name. - */ -QObject::QObject(QObject *parent, const char *name) - : d_ptr(new QObjectPrivate) -{ - Q_D(QObject); - qt_addObject(d_ptr->q_ptr = this); - d->threadData = (parent && !parent->thread()) ? parent->d_func()->threadData : QThreadData::current(); - d->threadData->ref(); - if (parent) { - if (!check_parent_thread(parent, parent ? parent->d_func()->threadData : 0, d->threadData)) - parent = 0; - setParent(parent); - } - setObjectName(QString::fromAscii(name)); -} -#endif - /*! \internal */ QObject::QObject(QObjectPrivate &dd, QObject *parent) @@ -1079,56 +1040,6 @@ void QObject::setObjectName(const QString &name) d->declarativeData->objectNameChanged(d->declarativeData, this); } - -#ifdef QT3_SUPPORT -/*! \internal - QObject::child is compat but needs to call itself recursively, - that's why we need this helper. -*/ -static QObject *qChildHelper(const char *objName, const char *inheritsClass, - bool recursiveSearch, const QObjectList &children) -{ - if (children.isEmpty()) - return 0; - - bool onlyWidgets = (inheritsClass && qstrcmp(inheritsClass, "QWidget") == 0); - const QLatin1String oName(objName); - for (int i = 0; i < children.size(); ++i) { - QObject *obj = children.at(i); - if (onlyWidgets) { - if (obj->isWidgetType() && (!objName || obj->objectName() == oName)) - return obj; - } else if ((!inheritsClass || obj->inherits(inheritsClass)) - && (!objName || obj->objectName() == oName)) - return obj; - if (recursiveSearch && (obj = qChildHelper(objName, inheritsClass, - recursiveSearch, obj->children()))) - return obj; - } - return 0; -} - - -/*! - Searches the children and optionally grandchildren of this object, - and returns a child that is called \a objName that inherits \a - inheritsClass. If \a inheritsClass is 0 (the default), any class - matches. - - If \a recursiveSearch is true (the default), child() performs a - depth-first search of the object's children. - - If there is no such object, this function returns 0. If there are - more than one, the first one found is returned. -*/ -QObject* QObject::child(const char *objName, const char *inheritsClass, - bool recursiveSearch) const -{ - Q_D(const QObject); - return qChildHelper(objName, inheritsClass, recursiveSearch, d->children); -} -#endif - /*! \fn bool QObject::isWidgetType() const @@ -1157,17 +1068,8 @@ bool QObject::event(QEvent *e) timerEvent((QTimerEvent*)e); break; -#ifdef QT3_SUPPORT - case QEvent::ChildInsertedRequest: - d_func()->sendPendingChildInsertedEvents(); - break; -#endif - case QEvent::ChildAdded: case QEvent::ChildPolished: -#ifdef QT3_SUPPORT - case QEvent::ChildInserted: -#endif case QEvent::ChildRemoved: childEvent((QChildEvent*)e); break; @@ -1483,7 +1385,7 @@ void QObjectPrivate::setThreadData_helper(QThreadData *currentData, QThreadData continue; if (pe.receiver == q) { // move this post event to the targetList - targetData->postEventList.append(pe); + targetData->postEventList.addEvent(pe); const_cast<QPostEvent &>(pe).event = 0; ++eventsMoved; } @@ -1636,102 +1538,6 @@ void QObject::killTimer(int id) \sa findChild(), findChildren(), parent(), setParent() */ -#ifdef QT3_SUPPORT -static void objSearch(QObjectList &result, - const QObjectList &list, - const char *inheritsClass, - bool onlyWidgets, - const char *objName, - QRegExp *rx, - bool recurse) -{ - for (int i = 0; i < list.size(); ++i) { - QObject *obj = list.at(i); - if (!obj) - continue; - bool ok = true; - if (onlyWidgets) - ok = obj->isWidgetType(); - else if (inheritsClass && !obj->inherits(inheritsClass)) - ok = false; - if (ok) { - if (objName) - ok = (obj->objectName() == QLatin1String(objName)); -#ifndef QT_NO_REGEXP - else if (rx) - ok = (rx->indexIn(obj->objectName()) != -1); -#endif - } - if (ok) // match! - result.append(obj); - if (recurse) { - QObjectList clist = obj->children(); - if (!clist.isEmpty()) - objSearch(result, clist, inheritsClass, - onlyWidgets, objName, rx, recurse); - } - } -} - -/*! - \internal - - Searches the children and optionally grandchildren of this object, - and returns a list of those objects that are named or that match - \a objName and inherit \a inheritsClass. If \a inheritsClass is 0 - (the default), all classes match. If \a objName is 0 (the - default), all object names match. - - If \a regexpMatch is true (the default), \a objName is a regular - expression that the objects's names must match. The syntax is that - of a QRegExp. If \a regexpMatch is false, \a objName is a string - and object names must match it exactly. - - Note that \a inheritsClass uses single inheritance from QObject, - the way inherits() does. According to inherits(), QWidget - inherits QObject but not QPaintDevice. This does not quite match - reality, but is the best that can be done on the wide variety of - compilers Qt supports. - - Finally, if \a recursiveSearch is true (the default), queryList() - searches \e{n}th-generation as well as first-generation children. - - If all this seems a bit complex for your needs, the simpler - child() function may be what you want. - - This somewhat contrived example disables all the buttons in this - window: - - \snippet doc/src/snippets/code/src_corelib_kernel_qobject.cpp 9 - - \warning Delete the list as soon you have finished using it. The - list contains pointers that may become invalid at almost any time - without notice (as soon as the user closes a window you may have - dangling pointers, for example). - - \sa child() children(), parent(), inherits(), objectName(), QRegExp -*/ - -QObjectList QObject::queryList(const char *inheritsClass, - const char *objName, - bool regexpMatch, - bool recursiveSearch) const -{ - Q_D(const QObject); - QObjectList list; - bool onlyWidgets = (inheritsClass && qstrcmp(inheritsClass, "QWidget") == 0); -#ifndef QT_NO_REGEXP - if (regexpMatch && objName) { // regexp matching - QRegExp rx(QString::fromLatin1(objName)); - objSearch(list, d->children, inheritsClass, onlyWidgets, 0, &rx, recursiveSearch); - } else -#endif - { - objSearch(list, d->children, inheritsClass, onlyWidgets, objName, 0, recursiveSearch); - } - return list; -} -#endif /*! \fn T *QObject::findChild(const QString &name) const @@ -1949,16 +1755,6 @@ void QObjectPrivate::setParent_helper(QObject *o) if (!isWidget) { QChildEvent e(QEvent::ChildAdded, q); QCoreApplication::sendEvent(parent, &e); -#ifdef QT3_SUPPORT - if (QCoreApplicationPrivate::useQt3Support) { - if (parent->d_func()->pendingChildInsertedEvents.isEmpty()) { - QCoreApplication::postEvent(parent, - new QEvent(QEvent::ChildInsertedRequest), - Qt::HighEventPriority); - } - parent->d_func()->pendingChildInsertedEvents.append(q); - } -#endif } } } @@ -2940,7 +2736,7 @@ bool QObject::disconnect(const QObject *sender, const char *signal, \a receiver. Returns true if the connection is successfully broken; otherwise returns false. - This function provides the same posibilities like + This function provides the same possibilities like disconnect(const QObject *sender, const char *signal, const QObject *receiver, const char *method) but uses QMetaMethod to represent the signal and the method to be disconnected. @@ -2958,7 +2754,7 @@ bool QObject::disconnect(const QObject *sender, const char *signal, QMetaMethod() may be used as wildcard in the meaning "any signal" or "any slot in receiving object". In the same way 0 can be used for \a receiver in the meaning "any receiving object". In this case - method shoud also be QMetaMethod(). \a sender parameter should be never 0. + method should also be QMetaMethod(). \a sender parameter should be never 0. \sa disconnect(const QObject *sender, const char *signal, const QObject *receiver, const char *method) */ diff --git a/src/corelib/kernel/qobject.h b/src/corelib/kernel/qobject.h index 0fa28c0e63..1c367eb8d1 100644 --- a/src/corelib/kernel/qobject.h +++ b/src/corelib/kernel/qobject.h @@ -188,14 +188,6 @@ public: } #endif -#ifdef QT3_SUPPORT - QT3_SUPPORT QObject *child(const char *objName, const char *inheritsClass = 0, - bool recursiveSearch = true) const; - QT3_SUPPORT QObjectList queryList(const char *inheritsClass = 0, - const char *objName = 0, - bool regexpMatch = true, - bool recursiveSearch = true) const; -#endif inline const QObjectList &children() const { return d_ptr->children; } void setParent(QObject *); @@ -204,44 +196,14 @@ public: static bool connect(const QObject *sender, const char *signal, - const QObject *receiver, const char *member, Qt::ConnectionType = -#ifdef qdoc - Qt::AutoConnection -#else -#ifdef QT3_SUPPORT - Qt::AutoCompatConnection -#else - Qt::AutoConnection -#endif -#endif - ); + const QObject *receiver, const char *member, Qt::ConnectionType = Qt::AutoConnection); static bool connect(const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, - Qt::ConnectionType type = -#ifdef qdoc - Qt::AutoConnection -#else -#ifdef QT3_SUPPORT - Qt::AutoCompatConnection -#else - Qt::AutoConnection -#endif -#endif - ); + Qt::ConnectionType type = Qt::AutoConnection); inline bool connect(const QObject *sender, const char *signal, - const char *member, Qt::ConnectionType type = -#ifdef qdoc - Qt::AutoConnection -#else -#ifdef QT3_SUPPORT - Qt::AutoCompatConnection -#else - Qt::AutoConnection -#endif -#endif - ) const; + const char *member, Qt::ConnectionType type = Qt::AutoConnection) const; static bool disconnect(const QObject *sender, const char *signal, const QObject *receiver, const char *member); @@ -292,29 +254,6 @@ protected: virtual void connectNotify(const char *signal); virtual void disconnectNotify(const char *signal); -#ifdef QT3_SUPPORT -public: - QT3_SUPPORT_CONSTRUCTOR QObject(QObject *parent, const char *name); - inline QT3_SUPPORT void insertChild(QObject *o) - { if (o) o->setParent(this); } - inline QT3_SUPPORT void removeChild(QObject *o) - { if (o) o->setParent(0); } - inline QT3_SUPPORT bool isA(const char *classname) const - { return qstrcmp(classname, metaObject()->className()) == 0; } - inline QT3_SUPPORT const char *className() const { return metaObject()->className(); } - inline QT3_SUPPORT const char *name() const { return objectName().latin1_helper(); } - inline QT3_SUPPORT const char *name(const char *defaultName) const - { QString s = objectName(); return s.isEmpty()?defaultName:s.latin1_helper(); } - inline QT3_SUPPORT void setName(const char *aName) { setObjectName(QLatin1String(aName)); } -protected: - inline QT3_SUPPORT bool checkConnectArgs(const char *signal, - const QObject *, - const char *member) - { return QMetaObject::checkConnectArgs(signal, member); } - static inline QT3_SUPPORT QByteArray normalizeSignalSlot(const char *signalSlot) - { return QMetaObject::normalizedSignature(signalSlot); } -#endif - protected: QObject(QObjectPrivate &dd, QObject *parent = 0); diff --git a/src/corelib/kernel/qobject_p.h b/src/corelib/kernel/qobject_p.h index 3968a31bb8..9151e8eb7b 100644 --- a/src/corelib/kernel/qobject_p.h +++ b/src/corelib/kernel/qobject_p.h @@ -157,10 +157,6 @@ public: void addConnection(int signal, Connection *c); void cleanConnectionLists(); -#ifdef QT3_SUPPORT - void sendPendingChildInsertedEvents(); -#endif - static inline Sender *setCurrentSender(QObject *receiver, Sender *sender); static inline void resetCurrentSender(QObject *receiver, @@ -190,14 +186,6 @@ public: Sender *currentSender; // object currently activating the object mutable quint32 connectedSignals[2]; -#ifdef QT3_SUPPORT - QVector< QWeakPointer<QObject> > pendingChildInsertedEvents; -#else - // preserve binary compatibility with code compiled without Qt 3 support - // keeping the binary layout stable helps the Qt Creator debugger - void *unused; -#endif - QList<QPointer<QObject> > eventFilters; union { QObject *currentChildBeingDeleted; diff --git a/src/corelib/kernel/qobjectdefs.h b/src/corelib/kernel/qobjectdefs.h index efce4d5456..705956869d 100644 --- a/src/corelib/kernel/qobjectdefs.h +++ b/src/corelib/kernel/qobjectdefs.h @@ -83,9 +83,6 @@ class QString; #define Q_OVERRIDE(text) #define Q_ENUMS(x) #define Q_FLAGS(x) -#ifdef QT3_SUPPORT -# define Q_SETS(x) -#endif #define Q_SCRIPTABLE #define Q_INVOKABLE #define Q_SIGNAL @@ -188,9 +185,6 @@ private: #define Q_OVERRIDE(text) Q_OVERRIDE(text) #define Q_ENUMS(x) Q_ENUMS(x) #define Q_FLAGS(x) Q_FLAGS(x) -#ifdef QT3_SUPPORT -# define Q_SETS(x) Q_SETS(x) -#endif /* tmake ignore Q_OBJECT */ #define Q_OBJECT Q_OBJECT /* tmake ignore Q_OBJECT */ @@ -233,12 +227,6 @@ Q_CORE_EXPORT const char *qFlagLocation(const char *method); # define SIGNAL(a) "2"#a #endif -#ifdef QT3_SUPPORT -#define METHOD_CODE 0 // member type codes -#define SLOT_CODE 1 -#define SIGNAL_CODE 2 -#endif - #define QMETHOD_CODE 0 // member type codes #define QSLOT_CODE 1 #define QSIGNAL_CODE 2 @@ -461,10 +449,6 @@ struct Q_CORE_EXPORT QMetaObject int static_metacall(Call, int, void **) const; static int metacall(QObject *, Call, int, void **); -#ifdef QT3_SUPPORT - QT3_SUPPORT const char *superClassName() const; -#endif - struct { // private data const QMetaObject *superdata; const char *stringdata; @@ -494,11 +478,6 @@ inline const char *QMetaObject::className() const inline const QMetaObject *QMetaObject::superClass() const { return d.superdata; } -#ifdef QT3_SUPPORT -inline const char *QMetaObject::superClassName() const -{ return d.superdata ? d.superdata->className() : 0; } -#endif - QT_END_NAMESPACE QT_END_HEADER diff --git a/src/corelib/kernel/qsignalmapper.cpp b/src/corelib/kernel/qsignalmapper.cpp index 2306450300..665b9e22b5 100644 --- a/src/corelib/kernel/qsignalmapper.cpp +++ b/src/corelib/kernel/qsignalmapper.cpp @@ -121,18 +121,6 @@ QSignalMapper::QSignalMapper(QObject* parent) { } -#ifdef QT3_SUPPORT -/*! - \overload QSignalMapper() - \obsolete - */ -QSignalMapper::QSignalMapper(QObject *parent, const char *name) - : QObject(*new QSignalMapperPrivate, parent) -{ - setObjectName(QString::fromAscii(name)); -} -#endif - /*! Destroys the QSignalMapper. */ diff --git a/src/corelib/kernel/qsignalmapper.h b/src/corelib/kernel/qsignalmapper.h index c28b9df319..72593679a9 100644 --- a/src/corelib/kernel/qsignalmapper.h +++ b/src/corelib/kernel/qsignalmapper.h @@ -85,11 +85,6 @@ public Q_SLOTS: private: Q_DISABLE_COPY(QSignalMapper) Q_PRIVATE_SLOT(d_func(), void _q_senderDestroyed()) - -#ifdef QT3_SUPPORT -public: - QT3_SUPPORT_CONSTRUCTOR QSignalMapper(QObject *parent, const char *name); -#endif }; #endif // QT_NO_SIGNALMAPPER diff --git a/src/corelib/kernel/qsocketnotifier.cpp b/src/corelib/kernel/qsocketnotifier.cpp index d59838ba23..5e99d1d483 100644 --- a/src/corelib/kernel/qsocketnotifier.cpp +++ b/src/corelib/kernel/qsocketnotifier.cpp @@ -185,40 +185,6 @@ QSocketNotifier::QSocketNotifier(int socket, Type type, QObject *parent) } } -#ifdef QT3_SUPPORT -/*! - \obsolete - - Use the QSocketNotifier() constructor combined with the - QObject::setObjectName() function instead. - - \oldcode - QSocketNotifier *notifier = new QSocketNotifier(socket, type, parent, name); - \newcode - QSocketNotifier *notifier = new QSocketNotifier(socket, type, parent); - notifier->setObjectName(name); - \endcode -*/ - -QSocketNotifier::QSocketNotifier(int socket, Type type, QObject *parent, - const char *name) - : QObject(parent) -{ - setObjectName(QString::fromAscii(name)); - if (socket < 0) - qWarning("QSocketNotifier: Invalid socket specified"); - sockfd = socket; - sntype = type; - snenabled = true; - - Q_D(QObject); - if (!d->threadData->eventDispatcher) { - qWarning("QSocketNotifier: Can only be used with threads started with QThread"); - } else { - d->threadData->eventDispatcher->registerSocketNotifier(this); - } -} -#endif /*! Destroys this socket notifier. */ diff --git a/src/corelib/kernel/qsocketnotifier.h b/src/corelib/kernel/qsocketnotifier.h index 4390d17c62..07dc129825 100644 --- a/src/corelib/kernel/qsocketnotifier.h +++ b/src/corelib/kernel/qsocketnotifier.h @@ -59,9 +59,6 @@ public: enum Type { Read, Write, Exception }; QSocketNotifier(int socket, Type, QObject *parent = 0); -#ifdef QT3_SUPPORT - QT3_SUPPORT_CONSTRUCTOR QSocketNotifier(int socket, Type, QObject *parent, const char *name); -#endif ~QSocketNotifier(); inline int socket() const { return sockfd; } diff --git a/src/corelib/kernel/qtimer.cpp b/src/corelib/kernel/qtimer.cpp index 0edcb3b3ac..5870885c63 100644 --- a/src/corelib/kernel/qtimer.cpp +++ b/src/corelib/kernel/qtimer.cpp @@ -147,18 +147,6 @@ QTimer::QTimer(QObject *parent) } -#ifdef QT3_SUPPORT -/*! - Constructs a timer called \a name, with a \a parent. -*/ - -QTimer::QTimer(QObject *parent, const char *name) - : QObject(parent), id(INV_TIMER), single(0), nulltimer(0) -{ - setObjectName(QString::fromAscii(name)); -} -#endif - /*! Destroys the timer. */ @@ -235,24 +223,6 @@ void QTimer::start(int msec) } -#ifdef QT3_SUPPORT -/*! \overload start() - - Call setSingleShot(\a sshot) and start(\a msec) instead. -*/ - -int QTimer::start(int msec, bool sshot) -{ - if (id >=0 && nulltimer && !msec && sshot) - return id; - stop(); - setInterval(msec); - setSingleShot(sshot); - start(); - return timerId(); -} -#endif - /*! Stops the timer. diff --git a/src/corelib/kernel/qtimer.h b/src/corelib/kernel/qtimer.h index 02f6ba455b..707bc83d3c 100644 --- a/src/corelib/kernel/qtimer.h +++ b/src/corelib/kernel/qtimer.h @@ -61,9 +61,6 @@ class Q_CORE_EXPORT QTimer : public QObject Q_PROPERTY(bool active READ isActive) public: explicit QTimer(QObject *parent = 0); -#ifdef QT3_SUPPORT - QT3_SUPPORT_CONSTRUCTOR QTimer(QObject *parent, const char *name); -#endif ~QTimer(); inline bool isActive() const { return id >= 0; } @@ -83,11 +80,6 @@ public Q_SLOTS: void start(); void stop(); -#ifdef QT3_SUPPORT - inline QT_MOC_COMPAT void changeInterval(int msec) { start(msec); } - QT_MOC_COMPAT int start(int msec, bool sshot); -#endif - Q_SIGNALS: void timeout(); diff --git a/src/corelib/kernel/qtranslator.cpp b/src/corelib/kernel/qtranslator.cpp index d2554229e2..1b3e06dd69 100644 --- a/src/corelib/kernel/qtranslator.cpp +++ b/src/corelib/kernel/qtranslator.cpp @@ -332,18 +332,6 @@ QTranslator::QTranslator(QObject * parent) { } -#ifdef QT3_SUPPORT -/*! - \overload QTranslator() - \obsolete - */ -QTranslator::QTranslator(QObject * parent, const char * name) - : QObject(*new QTranslatorPrivate, parent) -{ - setObjectName(QString::fromAscii(name)); -} -#endif - /*! Destroys the object and frees any allocated resources. */ diff --git a/src/corelib/kernel/qtranslator.h b/src/corelib/kernel/qtranslator.h index 495137c4cd..0a9bbde953 100644 --- a/src/corelib/kernel/qtranslator.h +++ b/src/corelib/kernel/qtranslator.h @@ -61,9 +61,6 @@ class Q_CORE_EXPORT QTranslator : public QObject Q_OBJECT public: explicit QTranslator(QObject *parent = 0); -#ifdef QT3_SUPPORT - QT3_SUPPORT_CONSTRUCTOR QTranslator(QObject * parent, const char * name); -#endif ~QTranslator(); // ### Qt 5: Merge (with "int n = -1") @@ -85,11 +82,6 @@ public: const QString & suffix = QString()); bool load(const uchar *data, int len); -#ifdef QT3_SUPPORT - QT3_SUPPORT QString find(const char *context, const char *sourceText, const char * comment = 0) const - { return translate(context, sourceText, comment); } -#endif - private: Q_DISABLE_COPY(QTranslator) Q_DECLARE_PRIVATE(QTranslator) diff --git a/src/corelib/kernel/qvariant.cpp b/src/corelib/kernel/qvariant.cpp index 7f750b38f2..01e12ee968 100644 --- a/src/corelib/kernel/qvariant.cpp +++ b/src/corelib/kernel/qvariant.cpp @@ -2886,21 +2886,6 @@ void* QVariant::data() } -#ifdef QT3_SUPPORT -/*! \internal - */ -void *QVariant::castOrDetach(Type t) -{ - if (d.type != uint(t)) { - if (!convert(t)) - create(t, 0); - } else { - detach(); - } - return data(); -} -#endif - /*! Returns true if this is a NULL variant, false otherwise. */ diff --git a/src/corelib/kernel/qvariant.h b/src/corelib/kernel/qvariant.h index 6aa0fabc2c..e77fc90b92 100644 --- a/src/corelib/kernel/qvariant.h +++ b/src/corelib/kernel/qvariant.h @@ -226,13 +226,6 @@ class Q_CORE_EXPORT QVariant bool canConvert(Type t) const; bool convert(Type t); -#ifdef QT3_SUPPORT - inline QT3_SUPPORT bool canCast(Type t) const - { return canConvert(t); } - inline QT3_SUPPORT bool cast(Type t) - { return convert(t); } -#endif - inline bool isValid() const; bool isNull() const; @@ -280,27 +273,6 @@ class Q_CORE_EXPORT QVariant QEasingCurve toEasingCurve() const; #endif -#ifdef QT3_SUPPORT - inline QT3_SUPPORT int &asInt(); - inline QT3_SUPPORT uint &asUInt(); - inline QT3_SUPPORT qlonglong &asLongLong(); - inline QT3_SUPPORT qulonglong &asULongLong(); - inline QT3_SUPPORT bool &asBool(); - inline QT3_SUPPORT double &asDouble(); - inline QT3_SUPPORT QByteArray &asByteArray(); - inline QT3_SUPPORT QBitArray &asBitArray(); - inline QT3_SUPPORT QString &asString(); - inline QT3_SUPPORT QStringList &asStringList(); - inline QT3_SUPPORT QDate &asDate(); - inline QT3_SUPPORT QTime &asTime(); - inline QT3_SUPPORT QDateTime &asDateTime(); - inline QT3_SUPPORT QList<QVariant> &asList(); - inline QT3_SUPPORT QMap<QString,QVariant> &asMap(); - inline QT3_SUPPORT QPoint &asPoint(); - inline QT3_SUPPORT QRect &asRect(); - inline QT3_SUPPORT QSize &asSize(); -#endif //QT3_SUPPORT - #ifndef QT_NO_DATASTREAM void load(QDataStream &ds); void save(QDataStream &ds) const; @@ -308,12 +280,6 @@ class Q_CORE_EXPORT QVariant static const char *typeToName(Type type); static Type nameToType(const char *name); -#ifdef QT3_SUPPORT - inline QT3_SUPPORT_CONSTRUCTOR QVariant(bool val, int) { create(Bool, &val); } - inline QT3_SUPPORT const QByteArray toCString() const { return toByteArray(); } - inline QT3_SUPPORT QByteArray &asCString() { return *reinterpret_cast<QByteArray *>(castOrDetach(ByteArray)); } -#endif - void *data(); const void *constData() const; inline const void *data() const { return constData(); } @@ -412,9 +378,6 @@ protected: static const Handler *handler; void create(int type, const void *copy); -#ifdef QT3_SUPPORT - void *castOrDetach(Type t); -#endif bool cmp(const QVariant &other) const; private: @@ -424,10 +387,6 @@ private: // force compile error when implicit conversion is not wanted inline QVariant(const char *) { Q_ASSERT(false); } #endif -#ifndef QT3_SUPPORT - // force compile error, prevent QVariant(QVariant::Type, int) to be called - inline QVariant(bool, int) { Q_ASSERT(false); } -#endif public: typedef Private DataPtr; inline DataPtr &data_ptr() { return d; } @@ -477,45 +436,6 @@ inline void qVariantSetValue<QVariant>(QVariant &v, const QVariant &t) inline QVariant::QVariant() {} inline bool QVariant::isValid() const { return d.type != Invalid; } -#ifdef QT3_SUPPORT -inline int &QVariant::asInt() -{ return *reinterpret_cast<int *>(castOrDetach(Int)); } -inline uint &QVariant::asUInt() -{ return *reinterpret_cast<uint *>(castOrDetach(UInt)); } -inline qlonglong &QVariant::asLongLong() -{ return *reinterpret_cast<qlonglong *>(castOrDetach(LongLong)); } -inline qulonglong &QVariant::asULongLong() -{ return *reinterpret_cast<qulonglong *>(castOrDetach(ULongLong)); } -inline bool &QVariant::asBool() -{ return *reinterpret_cast<bool *>(castOrDetach(Bool)); } -inline double &QVariant::asDouble() -{ return *reinterpret_cast<double *>(castOrDetach(Double)); } -inline QByteArray& QVariant::asByteArray() -{ return *reinterpret_cast<QByteArray *>(castOrDetach(ByteArray)); } -inline QBitArray& QVariant::asBitArray() -{ return *reinterpret_cast<QBitArray *>(castOrDetach(BitArray)); } -inline QString& QVariant::asString() -{ return *reinterpret_cast<QString *>(castOrDetach(String)); } -inline QStringList& QVariant::asStringList() -{ return *reinterpret_cast<QStringList *>(castOrDetach(StringList)); } -inline QDate& QVariant::asDate() -{ return *reinterpret_cast<QDate *>(castOrDetach(Date)); } -inline QTime& QVariant::asTime() -{ return *reinterpret_cast<QTime *>(castOrDetach(Time)); } -inline QDateTime& QVariant::asDateTime() -{ return *reinterpret_cast<QDateTime *>(castOrDetach(DateTime)); } -inline QList<QVariant>& QVariant::asList() -{ return *reinterpret_cast<QList<QVariant> *>(castOrDetach(List)); } -inline QMap<QString, QVariant>& QVariant::asMap() -{ return *reinterpret_cast<QMap<QString, QVariant> *>(castOrDetach(Map)); } -inline QPoint &QVariant::asPoint() -{ return *reinterpret_cast<QPoint *>(castOrDetach(Point)); } -inline QRect &QVariant::asRect() -{ return *reinterpret_cast<QRect *>(castOrDetach(Rect)); } -inline QSize &QVariant::asSize() -{ return *reinterpret_cast<QSize *>(castOrDetach(Size)); } -#endif //QT3_SUPPORT - template<typename T> inline void QVariant::setValue(const T &avalue) { qVariantSetValue(*this, avalue); } |