Remove the remaining QT3_SUPPORT code in corelib
authorLars Knoll <lars.knoll@nokia.com>
Tue, 28 Jun 2011 21:43:58 +0000 (23:43 +0200)
committerQt by Nokia <qt-info@nokia.com>
Wed, 29 Jun 2011 13:10:14 +0000 (15:10 +0200)
Change-Id: I6641c62d75d2034a46ea7cc869ae65285ae8b8f4
Reviewed-on: http://codereview.qt.nokia.com/866
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Liang Qi <liang.qi@nokia.com>
20 files changed:
src/corelib/kernel/qcoreapplication_p.h
src/corelib/kernel/qcoreevent.h
src/corelib/kernel/qeventloop.h
src/corelib/kernel/qmetaobject.cpp
src/corelib/kernel/qmetatype.cpp
src/corelib/kernel/qmetatype.h
src/corelib/kernel/qobjectdefs.h
src/corelib/kernel/qsignalmapper.cpp
src/corelib/kernel/qsignalmapper.h
src/corelib/kernel/qsocketnotifier.cpp
src/corelib/kernel/qsocketnotifier.h
src/corelib/kernel/qtimer.cpp
src/corelib/kernel/qtimer.h
src/corelib/kernel/qtranslator.cpp
src/corelib/kernel/qtranslator.h
src/corelib/kernel/qvariant.cpp
src/corelib/kernel/qvariant.h
src/corelib/plugin/qlibrary.h
src/corelib/thread/qmutex.h
src/corelib/thread/qthread.h

index 804906e..553e15f 100644 (file)
@@ -139,9 +139,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();
 };
 
index d2b2d97..302d525 100644 (file)
@@ -166,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
index 46ee118..5bd4146 100644 (file)
@@ -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
index b4c37f4..c8ac15c 100644 (file)
@@ -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
index fcc8a65..f241903 100644 (file)
@@ -760,9 +760,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:
@@ -965,9 +962,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:
index 36131d1..767d79a 100644 (file)
@@ -72,9 +72,7 @@ public:
         QVariantHash = 28, QEasingCurve = 29, LastCoreType = QEasingCurve,
 
         FirstGuiType = 63 /* QColorGroup */,
-#ifdef QT3_SUPPORT
-        QColorGroup = 63,
-#endif
+
         QFont = 64, QPixmap = 65, QBrush = 66, QColor = 67, QPalette = 68,
         QIcon = 69, QImage = 70, QPolygon = 71, QRegion = 72, QBitmap = 73,
         QCursor = 74, QSizePolicy = 75, QKeySequence = 76, QPen = 77,
@@ -313,9 +311,6 @@ class QEasingCurve;
 class QWidget;
 class QObject;
 
-#ifdef QT3_SUPPORT
-class QColorGroup;
-#endif
 class QFont;
 class QPixmap;
 class QBrush;
@@ -383,9 +378,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)
index efce4d5..7059568 100644 (file)
@@ -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
index 2306450..665b9e2 100644 (file)
@@ -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.
 */
index c28b9df..7259367 100644 (file)
@@ -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
 
index d59838b..5e99d1d 100644 (file)
@@ -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.
 */
index 4390d17..07dc129 100644 (file)
@@ -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; }
index 0edcb3b..5870885 100644 (file)
@@ -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.
index 02f6ba4..707bc83 100644 (file)
@@ -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();
 
index d255422..1b3e06d 100644 (file)
@@ -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.
 */
index 495137c..0a9bbde 100644 (file)
@@ -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)
index 7f750b3..01e12ee 100644 (file)
@@ -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.
 */
index 268d381..de8f911 100644 (file)
@@ -127,9 +127,6 @@ class Q_CORE_EXPORT QVariant
         LastCoreType = EasingCurve,
 
         // value 62 is internally reserved
-#ifdef QT3_SUPPORT
-        ColorGroup = 63,
-#endif
         Font = 64,
         Pixmap = 65,
         Brush = 66,
@@ -156,11 +153,6 @@ class Q_CORE_EXPORT QVariant
         LastGuiType = Quaternion,
 
         UserType = 127,
-#ifdef QT3_SUPPORT
-        IconSet = Icon,
-        CString = ByteArray,
-        PointArray = Polygon,
-#endif
         LastType = 0xffffffff // need this so that gcc >= 3.4 allocates 32 bits for Type
     };
 
@@ -233,13 +225,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;
 
@@ -287,27 +272,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;
@@ -315,12 +279,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(); }
@@ -419,9 +377,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:
@@ -431,10 +386,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; }
@@ -484,45 +435,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); }
index 72ba054..0154e94 100644 (file)
@@ -99,10 +99,6 @@ public:
 
     void setLoadHints(LoadHints hints);
     LoadHints loadHints() const;
-#ifdef QT3_SUPPORT
-    inline QT3_SUPPORT QString library() const { return fileName(); }
-    inline QT3_SUPPORT void setAutoUnload( bool ) {}
-#endif
 private:
     QLibraryPrivate *d;
     bool did_load;
index 0f3a72d..cc66756 100644 (file)
@@ -76,20 +76,6 @@ public:
     void unlock();     //### Qt5: make inline;
     inline void unlockInline();
 
-#if defined(QT3_SUPPORT)
-    inline QT3_SUPPORT bool locked()
-    {
-        if (!tryLock())
-            return true;
-        unlock();
-        return false;
-    }
-    inline QT3_SUPPORT_CONSTRUCTOR QMutex(bool recursive)
-    {
-        new (this) QMutex(recursive ? Recursive : NonRecursive);
-    }
-#endif
-
 private:
     void lockInternal();
     void unlockInternal();
@@ -217,10 +203,6 @@ public:
     static inline void unlock() {}
     static inline void unlockInline() {}
 
-#if defined(QT3_SUPPORT)
-    static inline QT3_SUPPORT bool locked() { return false; }
-#endif
-
 private:
     Q_DISABLE_COPY(QMutex)
 };
index 878a13c..bc529fd 100644 (file)
@@ -116,12 +116,6 @@ protected:
     static void msleep(unsigned long);
     static void usleep(unsigned long);
 
-#ifdef QT3_SUPPORT
-public:
-    inline QT3_SUPPORT bool finished() const { return isFinished(); }
-    inline QT3_SUPPORT bool running() const { return isRunning(); }
-#endif
-
 protected:
     QThread(QThreadPrivate &dd, QObject *parent = 0);