void MainWindow::on_OEditAbility_clicked() { /* Open a Dialog to update ability, when the OK button is clicked, an accepted signal is sent */ EditAbility wEditAbility(this); wEditAbility.setModal(true); connect(&wEditAbility, SIGNAL(accepted()), this, SLOT(updateAbility())); wEditAbility.exec(); }
void TB_PokemonBody::connectWithAdvanced(TB_Advanced *ptr) { connect(ptr, SIGNAL(abilityChanged()), this, SLOT(updateAbility())); connect(ptr, SIGNAL(levelChanged()), this, SLOT(updateLevel())); connect(ptr, SIGNAL(imageChanged()), this, SLOT(updateImage())); connect(ptr, SIGNAL(genderChanged()), this, SLOT(updateGender())); connect(ptr, SIGNAL(genderChanged()), this, SLOT(updateImage())); connect(ptr, SIGNAL(statChanged()), this, SLOT(updateEVs())); connect(ptr, SIGNAL(pokeFormeChanged(Pokemon::uniqueId)), this, SLOT(changeForme(Pokemon::uniqueId)), Qt::QueuedConnection); connect(this, SIGNAL(EVChanged(int)), ptr, SLOT(updateStat(int))); connect(this, SIGNAL(natureChanged()), ptr, SLOT(updateStats())); connect(this, SIGNAL(pokeImageChanged()), ptr, SLOT(updatePokeImage())); connect(ptr, SIGNAL(levelChanged()), this, SIGNAL(levelChanged())); }
void MainWindow::on_actionOpen_activated() { /* Get the path of the database file and put it in m_dbPath */ m_dbPath = QFileDialog::getOpenFileName(this, tr("Open Character"), "", tr("Files (*.pfchar)")); /* Open databaswe connection */ m_characterDB = QSqlDatabase::addDatabase("QSQLITE"); m_characterDB.setDatabaseName(m_dbPath); QFileInfo checkFile(m_dbPath); /* Check if the files is exist then if it's open, if not trow error with qDebug */ if(checkFile.isFile()) { if(m_characterDB.open()) { ui->tabWidget->setEnabled(true); updateAbility(); } } else { qDebug() << "[E]File does not exist"; } }