mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-01 03:21:41 +00:00
Editor: Do color to int conversion in ColorEditor
This commit is contained in:
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…
Reference in New Issue
Block a user