forked from teamnwah/openmw-tes3coop
Editor: Do color to int conversion in ColorEditor
This commit is contained in:
parent
c7241c692f
commit
3f2cd9b669
3 changed files with 10 additions and 2 deletions
|
@ -64,6 +64,11 @@ QColor CSVWidget::ColorEditor::color() const
|
||||||
return mColor;
|
return mColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int CSVWidget::ColorEditor::colorInt() const
|
||||||
|
{
|
||||||
|
return (mColor.blue() << 16) | (mColor.green() << 8) | (mColor.red());
|
||||||
|
}
|
||||||
|
|
||||||
void CSVWidget::ColorEditor::setColor(const QColor &color)
|
void CSVWidget::ColorEditor::setColor(const QColor &color)
|
||||||
{
|
{
|
||||||
mColor = color;
|
mColor = color;
|
||||||
|
|
|
@ -26,6 +26,10 @@ namespace CSVWidget
|
||||||
ColorEditor(const int colorInt, QWidget *parent = 0, const bool popupOnStart = false);
|
ColorEditor(const int colorInt, QWidget *parent = 0, const bool popupOnStart = false);
|
||||||
|
|
||||||
QColor color() const;
|
QColor color() const;
|
||||||
|
|
||||||
|
/// \return Color RGB value encoded in an int.
|
||||||
|
int colorInt() const;
|
||||||
|
|
||||||
void setColor(const QColor &color);
|
void setColor(const QColor &color);
|
||||||
|
|
||||||
/// \brief Set color using given int value.
|
/// \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);
|
CSVWidget::ColorEditor *colorEditor = qobject_cast<CSVWidget::ColorEditor *>(editor);
|
||||||
if (colorEditor != NULL)
|
if (colorEditor != NULL)
|
||||||
{
|
{
|
||||||
QColor color = colorEditor->color();
|
variant = colorEditor->colorInt();
|
||||||
variant = (color.blue() << 16) | (color.green() << 8) | (color.red());
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue