Exemplo n.º 1
0
void SideBarTask::keyReleaseEvent(QKeyEvent* event)
{
    switch (event->key()) {

    case Qt::Key_Return:
        submitTask();
        break;
    default:
        break;
    }
}
/**
 * \brief Slot to start tasks in the queue
 *
 * Slot called when the submit button is called. This slot reads the
 * multiplicity of the task, and emits a signal with the multiplicity
 * argument. The constructor has connected this signal to the task creator's
 * slot with the same signator, the TaskCreator then submits all the new
 * tasks.
 */
void	TaskMainWindow::submitTask() {
	int	multiplicity = ui->multiplicitySpinBox->value();
	debug(LOG_DEBUG, DEBUG_LOG, 0, "submit %d copies of task",
		multiplicity);
	emit submitTask(multiplicity);
}
Exemplo n.º 3
0
SideBarTask::SideBarTask(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::sideBarTask)
{
    ui->setupUi(this);

    layout = new QVBoxLayout();

    // task course
    courseDropDown = new QComboBox();

    // task type
    taskType = new TriStateButton("Type: ", "TE","Devoir", "Labo");

    // Task name
    taskName = new QLineEdit();
    taskName->setPlaceholderText("Titre de la tache");

    // Task description
    description = new QTextEdit();
    description->setPlaceholderText("Description");
    description->setSizePolicy(QSizePolicy::MinimumExpanding,QSizePolicy::MinimumExpanding);
    description->setMinimumHeight(20);
    description->setMaximumHeight(100);

    // task priority
    priority = new TriStateButton("Priorité: ", "Basse", "Moyenne", "Haute");

    // task term
    termDate = new QDateTimeEdit;
    termDate->setCalendarPopup(true);
    hasTerm = new QCheckBox("Echéance");
    hasTerm->setChecked(false);
    connect(hasTerm, SIGNAL(clicked(bool)), termDate, SLOT(setEnabled(bool)) );
    termDate->setEnabled(false);

    // Task Submit
    btnSubmit = new QPushButton();
    btnSubmit->setText("Sauver");
    btnSubmit->setDefault(false);
    btnSubmit->setAutoDefault(true);

    QSqlRelationalTableModel *model = Task::getInstance()->getModel();
    courseIndex = Task::getInstance()->getCourseIndex();

    //SQLRelation set dropdown to search course name in DB
    relModel = model->relationModel(courseIndex);
    courseDropDown->setModel(relModel);
    courseDropDown->setModelColumn(relModel->fieldIndex("name"));

    mapper = new QDataWidgetMapper(this);
    mapper->setModel(model);
    mapper->setSubmitPolicy(QDataWidgetMapper::ManualSubmit);
    mapper->setItemDelegate(new QSqlRelationalDelegate(this));

    // Mapping
    mapper->addMapping(taskName, model->fieldIndex("name"));
    mapper->addMapping(description, model->fieldIndex("description"));

    mapper->addMapping(courseDropDown, courseIndex);
    mapper->addMapping(priority, model->fieldIndex("priority"));
    mapper->addMapping(taskType, model->fieldIndex("typeId"));
    mapper->addMapping(termDate, model->fieldIndex("termDate"));


    // Ajout des widgets au layout
    layout->addWidget(courseDropDown);
    layout->addWidget(taskType);
    layout->addSpacing(10);
    layout->addWidget(taskName);
    layout->addWidget(description);
    layout->addSpacing(10);
    layout->addWidget(hasTerm);
    layout->addWidget(termDate);
    layout->addSpacing(10);
    layout->addWidget(priority);
    layout->addWidget(btnSubmit, QDialogButtonBox::AcceptRole);
    layout->addStretch();

    connect(btnSubmit, SIGNAL(clicked()), this , SLOT(submitTask()));

    mapper->toFirst();
    this->setLayout(layout);
}
Exemplo n.º 4
0
 void initOpenGL()
 {
     submitTask( new InitOpenGL_task() );
 }