void MainWindow::FillTableSoft(QTableWidget* table, const AvailableSoftWare::SoftWareMap& soft) { AvailableSoftWare::SoftWareMap::const_iterator iter; table->setRowCount(0); for (iter = soft.begin(); iter != soft.end(); ++iter) { const QString& name = iter.key(); const SoftWare& config = iter.value(); int i = table->rowCount(); table->insertRow(i); table->setItem(i, COLUMN_NAME, new QTableWidgetItem(name)); table->setItem(i, COLUMN_CUR_VER, new QTableWidgetItem(config.m_CurVersion)); if (config.m_AvailableVersion.size() == 1) { table->setItem(i, COLUMN_NEW_VER, new QTableWidgetItem(*(config.m_AvailableVersion.begin()))); } else { QComboBox* pComboBox = new QComboBox(table); connect(pComboBox, SIGNAL(currentIndexChanged(QString)), this, SLOT(OnComboBoxValueChanged(QString))); QList<QString> versionsList = config.m_AvailableVersion.toList(); qSort(versionsList); for (QList<QString>::const_iterator iter = versionsList.begin(); iter != versionsList.end(); ++iter) { pComboBox->addItem(*iter); } pComboBox->setCurrentIndex(pComboBox->count() - 1); table->setCellWidget(i, COLUMN_NEW_VER, pComboBox); } } table->resizeRowsToContents(); }
void EditFontDialog::ConnectToSignals() { //Connect signal and slots connect(ui->createNewRadioButton, SIGNAL(clicked()), this, SLOT(OnRadioButtonClicked())); connect(ui->applyToAllRadioButton, SIGNAL(clicked()), this, SLOT(OnRadioButtonClicked())); UpdateLineEditWidgetWithPropertyValue(ui->fontPresetNameLlineEdit); UpdateSpinBoxWidgetWithPropertyValue(ui->fontSizeSpinBox); UpdatePushButtonWidgetWithPropertyValue(ui->fontSelectButton); UpdateSpinBoxWidgetWithPropertyValue(ui->localizedFontSizeSpinBox); UpdatePushButtonWidgetWithPropertyValue(ui->localizedFontSelectButton); UpdateComboBoxWidgetWithPropertyValue(ui->selectLocaleComboBox); connect(ui->fontSelectButton, SIGNAL(clicked()), this, SLOT(OnPushButtonClicked())); connect(ui->fontSizeSpinBox, SIGNAL(valueChanged(int)), this, SLOT(OnSpinBoxValueChanged(int))); connect(ui->selectLocaleComboBox, SIGNAL(currentIndexChanged(QString)), this, SLOT(OnComboBoxValueChanged(QString))); connect(ui->resetFontForLocalePushButton, SIGNAL(clicked()), this, SLOT(OnPushButtonClicked())); connect(ui->localizedFontSelectButton, SIGNAL(clicked()), this, SLOT(OnPushButtonClicked())); connect(ui->localizedFontSizeSpinBox, SIGNAL(valueChanged(int)), this, SLOT(OnSpinBoxValueChanged(int))); connect(ui->buttonBox->button(QDialogButtonBox::Ok), SIGNAL(clicked()), this, SLOT(OnOkButtonClicked())); }
void EditFontDialog::DisconnectFromSignals() { disconnect(ui->createNewRadioButton, SIGNAL(clicked()), this, SLOT(OnRadioButtonClicked())); disconnect(ui->applyToAllRadioButton, SIGNAL(clicked()), this, SLOT(OnRadioButtonClicked())); disconnect(ui->fontSelectButton, SIGNAL(clicked()), this, SLOT(OnPushButtonClicked())); disconnect(ui->fontSizeSpinBox, SIGNAL(valueChanged(int)), this, SLOT(OnSpinBoxValueChanged(int))); disconnect(ui->selectLocaleComboBox, SIGNAL(currentIndexChanged(QString)), this, SLOT(OnComboBoxValueChanged(QString))); disconnect(ui->localizedFontSelectButton, SIGNAL(clicked()), this, SLOT(OnPushButtonClicked())); disconnect(ui->localizedFontSizeSpinBox, SIGNAL(valueChanged(int)), this, SLOT(OnSpinBoxValueChanged(int))); disconnect(ui->buttonBox, SIGNAL(clicked(QAbstractButton*)), this, SLOT(OnButtonBoxButtonClicked(QAbstractButton*))); }