--- a/src/guiutilities.cpp Thu Jan 04 19:40:52 2018 +0200 +++ b/src/guiutilities.cpp Thu Jan 04 19:44:26 2018 +0200 @@ -23,36 +23,36 @@ #include "ldDocument.h" #include "mainwindow.h" -GuiUtilities::GuiUtilities (QObject* parent) : - QObject (parent), - HierarchyElement (parent) {} +GuiUtilities::GuiUtilities(QObject* parent) : + QObject(parent), + HierarchyElement(parent) {} -QIcon GuiUtilities::makeColorIcon (LDColor ldcolor, int size) +QIcon GuiUtilities::makeColorIcon(LDColor ldcolor, int size) { // Create an image object and link a painter to it. - QImage img (size, size, QImage::Format_ARGB32); - QPainter painter (&img); + QImage img(size, size, QImage::Format_ARGB32); + QPainter painter(&img); QColor color = ldcolor.faceColor(); if (ldcolor == MainColor) { // Use the user preferences for main color here color = config.mainColor(); - color.setAlphaF (config.mainColorAlpha()); + color.setAlphaF(config.mainColorAlpha()); } // Paint the icon border - painter.fillRect (QRect (0, 0, size, size), ldcolor.edgeColor()); + painter.fillRect(QRect(0, 0, size, size), ldcolor.edgeColor()); // Paint the checkerboard background, visible with translucent icons - painter.drawPixmap (QRect (1, 1, size - 2, size - 2), GetIcon ("checkerboard"), QRect (0, 0, 8, 8)); + painter.drawPixmap(QRect(1, 1, size - 2, size - 2), GetIcon("checkerboard"), QRect(0, 0, 8, 8)); // Paint the color above the checkerboard - painter.fillRect (QRect (1, 1, size - 2, size - 2), color); - return QIcon (QPixmap::fromImage (img)); + painter.fillRect(QRect(1, 1, size - 2, size - 2), color); + return QIcon(QPixmap::fromImage(img)); } -void GuiUtilities::fillUsedColorsToComboBox (QComboBox* box) +void GuiUtilities::fillUsedColorsToComboBox(QComboBox* box) { QMap<LDColor, int> counts; @@ -61,7 +61,7 @@ if (not obj->isColored() or not obj->color().isValid()) continue; - if (not counts.contains (obj->color())) + if (not counts.contains(obj->color())) counts[obj->color()] = 1; else counts[obj->color()] += 1; @@ -70,25 +70,25 @@ box->clear(); int row = 0; - QMapIterator<LDColor, int> it (counts); + QMapIterator<LDColor, int> it(counts); while (it.hasNext()) { it.next(); - QIcon ico = makeColorIcon (it.key(), 16); - box->addItem (ico, format ("[%1] %2 (%3 object%4)", - it.key(), it.key().name(), it.value(), plural (it.value()))); - box->setItemData (row, it.key().index()); + QIcon ico = makeColorIcon(it.key(), 16); + box->addItem(ico, format("[%1] %2(%3 object%4)", + it.key(), it.key().name(), it.value(), plural(it.value()))); + box->setItemData(row, it.key().index()); ++row; } } QColor GuiUtilities::mainColorRepresentation() { - QColor col (config.mainColor()); + QColor col(config.mainColor()); if (not col.isValid()) - return QColor (0, 0, 0); + return QColor(0, 0, 0); - col.setAlpha (config.mainColorAlpha() * 255.f); + col.setAlpha(config.mainColorAlpha() * 255.f); return col; }