[Development] Qt 5.3 header diff: QtCore
Giuseppe D'Angelo
giuseppe.dangelo at kdab.com
Wed Apr 23 09:27:08 CEST 2014
Il 22/04/2014 23:12, Thiago Macieira ha scritto:
> http://macieira.org/~thiago/qt-5.3/QtCore.diff
>
>
> QtCore.diff
>
> + void warning(const char *msg, ...) const Q_ATTRIBUTE_FORMAT_PRINTF(2, 3);
> + void critical(const char *msg, ...) const Q_ATTRIBUTE_FORMAT_PRINTF(2, 3);
> +
> + typedef const QLoggingCategory &(*CategoryFunction)();
> +
> + void debug(const QLoggingCategory &cat, const char *msg, ...) const Q_ATTRIBUTE_FORMAT_PRINTF(3, 4);
> + void debug(CategoryFunction catFunc, const char *msg, ...) const Q_ATTRIBUTE_FORMAT_PRINTF(3, 4);
> + void warning(const QLoggingCategory &cat, const char *msg, ...) const Q_ATTRIBUTE_FORMAT_PRINTF(3, 4);
> + void warning(CategoryFunction catFunc, const char *msg, ...) const Q_ATTRIBUTE_FORMAT_PRINTF(3, 4);
> + void critical(const QLoggingCategory &cat, const char *msg, ...) const Q_ATTRIBUTE_FORMAT_PRINTF(3, 4);
> + void critical(CategoryFunction catFunc, const char *msg, ...) const Q_ATTRIBUTE_FORMAT_PRINTF(3, 4);
> diff --git a/src/corelib/io/qloggingcategory.h b/src/corelib/io/qloggingcategory.h
> index 15c0519..4aec8e6 100644
> --- a/src/corelib/io/qloggingcategory.h
> +++ b/src/corelib/io/qloggingcategory.h
> @@ -65,6 +65,7 @@ public:
>
> // allows usage of both factory method and variable in qCX macros
> QLoggingCategory &operator()() { return *this; }
> + const QLoggingCategory &operator()() const { return *this; }
>
> static QLoggingCategory *defaultCategory();
>
> @@ -84,25 +85,36 @@ private:
> };
>
> #define Q_DECLARE_LOGGING_CATEGORY(name) \
> - extern QLoggingCategory &name();
> + extern const QLoggingCategory &name();
>
> // relies on QLoggingCategory(QString) being thread safe!
> #define Q_LOGGING_CATEGORY(name, string) \
> - QLoggingCategory &name() \
> + const QLoggingCategory &name() \
> { \
> - static QLoggingCategory category(string); \
> + static const QLoggingCategory category(string); \
> return category; \
> }
>
> -#define qCDebug(category) \
> - for (bool enabled = category().isDebugEnabled(); Q_UNLIKELY(enabled); enabled = false) \
> - QMessageLogger(__FILE__, __LINE__, Q_FUNC_INFO, category().categoryName()).debug()
> -#define qCWarning(category) \
> - for (bool enabled = category().isWarningEnabled(); enabled; enabled = false) \
> - QMessageLogger(__FILE__, __LINE__, Q_FUNC_INFO, category().categoryName()).warning()
> -#define qCCritical(category) \
> - for (bool enabled = category().isCriticalEnabled(); enabled; enabled = false) \
> - QMessageLogger(__FILE__, __LINE__, Q_FUNC_INFO, category().categoryName()).critical()
> +#ifdef Q_COMPILER_VARIADIC_MACROS
> +
> +#define qCDebug(category, ...) \
> + for (bool qt_category_enabled = category().isDebugEnabled(); qt_category_enabled; qt_category_enabled = false) \
> + QMessageLogger(__FILE__, __LINE__, Q_FUNC_INFO, category().categoryName()).debug(__VA_ARGS__)
> +#define qCWarning(category, ...) \
> + for (bool qt_category_enabled = category().isWarningEnabled(); qt_category_enabled; qt_category_enabled = false) \
> + QMessageLogger(__FILE__, __LINE__, Q_FUNC_INFO, category().categoryName()).warning(__VA_ARGS__)
> +#define qCCritical(category, ...) \
> + for (bool qt_category_enabled = category().isCriticalEnabled(); qt_category_enabled; qt_category_enabled = false) \
> + QMessageLogger(__FILE__, __LINE__, Q_FUNC_INFO, category().categoryName()).critical(__VA_ARGS__)
> +
> +#else
> +
> +// check for enabled category inside QMessageLogger.
> +#define qCDebug qDebug
> +#define qCWarning qWarning
> +#define qCCritical qCritical
> +
> +#endif // Q_COMPILER_VARIADIC_MACROS
>
> #if defined(QT_NO_DEBUG_OUTPUT)
> # undef qCDebug
These two change combined trigger QTBUG-37283: it's now not possible to
use qCDebug(cat) on a compiler w/o variadic macros, where cat is a
function that returns a QLoggingCategory subclass. That's because
const QLoggingCategorySubclass &(*)()
is not a type compatible with CategoryFunction above. Perhaps the header
can be refactored?
> @@ -512,6 +518,9 @@ public:
> AA_SynthesizeTouchForUnhandledMouseEvents = 11,
> AA_SynthesizeMouseForUnhandledTouchEvents = 12,
> AA_UseHighDpiPixmaps = 13,
> + AA_ForceRasterWidgets = 14,
> + AA_UseDesktopOpenGL = 15,
> + AA_UseOpenGLES = 16,
Are the last two already used in 5.3?
Thanks,
--
Join us Oct 6-8 at BCC Berlin for Qt Developer Days 2014!
Giuseppe D'Angelo | giuseppe.dangelo at kdab.com | Software Engineer
KDAB (UK) Ltd., a KDAB Group company
Tel. UK +44-1738-450410, Sweden (HQ) +46-563-540090
KDAB - Qt Experts - Platform-independent software solutions
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4048 bytes
Desc: Firma crittografica S/MIME
URL: <http://lists.qt-project.org/pipermail/development/attachments/20140423/019835c6/attachment.bin>
More information about the Development
mailing list