Use faster ctor for QColor

Change-Id: Id4e44222e6e0dd61b1a73d774906e8804ba75a73
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
This commit is contained in:
Robert Loehning
2018-09-05 22:35:19 +02:00
parent da6c7972b0
commit 461d5b5d15
2 changed files with 16 additions and 16 deletions

View File

@@ -524,7 +524,7 @@ bool DefaultStyleEngine::areStackingRoles(DObject::VisualPrimaryRole rhsPrimaryR
QColor DefaultStyleEngine::baseColor(ElementType elementType, ObjectVisuals objectVisuals) QColor DefaultStyleEngine::baseColor(ElementType elementType, ObjectVisuals objectVisuals)
{ {
if (objectVisuals.visualSecondaryRole() == DObject::SecondaryRoleOutline) if (objectVisuals.visualSecondaryRole() == DObject::SecondaryRoleOutline)
return QColor("#FFFFFF"); return QColor(0xFF, 0xFF, 0xFF);
QColor baseColor; QColor baseColor;
@@ -534,33 +534,33 @@ QColor DefaultStyleEngine::baseColor(ElementType elementType, ObjectVisuals obje
} else { } else {
switch (elementType) { switch (elementType) {
case TypePackage: case TypePackage:
baseColor = QColor("#7C98AD"); baseColor = QColor(0x7C, 0x98, 0xAD);
break; break;
case TypeComponent: case TypeComponent:
baseColor = QColor("#A0A891"); baseColor = QColor(0xA0, 0xA8, 0x91);
break; break;
case TypeClass: case TypeClass:
baseColor = QColor("#E5A858"); baseColor = QColor(0xE5, 0xA8, 0x58);
break; break;
case TypeItem: case TypeItem:
baseColor = QColor("#B995C6"); baseColor = QColor(0xB9, 0x95, 0xC6);
break; break;
case TypeRelation: case TypeRelation:
case TypeAnnotation: case TypeAnnotation:
case TypeBoundary: case TypeBoundary:
case TypeSwimlane: case TypeSwimlane:
case TypeOther: case TypeOther:
baseColor = QColor("#BF7D65"); baseColor = QColor(0xBF, 0x7D, 0x65);
break; break;
} }
} }
} else { } else {
static QColor customColors[] = { static QColor customColors[] = {
QColor("#EE8E99").darker(110), // ROLE_CUSTOM1, QColor(0xEE, 0x8E, 0x99).darker(110), // ROLE_CUSTOM1,
QColor("#80AF47").lighter(130), // ROLE_CUSTOM2, QColor(0x80, 0xAF, 0x47).lighter(130), // ROLE_CUSTOM2,
QColor("#FFA15B").lighter(100), // ROLE_CUSTOM3, QColor(0xFF, 0xA1, 0x5B).lighter(100), // ROLE_CUSTOM3,
QColor("#55C4CF").lighter(120), // ROLE_CUSTOM4, QColor(0x55, 0xC4, 0xCF).lighter(120), // ROLE_CUSTOM4,
QColor("#FFE14B") // ROLE_CUSTOM5, QColor(0xFF, 0xE1, 0x4B) // ROLE_CUSTOM5,
}; };
int index = static_cast<int>(objectVisuals.visualPrimaryRole()) - static_cast<int>(DObject::PrimaryRoleCustom1); int index = static_cast<int>(objectVisuals.visualPrimaryRole()) - static_cast<int>(DObject::PrimaryRoleCustom1);

View File

@@ -36,11 +36,11 @@ ClangQueryExampleHighlighter::ClangQueryExampleHighlighter()
: m_marker(*this) : m_marker(*this)
{ {
std::array<QTextCharFormat, 5> textFormats; std::array<QTextCharFormat, 5> textFormats;
textFormats[0].setBackground(QColor("#c9ffc3")); textFormats[0].setBackground(QColor(0xc9, 0xff, 0xc3));
textFormats[1].setBackground(QColor("#c3d9ff")); textFormats[1].setBackground(QColor(0xc3, 0xd9, 0xff));
textFormats[2].setBackground(QColor("#e5c3ff")); textFormats[2].setBackground(QColor(0xe5, 0xc3, 0xff));
textFormats[3].setBackground(QColor("#ffc3cb")); textFormats[3].setBackground(QColor(0xff, 0xc3, 0xcb));
textFormats[4].setBackground(QColor("#ffe8c3")); textFormats[4].setBackground(QColor(0xff, 0xe8, 0xc3));
m_marker.setTextFormats(std::move(textFormats)); m_marker.setTextFormats(std::move(textFormats));