#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>
\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
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)
} 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;
}
}
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