From c28e61a0f430b4789adf3155559f6a3734b88e0c Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Thu, 1 Mar 2012 17:44:34 +0100 Subject: Fix annoying deprecation warning about QImageTextKeyLang If we deprecate the entire class, then we get the warning for every use of it with GCC, including the three operators defined inside the class. So instead, mark as only the constructors as deprecated, which should reduce the warnings to the places where the class was instantiated. That should be enough to poison the code enough: to fix the warning, you need to stop using the class there and/or stop calling one of the deprecated functions that deal with it. Unfortunately, we still get one more warning inside the inline code, in QImage::textList. To remove that warning, we disable all deprecation warnings around that code block. Change-Id: If3c11647a9d2cab055e15810d7cfe0d8f5e7042f Reviewed-by: Olivier Goffart Reviewed-by: Lars Knoll --- src/gui/image/qimage.h | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/gui/image/qimage.h b/src/gui/image/qimage.h index e9192f1031..6acc03f4bd 100644 --- a/src/gui/image/qimage.h +++ b/src/gui/image/qimage.h @@ -70,10 +70,10 @@ struct QImageData; class QImageDataMisc; // internal #ifndef QT_NO_IMAGE_TEXT #if QT_DEPRECATED_SINCE(5, 0) -class QT_DEPRECATED QImageTextKeyLang { +class QImageTextKeyLang { public: - QImageTextKeyLang(const char* k, const char* l) : key(k), lang(l) { } - QImageTextKeyLang() { } + QT_DEPRECATED QImageTextKeyLang(const char* k, const char* l) : key(k), lang(l) { } + QT_DEPRECATED QImageTextKeyLang() { } QByteArray key; QByteArray lang; @@ -315,6 +315,14 @@ Q_GUI_EXPORT_INLINE void QImage::setPixel(const QPoint &pt, uint index_or_rgb) { #if QT_DEPRECATED_SINCE(5, 0) #ifndef QT_NO_IMAGE_TEXT + +#if defined(Q_CC_GNU) && !defined(Q_CC_INTEL) && (__GNUC__ * 100 + __GNUC_MINOR__ >= 406) +# pragma GCC diagnostic push +# pragma GCC diagnostic ignored "-Wdeprecated-declarations" +#elif defined(Q_CC_MSVC) +# pragma warning(disable: 4996) +#endif + inline QString QImage::text(const char* key, const char* lang) const { if (!d) @@ -384,6 +392,13 @@ inline void QImage::setText(const char* key, const char* lang, const QString &s) k += QLatin1Char('/') + QString::fromAscii(lang); setText(k, s); } + +#if defined(Q_CC_GNU) && !defined(Q_CC_INTEL) && (__GNUC__ * 100 + __GNUC_MINOR__ >= 406) +# pragma GCC diagnostic pop +#elif defined(Q_CC_MSVC) +# pragma warning(default: 4996) +#endif + #endif inline int QImage::numColors() const -- cgit v1.2.3