wmayer patch for Win & OCC7 compat

This commit is contained in:
WandererFan
2016-05-17 21:44:49 -04:00
committed by wmayer
parent 015c538638
commit 3b96cbbeb6
17 changed files with 59 additions and 59 deletions

View File

@@ -28,7 +28,6 @@
# include <stdint.h>
#endif
#include <QColor>
#include <sstream>
#include <iomanip>
@@ -52,11 +51,6 @@ public:
*/
Color(uint32_t rgba)
{ setPackedValue( rgba ); }
/**
* creates FC Color from Qt QColor
*/
Color(QColor q)
{ set(q.redF(),q.greenF(),q.blueF()); }
/** Copy constructor. */
Color(const Color& c)
:r(c.r),g(c.g),b(c.b),a(c.a){}
@@ -111,17 +105,23 @@ public:
(uint32_t)(a*255.0f + 0.5f));
}
/**
* returns Qt color equivalent to FC color
*
*/
QColor asQColor()
{
return(QColor(int(r*255.0),int(g*255.0),int(b*255.0)));
* creates FC Color from template type, e.g. Qt QColor
*/
template <typename T>
void setValue(const T& q)
{ set(q.redF(),q.greenF(),q.blueF()); }
/**
* returns a template type e.g. Qt color equivalent to FC color
*
*/
template <typename T>
inline T asValue(void) const {
return(T(int(r*255.0),int(g*255.0),int(b*255.0)));
}
/**
* returns color as CSS color "#RRGGBB"
*
*/
* returns color as CSS color "#RRGGBB"
*
*/
std::string asCSSString() {
std::stringstream ss;
ss << "#" << std::hex << std::uppercase << std::setfill('0') << std::setw(2) << int(r*255.0)