Exemplo n.º 1
0
studentMonitor::studentMonitor(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::studentMonitor)
{
    QStringList students;

    ui->setupUi(this);
    ui->treeWidget->setColumnWidth( 0, 50  );
    ui->treeWidget->setColumnWidth( 1, 200 );
    this->setWindowFlags( Qt::Dialog | Qt::Popup );
    this->fillBoxGroupes();
    this->fillSudentsMonitor(students);
    ui->layMain->setMargin(8);
    this->setLayout(ui->layMain);
    this->setGeometry(100, 100, 640, 400);
    this->show();

    QObject::connect(ui->buttonAdd, SIGNAL(clicked()),
                     this, SLOT(newStudent()));
    QObject::connect(ui->buttonDelete, SIGNAL(clicked()),
                     this, SLOT(deleteStudent()));
    QObject::connect(ui->buttonEdit, SIGNAL(clicked()),
                     this, SLOT(editStudent()));
    QObject::connect(ui->treeWidget, SIGNAL(itemDoubleClicked(QTreeWidgetItem*,int)),
                     this, SLOT(determineStudent(QTreeWidgetItem*, int)));
    QObject::connect(ui->radioGroupes, SIGNAL(clicked(bool)),
                     this, SLOT(selectGroupeEnabled(bool)));
    QObject::connect(ui->boxGroupes, SIGNAL(currentIndexChanged(QString)),
                     this, SLOT(refreshStudentMonitorOneGroupe(QString)));
    QObject::connect(ui->buttonCancel, SIGNAL(clicked()),
                     this, SLOT(deleteLater()));
}
Exemplo n.º 2
0
/*	listStudents
	print a list of all students in global students[] array
	in:  none
	out: none
*/
void listStudents()
{
	// declarations
	struct STUDENT *s;	// pointer to "current" student
	int i;				// loop counter
	
	// print headers
	printf("LIST ALL STUDENTS\n\n");
	printf(	"  #  Student Name\t\t\tEnrolled    Credits\n"
			"===  ============\t\t\t==========  =======\n");
	
	// loop through all students
	for (i = 0; i < numStudents; i++)
	{
		s = &students[i];	// set pointer to "current" student
		// print the student's data
		printf("%3d  "     // ###
			"%-34.34s "    // last, first
			"%10s  "       // mm/dd/yyyy
			"%7d\n",       // ###
			i+1,
			formatName(s->firstName, s->lastName, 1),
			formatDate(s->enrollmentDate),
			s->completedCredits);
	}
	printf("\n");
	
	// ask user whether to view/edit the details
	i = inputInteger("Type # to view/edit, or blank to return to menu. ");
	// if not, return
	if (i < 1 || i > numStudents) return;
	
	// print the student's details
	// (if we had more fields, they would be displayed now)
	printf("\n");
	printStudent(&students[i-1]);
	printf("\n");
	
	// edit student if user wishes to do so
	if (confirm("Edit this student (y/n) ? "))
		editStudent(&students[i-1]);
}