DepartmentInputArea::DepartmentInputArea(QWidget *parent,
                                         const QModelIndex index)
    : QGroupBox(parent), ui(new Ui::DepartmentInputArea) {
  ui->setupUi(this);

  // Init UI
  qDebug() << "Init DepartmentInputArea for Index : " << index.row();

  m_actualMode = Mode::Edit;
  setViewOnlyMode(true);

  // Set the Model
  m_model = new QSqlRelationalTableModel(this);
  m_model->setTable(QLatin1String("department"));
  m_model->setEditStrategy(QSqlTableModel::OnManualSubmit);

  m_model->select();

  // Set the mapper
  m_mapper = new QDataWidgetMapper(this);
  m_mapper->setModel(m_model);
  m_mapper->setSubmitPolicy(QDataWidgetMapper::ManualSubmit);

  setMappings();

  m_mapper->setCurrentIndex(index.row());
}
示例#2
0
void Mesh::initStrip(GLuint shader, GLuint w, GLuint h, const glm::vec3 *verts, const glm::vec3 *norms)
{
    assert(w > 1 && h > 1);

    m_w = w;
    m_h = h;
    setMappings();
    GLuint memsize = m_mappingSize * 8 * sizeof(float);
    createBuffers(shader, memsize);
    setVerts(verts, norms);
}