comparison widgets/PropertyBox.cpp @ 1045:f535f6e5dbb0 alignment-simple

Merge in from SV 3.0-integration branches
author Chris Cannam
date Wed, 02 Mar 2016 17:25:27 +0000
parents 3f7cdfc56dce
children c02c51ae5238 5c3333fb70b3
comparison
equal deleted inserted replaced
976:f2c63ec85901 1045:f535f6e5dbb0
60 container->getPropertyContainerName() << "\" at " << container << ")]::PropertyBox" << endl; 60 container->getPropertyContainerName() << "\" at " << container << ")]::PropertyBox" << endl;
61 #endif 61 #endif
62 62
63 m_mainBox = new QVBoxLayout; 63 m_mainBox = new QVBoxLayout;
64 setLayout(m_mainBox); 64 setLayout(m_mainBox);
65
66 #ifdef Q_OS_MAC
67 QMargins mm = m_mainBox->contentsMargins();
68 QMargins mmhalf(mm.left()/2, mm.top()/3, mm.right()/2, mm.bottom()/3);
69 m_mainBox->setContentsMargins(mmhalf);
70 #endif
65 71
66 // m_nameWidget = new QLabel; 72 // m_nameWidget = new QLabel;
67 // m_mainBox->addWidget(m_nameWidget); 73 // m_mainBox->addWidget(m_nameWidget);
68 // m_nameWidget->setText(container->objectName()); 74 // m_nameWidget->setText(container->objectName());
69 75
441 cb->setEditable(false); 447 cb->setEditable(false);
442 448
443 if (type == PropertyContainer::ValueProperty) { 449 if (type == PropertyContainer::ValueProperty) {
444 450
445 for (int i = min; i <= max; ++i) { 451 for (int i = min; i <= max; ++i) {
446 cb->addItem(m_container->getPropertyValueLabel(name, i)); 452
453 QString label = m_container->getPropertyValueLabel(name, i);
454 QString iname = m_container->getPropertyValueIconName(name, i);
455
456 if (iname != "") {
457 QIcon icon(IconLoader().load(iname));
458 cb->addItem(icon, label);
459 } else {
460 cb->addItem(label);
461 }
447 } 462 }
448 463
449 } else if (type == PropertyContainer::UnitsProperty) { 464 } else if (type == PropertyContainer::UnitsProperty) {
450 465
451 QStringList units = UnitDatabase::getInstance()->getKnownUnits(); 466 QStringList units = UnitDatabase::getInstance()->getKnownUnits();
510 } 525 }
511 } 526 }
512 cb->blockSignals(false); 527 cb->blockSignals(false);
513 528
514 #ifdef Q_OS_MAC 529 #ifdef Q_OS_MAC
515 // Crashes on startup without this, for some reason 530 // Crashes on startup without this, for some reason; also
516 cb->setMinimumSize(QSize(10, 10)); 531 // prevents combo boxes from getting weirdly squished
532 // vertically
533 cb->setMinimumSize(QSize(10, cb->font().pixelSize() * 2));
517 #endif 534 #endif
518 535
519 break; 536 break;
520 } 537 }
521 538