diff --git a/apps/opencs/view/widget/coloreditor.cpp b/apps/opencs/view/widget/coloreditor.cpp index 4cccf504d..5f82f8e26 100644 --- a/apps/opencs/view/widget/coloreditor.cpp +++ b/apps/opencs/view/widget/coloreditor.cpp @@ -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; diff --git a/apps/opencs/view/widget/coloreditor.hpp b/apps/opencs/view/widget/coloreditor.hpp index 850cf6b2f..668f22cc9 100644 --- a/apps/opencs/view/widget/coloreditor.hpp +++ b/apps/opencs/view/widget/coloreditor.hpp @@ -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. diff --git a/apps/opencs/view/world/util.cpp b/apps/opencs/view/world/util.cpp index 7c1436d26..efba1ea82 100644 --- a/apps/opencs/view/world/util.cpp +++ b/apps/opencs/view/world/util.cpp @@ -133,8 +133,7 @@ void CSVWorld::CommandDelegate::setModelDataImp (QWidget *editor, QAbstractItemM CSVWidget::ColorEditor *colorEditor = qobject_cast(editor); if (colorEditor != NULL) { - QColor color = colorEditor->color(); - variant = (color.blue() << 16) | (color.green() << 8) | (color.red()); + variant = colorEditor->colorInt(); } else {