summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@intel.com>2012-03-01 17:44:34 +0100
committerQt by Nokia <qt-info@nokia.com>2012-03-26 14:45:29 +0200
commitc28e61a0f430b4789adf3155559f6a3734b88e0c (patch)
tree5843ab2192d2b5aa48fc9d54cc97e2951ced8d02 /src
parentde37821c56b2579a3088aef1c391cdf345deb190 (diff)
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 <ogoffart@woboq.com> Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
Diffstat (limited to 'src')
-rw-r--r--src/gui/image/qimage.h21
1 files changed, 18 insertions, 3 deletions
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