QWidget* MyBooleanItemDelegate::createEditor(QWidget*parent, const QStyleOptionViewItem&, const QModelIndex&) const { QCheckBox* editorWidget = new QCheckBox(parent); if (!readOnly) { if (essence != 0) { essence->saveOldValues(); disconnect(this, SIGNAL(closeEditor(QWidget*)), this, SLOT(calculate())); connect(this, SIGNAL(closeEditor(QWidget*)), this, SLOT(calculate())); editorWidget->setDisabled(false); } }
void GUIWidget::addTableRow() { if(m_pTableWidget){ int rowNumber = m_pTableWidget->rowCount(); m_pTableWidget->insertRow(rowNumber); QCheckBox* pCheckBox = new QCheckBox(); pCheckBox->setDisabled(true); m_pTableWidget->setCellWidget(rowNumber,0, pCheckBox); QDateEdit* pQde1 = new QDateEdit(); pQde1->setDisabled(true); QDateEdit* pQde2 = new QDateEdit(); pQde2->setDisabled(true); pQde2->setDateTime(QDateTime::currentDateTime()); m_pTableWidget->setCellWidget(rowNumber,2, pQde1); m_pTableWidget->setCellWidget(rowNumber,3, pQde2); } }
void MainWindow::addMaterialScenario(int index, QString name, QString abbr) { EscenarioMaterialCustom* new_scenario = main_scenario.createCustomMaterialScenario(index, name.toStdWString(), abbr.toStdString()); for (MaterialConfigUI* config: materials_ui) config->escenarioAdded(index, name); for (StrengthFunctionConfig* config: strength_functions_ui) config->escenarioAdded(index, name); QCheckBox* qcheckbox = new QCheckBox(name + " (" + abbr + ")", ui->groupBox_escenarios); qcheckbox->setChecked(true); if (index == MaterialProperty::ORIGINAL_VALUE) qcheckbox->setDisabled(true); ui->widget_materials->layout()->addWidget(qcheckbox); for (Material &material: main_scenario.materials) { if (material.type == 0) { general_material_config.addScenario(new_scenario, material, main_scenario.strength_functions.size() > 0); break; } } index_qcheckbox_material_scenario[index] = qcheckbox; qcheckbox_material_scenario_index[qcheckbox] = index; connect(qcheckbox, SIGNAL(toggled(bool)), this, SLOT(toggleMaterialScenario(bool))); }
void ROMSelectionDialog::refreshROMInfos() { QString controlROMFileName = synthProfile.controlROMFileName; QString pcmROMFileName = synthProfile.pcmROMFileName; clearButtonGroup(controlROMGroup); clearButtonGroup(pcmROMGroup); controlROMRow = -1; pcmROMRow = -1; QStringList fileFilter = ui->fileFilterCombo->itemData(ui->fileFilterCombo->currentIndex()).value<QStringList>(); QStringList dirEntries = synthProfile.romDir.entryList(fileFilter); ui->romInfoTable->clearContents(); ui->romInfoTable->setRowCount(dirEntries.size()); int row = 0; for (QStringListIterator it(dirEntries); it.hasNext();) { QString fileName = it.next(); FileStream file; if (!file.open((synthProfile.romDir.absolutePath() + QDir::separator() + fileName).toUtf8())) continue; const ROMInfo *romInfoPtr = ROMInfo::getROMInfo(&file); if (romInfoPtr == NULL) continue; const ROMInfo &romInfo = *romInfoPtr; QButtonGroup *romGroup; QString romType; switch (romInfo.type) { case ROMInfo::PCM: romType = QString("PCM"); romGroup = &pcmROMGroup; if (pcmROMRow == -1) pcmROMRow = row; break; case ROMInfo::Control: romType = QString("Control"); romGroup = &controlROMGroup; if (controlROMRow == -1) controlROMRow = row; break; case ROMInfo::Reverb: romType = QString("Reverb"); romGroup = NULL; break; default: MT32Emu::ROMInfo::freeROMInfo(romInfoPtr); continue; } if (fileName == controlROMFileName) { controlROMRow = row; } else if (fileName == pcmROMFileName) { pcmROMRow = row; } int column = 0; QCheckBox *checkBox = new QCheckBox(); if (romInfo.type != ROMInfo::Reverb) { romGroup->addButton(checkBox); romGroup->setId(checkBox, row); } else checkBox->setDisabled(true); ui->romInfoTable->setCellWidget(row, column++, checkBox); if (controlROMRow == row || pcmROMRow == row) { checkBox->setChecked(true); } QTableWidgetItem *item = new QTableWidgetItem(fileName); item->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable); ui->romInfoTable->setItem(row, column++, item); item = new QTableWidgetItem(QString(romInfo.shortName)); item->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable); ui->romInfoTable->setItem(row, column++, item); item = new QTableWidgetItem(QString(romInfo.description)); item->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable); ui->romInfoTable->setItem(row, column++, item); item = new QTableWidgetItem(romType); item->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable); ui->romInfoTable->setItem(row, column++, item); item = new QTableWidgetItem(QString(romInfo.sha1Digest)); item->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable); ui->romInfoTable->setItem(row, column++, item); MT32Emu::ROMInfo::freeROMInfo(romInfoPtr); row++; } ui->romInfoTable->setRowCount(row); ui->romInfoTable->resizeColumnsToContents(); }