diff --git a/src/3rdparty/javascriptcore/wtf/Platform.h b/src/3rdparty/javascriptcore/wtf/Platform.h index d639203c8..15f4be10d 100644 --- a/src/3rdparty/javascriptcore/wtf/Platform.h +++ b/src/3rdparty/javascriptcore/wtf/Platform.h @@ -29,6 +29,8 @@ #include +QT_USE_NAMESPACE + /* ==== PLATFORM handles OS, operating environment, graphics API, and CPU. This macro will be phased out in favor of platform adaptation macros, policy decision macros, and top-level port definitions. ==== */ diff --git a/src/core/global/qglobal.cpp b/src/core/global/qglobal.cpp index 219ffff3d..f09c35af6 100644 --- a/src/core/global/qglobal.cpp +++ b/src/core/global/qglobal.cpp @@ -2499,9 +2499,7 @@ bool QInternal::callFunction(InternalFunction func, void **args) into namespace \c ns. \sa QT_BEGIN_NAMESPACE, QT_END_NAMESPACE, - QT_PREPEND_NAMESPACE, QT_USE_NAMESPACE, - QT_BEGIN_INCLUDE_NAMESPACE, QT_END_INCLUDE_NAMESPACE, - QT_BEGIN_MOC_NAMESPACE, QT_END_MOC_NAMESPACE, + QT_PREPEND_NAMESPACE, QT_BEGIN_INCLUDE_NAMESPACE, QT_END_INCLUDE_NAMESPACE */ /*! @@ -2600,26 +2598,6 @@ bool QInternal::callFunction(InternalFunction func, void **args) \sa QT_NAMESPACE */ -/*! - \macro QT_BEGIN_MOC_NAMESPACE - \internal - - This macro is output by moc at the beginning of - moc files. It is equivalent to \c QT_USE_NAMESPACE. - - \sa QT_NAMESPACE -*/ - -/*! - \macro QT_END_MOC_NAMESPACE - \internal - - This macro is output by moc at the beginning of - moc files. It expands to nothing. - - \sa QT_NAMESPACE -*/ - /*! \fn bool qFuzzyCompare(double p1, double p2) \relates diff --git a/src/core/global/qglobal.h.cmake b/src/core/global/qglobal.h.cmake index 97891e236..1ad170856 100644 --- a/src/core/global/qglobal.h.cmake +++ b/src/core/global/qglobal.h.cmake @@ -137,72 +137,36 @@ #endif #ifdef __cplusplus - #include +#endif -#ifndef QT_NAMESPACE /* user namespace */ - -# define QT_PREPEND_NAMESPACE(name) ::name -# define QT_USE_NAMESPACE -# define QT_BEGIN_NAMESPACE -# define QT_END_NAMESPACE -# define QT_BEGIN_INCLUDE_NAMESPACE -# define QT_END_INCLUDE_NAMESPACE -# define QT_BEGIN_MOC_NAMESPACE -# define QT_END_MOC_NAMESPACE -# define QT_FORWARD_DECLARE_CLASS(name) class name; -# define QT_FORWARD_DECLARE_STRUCT(name) struct name; -# define QT_MANGLE_NAMESPACE(name) name - -#else /* user namespace */ +#if defined(__cplusplus) && !defined(QT_NO_USING_NAMESPACE) +# define QT_NAMESPACE Katie # define QT_PREPEND_NAMESPACE(name) ::QT_NAMESPACE::name +# define QT_MANGLE_NAMESPACE(x) x # define QT_USE_NAMESPACE using namespace ::QT_NAMESPACE; + # define QT_BEGIN_NAMESPACE namespace QT_NAMESPACE { # define QT_END_NAMESPACE } # define QT_BEGIN_INCLUDE_NAMESPACE } # define QT_END_INCLUDE_NAMESPACE namespace QT_NAMESPACE { -# define QT_BEGIN_MOC_NAMESPACE QT_USE_NAMESPACE -# define QT_END_MOC_NAMESPACE -# define QT_FORWARD_DECLARE_CLASS(name) \ - QT_BEGIN_NAMESPACE class name; QT_END_NAMESPACE \ - using QT_PREPEND_NAMESPACE(name); - -# define QT_FORWARD_DECLARE_STRUCT(name) \ - QT_BEGIN_NAMESPACE struct name; QT_END_NAMESPACE \ - using QT_PREPEND_NAMESPACE(name); - -# define QT_MANGLE_NAMESPACE0(x) x -# define QT_MANGLE_NAMESPACE1(a, b) a##_##b -# define QT_MANGLE_NAMESPACE2(a, b) QT_MANGLE_NAMESPACE1(a,b) -# define QT_MANGLE_NAMESPACE(name) QT_MANGLE_NAMESPACE2( \ - QT_MANGLE_NAMESPACE0(name), QT_MANGLE_NAMESPACE0(QT_NAMESPACE)) namespace QT_NAMESPACE {} -# ifndef QT_BOOTSTRAPPED -# ifndef QT_NO_USING_NAMESPACE - /* - This expands to a "using QT_NAMESPACE" also in _header files_. - It is the only way the feature can be used without too much - pain, but if people _really_ do not want it they can add - DEFINES += QT_NO_USING_NAMESPACE to their .pro files. - */ - QT_USE_NAMESPACE -# endif -# endif +#else /* QT_NO_USING_NAMESPACE && __cplusplus */ -#endif /* user namespace */ - -#else /* __cplusplus */ +# define QT_NAMESPACE +# define QT_PREPEND_NAMESPACE(name) ::name +# define QT_MANGLE_NAMESPACE(x) x +# define QT_USE_NAMESPACE # define QT_BEGIN_NAMESPACE # define QT_END_NAMESPACE -# define QT_USE_NAMESPACE # define QT_BEGIN_INCLUDE_NAMESPACE # define QT_END_INCLUDE_NAMESPACE -#endif /* __cplusplus */ +#endif /* QT_NO_USING_NAMESPACE && __cplusplus */ #define QT_BEGIN_HEADER #define QT_END_HEADER diff --git a/src/core/io/qprocess.cpp b/src/core/io/qprocess.cpp index 0ff13d0ce..2c8c7f786 100644 --- a/src/core/io/qprocess.cpp +++ b/src/core/io/qprocess.cpp @@ -93,6 +93,8 @@ QT_END_NAMESPACE #ifndef QT_NO_PROCESS +extern char **environ; + QT_BEGIN_NAMESPACE /*! @@ -2108,8 +2110,6 @@ bool QProcess::startDetached(const QString &program) return QProcessPrivate::startDetached(prog, args); } -extern char **environ; - /*! \since 4.1 diff --git a/src/core/io/qprocess_unix.cpp b/src/core/io/qprocess_unix.cpp index b775cda7f..f32e4f458 100644 --- a/src/core/io/qprocess_unix.cpp +++ b/src/core/io/qprocess_unix.cpp @@ -101,6 +101,7 @@ QT_END_NAMESPACE #include #include +extern char **environ; QT_BEGIN_NAMESPACE @@ -469,8 +470,6 @@ bool QProcessPrivate::createChannel(Channel &channel) } } -extern char **environ; - QProcessEnvironment QProcessEnvironment::systemEnvironment() { QProcessEnvironment env; diff --git a/src/core/qcorecommon_p.h b/src/core/qcorecommon_p.h index 1bf788279..3a8a4c249 100644 --- a/src/core/qcorecommon_p.h +++ b/src/core/qcorecommon_p.h @@ -3,6 +3,8 @@ #include "qstring.h" +QT_BEGIN_NAMESPACE + #if !defined(QT_NO_THREAD) && defined(_POSIX_THREAD_SAFE_FUNCTIONS) && _POSIX_VERSION >= 200112L namespace { // There are two incompatible versions of strerror_r: @@ -31,4 +33,6 @@ static void report_error(int code, const char *where, const char *what) qWarning("%s: %s failure: %s", where, what, qPrintable(qt_error_string(code))); } +QT_END_NAMESPACE + #endif // QCORECOMMON_P_H diff --git a/src/dbus/qdbusconnection_p.h b/src/dbus/qdbusconnection_p.h index e5f3550fc..30c1cf684 100644 --- a/src/dbus/qdbusconnection_p.h +++ b/src/dbus/qdbusconnection_p.h @@ -56,6 +56,7 @@ #include #include +#include #include #include @@ -66,8 +67,6 @@ #include #include -#include - #ifndef QT_NO_DBUS #include diff --git a/src/dbus/qdbuserror.cpp b/src/dbus/qdbuserror.cpp index 12cc10247..f2dfdfe96 100644 --- a/src/dbus/qdbuserror.cpp +++ b/src/dbus/qdbuserror.cpp @@ -137,13 +137,13 @@ static const int errorMessages_indices[] = { static const int errorMessages_count = sizeof errorMessages_indices / sizeof errorMessages_indices[0]; -static inline const char *get(QDBusError::ErrorType code) +static inline const char *getError(QDBusError::ErrorType code) { int intcode = qBound(0, int(code) - int(QDBusError::Other), errorMessages_count); return errorMessages_string + errorMessages_indices[intcode]; } -static inline QDBusError::ErrorType get(const char *name) +static inline QDBusError::ErrorType getError(const char *name) { if (!name || !*name) return QDBusError::NoError; @@ -248,7 +248,7 @@ QDBusError::QDBusError(const DBusError *error) if (!error || !dbus_error_is_set(error)) return; - code = ::get(error->name); + code = getError(error->name); msg = QString::fromUtf8(error->message); nm = QString::fromUtf8(error->name); } @@ -263,7 +263,7 @@ QDBusError::QDBusError(const QDBusMessage &qdmsg) if (qdmsg.type() != QDBusMessage::ErrorMessage) return; - code = ::get(qdmsg.errorName().toUtf8().constData()); + code = getError(qdmsg.errorName().toUtf8().constData()); nm = qdmsg.errorName(); msg = qdmsg.errorMessage(); } @@ -275,7 +275,7 @@ QDBusError::QDBusError(const QDBusMessage &qdmsg) QDBusError::QDBusError(ErrorType error, const QString &mess) : code(error) { - nm = QLatin1String(::get(error)); + nm = QLatin1String(getError(error)); msg = mess; } @@ -351,7 +351,7 @@ bool QDBusError::isValid() const */ QString QDBusError::errorString(ErrorType error) { - return QLatin1String(::get(error)); + return QLatin1String(getError(error)); } #ifndef QT_NO_DEBUG_STREAM diff --git a/src/dbus/qdbusintegrator.cpp b/src/dbus/qdbusintegrator.cpp index ae18707f8..de1018faa 100644 --- a/src/dbus/qdbusintegrator.cpp +++ b/src/dbus/qdbusintegrator.cpp @@ -71,7 +71,7 @@ QT_BEGIN_NAMESPACE static QAtomicInt isDebugging = QAtomicInt(-1); -#define qDBusDebug if (::isDebugging == 0); else qDebug +#define qDBusDebug if (isDebugging == 0); else qDebug static const QString orgFreedesktopDBusString = QLatin1String(DBUS_SERVICE_DBUS); @@ -629,7 +629,7 @@ static void huntAndEmit(DBusConnection *connection, DBusMessage *msg, } } -static int findSlot(const QMetaObject *mo, const QByteArray &name, int flags, +static int findMetaSlot(const QMetaObject *mo, const QByteArray &name, int flags, const QString &signature_, QList& metaTypes) { QByteArray msgSignature = signature_.toLatin1(); @@ -826,11 +826,11 @@ bool QDBusConnectionPrivate::activateCall(QObject* object, int flags, const QDBu // find a slot that matches according to the rules above QDBusSlotCache::Data slotData; slotData.flags = flags; - slotData.slotIdx = ::findSlot(mo, memberName, flags, msg.signature(), slotData.metaTypes); + slotData.slotIdx = findMetaSlot(mo, memberName, flags, msg.signature(), slotData.metaTypes); if (slotData.slotIdx == -1) { // ### this is where we want to add the connection as an arg too // try with no parameters, but with a QDBusMessage - slotData.slotIdx = ::findSlot(mo, memberName, flags, QString(), slotData.metaTypes); + slotData.slotIdx = findMetaSlot(mo, memberName, flags, QString(), slotData.metaTypes); if (slotData.metaTypes.count() != 2 || slotData.metaTypes.at(1) != QDBusMetaTypeId::message) { // not found @@ -976,12 +976,12 @@ QDBusConnectionPrivate::QDBusConnectionPrivate(QObject *p) rootNode(QString(QLatin1Char('/'))) { static const bool threads = dbus_threads_init_default(); - if (::isDebugging == -1) - ::isDebugging = qgetenv("QDBUS_DEBUG").toInt(); + if (isDebugging == -1) + isDebugging = qgetenv("QDBUS_DEBUG").toInt(); Q_UNUSED(threads) #if QDBUS_THREAD_DEBUG - if (::isDebugging > 1) + if (isDebugging > 1) qdbusThreadDebug = qdbusDefaultThreadDebug; #endif diff --git a/src/dbus/qdbuspendingreply.cpp b/src/dbus/qdbuspendingreply.cpp index a672a29e6..9518580f7 100644 --- a/src/dbus/qdbuspendingreply.cpp +++ b/src/dbus/qdbuspendingreply.cpp @@ -45,6 +45,8 @@ #ifndef QT_NO_DBUS +QT_BEGIN_NAMESPACE + /*! \class QDBusPendingReply \inmodule QtDBus @@ -278,4 +280,6 @@ void QDBusPendingReplyData::setMetaTypes(int count, const int *types) d->checkReceivedSignature(); } +QT_END_NAMESPACE + #endif // QT_NO_DBUS diff --git a/src/dbus/qdbusthreaddebug_p.h b/src/dbus/qdbusthreaddebug_p.h index a436e045a..064ab127a 100644 --- a/src/dbus/qdbusthreaddebug_p.h +++ b/src/dbus/qdbusthreaddebug_p.h @@ -56,6 +56,8 @@ #ifndef QT_NO_DBUS +QT_BEGIN_NAMESPACE + #if !defined(QDBUS_THREAD_DEBUG) && defined(QT_BUILD_INTERNAL) # define QDBUS_THREAD_DEBUG 1 #else @@ -63,11 +65,9 @@ #endif #if QDBUS_THREAD_DEBUG -QT_BEGIN_NAMESPACE typedef void (*qdbusThreadDebugFunc)(int, int, QDBusConnectionPrivate *); Q_DBUS_EXPORT void qdbusDefaultThreadDebug(int, int, QDBusConnectionPrivate *); extern Q_DBUS_EXPORT qdbusThreadDebugFunc qdbusThreadDebug; -QT_END_NAMESPACE #endif enum ThreadAction { @@ -233,5 +233,7 @@ struct QDBusWatchAndTimeoutLocker: QDBusMutexLocker # define SEM_RELEASE(action, sem) sem.release() #endif +QT_END_NAMESPACE + #endif // QT_NO_DBUS #endif diff --git a/src/declarative/graphicsitems/qdeclarativeitemsmodule.cpp b/src/declarative/graphicsitems/qdeclarativeitemsmodule.cpp index 79a572a89..b789e142b 100644 --- a/src/declarative/graphicsitems/qdeclarativeitemsmodule.cpp +++ b/src/declarative/graphicsitems/qdeclarativeitemsmodule.cpp @@ -76,6 +76,8 @@ #include "qdeclarativeanchors_p.h" #include "qdeclarativepincharea_p.h" +QT_BEGIN_NAMESPACE + static QDeclarativePrivate::AutoParentResult qgraphicsobject_autoParent(QObject *obj, QObject *parent) { QGraphicsObject* gobj = qobject_cast(obj); @@ -199,3 +201,5 @@ void QDeclarativeItemModule::defineModule() qmlRegisterRevision("QtQuick",1,1); qmlRegisterUncreatableType("QtQuick",1,1,"LayoutMirroring", QDeclarativeLayoutMirroringAttached::tr("LayoutMirroring is only available via attached properties")); } + +QT_END_NAMESPACE diff --git a/src/declarative/qdeclarativecommon_p.h b/src/declarative/qdeclarativecommon_p.h index 1dfa612e3..80d35ec2e 100644 --- a/src/declarative/qdeclarativecommon_p.h +++ b/src/declarative/qdeclarativecommon_p.h @@ -7,6 +7,11 @@ #include "qlistmodelinterface_p.h" #include "qscriptvalue.h" +Q_DECLARE_METATYPE(QScriptValue) +QML_DECLARE_TYPE(QListModelInterface) + +QT_BEGIN_NAMESPACE + struct StaticQtMetaObject : public QObject { static const QMetaObject *get() @@ -35,7 +40,6 @@ static int inline qRoundDouble(double d) DEFINE_BOOL_CONFIG_OPTION(stateChangeDebug, STATECHANGE_DEBUG) DEFINE_BOOL_CONFIG_OPTION(bindingsDump, QML_BINDINGS_DUMP) -Q_DECLARE_METATYPE(QScriptValue) -QML_DECLARE_TYPE(QListModelInterface) +QT_END_NAMESPACE #endif // QDECLARATIVECOMMON_P_H diff --git a/src/declarative/qml/parser/qdeclarativejsgrammar_p.h b/src/declarative/qml/parser/qdeclarativejsgrammar_p.h index c33acfef5..eb4c865d8 100644 --- a/src/declarative/qml/parser/qdeclarativejsgrammar_p.h +++ b/src/declarative/qml/parser/qdeclarativejsgrammar_p.h @@ -204,7 +204,7 @@ public: } }; - QT_END_NAMESPACE + #endif // QDECLARATIVEJSGRAMMAR_P_H diff --git a/src/declarative/qml/parser/qdeclarativejsparser.cpp b/src/declarative/qml/parser/qdeclarativejsparser.cpp index 364468f4c..ac410f50f 100644 --- a/src/declarative/qml/parser/qdeclarativejsparser.cpp +++ b/src/declarative/qml/parser/qdeclarativejsparser.cpp @@ -42,27 +42,24 @@ #include #include -#include - #include "qdeclarativejsengine_p.h" #include "qdeclarativejslexer_p.h" #include "qdeclarativejsast_p.h" #include "qdeclarativejsnodepool_p.h" - - - #include "qdeclarativejsparser_p.h" #include +#include + // // This file is automatically generated from qdeclarativejs.g. // Changes will be lost. // -using namespace QDeclarativeJS; - QT_BEGIN_NAMESPACE +using namespace QDeclarativeJS; + void Parser::reallocateStack() { if (! stack_size) diff --git a/src/declarative/qml/parser/qdeclarativejsparser_p.h b/src/declarative/qml/parser/qdeclarativejsparser_p.h index 955d605ce..a0f531f33 100644 --- a/src/declarative/qml/parser/qdeclarativejsparser_p.h +++ b/src/declarative/qml/parser/qdeclarativejsparser_p.h @@ -240,6 +240,4 @@ protected: QT_END_NAMESPACE - - #endif // QDECLARATIVEJSPARSER_P_H diff --git a/src/declarative/util/qdeclarativeutilmodule.cpp b/src/declarative/util/qdeclarativeutilmodule.cpp index 19e1a9e2c..20e40fb16 100644 --- a/src/declarative/util/qdeclarativeutilmodule.cpp +++ b/src/declarative/util/qdeclarativeutilmodule.cpp @@ -71,6 +71,8 @@ #include "qdeclarativeinfo.h" #include "qdeclarativetypenotavailable_p.h" +QT_BEGIN_NAMESPACE + void QDeclarativeUtilModule::defineModule() { if (QApplication::type() != QApplication::Tty) { @@ -120,3 +122,5 @@ void QDeclarativeUtilModule::defineModule() qmlRegisterCustomType("QtQuick",1,0,"PropertyChanges", new QDeclarativePropertyChangesParser); qmlRegisterCustomType("QtQuick",1,0,"ListModel", new QDeclarativeListModelParser); } + +QT_END_NAMESPACE diff --git a/src/designer/components/formeditor/formwindowsettings.cpp b/src/designer/components/formeditor/formwindowsettings.cpp index 39bb53a58..e254b50a4 100644 --- a/src/designer/components/formeditor/formwindowsettings.cpp +++ b/src/designer/components/formeditor/formwindowsettings.cpp @@ -176,7 +176,7 @@ void FormWindowData::applyToFormWindow(FormWindowBase* fw) const FormWindowSettings::FormWindowSettings(QDesignerFormWindowInterface *parent) : QDialog(parent), - m_ui(new ::Ui_FormWindowSettings), + m_ui(new Ui_FormWindowSettings), m_formWindow(qobject_cast(parent)), m_oldData(new FormWindowData) { diff --git a/src/designer/components/objectinspector/objectinspector.h b/src/designer/components/objectinspector/objectinspector.h index 521bbcd67..7d734c299 100644 --- a/src/designer/components/objectinspector/objectinspector.h +++ b/src/designer/components/objectinspector/objectinspector.h @@ -90,6 +90,6 @@ private: } // namespace qdesigner_internal -#endif // OBJECTINSPECTOR_H - QT_END_NAMESPACE + +#endif // OBJECTINSPECTOR_H diff --git a/src/designer/components/objectinspector/objectinspectormodel_p.h b/src/designer/components/objectinspector/objectinspectormodel_p.h index 9e2be1cc8..8b5579065 100644 --- a/src/designer/components/objectinspector/objectinspectormodel_p.h +++ b/src/designer/components/objectinspector/objectinspectormodel_p.h @@ -163,6 +163,6 @@ namespace qdesigner_internal { }; } // namespace qdesigner_internal -#endif // OBJECTINSPECTORMODEL_H - QT_END_NAMESPACE + +#endif // OBJECTINSPECTORMODEL_H diff --git a/src/designer/components/qdesignercomponentscommon_p.h b/src/designer/components/qdesignercomponentscommon_p.h index dc2a491b1..cea7efdff 100644 --- a/src/designer/components/qdesignercomponentscommon_p.h +++ b/src/designer/components/qdesignercomponentscommon_p.h @@ -1,7 +1,13 @@ #ifndef QDESIGNERCOMPONENTS_P_H #define QDESIGNERCOMPONENTS_P_H +#include "QtCore/qglobal.h" + +QT_BEGIN_NAMESPACE + static const char *widgetElementC = "widget"; static const char *nameAttributeC = "name"; +QT_END_NAMESPACE + #endif // QDESIGNERCOMPONENTS_P_H diff --git a/src/designer/qdesignercommon_p.h b/src/designer/qdesignercommon_p.h index 7f472ca8e..d42ce8edd 100644 --- a/src/designer/qdesignercommon_p.h +++ b/src/designer/qdesignercommon_p.h @@ -4,6 +4,11 @@ #include "abstractformeditor.h" #include "qwidget.h" +Q_DECLARE_METATYPE(QWidgetList) +Q_DECLARE_METATYPE(QAction*) + +QT_BEGIN_NAMESPACE + enum { FormLayoutColumns = 2 }; static const char *Geometry = "Geometry"; @@ -35,7 +40,6 @@ static void recursiveUpdate(QWidget *w) } } -Q_DECLARE_METATYPE(QWidgetList) -Q_DECLARE_METATYPE(QAction*) +QT_END_NAMESPACE #endif // QDESIGNERCOMMON_P_H diff --git a/src/designer/shared/qdesigner_integration.cpp b/src/designer/shared/qdesigner_integration.cpp index 454b6f773..f8beb87f2 100644 --- a/src/designer/shared/qdesigner_integration.cpp +++ b/src/designer/shared/qdesigner_integration.cpp @@ -494,4 +494,5 @@ QString QDesignerIntegration::contextHelpId() const } // namespace qdesigner_internal QT_END_NAMESPACE + #include diff --git a/src/designer/shared/qdesigner_qsettings.cpp b/src/designer/shared/qdesigner_qsettings.cpp index 5e29e48fe..983baf9ef 100644 --- a/src/designer/shared/qdesigner_qsettings.cpp +++ b/src/designer/shared/qdesigner_qsettings.cpp @@ -47,6 +47,8 @@ #include #include +QT_BEGIN_NAMESPACE + /*! \class QDesignerSettingsSimple @@ -92,3 +94,5 @@ void QDesignerQSettings::remove(const QString &key) { m_settings.remove(key); } + +QT_END_NAMESPACE diff --git a/src/gui/dialogs/qmessagebox.cpp b/src/gui/dialogs/qmessagebox.cpp index e80e63e4e..bae2d806a 100644 --- a/src/gui/dialogs/qmessagebox.cpp +++ b/src/gui/dialogs/qmessagebox.cpp @@ -1727,7 +1727,6 @@ QPixmap QMessageBox::standardIcon(Icon icon) QT_END_NAMESPACE - #include "moc_qmessagebox.h" #include "qrc_qmessagebox.cpp" diff --git a/src/gui/kernel/qboxlayout.h b/src/gui/kernel/qboxlayout.h index c01804b30..a027a45da 100644 --- a/src/gui/kernel/qboxlayout.h +++ b/src/gui/kernel/qboxlayout.h @@ -120,7 +120,6 @@ public: explicit QHBoxLayout(QWidget *parent); ~QHBoxLayout(); - private: Q_DISABLE_COPY(QHBoxLayout) }; @@ -133,7 +132,6 @@ public: explicit QVBoxLayout(QWidget *parent); ~QVBoxLayout(); - private: Q_DISABLE_COPY(QVBoxLayout) }; diff --git a/src/gui/kernel/qlayout.h b/src/gui/kernel/qlayout.h index ba9748aff..c74f351bd 100644 --- a/src/gui/kernel/qlayout.h +++ b/src/gui/kernel/qlayout.h @@ -49,11 +49,8 @@ QT_BEGIN_HEADER QT_BEGIN_NAMESPACE - -class QLayout; class QSize; - class QLayoutPrivate; class Q_GUI_EXPORT QLayout : public QObject, public QLayoutItem @@ -157,15 +154,14 @@ private: friend class QApplicationPrivate; friend class QWidget; - }; +QT_END_NAMESPACE + // legacy includes #include #include -QT_END_NAMESPACE - QT_END_HEADER #endif // QLAYOUT_H diff --git a/src/gui/qguicommon_p.h b/src/gui/qguicommon_p.h index 3171de898..e70bad78a 100644 --- a/src/gui/qguicommon_p.h +++ b/src/gui/qguicommon_p.h @@ -6,6 +6,8 @@ #include "qiconengineplugin.h" #include "qimageiohandler.h" +QT_BEGIN_NAMESPACE + static QColor mergedColors(const QColor &colorA, const QColor &colorB, int factor = 50) { const int maxFactor = 100; @@ -28,4 +30,6 @@ Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, imageloader, (QImageIOHandlerFactoryInterface_iid, QLatin1String("/imageformats"))) #endif +QT_END_NAMESPACE + #endif // QGUICOMMON_P_H diff --git a/src/gui/styles/qstyle.cpp b/src/gui/styles/qstyle.cpp index 2a896c37a..3816704b7 100644 --- a/src/gui/styles/qstyle.cpp +++ b/src/gui/styles/qstyle.cpp @@ -2331,7 +2331,7 @@ void QStyle::setProxy(QStyle *style) d->proxyStyle = style; } +QT_END_NAMESPACE + #include "moc_qstyle.h" #include "qrc_qstyle.cpp" - -QT_END_NAMESPACE diff --git a/src/network/qnetworkcommon_p.h b/src/network/qnetworkcommon_p.h index 47f774fac..568bce83d 100644 --- a/src/network/qnetworkcommon_p.h +++ b/src/network/qnetworkcommon_p.h @@ -16,6 +16,8 @@ Q_DECLARE_METATYPE(QNetworkSession::State) Q_DECLARE_METATYPE(QNetworkSession::SessionError) #endif +QT_BEGIN_NAMESPACE + static void downloadBufferDeleter(char *ptr) { delete[] ptr; @@ -34,4 +36,6 @@ static int qt_timeout_value(int msecs, int elapsed) return timeout < 0 ? 0 : timeout; } +QT_END_NAMESPACE + #endif // QNETWORKCOMMON_H diff --git a/src/network/ssl/qsslsocket_openssl.cpp b/src/network/ssl/qsslsocket_openssl.cpp index e42343805..950e4faf2 100644 --- a/src/network/ssl/qsslsocket_openssl.cpp +++ b/src/network/ssl/qsslsocket_openssl.cpp @@ -59,12 +59,6 @@ #include #include -#if OPENSSL_VERSION_NUMBER >= 0x0090806fL && !defined(OPENSSL_NO_TLSEXT) -// Symbian does not seem to have the symbol for SNI defined -#ifndef SSL_CTRL_SET_TLSEXT_HOSTNAME -#define SSL_CTRL_SET_TLSEXT_HOSTNAME 55 -#endif -#endif QT_BEGIN_NAMESPACE bool QSslSocketPrivate::s_libraryLoaded = false; diff --git a/src/plugins/bearer/connman/qofonoservice_linux.cpp b/src/plugins/bearer/connman/qofonoservice_linux.cpp index 154375cad..d56306973 100644 --- a/src/plugins/bearer/connman/qofonoservice_linux.cpp +++ b/src/plugins/bearer/connman/qofonoservice_linux.cpp @@ -57,6 +57,8 @@ #ifndef QT_NO_BEARERMANAGEMENT #ifndef QT_NO_DBUS +QT_BEGIN_NAMESPACE + QDBusArgument &operator<<(QDBusArgument &argument, const ObjectPathProperties &item) { argument.beginStructure(); @@ -73,7 +75,6 @@ const QDBusArgument &operator>>(const QDBusArgument &argument, ObjectPathPropert return argument; } -QT_BEGIN_NAMESPACE static QDBusConnection ofonoConnection = QDBusConnection::systemBus(); diff --git a/src/plugins/bearer/connman/qofonoservice_linux_p.h b/src/plugins/bearer/connman/qofonoservice_linux_p.h index 52819a9aa..f8f35c6fc 100644 --- a/src/plugins/bearer/connman/qofonoservice_linux_p.h +++ b/src/plugins/bearer/connman/qofonoservice_linux_p.h @@ -84,17 +84,16 @@ QT_BEGIN_NAMESPACE - -QT_END_NAMESPACE - struct ObjectPathProperties { QDBusObjectPath path; QVariantMap properties; }; typedef QList PathPropertiesList; +QT_END_NAMESPACE + Q_DECLARE_METATYPE(ObjectPathProperties) -Q_DECLARE_METATYPE (PathPropertiesList) +Q_DECLARE_METATYPE(PathPropertiesList) QT_BEGIN_NAMESPACE diff --git a/src/plugins/imageformats/tga/qtgafile.cpp b/src/plugins/imageformats/tga/qtgafile.cpp index 205e60b69..0c0bba33c 100644 --- a/src/plugins/imageformats/tga/qtgafile.cpp +++ b/src/plugins/imageformats/tga/qtgafile.cpp @@ -45,6 +45,8 @@ #include #include +QT_BEGIN_NAMESPACE + struct TgaReader { virtual ~TgaReader() {} @@ -266,3 +268,5 @@ QImage QTgaFile::readImage() // TODO: add processing of TGA extension information - ie TGA 2.0 files return im; } + +QT_END_NAMESPACE diff --git a/src/plugins/script/qtdbus/dbmain.cpp b/src/plugins/script/qtdbus/dbmain.cpp index 4c17345de..524a44cd5 100644 --- a/src/plugins/script/qtdbus/dbmain.cpp +++ b/src/plugins/script/qtdbus/dbmain.cpp @@ -398,4 +398,5 @@ Q_EXPORT_STATIC_PLUGIN(QtDBusScriptPlugin) Q_EXPORT_PLUGIN2(qtscriptdbus, QtDBusScriptPlugin) #endif // QT_NO_DBUS + #include "moc_dbmain.h" diff --git a/src/plugins/script/qtdbus/dbmain.h b/src/plugins/script/qtdbus/dbmain.h index e63ee5f10..b259497aa 100644 --- a/src/plugins/script/qtdbus/dbmain.h +++ b/src/plugins/script/qtdbus/dbmain.h @@ -53,6 +53,8 @@ #ifndef QT_NO_DBUS +QT_USE_NAMESPACE + class QDBusConnectionConstructor : public QObject, public QScriptable { diff --git a/src/script/CMakeLists.txt b/src/script/CMakeLists.txt index 7a3c94a92..39d7c7495 100644 --- a/src/script/CMakeLists.txt +++ b/src/script/CMakeLists.txt @@ -5,7 +5,6 @@ add_definitions( -Djscyylex=qtjscyylex -Djscyyerror=qtjscyyerror -DWTF=QTWTF - -DQT_NO_USING_NAMESPACE -DQLALR_NO_QSCRIPTGRAMMAR_DEBUG_INFO -DBUILDING_QT__ ) diff --git a/src/scripttools/qscripttoolscommon_p.h b/src/scripttools/qscripttoolscommon_p.h index c1ade3a66..6cc77015a 100644 --- a/src/scripttools/qscripttoolscommon_p.h +++ b/src/scripttools/qscripttoolscommon_p.h @@ -34,9 +34,7 @@ Q_DECLARE_METATYPE(QScriptDebuggerConsoleCommandGroupData) Q_DECLARE_METATYPE(QScriptDebuggerConsoleCommandGroupMap) Q_DECLARE_METATYPE(QScriptDebuggerValueList) - - -namespace { +QT_BEGIN_NAMESPACE static inline bool isAlmostIdentChar(const QChar &ch) { @@ -55,6 +53,6 @@ static inline bool isPrefixOf(const QString &prefix, const QString &what) return ((what.length() > prefix.length()) && what.startsWith(prefix)); } -} // namespace +QT_END_NAMESPACE #endif // QSCRIPTTOOLSCOMMON_H \ No newline at end of file diff --git a/src/test/qbenchmarkmetric.cpp b/src/test/qbenchmarkmetric.cpp index a9ce0dd02..4f82493a9 100644 --- a/src/test/qbenchmarkmetric.cpp +++ b/src/test/qbenchmarkmetric.cpp @@ -41,6 +41,8 @@ #include +QT_BEGIN_NAMESPACE + /*! \enum QTest::QBenchmarkMetric \since 4.7 @@ -113,3 +115,4 @@ const char * QTest::benchmarkMetricUnit(QBenchmarkMetric metric) } } +QT_END_NAMESPACE diff --git a/src/test/qtestcommon_p.h b/src/test/qtestcommon_p.h index eaac35556..9a03dd270 100644 --- a/src/test/qtestcommon_p.h +++ b/src/test/qtestcommon_p.h @@ -4,9 +4,13 @@ #include #include +QT_BEGIN_NAMESPACE + namespace QTest { static FILE *stream = 0; } +QT_END_NAMESPACE + #endif // QTESTCOMMON_H diff --git a/src/tools/lupdate/lupdate.cpp b/src/tools/lupdate/lupdate.cpp index ead9e223c..119ff294d 100644 --- a/src/tools/lupdate/lupdate.cpp +++ b/src/tools/lupdate/lupdate.cpp @@ -56,6 +56,8 @@ #include +QT_USE_NAMESPACE + static QString m_defaultExtensions; static void printOut(const QString & out) diff --git a/src/tools/moc/moc.cpp b/src/tools/moc/moc.cpp index c5aabb153..1fa300808 100644 --- a/src/tools/moc/moc.cpp +++ b/src/tools/moc/moc.cpp @@ -813,14 +813,12 @@ void Moc::generate(FILE *out) " much.)\"\n", QT_VERSION_STR); fprintf(out, "#endif\n\n"); - fprintf(out, "QT_BEGIN_MOC_NAMESPACE\n"); + fprintf(out, "QT_USE_NAMESPACE\n"); for (i = 0; i < classList.size(); ++i) { Generator generator(&classList[i], metaTypes, out); generator.generateCode(); } - - fprintf(out, "QT_END_MOC_NAMESPACE\n"); } diff --git a/src/tools/qdbus/qdbus.cpp b/src/tools/qdbus/qdbus.cpp index 4b68c5bc1..be149a319 100644 --- a/src/tools/qdbus/qdbus.cpp +++ b/src/tools/qdbus/qdbus.cpp @@ -57,6 +57,8 @@ QT_BEGIN_NAMESPACE Q_DBUS_EXPORT extern bool qt_dbus_metaobject_skip_annotations; QT_END_NAMESPACE +QT_USE_NAMESPACE + static QDBusConnection connection(QLatin1String("")); static bool printArgumentsLiterally = false; diff --git a/src/tools/qdbus/qdbuscpp2xml.cpp b/src/tools/qdbus/qdbuscpp2xml.cpp index b85746b62..720016339 100644 --- a/src/tools/qdbus/qdbuscpp2xml.cpp +++ b/src/tools/qdbus/qdbuscpp2xml.cpp @@ -72,6 +72,8 @@ QT_END_NAMESPACE #define PROGRAMVERSION "0.1" #define PROGRAMCOPYRIGHT "Copyright (C) 2015 The Qt Company Ltd." +QT_USE_NAMESPACE + static QString outputFile; static int flags; diff --git a/src/tools/qdbus/qdbusxml2cpp.cpp b/src/tools/qdbus/qdbusxml2cpp.cpp index 469ec588c..b755ecc7b 100644 --- a/src/tools/qdbus/qdbusxml2cpp.cpp +++ b/src/tools/qdbus/qdbusxml2cpp.cpp @@ -68,6 +68,8 @@ #define ANNOTATION_NO_WAIT "org.freedesktop.DBus.Method.NoReply" +QT_USE_NAMESPACE + static QString globalClassName; static QString parentClassName; static QString proxyFile; diff --git a/src/tools/qdbusviewer/propertydialog.cpp b/src/tools/qdbusviewer/propertydialog.cpp index d848216e1..5e64dfc6e 100644 --- a/src/tools/qdbusviewer/propertydialog.cpp +++ b/src/tools/qdbusviewer/propertydialog.cpp @@ -45,6 +45,8 @@ #include #include +QT_BEGIN_NAMESPACE + PropertyDialog::PropertyDialog(QWidget *parent, Qt::WindowFlags f) : QDialog(parent, f) { @@ -112,4 +114,6 @@ QList PropertyDialog::values() const return result; } -#include +QT_END_NAMESPACE + +#include "moc_propertydialog.h" diff --git a/src/tools/qdbusviewer/propertydialog.h b/src/tools/qdbusviewer/propertydialog.h index c68f3995e..03efd3f4b 100644 --- a/src/tools/qdbusviewer/propertydialog.h +++ b/src/tools/qdbusviewer/propertydialog.h @@ -47,6 +47,8 @@ #include #include +QT_BEGIN_NAMESPACE + class PropertyDialog: public QDialog { Q_OBJECT @@ -66,5 +68,7 @@ private: QDialogButtonBox *buttonBox; }; +QT_END_NAMESPACE + #endif diff --git a/src/tools/qdbusviewer/qdbusmodel.cpp b/src/tools/qdbusviewer/qdbusmodel.cpp index 68c2dcbf4..412c95aa3 100644 --- a/src/tools/qdbusviewer/qdbusmodel.cpp +++ b/src/tools/qdbusviewer/qdbusmodel.cpp @@ -48,6 +48,8 @@ #include #include +QT_BEGIN_NAMESPACE + struct QDBusItem { inline QDBusItem(QDBusModel::Type aType, const QString &aName, QDBusItem *aParent = 0) @@ -352,4 +354,6 @@ QModelIndex QDBusModel::findObject(const QDBusObjectPath &objectPath) return QModelIndex(); } -#include +QT_END_NAMESPACE + +#include "moc_qdbusmodel.h" diff --git a/src/tools/qdbusviewer/qdbusmodel.h b/src/tools/qdbusviewer/qdbusmodel.h index beddedcef..1cdd7dc34 100644 --- a/src/tools/qdbusviewer/qdbusmodel.h +++ b/src/tools/qdbusviewer/qdbusmodel.h @@ -43,15 +43,15 @@ #define QDBUSMODEL_H #include +#include +#include #include #include +QT_BEGIN_NAMESPACE + struct QDBusItem; -QT_FORWARD_DECLARE_CLASS(QDomDocument) -QT_FORWARD_DECLARE_CLASS(QDomElement) - - class QDBusModel: public QAbstractItemModel { Q_OBJECT @@ -92,5 +92,7 @@ private: QDBusItem *root; }; +QT_END_NAMESPACE + #endif diff --git a/src/tools/qdbusviewer/qdbusviewer.cpp b/src/tools/qdbusviewer/qdbusviewer.cpp index ae704b427..46f82fadd 100644 --- a/src/tools/qdbusviewer/qdbusviewer.cpp +++ b/src/tools/qdbusviewer/qdbusviewer.cpp @@ -50,6 +50,8 @@ #include #include +QT_BEGIN_NAMESPACE + class QDBusViewModel: public QDBusModel { public: @@ -533,4 +535,6 @@ void QDBusViewer::anchorClicked(const QUrl &url) are output in the message view on the lower side of the window. */ -#include +QT_END_NAMESPACE + +#include "moc_qdbusviewer.h" diff --git a/src/tools/qdbusviewer/qdbusviewer.h b/src/tools/qdbusviewer/qdbusviewer.h index 6a78c8e11..e88ca67c7 100644 --- a/src/tools/qdbusviewer/qdbusviewer.h +++ b/src/tools/qdbusviewer/qdbusviewer.h @@ -42,13 +42,13 @@ #ifndef QDBUSVIEWER_H #define QDBUSVIEWER_H +#include +#include #include #include #include -QT_FORWARD_DECLARE_CLASS(QTreeView) -QT_FORWARD_DECLARE_CLASS(QDomDocument) -QT_FORWARD_DECLARE_CLASS(QDomElement) +QT_BEGIN_NAMESPACE struct BusSignature { @@ -100,4 +100,6 @@ private: QRegExp objectPathRegExp; }; +QT_END_NAMESPACE + #endif diff --git a/src/tools/qdbusviewer/qdbusviewermain.cpp b/src/tools/qdbusviewer/qdbusviewermain.cpp index 9bbd07a8f..dd34d898c 100644 --- a/src/tools/qdbusviewer/qdbusviewermain.cpp +++ b/src/tools/qdbusviewer/qdbusviewermain.cpp @@ -47,6 +47,8 @@ #include +QT_USE_NAMESPACE + int main(int argc, char *argv[]) { QApplication app(argc, argv); diff --git a/src/tools/qscript/bytearrayclass.cpp b/src/tools/qscript/bytearrayclass.cpp index 5caf99bf8..a3324b071 100644 --- a/src/tools/qscript/bytearrayclass.cpp +++ b/src/tools/qscript/bytearrayclass.cpp @@ -48,6 +48,8 @@ Q_DECLARE_METATYPE(QByteArray*) Q_DECLARE_METATYPE(ByteArrayClass*) +QT_BEGIN_NAMESPACE + class ByteArrayClassPropertyIterator : public QScriptClassPropertyIterator { public: @@ -306,3 +308,5 @@ uint ByteArrayClassPropertyIterator::id() const return m_last; } //! [8] + +QT_END_NAMESPACE diff --git a/src/tools/qscript/bytearrayclass.h b/src/tools/qscript/bytearrayclass.h index 17d6bf322..8290c1bfa 100644 --- a/src/tools/qscript/bytearrayclass.h +++ b/src/tools/qscript/bytearrayclass.h @@ -45,6 +45,8 @@ #include #include +QT_BEGIN_NAMESPACE + class ByteArrayClass : public QObject, public QScriptClass { public: @@ -88,4 +90,6 @@ private: QScriptValue ctor; }; +QT_END_NAMESPACE + #endif diff --git a/src/tools/qscript/bytearrayprototype.cpp b/src/tools/qscript/bytearrayprototype.cpp index 71d9b8291..57e60df97 100644 --- a/src/tools/qscript/bytearrayprototype.cpp +++ b/src/tools/qscript/bytearrayprototype.cpp @@ -45,6 +45,8 @@ Q_DECLARE_METATYPE(QByteArray*) #endif +QT_BEGIN_NAMESPACE + ByteArrayPrototype::ByteArrayPrototype(QObject *parent) : QObject(parent) { @@ -136,4 +138,6 @@ QScriptValue ByteArrayPrototype::valueOf() const } //! [2] +QT_END_NAMESPACE + #include "moc_bytearrayprototype.h" diff --git a/src/tools/qscript/bytearrayprototype.h b/src/tools/qscript/bytearrayprototype.h index bb618ebe6..35327fb74 100644 --- a/src/tools/qscript/bytearrayprototype.h +++ b/src/tools/qscript/bytearrayprototype.h @@ -46,6 +46,8 @@ #include #include +QT_BEGIN_NAMESPACE + //! [0] class ByteArrayPrototype : public QObject, public QScriptable { @@ -75,5 +77,6 @@ private: }; //! [0] +QT_END_NAMESPACE #endif diff --git a/src/tools/qscript/qscript.cpp b/src/tools/qscript/qscript.cpp index f16f0a503..28366f616 100644 --- a/src/tools/qscript/qscript.cpp +++ b/src/tools/qscript/qscript.cpp @@ -38,17 +38,18 @@ ** ****************************************************************************/ -#include - #include #include #include #include +#include #include +#include "bytearrayclass.h" + #include -#include "bytearrayclass.h" +QT_USE_NAMESPACE static bool wantsToQuit; @@ -222,4 +223,4 @@ int main(int argc, char *argv[]) delete app; return EXIT_SUCCESS; -} +} diff --git a/tests/auto/qsqldatabase/tst_qsqldatabase.cpp b/tests/auto/qsqldatabase/tst_qsqldatabase.cpp index 26cb6f0f0..52d81126d 100644 --- a/tests/auto/qsqldatabase/tst_qsqldatabase.cpp +++ b/tests/auto/qsqldatabase/tst_qsqldatabase.cpp @@ -44,11 +44,6 @@ #include #include #include -#ifdef QT3_SUPPORT -#include -#include -#include -#endif #include #include #include @@ -63,7 +58,6 @@ //TESTED_FILES= -QT_FORWARD_DECLARE_CLASS(QSqlDatabase) struct FieldDef; class tst_QSqlDatabase : public QObject @@ -132,8 +126,6 @@ private slots: //problem specific tests void alterTable_data() { generic_data(); } void alterTable(); - void recordNonSelect_data() { generic_data(); } - void recordNonSelect(); void caseSensivity_data() { generic_data(); } void caseSensivity(); void noEscapedFieldNamesInRecord_data() { generic_data(); } @@ -213,13 +205,8 @@ private: void populateTestTables(QSqlDatabase db); void generic_data(const QString &engine=QString()); -#ifdef QT3_SUPPORT - void testRecordInfo(const FieldDef fieldDefs[], const Q3SqlRecordInfo& inf); -#endif void testRecord(const FieldDef fieldDefs[], const QSqlRecord& inf, QSqlDatabase db); void commonFieldTest(const FieldDef fieldDefs[], QSqlDatabase, const int); - void checkValues(const FieldDef fieldDefs[], QSqlDatabase db); - void checkNullValues(const FieldDef fieldDefs[], QSqlDatabase db); tst_Databases dbs; }; @@ -240,11 +227,7 @@ struct FieldDef { { QString rt = typeName; rt.replace(QRegExp("\\s"), QString("_")); -#ifdef QT3_SUPPORT - int i = rt.find("("); -#else int i = rt.indexOf("("); -#endif if (i == -1) i = rt.length(); if (i > 20) @@ -514,31 +497,6 @@ void tst_QSqlDatabase::open() } } -void tst_QSqlDatabase::recordNonSelect() -{ -#ifdef QT3_SUPPORT - QFETCH(QString, dbName); - QSqlDatabase db = QSqlDatabase::database(dbName); - CHECK_DATABASE(db); - - QSqlQuery q(db); - - // nothing should happen on an empty query - QSqlRecord rec = db.record(q); - QVERIFY(rec.isEmpty()); - Q3SqlRecordInfo rInf = db.recordInfo(q); - QVERIFY(rInf.isEmpty()); - - QVERIFY_SQL(q, exec("create table " + qTableName("qtest_temp", __FILE__) + " (id int)")); - - // query without result set should return empty record - rec = db.record(q); - QVERIFY(rec.isEmpty()); - rInf = db.recordInfo(q); - QVERIFY(rInf.isEmpty()); -#endif -} - void tst_QSqlDatabase::tables() { QFETCH(QString, dbName); @@ -644,18 +602,9 @@ void tst_QSqlDatabase::alterTable() QVERIFY_SQL(q, exec("create table " + qtestalter + " (F1 char(20), F2 char(20), F3 char(20))")); QSqlRecord rec = db.record(qtestalter); QCOMPARE((int)rec.count(), 3); -#ifdef QT3_SUPPORT - Q3SqlRecordInfo rinf = db.recordInfo(qtestalter); - QCOMPARE((int)rinf.count(), 3); -#endif - - int i; - for (i = 0; i < 3; ++i) { + for (int i = 0; i < 3; ++i) { QCOMPARE(rec.field(i).name().toUpper(), QString("F%1").arg(i + 1)); -#ifdef QT3_SUPPORT - QCOMPARE(rinf[ i ].name().upper(), QString("F%1").arg(i + 1)); -#endif } if (!q.exec("alter table " + qtestalter + " drop column F2")) { @@ -663,36 +612,13 @@ void tst_QSqlDatabase::alterTable() } rec = db.record(qtestalter); -#ifdef QT3_SUPPORT - rinf = db.recordInfo(qtestalter); -#endif QCOMPARE((int)rec.count(), 2); -#ifdef QT3_SUPPORT - QCOMPARE((int)rinf.count(), 2); -#endif QCOMPARE(rec.field(0).name().toUpper(), QString("F1")); QCOMPARE(rec.field(1).name().toUpper(), QString("F3")); -#ifdef QT3_SUPPORT - QCOMPARE(rinf[ 0 ].name().upper(), QString("F1")); - QCOMPARE(rinf[ 1 ].name().upper(), QString("F3")); -#endif q.exec("select * from " + qtestalter); - -#ifdef QT3_SUPPORT - rec = db.record(q); - rinf = db.recordInfo(q); - - QCOMPARE((int)rec.count(), 2); - QCOMPARE((int)rinf.count(), 2); - - QCOMPARE(rec.field(0).name().upper(), QString("F1")); - QCOMPARE(rec.field(1).name().upper(), QString("F3")); - QCOMPARE(rinf[ 0 ].name().upper(), QString("F1")); - QCOMPARE(rinf[ 1 ].name().upper(), QString("F3")); -#endif } #if 0 @@ -716,27 +642,7 @@ void tst_QSqlDatabase::record() const int fieldCount = createFieldTable(fieldDefs, db); QVERIFY(fieldCount > 0); -// doesn't work with oracle: checkNullValues(fieldDefs, db); commonFieldTest(fieldDefs, db, fieldCount); - for (int i = 0; i < ITERATION_COUNT; ++i) { - checkValues(fieldDefs, db); - } -} -#endif - -#ifdef QT3_SUPPORT -void tst_QSqlDatabase::testRecordInfo(const FieldDef fieldDefs[], const Q3SqlRecordInfo& inf) -{ - int i = 0; - for (i = 0; !fieldDefs[ i ].typeName.isNull(); ++i) { - QCOMPARE(inf[i+1].name().upper(), fieldDefs[ i ].fieldName().upper()); - if (inf[i+1].type() != fieldDefs[ i ].type) { - QFAIL(QString(" Expected: '%1' Received: '%2' for field %3 in testRecordInfo").arg( - QVariant::typeToName(fieldDefs[ i ].type)).arg( - QVariant::typeToName(inf[i+1].type())).arg( - fieldDefs[ i ].fieldName())); - } - } } #endif @@ -765,125 +671,12 @@ void tst_QSqlDatabase::commonFieldTest(const FieldDef fieldDefs[], QSqlDatabase CHECK_DATABASE(db); // check whether recordInfo returns the right types -#ifdef QT3_SUPPORT - Q3SqlRecordInfo inf = db.recordInfo(qTableName("qtestfields", __FILE__)); - QCOMPARE((int)inf.count(), fieldCount+1); - testRecordInfo(fieldDefs, inf); -#endif - QSqlRecord rec = db.record(qTableName("qtestfields", __FILE__)); QCOMPARE((int)rec.count(), fieldCount+1); testRecord(fieldDefs, rec, db); QSqlQuery q(db); QVERIFY_SQL(q, exec("select * from " + qTableName("qtestfields", __FILE__))); - -#ifdef QT3_SUPPORT - inf = db.recordInfo(q); - QCOMPARE((int)inf.count(), fieldCount+1); - testRecordInfo(fieldDefs, inf); - - rec = db.record(q); - QCOMPARE((int)rec.count(), fieldCount+1); - testRecord(fieldDefs, rec, db); -#endif -} - -// inserts testdata into the testtable, fetches and compares them -void tst_QSqlDatabase::checkValues(const FieldDef fieldDefs[], QSqlDatabase db) -{ - Q_UNUSED(fieldDefs); -#ifdef QT3_SUPPORT - CHECK_DATABASE(db); - - Q3SqlCursor cur(qTableName("qtestfields", __FILE__), true, db); - QVERIFY_SQL(cur, select()); - QSqlRecord* rec = cur.primeInsert(); - QVERIFY(rec); - rec->setValue("id", pkey++); - int i = 0; - for (i = 0; !fieldDefs[ i ].typeName.isNull(); ++i) { - rec->setValue(fieldDefs[ i ].fieldName(), fieldDefs[ i ].val); -// qDebug(QString("inserting %1 into %2").arg(fieldDefs[ i ].val.toString()).arg(fieldDefs[ i ].fieldName())); - } - QVERIFY_SQL(cur, insert()); - cur.setForwardOnly(true); - QVERIFY_SQL(cur, select("id = " + QString::number(pkey - 1))); - QVERIFY_SQL(cur, next()); - - for (i = 0; !fieldDefs[ i ].typeName.isNull(); ++i) { - bool ok = false; - QVariant val1 = cur.value(fieldDefs[ i ].fieldName()); - QVariant val2 = fieldDefs[ i ].val; - if (val1.type() == QVariant::String) - //TDS Workaround - val1 = val1.toString().stripWhiteSpace(); - if (fieldDefs[ i ].fieldName() == "t_real") { - // strip precision - val1 = (float)val1.toDouble(); - val2 = (float)val2.toDouble(); - } - if (val1.canCast(QVariant::Double) && val2.type() == QVariant::Double) { - // we don't care about precision here, we just want to know whether - // we can insert/fetch the right values - ok = (val1.toDouble() - val2.toDouble() < 0.00001); - } else if (val1.type() == val2.type()) { - ok = (val1 == val2); - } else { - ok = (val1.toString() == val2.toString()); - } - if (!ok) { - if (val2.type() == QVariant::DateTime || val2.type() == QVariant::Time) - qDebug("Expected Time: " + val2.toTime().toString("hh:mm:ss.zzz")); - if (val1.type() == QVariant::DateTime || val1.type() == QVariant::Time) - qDebug("Received Time: " + val1.toTime().toString("hh:mm:ss.zzz")); - QFAIL(QString(" Expected: '%1' Received: '%2' for field %3 (etype %4 rtype %5) in checkValues").arg( - val2.type() == QVariant::ByteArray ? val2.toByteArray().toHex() : val2.toString()).arg( - val1.type() == QVariant::ByteArray ? val1.toByteArray().toHex() : val1.toString()).arg( - fieldDefs[ i ].fieldName()).arg( - val2.typeName()).arg( - val1.typeName()) - ); - } - } -#endif -} - -// inserts a NULL value for each nullable field in testdata, fetches and checks whether -// we get back NULL -void tst_QSqlDatabase::checkNullValues(const FieldDef fieldDefs[], QSqlDatabase db) -{ - Q_UNUSED(fieldDefs); -#ifdef QT3_SUPPORT - CHECK_DATABASE(db); - - Q3SqlCursor cur(qTableName("qtestfields", __FILE__), true, db); - QVERIFY_SQL(cur, select()); - QSqlRecord* rec = cur.primeInsert(); - QVERIFY(rec); - rec->setValue("id", pkey++); - int i = 0; - for (i = 0; !fieldDefs[ i ].typeName.isNull(); ++i) { - if (fieldDefs[ i ].fieldName(), fieldDefs[ i ].nullable) - rec->setNull(fieldDefs[ i ].fieldName()); - else - rec->setValue(fieldDefs[ i ].fieldName(), fieldDefs[ i ].val); - } - QVERIFY_SQL(cur, insert()); - cur.setForwardOnly(true); - QVERIFY_SQL(cur, select("id = " + QString::number(pkey - 1))); - QVERIFY_SQL(cur, next()); - - for (i = 0; !fieldDefs[ i ].typeName.isNull(); ++i) { - if (fieldDefs[ i ].nullable == false) - continue; - // multiple inheritance sucks so much - QVERIFY2(((QSqlQuery)cur).isNull(i + 1), "Check whether '" + fieldDefs[ i ].fieldName() + "' is null in QSqlQuery"); - QVERIFY2(((QSqlRecord)cur).isNull(fieldDefs[ i ].fieldName()), "Check whether '" + fieldDefs[ i ].fieldName() + "' is null in QSqlRecord"); - if (!cur.value(fieldDefs[ i ].fieldName()).isNull()) - qDebug(QString("QVariant is not null for NULL-Value in Field '%1'").arg(fieldDefs[ i ].fieldName())); - } -#endif } void tst_QSqlDatabase::recordTDS() @@ -912,11 +705,6 @@ void tst_QSqlDatabase::recordTDS() FieldDef("nchar(20)", QVariant::String, "blah3"), FieldDef("nvarchar(20)", QVariant::String, "blah4"), FieldDef("text", QVariant::String, "blah5"), -#ifdef QT3_SUPPORT - FieldDef("binary(20)", QVariant::ByteArray, Q3CString("blah6")), - FieldDef("varbinary(20)", QVariant::ByteArray, Q3CString("blah7")), - FieldDef("image", QVariant::ByteArray, Q3CString("blah8")), -#endif FieldDef("bit", QVariant::Int, 1, false), FieldDef() @@ -926,10 +714,6 @@ void tst_QSqlDatabase::recordTDS() QVERIFY(fieldCount > 0); commonFieldTest(fieldDefs, db, fieldCount); - checkNullValues(fieldDefs, db); - for (int i = 0; i < ITERATION_COUNT; ++i) { - checkValues(fieldDefs, db); - } } void tst_QSqlDatabase::recordOCI() @@ -986,9 +770,6 @@ void tst_QSqlDatabase::recordOCI() QVERIFY(fieldCount > 0); commonFieldTest(fieldDefs, db, fieldCount); - checkNullValues(fieldDefs, db); - for (int i = 0; i < ITERATION_COUNT; ++i) - checkValues(fieldDefs, db); // some additional tests QSqlRecord rec = db.record(qTableName("qtestfields", __FILE__)); @@ -1010,18 +791,11 @@ void tst_QSqlDatabase::recordPSQL() FieldDef byteadef; if (db.driver()->hasFeature(QSqlDriver::BLOB)) -#ifdef QT3_SUPPORT - byteadef = FieldDef("bytea", QVariant::ByteArray, QByteArray(Q3CString("bl\\ah"))); -#else byteadef = FieldDef("bytea", QVariant::ByteArray, QByteArray("bl\\ah")); -#endif static FieldDef fieldDefs[] = { FieldDef("bigint", QVariant::LongLong, Q_INT64_C(9223372036854775807)), FieldDef("bigserial", QVariant::LongLong, 100, false), FieldDef("bit", QVariant::String, "1"), // a bit in postgres is a bit-string -#ifdef QT3_SUPPORT - FieldDef("boolean", QVariant::Bool, QVariant(bool(true), 0)), -#endif FieldDef("box", QVariant::String, "(5,6),(1,2)"), FieldDef("char(20)", QVariant::String, "blah5678901234567890"), FieldDef("varchar(20)", QVariant::String, "blah5678901234567890"), @@ -1070,24 +844,18 @@ void tst_QSqlDatabase::recordPSQL() QVERIFY(fieldCount > 0); commonFieldTest(fieldDefs, db, fieldCount); - checkNullValues(fieldDefs, db); for (int i = 0; i < ITERATION_COUNT; ++i) { - // increase serial values - for (int i2 = 0; !fieldDefs[ i2 ].typeName.isNull(); ++i2) { - if (fieldDefs[ i2 ].typeName == "serial" || - fieldDefs[ i2 ].typeName == "bigserial") { + // increase serial values + for (int i2 = 0; !fieldDefs[ i2 ].typeName.isNull(); ++i2) { + if (fieldDefs[ i2 ].typeName == "serial" || + fieldDefs[ i2 ].typeName == "bigserial") { - FieldDef def = fieldDefs[ i2 ]; -#ifdef QT3_SUPPORT - def.val = def.val.asInt() + 1; -#else - def.val = def.val.toInt() + 1; -#endif - fieldDefs[ i2 ] = def; + FieldDef def = fieldDefs[ i2 ]; + def.val = def.val.toInt() + 1; + fieldDefs[ i2 ] = def; + } } } - checkValues(fieldDefs, db); - } } void tst_QSqlDatabase::recordMySQL() @@ -1108,13 +876,8 @@ void tst_QSqlDatabase::recordMySQL() with space on insert, and trailing spaces are removed on select. */ if( vernum >= ((5 << 16) + 15) ) { -#ifdef QT3_SUPPORT - bin10 = FieldDef("binary(10)", QVariant::ByteArray, QByteArray(Q3CString("123abc "))); - varbin10 = FieldDef("varbinary(10)", QVariant::ByteArray, QByteArray(Q3CString("123abcv "))); -#else bin10 = FieldDef("binary(10)", QVariant::ByteArray, QString("123abc ")); varbin10 = FieldDef("varbinary(10)", QVariant::ByteArray, QString("123abcv ")); -#endif } static QDateTime dt(QDate::currentDate(), QTime(1, 2, 3, 0)); @@ -1140,20 +903,10 @@ void tst_QSqlDatabase::recordMySQL() FieldDef("year", QVariant::Int, 2003), FieldDef("char(20)", QVariant::String, "Blah"), FieldDef("varchar(20)", QVariant::String, "BlahBlah"), -#ifdef QT3_SUPPORT - FieldDef("tinyblob", QVariant::ByteArray, QByteArray(Q3CString("blah1"))), - FieldDef("blob", QVariant::ByteArray, QByteArray(Q3CString("blah2"))), - FieldDef("mediumblob", QVariant::ByteArray,QByteArray(Q3CString("blah3"))), - FieldDef("longblob", QVariant::ByteArray, QByteArray(Q3CString("blah4"))), -#endif FieldDef("tinytext", QVariant::String, QString("blah5")), FieldDef("text", QVariant::String, QString("blah6")), FieldDef("mediumtext", QVariant::String, QString("blah7")), FieldDef("longtext", QVariant::String, QString("blah8")), -#ifdef QT3_SUPPORT - bin10, - varbin10, -#endif // SET OF? FieldDef() @@ -1163,10 +916,6 @@ void tst_QSqlDatabase::recordMySQL() QVERIFY(fieldCount > 0); commonFieldTest(fieldDefs, db, fieldCount); - checkNullValues(fieldDefs, db); - for (int i = 0; i < ITERATION_COUNT; ++i) { - checkValues(fieldDefs, db); - } QSqlQuery q(db); QVERIFY_SQL(q, exec("SELECT DATE_SUB(CURDATE(), INTERVAL 2 DAY)")); @@ -1200,11 +949,6 @@ void tst_QSqlDatabase::recordDB2() // FieldDef("graphic(20)", QVariant::String, QString("Blah4")), // FieldDef("vargraphic(20)", QVariant::String, QString("Blah5")), // FieldDef("long vargraphic", QVariant::String, QString("Blah6")), -#ifdef QT3_SUPPORT -// FieldDef("clob(20)", QVariant::CString, QString("Blah7")), -// FieldDef("dbclob(20)", QVariant::CString, QString("Blah8")), -// FieldDef("blob(20)", QVariant::ByteArray, QByteArray(Q3CString("Blah9"))), -#endif //X FieldDef("datalink", QVariant::String, QString("DLVALUE('Blah10')")), FieldDef() }; @@ -1213,10 +957,6 @@ void tst_QSqlDatabase::recordDB2() QVERIFY(fieldCount > 0); commonFieldTest(fieldDefs, db, fieldCount); - checkNullValues(fieldDefs, db); - for (int i = 0; i < ITERATION_COUNT; ++i) { - checkValues(fieldDefs, db); - } } void tst_QSqlDatabase::recordIBase() @@ -1243,10 +983,6 @@ void tst_QSqlDatabase::recordIBase() QVERIFY(fieldCount > 0); commonFieldTest(fieldDefs, db, fieldCount); - checkNullValues(fieldDefs, db); - for (int i = 0; i < ITERATION_COUNT; ++i) { - checkValues(fieldDefs, db); - } } void tst_QSqlDatabase::recordSQLite() @@ -1273,10 +1009,6 @@ void tst_QSqlDatabase::recordSQLite() QVERIFY(fieldCount > 0); commonFieldTest(fieldDefs, db, fieldCount); - checkNullValues(fieldDefs, db); - for (int i = 0; i < ITERATION_COUNT; ++i) { - checkValues(fieldDefs, db); - } } void tst_QSqlDatabase::recordSQLServer() @@ -1296,9 +1028,6 @@ void tst_QSqlDatabase::recordSQLServer() FieldDef("bigint", QVariant::LongLong, 12345), FieldDef("int", QVariant::Int, 123456), FieldDef("tinyint", QVariant::UInt, 255), -#ifdef QT3_SUPPORT - FieldDef("image", QVariant::ByteArray, Q3CString("Blah1")), -#endif FieldDef("float", QVariant::Double, 1.12345), FieldDef("numeric(5,2)", QVariant::Double, 123.45), FieldDef("uniqueidentifier", QVariant::String, @@ -1311,10 +1040,6 @@ void tst_QSqlDatabase::recordSQLServer() QVERIFY(fieldCount > 0); commonFieldTest(fieldDefs, db, fieldCount); - checkNullValues(fieldDefs, db); - for (int i = 0; i < ITERATION_COUNT; ++i) { - checkValues(fieldDefs, db); - } } void tst_QSqlDatabase::recordAccess() @@ -1338,9 +1063,6 @@ void tst_QSqlDatabase::recordAccess() FieldDef("single", QVariant::Double, 1.12345), FieldDef("double", QVariant::Double, 1.123456), FieldDef("byte", QVariant::UInt, 255), -#ifdef QT3_SUPPORT - FieldDef("binary(5)", QVariant::ByteArray, Q3CString("Blah2")), -#endif FieldDef("long", QVariant::Int, 2147483647), FieldDef("memo", QVariant::String, memo), FieldDef() @@ -1350,10 +1072,6 @@ void tst_QSqlDatabase::recordAccess() QVERIFY(fieldCount > 0); commonFieldTest(fieldDefs, db, fieldCount); - checkNullValues(fieldDefs, db); - for (int i = 0; i < ITERATION_COUNT; ++i) { - checkValues(fieldDefs, db); - } } void tst_QSqlDatabase::transaction() @@ -1494,17 +1212,6 @@ void tst_QSqlDatabase::caseSensivity() QVERIFY((int)rec.count() > 0); } -#ifdef QT3_SUPPORT - Q3SqlRecordInfo rInf = db.recordInfo(qTableName("qtest", __FILE__)); - QVERIFY((int)rInf.count() > 0); - if (!cs) { - rInf = db.recordInfo(qTableName("QTEST", __FILE__).upper()); - QVERIFY((int)rInf.count() > 0); - rInf = db.recordInfo(qTableName("qTesT", __FILE__)); - QVERIFY((int)rInf.count() > 0); - } -#endif - rec = db.primaryIndex(qTableName("qtest", __FILE__)); QVERIFY((int)rec.count() > 0); if (!cs) { @@ -1558,12 +1265,6 @@ void tst_QSqlDatabase::psql_schemas() QCOMPARE(rec.fieldName(0), QString("id")); QCOMPARE(rec.fieldName(1), QString("name")); -#ifdef QT3_SUPPORT - rec = db.record(QSqlQuery("select * from " + table, db)); - QCOMPARE(rec.count(), 2); - QCOMPARE(rec.fieldName(0), QString("id")); - QCOMPARE(rec.fieldName(1), QString("name")); -#endif QSqlIndex idx = db.primaryIndex(table); QCOMPARE(idx.count(), 1); QCOMPARE(idx.fieldName(0), QString("id")); diff --git a/tests/benchmarks/gui/graphicsview/qgraphicsview/benchapps/chipTest/mainwindow.h b/tests/benchmarks/gui/graphicsview/qgraphicsview/benchapps/chipTest/mainwindow.h index d195c3e4c..338f6584c 100644 --- a/tests/benchmarks/gui/graphicsview/qgraphicsview/benchapps/chipTest/mainwindow.h +++ b/tests/benchmarks/gui/graphicsview/qgraphicsview/benchapps/chipTest/mainwindow.h @@ -43,12 +43,7 @@ #define MAINWINDOW_H #include - -QT_FORWARD_DECLARE_CLASS(QGraphicsScene) -QT_FORWARD_DECLARE_CLASS(QGraphicsView) -QT_FORWARD_DECLARE_CLASS(QLabel) -QT_FORWARD_DECLARE_CLASS(QSlider) -QT_FORWARD_DECLARE_CLASS(QSplitter) +#include class MainWindow : public QWidget { diff --git a/tests/benchmarks/gui/graphicsview/qgraphicsview/benchapps/chipTest/view.h b/tests/benchmarks/gui/graphicsview/qgraphicsview/benchapps/chipTest/view.h index 70054cd8b..1a035b616 100644 --- a/tests/benchmarks/gui/graphicsview/qgraphicsview/benchapps/chipTest/view.h +++ b/tests/benchmarks/gui/graphicsview/qgraphicsview/benchapps/chipTest/view.h @@ -43,11 +43,10 @@ #define VIEW_H #include - -QT_FORWARD_DECLARE_CLASS(QGraphicsView) -QT_FORWARD_DECLARE_CLASS(QLabel) -QT_FORWARD_DECLARE_CLASS(QSlider) -QT_FORWARD_DECLARE_CLASS(QToolButton) +#include +#include +#include +#include class View : public QFrame { diff --git a/tests/benchmarks/gui/graphicsview/qgraphicsview/chiptester/chiptester.h b/tests/benchmarks/gui/graphicsview/qgraphicsview/chiptester/chiptester.h index 0f6d81835..befb67d11 100644 --- a/tests/benchmarks/gui/graphicsview/qgraphicsview/chiptester/chiptester.h +++ b/tests/benchmarks/gui/graphicsview/qgraphicsview/chiptester/chiptester.h @@ -42,13 +42,8 @@ #ifndef CHIPTESTER_H #define CHIPTESTER_H -#include - -QT_FORWARD_DECLARE_CLASS(QGraphicsScene) -QT_FORWARD_DECLARE_CLASS(QGraphicsView) -QT_FORWARD_DECLARE_CLASS(QLabel) -QT_FORWARD_DECLARE_CLASS(QSlider) -QT_FORWARD_DECLARE_CLASS(QSplitter) +#include +#include class ChipTester : public QGraphicsView { diff --git a/util/qlalr/dotgraph.h b/util/qlalr/dotgraph.h index c73f606a7..36636dcb7 100644 --- a/util/qlalr/dotgraph.h +++ b/util/qlalr/dotgraph.h @@ -42,7 +42,8 @@ #ifndef DOTGRAPH_H #define DOTGRAPH_H -QT_FORWARD_DECLARE_CLASS(QTextStream); +#include + class Automaton; class DotGraph diff --git a/util/qlalr/parsetable.h b/util/qlalr/parsetable.h index 6c7df0550..6f29e64ce 100644 --- a/util/qlalr/parsetable.h +++ b/util/qlalr/parsetable.h @@ -42,7 +42,8 @@ #ifndef PARSETABLE_H #define PARSETABLE_H -QT_FORWARD_DECLARE_CLASS(QTextStream); +#include + class Automaton; class ParseTable