| 10 | #include <limits> |
| 11 | |
| 12 | KeyWidgetDebugger::KeyWidgetDebugger(QWidget* parent) : |
| 13 | QWidget(parent), |
| 14 | ui(new Ui::KeyWidgetDebugger), w(new KeyWidget(this)), m(KeyMap::Model::NO_MODEL), l(KeyMap::Layout::NO_LAYOUT) |
| 15 | { |
| 16 | ui->setupUi(this); |
| 17 | ui->devw->setMaximum(std::numeric_limits<short>::max()); |
| 18 | ui->devh->setMaximum(std::numeric_limits<short>::max()); |
| 19 | |
| 20 | KeyWidgetLayout* wl = new KeyWidgetLayout; |
| 21 | wl->addItem(new QWidgetItem(w)); |
| 22 | wl->addItem(new QWidgetItem(new QWidget(this))); |
| 23 | ui->verticalLayout->addLayout(wl); |
| 24 | ui->layoutComboBox->addItems(KeyMap::layoutList); |
| 25 | for(int i = KeyMap::Model::NO_MODEL + 1; i < KeyMap::Model::_MODEL_MAX; i++) |
| 26 | ui->modelComboBox->addItem(KeyMap::getModel(static_cast<KeyMap::Model>(i))); |
| 27 | |
| 28 | ui->layoutComboBox->setCurrentIndex(KeyMap::Layout::US); |
| 29 | ui->modelComboBox->setCurrentIndex(KeyMap::Model::K95P); |
| 30 | connect(w, &KeyWidget::selectionChanged, this, [this](const QStringList& sl){ |
| 31 | if(!sl.count()) |
| 32 | return; |
| 33 | QList<QListWidgetItem*> list = ui->keyList->findItems(sl.at(0), Qt::MatchExactly); |
| 34 | if(!list.count()) |
| 35 | return; |
| 36 | ui->keyList->setCurrentItem(list.at(0)); |
| 37 | }); |
| 38 | } |
| 39 | |
| 40 | KeyWidgetDebugger::~KeyWidgetDebugger() |
| 41 | { |