CSinglePrealertEdit::CSinglePrealertEdit(CPrealert *pPreAlert, QWidget *parent) : QDialog(parent), ui(new Ui::CSinglePrealertEdit) { m_actAlert = new CPrealert(); *m_actAlert = *pPreAlert; m_actAlID = pPreAlert->id(); m_paTypes = m_actAlert->paTypes(); ui->setupUi(this); m_actPers = pPreAlert->Pers(); this->setWindowTitle(QString("Vormerkung für %1, %2").arg(m_actPers->Name()).arg(m_actPers->VName())); m_DutyTypes= m_db->dutyTypeList(); ui->dteFrom->setDate(m_actAlert->Date()); ui->dteTo->setDate(m_actAlert->Date()); ui->dteTo->setReadOnly(true); updateTypes(); m_newAlert = false; m_dtMenu = new QMenu("Dienstart auswählen", ui->trvDutyTypes); QList<QAction*> *lActions = new QList<QAction*>(); for(int dt = 0; dt < m_DutyTypes->count(); dt++) { QAction *lact = new QAction(m_DutyTypes->at(dt).Desc(), m_dtMenu); lact->setData(QVariant(m_DutyTypes->at(dt).id())); lActions->append(lact); } m_dtMenu->addActions(*lActions); connect(m_dtMenu, SIGNAL(triggered(QAction*)),SLOT(on_dtMenu(QAction*))); }
int QtEngineThread::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QThread::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { switch (_id) { case 0: updateTypes((*reinterpret_cast< int(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2]))); break; case 1: updateGeometry((*reinterpret_cast< QString(*)>(_a[1]))); break; case 2: updateTime((*reinterpret_cast< QString(*)>(_a[1]))); break; case 3: updateStatus((*reinterpret_cast< QString(*)>(_a[1]))); break; case 4: updateDialog((*reinterpret_cast< Tissue*(*)>(_a[1]))); break; case 5: onLoadDef((*reinterpret_cast< QString(*)>(_a[1]))); break; case 6: onLoadInit((*reinterpret_cast< QString(*)>(_a[1]))); break; case 7: onSetSeed((*reinterpret_cast< int(*)>(_a[1]))); break; case 8: onSetDur((*reinterpret_cast< int(*)>(_a[1]))); break; case 9: onSetUpdate((*reinterpret_cast< int(*)>(_a[1]))); break; case 10: onSetStep((*reinterpret_cast< double(*)>(_a[1]))); break; case 11: onSetView((*reinterpret_cast< QString(*)>(_a[1])),(*reinterpret_cast< QWidget*(*)>(_a[2]))); break; case 12: onWriteHistory((*reinterpret_cast< QString(*)>(_a[1]))); break; case 13: onWriteDetail((*reinterpret_cast< QString(*)>(_a[1]))); break; case 14: toggleRun(); break; case 15: onIdle(); break; default: ; } _id -= 16; } return _id; }
PokeSelection::PokeSelection(Pokemon::uniqueId pokemon, QAbstractItemModel *pokemonModel) : ui(new Ui::PokeSelection), search(NULL), newwidth(0) { ui->setupUi(this); QSortFilterProxyModel *proxy = new QSortFilterProxyModel(this); proxy->setFilterRegExp("."); proxy->setSourceModel(pokemonModel); this->sourceModel = pokemonModel; this->proxy = proxy; ui->pokemonList->setModel(proxy); QCompleter *completer = new QCompleter(proxy, ui->pokeEdit); completer->setCompletionColumn(1); completer->setCompletionRole(Qt::DisplayRole); completer->setCaseSensitivity(Qt::CaseInsensitive); completer->setCompletionMode(QCompleter::PopupCompletion); ui->pokeEdit->setCompleter(completer); setNum(pokemon); ui->pokemonList->setCurrentIndex(pokemonModel->index(pokemon.pokenum, 1)); ui->pokemonList->scrollTo(ui->pokemonList->currentIndex()); updateSprite(); updateTypes(); if (getGen() <= 1) { ui->shiny->hide(); } else { ui->shiny->show(); } ui->baseStats->setGen(getGen()); connect(completer, SIGNAL(activated(QModelIndex)), SLOT(setPokemon(QModelIndex))); connect(ui->shiny, SIGNAL(toggled(bool)), SLOT(updateSprite())); connect(ui->pokemonList, SIGNAL(pokemonSelected(Pokemon::uniqueId)), SLOT(setNum(Pokemon::uniqueId))); connect(ui->pokemonList, SIGNAL(pokemonSelected(Pokemon::uniqueId)), SLOT(updateSprite())); connect(ui->pokemonList, SIGNAL(pokemonSelected(Pokemon::uniqueId)), SLOT(updateTypes())); connect(ui->pokemonList, SIGNAL(pokemonActivated(Pokemon::uniqueId)), SLOT(finish())); connect(ui->changeSpecies, SIGNAL(clicked()), SLOT(finish())); connect(ui->pokemonFrame, SIGNAL(clicked()), SLOT(toggleSearchWindow())); }
void CSinglePrealertEdit::on_cmdDelete_clicked() { if(ui->trvDutyTypes->currentItem()) { int pid = ui->trvDutyTypes->currentItem()->data(0, Qt::UserRole).toInt(); QSqlQuery lqry; lqry.prepare("DELETE FROM tblPATypes WHERE ID = :ID;"); lqry.bindValue(":ID", pid); lqry.exec(); ui->trvDutyTypes->removeItemWidget(ui->trvDutyTypes->currentItem(),0); } updateTypes(); }
void CSinglePrealertEdit::on_dtMenu(QAction *pAction) { CDutyType *dtyp = new CDutyType(pAction->data().toInt()); CPrealertType ltype; ltype.setType(dtyp); if(m_actAlert) { int pID = m_actAlID; ltype.setPid(pID); QSqlQuery lqry; lqry.prepare("INSERT INTO tblPATypes (PAID, TypeID) VALUES (:PID, :TID);"); lqry.bindValue(":PID", m_actAlID); lqry.bindValue(":TID", dtyp->id()); lqry.exec(); } m_paTypes->append(ltype); updateTypes(); }