18#include "colormanager.h"
28ColorManager::~ColorManager()
32bool ColorManager::init()
39 mCurrentColorIndex = 0;
40 mCurrentFrontColor = o->data()->getCurrentColor();
47 o->data()->setCurrentColor(mCurrentFrontColor);
51void ColorManager::workingLayerChanged(
Layer* layer)
53 mIsWorkingOnVectorLayer = (layer->type() == Layer::VECTOR);
54 if (mIsWorkingOnVectorLayer)
56 mCurrentFrontColor = object()->getColor(mCurrentColorIndex).color;
57 emit colorChanged(mCurrentFrontColor, mCurrentColorIndex);
63 if (mIsWorkingOnVectorLayer && useIndexedColor)
64 return object()->getColor(mCurrentColorIndex).color;
66 return mCurrentFrontColor;
69void ColorManager::setColorNumber(
int n)
73 mCurrentColorIndex = n;
75 QColor currentColor = object()->getColor(mCurrentColorIndex).color;
77 emit colorNumberChanged(mCurrentColorIndex);
78 setFrontColor(currentColor);
81void ColorManager::setFrontColor(
const QColor& newFrontColor)
83 mCurrentFrontColor = newFrontColor;
84 emit colorChanged(newFrontColor, mCurrentColorIndex);
89 object()->setColor(mCurrentColorIndex, newColor);
90 emit colorChanged(newColor, mCurrentColorIndex);
93int ColorManager::frontColorNumber()
const
95 return mCurrentColorIndex;
void setIndexedColor(const QColor &newColor)
Set color for current index.
QColor frontColor(bool useIndexedColor=true)
frontColor