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

@@ -36,6 +36,7 @@
#endif
#include <Base/Interpreter.h>
#include <App/Color.h>
#include "PythonConsole.h"
#include "PythonConsolePy.h"
@@ -528,7 +529,7 @@ void PythonConsole::OnChange(Base::Subject<const char*> &rCaller, const char* sR
QMap<QString, QColor>::Iterator it = d->colormap.find(QString::fromLatin1(sReason));
if (it != d->colormap.end()) {
QColor color = it.value();
unsigned int col = (color.red() << 24) | (color.green() << 16) | (color.blue() << 8);
unsigned int col = App::Color::asPackedRGB<QColor>(color);
auto value = static_cast<unsigned long>(col);
value = rGrp.GetUnsigned(sReason, value);
col = static_cast<unsigned int>(value);
@@ -960,7 +961,7 @@ void PythonConsole::changeEvent(QEvent *e)
else if (e->type() == QEvent::StyleChange) {
QPalette pal = qApp->palette();
QColor color = pal.windowText().color();
unsigned int text = (color.red() << 24) | (color.green() << 16) | (color.blue() << 8);
unsigned int text = App::Color::asPackedRGB<QColor>(color);
auto value = static_cast<unsigned long>(text);
// if this parameter is not already set use the style's window text color
value = getWindowParameter()->GetUnsigned("Text", value);