Exemplo n.º 1
0
void MainWindow::editRS()
{
    if( view->currentIndex().isValid() )
    {
        int row = view->currentIndex().row();
        People p;
        model->getRec(p, row);

        PeopleDialog *dial;
        dial = new PeopleDialog;
        dial->setPeople(p);

        if( dial->exec() == QDialog::Accepted )
        {
            p.setSurname( dial->getSurname() );
            p.setName( dial->getName() );
            p.setPatronimic( dial->getPatronomic() );
            p.setSex( dial->getSex() );
            p.setDate( dial->getDate() );
            p.setEducation( dial->getEducation() );
            p.setMatrialStatus( dial->getMatrial_Status() );

            model->editRec(p, row);
        }

        delete dial;
    }
}
Exemplo n.º 2
0
void MainWindow::addRS()
{
    if(!model)
        return;
    PeopleDialog *dial;
    dial = new PeopleDialog;

    if( dial->exec() == QDialog::Accepted )
    {
        People p;
        p.setSurname( dial->getSurname() );
        p.setName( dial->getName() );
        p.setPatronimic( dial->getPatronomic() );
        p.setSex( dial->getSex() );
        p.setDate( dial->getDate() );
        p.setEducation( dial->getEducation() );
        p.setMatrialStatus( dial->getMatrial_Status() );

        model->addRec(p);
    }

    delete dial;
}