Get rid of QColor::allowX11ColorNames().
authorSamuel Rødal <samuel.rodal@nokia.com>
Wed, 7 Sep 2011 11:46:42 +0000 (13:46 +0200)
committerSamuel Rødal <samuel.rodal@nokia.com>
Wed, 7 Sep 2011 12:02:41 +0000 (14:02 +0200)
This code is no longer in use.

Change-Id: I1e582b8a5f1fad40ef75e412162f3aa9f10ab535
Reviewed-on: http://codereview.qt.nokia.com/4352
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Kent Hansen <kent.hansen@nokia.com>
src/gui/painting/qcolor.cpp
src/gui/painting/qcolor.h

index 93492ab..8234fa1 100644 (file)
 #include "qvariant.h"
 #include "qdebug.h"
 
-#ifdef Q_WS_X11
-#  include "qapplication.h"
-#  include "qx11info_x11.h"
-#  include "private/qt_x11_p.h"
-
-static bool allowX11ColorNames = false;
-
-#endif
-
 #include <math.h>
 #include <stdio.h>
 #include <limits.h>
@@ -163,9 +154,6 @@ QT_BEGIN_NAMESPACE
 
     \img alphafill.png
 
-    Alpha-blended drawing is supported on Windows, Mac OS X, and on
-    X11 systems that have the X Render extension installed.
-
     The alpha channel of a color can be retrieved and set using the
     alpha() and setAlpha() functions if its value is an integer, and
     alphaF() and setAlphaF() if its value is qreal (double). By
@@ -520,13 +508,11 @@ QString QColor::name() const
        same as defined by the Qt::GlobalColor enums, e.g. "green" and Qt::green does not
        refer to the same color.
     \i \c transparent - representing the absence of a color.
-    \i \e{X11 only}: If allowX11ColorNames() returns true, any valid X11 color name. See
-       the documentation for \c XParseColor() for information about valid X11 color names.
     \endlist
 
     The color is invalid if \a name cannot be parsed.
 
-    \sa QColor(), name(), isValid(), allowX11ColorNames()
+    \sa QColor(), name(), isValid()
 */
 
 void QColor::setNamedColor(const QString &name)
@@ -576,20 +562,8 @@ bool QColor::setColorFromString(const QString &name)
     } else
 #endif
     {
-#ifdef Q_WS_X11
-        XColor result;
-        if (allowX11ColorNames()
-            && QApplication::instance()
-            && QX11Info::display()
-            && XParseColor(QX11Info::display(), QX11Info::appColormap(), name.toLatin1().constData(), &result)) {
-            setRgb(result.red >> 8, result.green >> 8, result.blue >> 8);
-            return true;
-        } else
-#endif
-        {
-            invalidate();
-            return false;
-        }
+        invalidate();
+        return false;
     }
 }
 
@@ -2417,35 +2391,6 @@ QColor::operator QVariant() const
     return QVariant(QVariant::Color, this);
 }
 
-#ifdef Q_WS_X11
-/*!
-    Returns true if setNamedColor() is allowed to look up colors in the X11
-    color database. By default, this function returns false.
-
-    \note This function is only available on the X11 platform.
-
-    \sa setAllowX11ColorNames()
-*/
-bool QColor::allowX11ColorNames()
-{
-    return ::allowX11ColorNames;
-}
-
-/*!
-    Allow setNamedColor() to look up colors in the X11 color database if
-    \a enabled. By default, setNamedColor() does \e not look up colors in the
-    X11 color database.
-
-    \note This function is only available on the X11 platform.
-
-    \sa setNamedColor(), allowX11ColorNames()
-*/
-void QColor::setAllowX11ColorNames(bool enabled)
-{
-    ::allowX11ColorNames = enabled;
-}
-#endif
-
 /*! \internal
 
     Marks the color as invalid and sets all components to zero (alpha is set
index 1dd6c2a..460a431 100644 (file)
@@ -203,11 +203,6 @@ public:
 
     operator QVariant() const;
 
-#ifdef Q_WS_X11
-    static bool allowX11ColorNames();
-    static void setAllowX11ColorNames(bool enabled);
-#endif
-
     static bool isValidColor(const QString &name);
 
 private: