comparison widgets/PropertyBox.cpp @ 1198:69ff93e0c624 levelpanwidget

Introduce a colour map combo too. Doesn't yet have swatches
author Chris Cannam
date Fri, 16 Dec 2016 14:16:05 +0000
parents ff77b7707c95
children 73d43e410a6b
comparison
equal deleted inserted replaced
1197:ff77b7707c95 1198:69ff93e0c624
33 #include "NotifyingCheckBox.h" 33 #include "NotifyingCheckBox.h"
34 #include "NotifyingComboBox.h" 34 #include "NotifyingComboBox.h"
35 #include "NotifyingPushButton.h" 35 #include "NotifyingPushButton.h"
36 #include "NotifyingToolButton.h" 36 #include "NotifyingToolButton.h"
37 #include "ColourComboBox.h" 37 #include "ColourComboBox.h"
38 #include "ColourMapComboBox.h"
38 39
39 #include <QGridLayout> 40 #include <QGridLayout>
40 #include <QHBoxLayout> 41 #include <QHBoxLayout>
41 #include <QVBoxLayout> 42 #include <QVBoxLayout>
42 #include <QPushButton> 43 #include <QPushButton>
417 cb->blockSignals(true); 418 cb->blockSignals(true);
418 cb->setCurrentIndex(value); 419 cb->setCurrentIndex(value);
419 cb->blockSignals(false); 420 cb->blockSignals(false);
420 } 421 }
421 422
422 #ifdef Q_OS_MAC
423 // Crashes on startup without this, for some reason; also
424 // prevents combo boxes from getting weirdly squished
425 // vertically
426 cb->setMinimumSize(QSize(10, cb->font().pixelSize() * 2)); 423 cb->setMinimumSize(QSize(10, cb->font().pixelSize() * 2));
427 #endif 424 break;
428 425 }
426
427 case PropertyContainer::ColourMapProperty:
428 {
429 ColourMapComboBox *cb;
430
431 if (have) {
432 cb = qobject_cast<ColourMapComboBox *>(m_propertyControllers[name]);
433 assert(cb);
434 } else {
435 #ifdef DEBUG_PROPERTY_BOX
436 cerr << "PropertyBox: creating new colourmap combobox" << endl;
437 #endif
438 cb = new ColourMapComboBox();
439 cb->setObjectName(name);
440
441 connect(cb, SIGNAL(colourMapChanged(int)),
442 this, SLOT(propertyControllerChanged(int)));
443 connect(cb, SIGNAL(mouseEntered()),
444 this, SLOT(mouseEnteredWidget()));
445 connect(cb, SIGNAL(mouseLeft()),
446 this, SLOT(mouseLeftWidget()));
447
448 cb->setToolTip(propertyLabel);
449 m_groupLayouts[groupName]->addWidget
450 (cb, 0, m_groupLayouts[groupName]->columnCount());
451 m_propertyControllers[name] = cb;
452 }
453
454 if (cb->currentIndex() != value) {
455 cb->blockSignals(true);
456 cb->setCurrentIndex(value);
457 cb->blockSignals(false);
458 }
459
460 cb->setMinimumSize(QSize(10, cb->font().pixelSize() * 2));
429 break; 461 break;
430 } 462 }
431 463
432 case PropertyContainer::ValueProperty: 464 case PropertyContainer::ValueProperty:
433 case PropertyContainer::UnitsProperty: 465 case PropertyContainer::UnitsProperty: