示例#1
0
  CEMatrixEditor::CEMatrixEditor(CrystallographyExtension *ext, QMainWindow *w)
    : CEAbstractEditor(ext, w)
  {
    ui.setupUi(this);

    // Emit editStarted
    connect(ui.edit_matrix, SIGNAL(textChanged()),
            this, SIGNAL(editStarted()));

    // Apply button connections
    connect(ui.push_matrix_apply, SIGNAL(clicked()),
            this, SIGNAL(editAccepted()));
    connect(ui.push_matrix_apply, SIGNAL(clicked()),
            this, SLOT(setMatrix()));

    // Reset button connections
    connect(ui.push_matrix_reset, SIGNAL(clicked()),
            this, SIGNAL(editRejected()));
    connect(ui.push_matrix_reset, SIGNAL(clicked()),
            this, SLOT(refreshEditor()));

    // Validation
    connect(ui.edit_matrix, SIGNAL(textChanged()),
            this, SLOT(validateEditor()));

    // Apply/reset enable
    connect(ui.edit_matrix, SIGNAL(textChanged()),
            this, SLOT(enableButtons()));

    ui.edit_matrix->setCurrentFont(QFont("Monospace",
                                         CE_FONTSIZE));
    m_charFormat = ui.edit_matrix->textCursor().charFormat();
  }
  CEParameterEditor::CEParameterEditor(CrystallographyExtension *ext)
    : CEAbstractEditor(ext)
  {
    ui.setupUi(this);

    // Emit editStarted
    connect(ui.spin_a, SIGNAL(valueChanged(double)),
            this, SIGNAL(editStarted()));
    connect(ui.spin_b, SIGNAL(valueChanged(double)),
            this, SIGNAL(editStarted()));
    connect(ui.spin_c, SIGNAL(valueChanged(double)),
            this, SIGNAL(editStarted()));
    connect(ui.spin_alpha, SIGNAL(valueChanged(double)),
            this, SIGNAL(editStarted()));
    connect(ui.spin_beta, SIGNAL(valueChanged(double)),
            this, SIGNAL(editStarted()));
    connect(ui.spin_gamma, SIGNAL(valueChanged(double)),
            this, SIGNAL(editStarted()));

    // Apply button connections
    connect(ui.push_params_apply, SIGNAL(clicked()),
            this, SIGNAL(editAccepted()));
    connect(ui.push_params_apply, SIGNAL(clicked()),
            this, SLOT(setParameters()));

    // Reset button connections
    connect(ui.push_params_reset, SIGNAL(clicked()),
            this, SIGNAL(editRejected()));
    connect(ui.push_params_reset, SIGNAL(clicked()),
            this, SLOT(refreshEditor()));

    // Validation
    connect(ui.spin_a, SIGNAL(valueChanged(double)),
            this, SLOT(validateEditor()));
    connect(ui.spin_b, SIGNAL(valueChanged(double)),
            this, SLOT(validateEditor()));
    connect(ui.spin_c, SIGNAL(valueChanged(double)),
            this, SLOT(validateEditor()));
    connect(ui.spin_alpha, SIGNAL(valueChanged(double)),
            this, SLOT(validateEditor()));
    connect(ui.spin_beta, SIGNAL(valueChanged(double)),
            this, SLOT(validateEditor()));
    connect(ui.spin_gamma, SIGNAL(valueChanged(double)),
            this, SLOT(validateEditor()));

    // Apply/reset enable
    connect(ui.spin_a, SIGNAL(valueChanged(double)),
            this, SLOT(enableButtons()));
    connect(ui.spin_b, SIGNAL(valueChanged(double)),
            this, SLOT(enableButtons()));
    connect(ui.spin_c, SIGNAL(valueChanged(double)),
            this, SLOT(enableButtons()));
    connect(ui.spin_alpha, SIGNAL(valueChanged(double)),
            this, SLOT(enableButtons()));
    connect(ui.spin_beta, SIGNAL(valueChanged(double)),
            this, SLOT(enableButtons()));
    connect(ui.spin_gamma, SIGNAL(valueChanged(double)),
            this, SLOT(enableButtons()));
  }
void ManageTeachersWidget::editClicked()
{
	if (m_editTeacherDialog == 0) {
		m_editTeacherDialog = new EditTeacherDialog(m_schoolDatabase, this);
		connect(m_editTeacherDialog, SIGNAL(accepted()), this, SLOT(editAccepted()));
		connect(m_editTeacherDialog, SIGNAL(rejected()), this, SLOT(editRejected()));
	}

	QModelIndex teacherIndex = m_selectTeacherWidget->selectedTeacherIndex();
	m_editTeacherDialog->setTeacher(m_mainController->teacherTableModel()->at(teacherIndex.row()));
	m_editTeacherDialog->showNormal();
}
  CEAbstractEditor::CEAbstractEditor(CrystallographyExtension *ext)
    : CEAbstractDockWidget(ext),
      m_isLocked(false)
  {
    connect(this, SIGNAL(invalidInput()),
            this, SLOT(markAsInvalid()));
    connect(this, SIGNAL(validInput()),
            this, SLOT(markAsValid()));

    connect(m_ext, SIGNAL(cellChanged()),
            this, SLOT(refreshEditor()));

    connect(this, SIGNAL(visibilityChanged()),
            m_ext, SLOT(refreshActions()));

    connect(this, SIGNAL(editStarted()),
            m_ext, SLOT(lockEditors()));
    connect(this, SIGNAL(editAccepted()),
            m_ext, SLOT(unlockEditors()));
    connect(this, SIGNAL(editRejected()),
            m_ext, SLOT(unlockEditors()));

  }