zz_addObjectDialog.cpp

changeset 158
499286fcbf37
parent 157
635da3135bd4
child 160
edcb03f3ef75
equal deleted inserted replaced
157:635da3135bd4 158:499286fcbf37
47 // ============================================================================= 47 // =============================================================================
48 AddObjectDialog::AddObjectDialog (const LDObjectType_e type, LDObject* obj, QWidget* parent) : 48 AddObjectDialog::AddObjectDialog (const LDObjectType_e type, LDObject* obj, QWidget* parent) :
49 QDialog (parent) 49 QDialog (parent)
50 { 50 {
51 short coordCount = 0; 51 short coordCount = 0;
52 str iconName = format ("icons/add-%s.png", g_saObjTypeIcons[type]); 52 QPixmap icon = getIcon (format ("add-%s", g_saObjTypeIcons[type]));
53 LDObject* defaults = LDObject::getDefault (type); 53 LDObject* defaults = LDObject::getDefault (type);
54 54
55 lb_typeIcon = new QLabel; 55 lb_typeIcon = new QLabel;
56 lb_typeIcon->setPixmap (QPixmap (iconName)); 56 lb_typeIcon->setPixmap (icon);
57 57
58 switch (type) { 58 switch (type) {
59 case OBJ_Comment: 59 case OBJ_Comment:
60 le_comment = new QLineEdit; 60 le_comment = new QLineEdit;
61 if (obj) 61 if (obj)
272 layout->addWidget (bbx_buttons, 5, 0, 1, 4); 272 layout->addWidget (bbx_buttons, 5, 0, 1, 4);
273 setLayout (layout); 273 setLayout (layout);
274 setWindowTitle (format (APPNAME_DISPLAY ": New %s", 274 setWindowTitle (format (APPNAME_DISPLAY ": New %s",
275 g_saObjTypeNames[type]).chars()); 275 g_saObjTypeNames[type]).chars());
276 276
277 setWindowIcon (QIcon (iconName.chars ())); 277 setWindowIcon (icon);
278 delete defaults; 278 delete defaults;
279 } 279 }
280 280
281 // ============================================================================= 281 // =============================================================================
282 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 282 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
283 // ============================================================================= 283 // =============================================================================
284 void AddObjectDialog::setButtonBackground (QPushButton* button, short color) { 284 void AddObjectDialog::setButtonBackground (QPushButton* button, short color) {
285 button->setIcon (QIcon ("icons/palette.png")); 285 button->setIcon (getIcon ("palette"));
286 button->setAutoFillBackground (true); 286 button->setAutoFillBackground (true);
287 button->setStyleSheet ( 287 button->setStyleSheet (
288 format ("background-color: %s", getColor (color)->zColorString.chars()).chars() 288 format ("background-color: %s", getColor (color)->zColorString.chars()).chars()
289 ); 289 );
290 } 290 }

mercurial