| 128 |
128 |
| 129 // Show a color edit dialog for the types that actually use the color |
129 // Show a color edit dialog for the types that actually use the color |
| 130 if (defaults->isColored()) |
130 if (defaults->isColored()) |
| 131 { |
131 { |
| 132 if (obj != null) |
132 if (obj != null) |
| 133 colnum = obj->color(); |
133 _color = obj->color(); |
| 134 else |
134 else |
| 135 colnum = (type == OBJ_CondLine || type == OBJ_Line) ? edgecolor : maincolor; |
135 _color = (type == OBJ_CondLine || type == OBJ_Line) ? edgecolor() : maincolor(); |
| 136 |
136 |
| 137 pb_color = new QPushButton; |
137 pb_color = new QPushButton; |
| 138 setButtonBackground (pb_color, colnum); |
138 setButtonBackground (pb_color, _color); |
| 139 connect (pb_color, SIGNAL (clicked()), this, SLOT (slot_colorButtonClicked())); |
139 connect (pb_color, SIGNAL (clicked()), this, SLOT (slot_colorButtonClicked())); |
| 140 } |
140 } |
| 141 |
141 |
| 142 for (int i = 0; i < coordCount; ++i) |
142 for (int i = 0; i < coordCount; ++i) |
| 143 { |
143 { |
| 232 setWindowIcon (icon); |
232 setWindowIcon (icon); |
| 233 } |
233 } |
| 234 |
234 |
| 235 // ============================================================================= |
235 // ============================================================================= |
| 236 // ============================================================================= |
236 // ============================================================================= |
| 237 void AddObjectDialog::setButtonBackground (QPushButton* button, int colnum) |
237 void AddObjectDialog::setButtonBackground (QPushButton* button, LDColor color) |
| 238 { |
238 { |
| 239 LDColor* col = ::getColor (colnum); |
|
| 240 |
|
| 241 button->setIcon (getIcon ("palette")); |
239 button->setIcon (getIcon ("palette")); |
| 242 button->setAutoFillBackground (true); |
240 button->setAutoFillBackground (true); |
| 243 |
241 |
| 244 if (col) |
242 if (color != null) |
| 245 button->setStyleSheet (format ("background-color: %1", col->hexcode)); |
243 button->setStyleSheet (format ("background-color: %1", color->hexcode())); |
| 246 } |
244 } |
| 247 |
245 |
| 248 // ============================================================================= |
246 // ============================================================================= |
| 249 // ============================================================================= |
247 // ============================================================================= |
| 250 QString AddObjectDialog::currentSubfileName() |
248 QString AddObjectDialog::currentSubfileName() |
| 259 |
257 |
| 260 // ============================================================================= |
258 // ============================================================================= |
| 261 // ============================================================================= |
259 // ============================================================================= |
| 262 void AddObjectDialog::slot_colorButtonClicked() |
260 void AddObjectDialog::slot_colorButtonClicked() |
| 263 { |
261 { |
| 264 ColorSelector::selectColor (colnum, colnum, this); |
262 ColorSelector::selectColor (_color, _color, this); |
| 265 setButtonBackground (pb_color, colnum); |
263 setButtonBackground (pb_color, _color); |
| 266 } |
264 } |
| 267 |
265 |
| 268 // ============================================================================= |
266 // ============================================================================= |
| 269 // ============================================================================= |
267 // ============================================================================= |
| 270 void AddObjectDialog::slot_subfileTypeChanged() |
268 void AddObjectDialog::slot_subfileTypeChanged() |