From efb21f629aba0bbc7801f9b26f1cd7814358c08a Mon Sep 17 00:00:00 2001 From: parax0 Date: Sat, 26 Dec 2015 00:42:34 -0700 Subject: [PATCH] Fixed bugged color pickers caused by incorrect conversion from CColor to QColor --- src/Editor/ModelEditor/CModelEditorWindow.cpp | 8 ++++---- src/Editor/Widgets/WPropertyEditor.cpp | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Editor/ModelEditor/CModelEditorWindow.cpp b/src/Editor/ModelEditor/CModelEditorWindow.cpp index 85882df2..197a2257 100644 --- a/src/Editor/ModelEditor/CModelEditorWindow.cpp +++ b/src/Editor/ModelEditor/CModelEditorWindow.cpp @@ -234,10 +234,10 @@ void CModelEditorWindow::SetActiveMaterial(int MatIndex) { QColor Color; CColor KColor = mpCurrentMat->Konst(iKonst); - Color.setRed(KColor.r); - Color.setGreen(KColor.g); - Color.setBlue(KColor.b); - Color.setAlpha(KColor.a); + Color.setRed(KColor.r * 255); + Color.setGreen(KColor.g * 255); + Color.setBlue(KColor.b * 255); + Color.setAlpha(KColor.a * 255); if (iKonst == 0) ui->KonstColorPickerA->setColor(Color); else if (iKonst == 1) ui->KonstColorPickerB->setColor(Color); diff --git a/src/Editor/Widgets/WPropertyEditor.cpp b/src/Editor/Widgets/WPropertyEditor.cpp index 5614161d..57ecfeaa 100644 --- a/src/Editor/Widgets/WPropertyEditor.cpp +++ b/src/Editor/Widgets/WPropertyEditor.cpp @@ -244,7 +244,7 @@ void WPropertyEditor::CreateEditor() WColorPicker *pColorPicker = new WColorPicker(this); CColor color = pColorCast->Get(); - QColor qcolor = QColor(color.r, color.g, color.b, color.a); + QColor qcolor = QColor(color.r * 255, color.g * 255, color.b * 255, color.a * 255); pColorPicker->setColor(qcolor); mUI.EditorWidget = pColorPicker; @@ -424,7 +424,7 @@ void WPropertyEditor::UpdateEditor() WColorPicker *pColorPicker = static_cast(mUI.EditorWidget); CColor color = pColorCast->Get(); - QColor qcolor = QColor(color.r, color.g, color.b, color.a); + QColor qcolor = QColor(color.r * 255, color.g * 255, color.b * 255, color.a * 255); pColorPicker->setColor(qcolor); break;