| 27 | #include <QKeyEvent> |
| 28 | |
| 29 | ComboBoxLoopMode::ComboBoxLoopMode(QWidget *parent) : QComboBox(parent), |
| 30 | _ignoreFirstHide(true), |
| 31 | _currentIndex(0) |
| 32 | { |
| 33 | this->setView(new ComboView()); |
| 34 | this->setFocusPolicy(Qt::StrongFocus); |
| 35 | this->setFocus(); |
| 36 | |
| 37 | // Different loop possibilities |
| 38 | this->addItem("", -1); |
| 39 | QMap<QString, QString> replacement; |
| 40 | replacement["currentColor"] = ContextManager::theme()->getColor(ThemeManager::LIST_TEXT).name(); |
| 41 | replacement["secondColor"] = ContextManager::theme()->getColor(ThemeManager::LIST_TEXT, ThemeManager::ColorContext::DISABLED).name(); |
| 42 | this->addItem(ContextManager::theme()->getColoredSvg(":/icons/sample_mode_loop_off.svg", QSize(48, 48), replacement), "", 0); |
| 43 | this->addItem(ContextManager::theme()->getColoredSvg(":/icons/sample_mode_loop_on.svg", QSize(48, 48), replacement), "", 1); |
| 44 | this->addItem(ContextManager::theme()->getColoredSvg(":/icons/sample_mode_release.svg", QSize(48, 48), replacement), "", 2); |
| 45 | this->addItem(ContextManager::theme()->getColoredSvg(":/icons/sample_mode_loop_on_end.svg", QSize(48, 48), replacement), "", 3); |
| 46 | |
| 47 | QObject::connect(this, SIGNAL(activated(int)), this, SLOT(onActivated(int))); |
| 48 | QObject::connect(this, SIGNAL(currentIndexChanged(int)), this, SLOT(onActivated(int))); |
| 49 | } |
| 50 | |
| 51 | void ComboBoxLoopMode::showEvent(QShowEvent * event) |
| 52 | { |
nothing calls this directly
no test coverage detected