QCAD
Open Source 2D CAD
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
RColor Class Reference

Color. More...

#include <RColor.h>

List of all members.

Public Types

enum  Mode { ByLayer, ByBlock, Fixed }

Public Member Functions

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
 RColor ()
 Constructs an invalid color with the fixed RGB value (0, 0, 0).
 RColor (int r, int g, int b, int a=255, RColor::Mode mode=RColor::Fixed)
 RColor (RColor::Mode mode)
 RColor (const QString &name, RColor::Mode mode=RColor::Fixed)
 RColor (Qt::GlobalColor color, RColor::Mode mode=RColor::Fixed)
 RColor (const QColor &color, RColor::Mode mode=RColor::Fixed)
QColor toCompat () const

Static Public Member Functions

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 RColor getHighlighted (const RColor &color, const QColor &bgColor)
static QIcon getIcon (const RColor &color, const QSize &size=RDEFAULT_QSIZE_ICON)
static QList< QPair< QString,
RColor > > 
getList (bool onlyFixed=false)

Static Public Attributes

static QColor CompatByBlock = QColor(2,2,2)
static QColor CompatByLayer = QColor(1,1,1)
 Copyright (c) 2011-2014 by Andrew Mustun.

Private Member Functions

 Q_DECLARE_TR_FUNCTIONS (RColor)

Static Private Member Functions

static void init ()
static void init (const QString &cn, const RColor &c)

Private Attributes

Mode mode

Static Private Attributes

static const double cadColors [][3]
 Copyright (c) 2011-2014 by Andrew Mustun.
static QMap< QPair< RColor,
QPair< int, int > >, QIcon > 
iconMap
static bool isInitialized = false
static QList< QPair< QString,
RColor > > 
list

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.

Detailed Description

Color.

Fixed RGBA or ByLayer or ByBlock.

Scriptable:
This class is wrapped for script environments.
Copyable:
Script wrappers of this class should pass objects by reference.

Member Enumeration Documentation

Enumerator:
ByLayer 
ByBlock 
Fixed 

Constructor & Destructor Documentation

RColor::RColor ( )

Constructs an invalid color with the fixed RGB value (0, 0, 0).

RColor::RColor ( int  r,
int  g,
int  b,
int  a = 255,
RColor::Mode  mode = RColor::Fixed 
)
RColor::RColor ( RColor::Mode  mode)
RColor::RColor ( const QString &  name,
RColor::Mode  mode = RColor::Fixed 
)
RColor::RColor ( Qt::GlobalColor  color,
RColor::Mode  mode = RColor::Fixed 
)
   \par Non-Scriptable:

This function is not available in script environments.

RColor::RColor ( const QColor &  color,
RColor::Mode  mode = RColor::Fixed 
)
   \par Non-Scriptable:

This function is not available in script environments.


Member Function Documentation

static RColor RColor::createFromCadCustom ( const QString &  code)
inlinestatic
RColor RColor::createFromCadCustom ( int  code)
static

Creates a color from the given CAD code (RGB encoded int).

static RColor RColor::createFromCadIndex ( const QString &  code)
inlinestatic
RColor RColor::createFromCadIndex ( int  code)
static

Creates a color from the given CAD code (index 0...256).

RColor RColor::createFromName ( const QString &  name)
static
int RColor::getColorIndex ( ) const
Returns:
CAD index of this color used in MTEXT strings.
int RColor::getCustomColorCode ( ) const
unsigned long long RColor::getHash ( ) const
RColor RColor::getHighlighted ( const RColor color,
const QColor &  bgColor 
)
static
Returns:
Highlighted color for the given color.
QIcon RColor::getIcon ( const RColor color,
const QSize &  size = RDEFAULT_QSIZE_ICON 
)
static
QList< QPair< QString, RColor > > RColor::getList ( bool  onlyFixed = false)
static
Returns:
List of known colors.
Parameters:
onlyFixedOnly fixed colors, not ByLayer, ByBlock, ...
QString RColor::getName ( ) const
Returns:
Name of the color if known, otherwise "#RRGGBB".
void RColor::init ( )
staticprivate
void RColor::init ( const QString &  cn,
const RColor c 
)
staticprivate
bool RColor::isByBlock ( ) const
bool RColor::isByLayer ( ) const
bool RColor::isFixed ( ) const
bool RColor::isValid ( ) const
bool RColor::operator!= ( const RColor color) const
bool RColor::operator< ( const RColor color) const
bool RColor::operator== ( const RColor color) const
RColor::Q_DECLARE_TR_FUNCTIONS ( RColor  )
private
QColor RColor::toCompat ( ) const
Returns:
QColor compatibility equivlent of the current color.

Friends And Related Function Documentation

QCADCORE_EXPORT QDataStream& operator<< ( QDataStream &  stream,
const RColor color 
)
friend

Serializes the given RColor object.

Used for RSettings, keep in sync with operator>>.

Non-Scriptable:
This function is not available in script environments.
QCADCORE_EXPORT QDataStream& operator>> ( QDataStream &  stream,
RColor color 
)
friend

Deserializes the given RColor object.

Non-Scriptable:
This function is not available in script environments.

Member Data Documentation

const double RColor::cadColors
staticprivate

Copyright (c) 2011-2014 by Andrew Mustun.

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.

QColor RColor::CompatByBlock = QColor(2,2,2)
static
QColor RColor::CompatByLayer = QColor(1,1,1)
static

Copyright (c) 2011-2014 by Andrew Mustun.

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.

QMap< QPair< RColor, QPair< int, int > >, QIcon > RColor::iconMap
staticprivate
bool RColor::isInitialized = false
staticprivate
QList< QPair< QString, RColor > > RColor::list
staticprivate
Mode RColor::mode
private

The documentation for this class was generated from the following files: