Gui: use Color::asPackedRGB<QColor>()

This commit is contained in:
wmayer
2023-02-25 18:21:16 +01:00
committed by wwmayer
parent 41e6c17605
commit 7c359469ba
7 changed files with 44 additions and 39 deletions

View File

@@ -30,6 +30,7 @@
#include <Base/Console.h>
#include <Base/Tools.h>
#include <App/Color.h>
#include "PrefWidgets.h"
@@ -555,9 +556,7 @@ void PrefColorButton::restorePreferences()
if (!m_Restored)
m_Default = color();
const QColor &col = m_Default;
unsigned int icol = (col.red() << 24) | (col.green() << 16) | (col.blue() << 8) | col.alpha();
unsigned int icol = App::Color::asPackedRGBA<QColor>(m_Default);
unsigned long lcol = static_cast<unsigned long>(icol);
lcol = getWindowParameter()->GetUnsigned( entryName(), lcol );
@@ -581,7 +580,7 @@ void PrefColorButton::savePreferences()
QColor col = color();
// (r,g,b,a) with a = 255 (opaque)
unsigned int icol = (col.red() << 24) | (col.green() << 16) | (col.blue() << 8) | col.alpha();
unsigned int icol = App::Color::asPackedRGBA<QColor>(col);
unsigned long lcol = static_cast<unsigned long>(icol);
getWindowParameter()->SetUnsigned( entryName(), lcol );
}