summaryrefslogtreecommitdiffstats
path: root/src/corelib
diff options
context:
space:
mode:
Diffstat (limited to 'src/corelib')
-rw-r--r--src/corelib/doc/snippets/signalsandslots/lcdnumber.h2
-rw-r--r--src/corelib/doc/src/objectmodel/signalsandslots.qdoc4
-rw-r--r--src/corelib/io/qloggingcategory.h49
-rw-r--r--src/corelib/serialization/qcborstream.cpp27
-rw-r--r--src/corelib/tools/qscopeguard.qdoc6
5 files changed, 64 insertions, 24 deletions
diff --git a/src/corelib/doc/snippets/signalsandslots/lcdnumber.h b/src/corelib/doc/snippets/signalsandslots/lcdnumber.h
index fbd31b08cf..b311586e8f 100644
--- a/src/corelib/doc/snippets/signalsandslots/lcdnumber.h
+++ b/src/corelib/doc/snippets/signalsandslots/lcdnumber.h
@@ -69,7 +69,7 @@ class LcdNumber : public QFrame
//! [6]
public:
//! [6] //! [7]
- LcdNumber(QWidget *parent = 0);
+ LcdNumber(QWidget *parent = nullptr);
//! [7]
//! [8]
diff --git a/src/corelib/doc/src/objectmodel/signalsandslots.qdoc b/src/corelib/doc/src/objectmodel/signalsandslots.qdoc
index fcf091458a..85fe4df2ce 100644
--- a/src/corelib/doc/src/objectmodel/signalsandslots.qdoc
+++ b/src/corelib/doc/src/objectmodel/signalsandslots.qdoc
@@ -330,7 +330,7 @@
arguments can have default values. Consider QObject::destroyed():
\code
- void destroyed(QObject* = 0);
+ void destroyed(QObject* = nullptr);
\endcode
When a QObject is deleted, it emits this QObject::destroyed()
@@ -339,7 +339,7 @@
A suitable slot signature might be:
\code
- void objectDestroyed(QObject* obj = 0);
+ void objectDestroyed(QObject* obj = nullptr);
\endcode
To connect the signal to the slot, we use QObject::connect().
diff --git a/src/corelib/io/qloggingcategory.h b/src/corelib/io/qloggingcategory.h
index 489e250087..91e3144300 100644
--- a/src/corelib/io/qloggingcategory.h
+++ b/src/corelib/io/qloggingcategory.h
@@ -120,15 +120,30 @@ private:
return category; \
}
-#define qCDebug(category, ...) \
+#if !defined(QT_NO_DEBUG_OUTPUT)
+# define qCDebug(category, ...) \
for (bool qt_category_enabled = category().isDebugEnabled(); qt_category_enabled; qt_category_enabled = false) \
QMessageLogger(QT_MESSAGELOG_FILE, QT_MESSAGELOG_LINE, QT_MESSAGELOG_FUNC, category().categoryName()).debug(__VA_ARGS__)
-#define qCInfo(category, ...) \
+#else
+# define qCDebug(category, ...) QT_NO_QDEBUG_MACRO()
+#endif
+
+#if !defined(QT_NO_INFO_OUTPUT)
+# define qCInfo(category, ...) \
for (bool qt_category_enabled = category().isInfoEnabled(); qt_category_enabled; qt_category_enabled = false) \
QMessageLogger(QT_MESSAGELOG_FILE, QT_MESSAGELOG_LINE, QT_MESSAGELOG_FUNC, category().categoryName()).info(__VA_ARGS__)
-#define qCWarning(category, ...) \
+#else
+# define qCInfo(category, ...) QT_NO_QDEBUG_MACRO()
+#endif
+
+#if !defined(QT_NO_WARNING_OUTPUT)
+# define qCWarning(category, ...) \
for (bool qt_category_enabled = category().isWarningEnabled(); qt_category_enabled; qt_category_enabled = false) \
QMessageLogger(QT_MESSAGELOG_FILE, QT_MESSAGELOG_LINE, QT_MESSAGELOG_FUNC, category().categoryName()).warning(__VA_ARGS__)
+#else
+# define qCWarning(category, ...) QT_NO_QDEBUG_MACRO()
+#endif
+
#define qCCritical(category, ...) \
for (bool qt_category_enabled = category().isCriticalEnabled(); qt_category_enabled; qt_category_enabled = false) \
QMessageLogger(QT_MESSAGELOG_FILE, QT_MESSAGELOG_LINE, QT_MESSAGELOG_FUNC, category().categoryName()).critical(__VA_ARGS__)
@@ -144,26 +159,28 @@ private:
}
// check for enabled category inside QMessageLogger.
-#define qCDebug qDebug
-#define qCInfo qInfo
-#define qCWarning qWarning
-#define qCCritical qCritical
-
-#endif // Q_COMPILER_VARIADIC_MACROS || defined(Q_MOC_RUN)
-
-#if defined(QT_NO_DEBUG_OUTPUT)
-# undef qCDebug
+#if !defined(QT_NO_DEBUG_OUTPUT)
+# define qCDebug qDebug
+#else
# define qCDebug(category) QT_NO_QDEBUG_MACRO()
#endif
-#if defined(QT_NO_INFO_OUTPUT)
-# undef qCInfo
+
+#if !defined(QT_NO_INFO_OUTPUT)
+# define qCInfo qInfo
+#else
# define qCInfo(category) QT_NO_QDEBUG_MACRO()
#endif
-#if defined(QT_NO_WARNING_OUTPUT)
-# undef qCWarning
+
+#if !defined(QT_NO_WARNING_OUTPUT)
+# define qCWarning qWarning
+#else
# define qCWarning(category) QT_NO_QDEBUG_MACRO()
#endif
+#define qCCritical qCritical
+
+#endif // Q_COMPILER_VARIADIC_MACROS || defined(Q_MOC_RUN)
+
QT_END_NAMESPACE
#endif // QLOGGINGCATEGORY_H
diff --git a/src/corelib/serialization/qcborstream.cpp b/src/corelib/serialization/qcborstream.cpp
index e222bf5514..20a7e14dde 100644
--- a/src/corelib/serialization/qcborstream.cpp
+++ b/src/corelib/serialization/qcborstream.cpp
@@ -420,7 +420,7 @@ QDebug operator<<(QDebug dbg, QCborKnownTags tag)
\value IllegalSimpleType The CBOR stream contains a Simple Type encoded incorrectly (data is
corrupt and the error is not recoverable).
\value InvalidUtf8String The CBOR stream contains a text string that does not decode properly
- as UTF (data is corrupt and the error is not recoverable).
+ as UTF-8 (data is corrupt and the error is not recoverable).
\value DataTooLarge CBOR string, map or array is too big and cannot be parsed by Qt
(internal limitation, but the error is not recoverable).
\value NestingTooDeep Too many levels of arrays or maps encountered while processing the
@@ -429,6 +429,24 @@ QDebug operator<<(QDebug dbg, QCborKnownTags tag)
support (internal limitation, but the error is not recoverable).
*/
+// Convert from CborError to QCborError.
+//
+// Centralized in a function in case we need to make more adjustments in the
+// future.
+static QCborError fromCborError(CborError err)
+{
+ return { QCborError::Code(int(err)) };
+}
+
+// Convert to CborError from QCborError.
+//
+// Centralized in a function in case we need to make more adjustments in the
+// future.
+static CborError toCborError(QCborError c)
+{
+ return CborError(int(c.c));
+}
+
/*!
\variable QCborError::c
\internal
@@ -499,8 +517,8 @@ QString QCborError::toString() const
return QStringLiteral("Internal limitation: unsupported type");
}
- // get the error from TinyCBOR
- CborError err = CborError(int(c));
+ // get the error string from TinyCBOR
+ CborError err = toCborError(*this);
return QString::fromLatin1(cbor_error_string(err));
}
@@ -1839,8 +1857,7 @@ public:
if (err != CborErrorUnexpectedEOF)
corrupt = true;
- // our error codes are the same (for now)
- lastError = { QCborError::Code(err) };
+ lastError = fromCborError(err);
}
void updateBufferAfterString(qsizetype offset, qsizetype size)
diff --git a/src/corelib/tools/qscopeguard.qdoc b/src/corelib/tools/qscopeguard.qdoc
index 21b0bab9cf..5a9b7fd210 100644
--- a/src/corelib/tools/qscopeguard.qdoc
+++ b/src/corelib/tools/qscopeguard.qdoc
@@ -37,6 +37,12 @@ QT_BEGIN_NAMESPACE
a scope.
*/
+/*! \fn template <typename F> void QScopeGuard<F>::dismiss()
+
+ Disarms the scope guard, so that the function \e F will not be called at
+ the end of the scope.
+*/
+
/*!
\fn template <typename F> const QScopeGuard<F> qScopeGuard(F f)
\inmodule QtCore