Editor: Do color to int conversion in ColorEditor

pull/251/head^2
Rob Cutmore 8 years ago
parent c7241c692f
commit 3f2cd9b669

@ -64,6 +64,11 @@ QColor CSVWidget::ColorEditor::color() const
return mColor;
}
int CSVWidget::ColorEditor::colorInt() const
{
return (mColor.blue() << 16) | (mColor.green() << 8) | (mColor.red());
}
void CSVWidget::ColorEditor::setColor(const QColor &color)
{
mColor = color;

@ -26,6 +26,10 @@ namespace CSVWidget
ColorEditor(const int colorInt, QWidget *parent = 0, const bool popupOnStart = false);
QColor color() const;
/// \return Color RGB value encoded in an int.
int colorInt() const;
void setColor(const QColor &color);
/// \brief Set color using given int value.

@ -133,8 +133,7 @@ void CSVWorld::CommandDelegate::setModelDataImp (QWidget *editor, QAbstractItemM
CSVWidget::ColorEditor *colorEditor = qobject_cast<CSVWidget::ColorEditor *>(editor);
if (colorEditor != NULL)
{
QColor color = colorEditor->color();
variant = (color.blue() << 16) | (color.green() << 8) | (color.red());
variant = colorEditor->colorInt();
}
else
{

Loading…
Cancel
Save