RColor
Class in Core Module
Header: #include <src/core/RColor.h>
Inherits: QColor
Description
Section titled “Description”Color.
Fixed RGBA or ByLayer or ByBlock.
Scriptable: This class is available in script environments.
Copyable: Objects are cleaned up automatically by the garbage collector of the script engine.
Public Types
Section titled “Public Types”| enum | Mode { ByLayer, ByBlock, Fixed } |
Public Functions
Section titled “Public Functions”RColor()Constructs an invalid color with the fixed RGB value (0, 0, 0). |
|
RColor(const QColor &color, RColor::Mode mode=RColor::Fixed) |
|
RColor(const QString &name, RColor::Mode mode=RColor::Fixed) |
|
RColor(int r, int g, int b, int a=255, RColor::Mode mode=RColor::Fixed) |
|
RColor(Qt::GlobalColor color, RColor::Mode mode=RColor::Fixed) |
|
RColor(RColor::Mode mode) |
|
| int | getColorIndex() const |
| int | getCustomColorCode() const |
| unsigned long long | getHash() const |
| QString | getName() const |
| bool | isByBlock() const |
| bool | isByLayer() const |
| bool | isFixed() const |
| bool | isValid() const |
| bool | operator!=(const RColor &color) const |
| bool | operator<(const RColor &color) const |
| bool | operator==(const RColor &color) const |
| void | setCompat(const QColor &col)Initializes this color based on the given compatibility color. |
| QColor | toCompat() const |
Static Public Functions
Section titled “Static Public Functions”| static void | addColor(const QString &cn, const RColor &c) |
| static RColor | createFromCadCustom(const QString &code) |
| static RColor | createFromCadCustom(int code)Creates a color from the given CAD code (RGB encoded int). |
| static RColor | createFromCadIndex(const QString &code) |
| static RColor | createFromCadIndex(int code)Creates a color from the given CAD code (index 0…256). |
| static RColor | createFromName(const QString &name) |
| static QList< RColor > | getColorList(bool onlyFixed=false) |
| static RColor | getFaded(const RColor &color, const QColor &bgColor, double factor=1) |
| static RColor | getHighlighted(const RColor &color, const QColor &bgColor, int minDist=75) |
| static QIcon | getIcon(const RColor &color, const QSize &size=RDEFAULT_QSIZE_ICON) |
| static QList< QPair< QString, RColor > > | getList(bool onlyFixed=false) |
| static QStringList | getNameList(bool onlyFixed=false) |
| static void | reinit() |
| static void | removeColor(const QString &cn) |
Static Public Attributes
Section titled “Static Public Attributes”| static QColor | CompatByBlock |
| static QColor | CompatByLayer |
Private Functions
Section titled “Private Functions”Q_DECLARE_TR_FUNCTIONS(RColor) |
Static Private Functions
Section titled “Static Private Functions”| static void | init() |
| static void | init(const QString &cn, const RColor &c) |
Private Attributes
Section titled “Private Attributes”| Mode | mode |
Static Private Attributes
Section titled “Static Private Attributes”| static const double | cadColors |
| static QMap< QPair< RColor, QPair< int, int > >, QIcon > | iconMap |
| static bool | isInitialized |
| static QList< QPair< QString, RColor > > | list |
Friends
Section titled “Friends”| QCADCORE_EXPORT QDataStream & | operator<<(QDataStream &stream, const RColor &color)Serializes the given RColor object. |
| QCADCORE_EXPORT QDataStream & | operator>>(QDataStream &stream, RColor &color)Deserializes the given RColor object. |
Member Documentation
Section titled “Member Documentation”enum Mode| Value | Description |
|---|---|
ByLayer |
|
ByBlock |
|
Fixed |
RColor
Section titled “RColor”RColor::RColor()Constructs an invalid color with the fixed RGB value (0, 0, 0).
RColor
Section titled “RColor”RColor::RColor(const QColor &color, RColor::Mode mode=RColor::Fixed)Non-Scriptable: This function is not available in script environments.
RColor
Section titled “RColor”explicit RColor::RColor(const QString &name, RColor::Mode mode=RColor::Fixed)explicit
RColor
Section titled “RColor”RColor::RColor(int r, int g, int b, int a=255, RColor::Mode mode=RColor::Fixed)RColor
Section titled “RColor”RColor::RColor(Qt::GlobalColor color, RColor::Mode mode=RColor::Fixed)Non-Scriptable: This function is not available in script environments.
RColor
Section titled “RColor”RColor::RColor(RColor::Mode mode)getColorIndex
Section titled “getColorIndex”int RColor::getColorIndex() constconst
Returns: CAD index of this color used in MTEXT strings.
getCustomColorCode
Section titled “getCustomColorCode”int RColor::getCustomColorCode() constconst
getHash
Section titled “getHash”unsigned long long RColor::getHash() constconst
getName
Section titled “getName”QString RColor::getName() constconst
Returns: Localized name of the color if known, otherwise “#RRGGBB”. For a localization neutral name use name() instead.
isByBlock
Section titled “isByBlock”bool RColor::isByBlock() constconst
isByLayer
Section titled “isByLayer”bool RColor::isByLayer() constconst
isFixed
Section titled “isFixed”bool RColor::isFixed() constconst
isValid
Section titled “isValid”bool RColor::isValid() constconst
operator!=
Section titled “operator!=”bool RColor::operator!=(const RColor &color) constconst
operator<
Section titled “operator<”bool RColor::operator<(const RColor &color) constconst
operator==
Section titled “operator==”bool RColor::operator==(const RColor &color) constconst
setCompat
Section titled “setCompat”void RColor::setCompat(const QColor &col)Initializes this color based on the given compatibility color.
toCompat
Section titled “toCompat”QColor RColor::toCompat() constconst
Returns: QColor compatibility equivalent of the current color.
addColor
Section titled “addColor”static void RColor::addColor(const QString &cn, const RColor &c)static
createFromCadCustom
Section titled “createFromCadCustom”static RColor RColor::createFromCadCustom(const QString &code)static inline
createFromCadCustom
Section titled “createFromCadCustom”static RColor RColor::createFromCadCustom(int code)static
Creates a color from the given CAD code (RGB encoded int).
createFromCadIndex
Section titled “createFromCadIndex”static RColor RColor::createFromCadIndex(const QString &code)static inline
createFromCadIndex
Section titled “createFromCadIndex”static RColor RColor::createFromCadIndex(int code)static
Creates a color from the given CAD code (index 0…256).
createFromName
Section titled “createFromName”static RColor RColor::createFromName(const QString &name)static
getColorList
Section titled “getColorList”static QList< RColor > RColor::getColorList(bool onlyFixed=false)static
getFaded
Section titled “getFaded”static RColor RColor::getFaded(const RColor &color, const QColor &bgColor, double factor=1)static
getHighlighted
Section titled “getHighlighted”static RColor RColor::getHighlighted(const RColor &color, const QColor &bgColor, int minDist=75)static
Returns: Highlighted color for the given color.
getIcon
Section titled “getIcon”static QIcon RColor::getIcon(const RColor &color, const QSize &size=RDEFAULT_QSIZE_ICON)static
getList
Section titled “getList”static QList< QPair< QString, RColor > > RColor::getList(bool onlyFixed=false)static
Returns: List of known colors.
Parameters:
onlyFixed: Only fixed colors, not ByLayer, ByBlock, …
getNameList
Section titled “getNameList”static QStringList RColor::getNameList(bool onlyFixed=false)static
reinit
Section titled “reinit”static void RColor::reinit()static inline
removeColor
Section titled “removeColor”static void RColor::removeColor(const QString &cn)static
CompatByBlock
Section titled “CompatByBlock”static QColor RColor::CompatByBlock = QColor(2,2,2)static
CompatByLayer
Section titled “CompatByLayer”static QColor RColor::CompatByLayer = QColor(1,1,1)static
All rights reserved.
This file is part of the QCAD project.
QCAD is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
QCAD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with QCAD.
Q_DECLARE_TR_FUNCTIONS
Section titled “Q_DECLARE_TR_FUNCTIONS”RColor::Q_DECLARE_TR_FUNCTIONS(RColor)private
static void RColor::init()static private
static void RColor::init(const QString &cn, const RColor &c)static private
Mode RColor::modeprivate
cadColors
Section titled “cadColors”static const double RColor::cadColors [][3]static private
All rights reserved.
This file is part of the QCAD project.
QCAD is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
QCAD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with QCAD.
iconMap
Section titled “iconMap”static QMap< QPair< RColor, QPair< int, int > >, QIcon > RColor::iconMapstatic private
isInitialized
Section titled “isInitialized”static bool RColor::isInitialized = falsestatic private
static QList< QPair< QString, RColor > > RColor::liststatic private
operator<<
Section titled “operator<<”QCADCORE_EXPORT QDataStream & operator<<(QDataStream &stream, const RColor &color)Serializes the given RColor object.
Used for RSettings, keep in sync with operator>>.
Non-Scriptable: This function is not available in script environments.
operator>>
Section titled “operator>>”QCADCORE_EXPORT QDataStream & operator>>(QDataStream &stream, RColor &color)Deserializes the given RColor object.
Non-Scriptable: This function is not available in script environments.