20 #include <QPainter> |
20 #include <QPainter> |
21 #include "colors.h" |
21 #include "colors.h" |
22 #include "guiutilities.h" |
22 #include "guiutilities.h" |
23 #include "lddocument.h" |
23 #include "lddocument.h" |
24 #include "mainwindow.h" |
24 #include "mainwindow.h" |
25 |
|
26 GuiUtilities::GuiUtilities (QObject* parent) : |
|
27 QObject (parent), |
|
28 HierarchyElement (parent) {} |
|
29 |
25 |
30 /* |
26 /* |
31 * makeColorIcon |
27 * makeColorIcon |
32 * |
28 * |
33 * Creates an icon to represent an LDraw color. |
29 * Creates an icon to represent an LDraw color. |
61 /* |
57 /* |
62 * fillUsedColorsToComboBox |
58 * fillUsedColorsToComboBox |
63 * |
59 * |
64 * Fills the provided combo box with the colors used in the current document. |
60 * Fills the provided combo box with the colors used in the current document. |
65 */ |
61 */ |
66 void GuiUtilities::fillUsedColorsToComboBox (QComboBox* box) |
62 void GuiUtilities::fillUsedColorsToComboBox(Model* model, QComboBox* box) |
67 { |
63 { |
68 QMap<LDColor, int> frequencies; |
64 QMap<LDColor, int> frequencies; |
69 |
65 |
70 for (LDObject* object : currentDocument()->objects()) |
66 for (LDObject* object : model->objects()) |
71 { |
67 { |
72 if (object->isColored() and object->color().isValid()) |
68 if (object->isColored() and object->color().isValid()) |
73 { |
69 { |
74 if (not frequencies.contains(object->color())) |
70 if (not frequencies.contains(object->color())) |
75 frequencies[object->color()] = 1; |
71 frequencies[object->color()] = 1; |