src/ChildWidget.cpp
/*
 * Store current page (in table view) to pages vector
 *
 */
Store current page (in table view) to pages vector
Store current page ( in table view ) to pages vector
void ChildWidget::storePage() {
  QModelIndex index = selectionModel->currentIndex();
  if (!index.isValid())
    return;
  QVector<QStringList> page;
  for (int row = 0; row < model->rowCount(); ++row) {
    QString letter = model->index(row, 0).data().toString();
    QString left = model->index(row, 1).data().toString();
    int bottom = model->index(row, 2).data().toInt();
    QString right = model->index(row, 3).data().toString();
    int top = model->index(row, 4).data().toInt();
    QString pageNum = model->index(row, 5).data().toString();
    bool italic = model->index(row, 6).data().toBool();
    bool bold = model->index(row, 7).data().toBool();
    bool underline = model->index(row, 8).data().toBool();
    if (underline)
      letter.prepend("\'");
    if (italic)
      letter.prepend("$");
    if (bold)
      letter.prepend("@");
    QStringList box;
    box << letter << left << QString::number(imageHeight - bottom)
        << right  << QString::number(imageHeight - top) << pageNum;
    page.append(box);
  }
  pages[currPage] = page;
}
void ChildWidget :: storePage ( ) { QModelIndex index = selectionModel -> currentIndex ( ) ; if ( ! index . isValid ( ) ) return ; QVector < QStringList > page ; for ( int row = 0 ; row < model -> rowCount ( ) ; ++ row ) { QString letter = model -> index ( row , 0 ) . data ( ) . toString ( ) ; QString left = model -> index ( row , 1 ) . data ( ) . toString ( ) ; int bottom = model -> index ( row , 2 ) . data ( ) . toInt ( ) ; QString right = model -> index ( row , 3 ) . data ( ) . toString ( ) ; int top = model -> index ( row , 4 ) . data ( ) . toInt ( ) ; QString pageNum = model -> index ( row , 5 ) . data ( ) . toString ( ) ; bool italic = model -> index ( row , 6 ) . data ( ) . toBool ( ) ; bool bold = model -> index ( row , 7 ) . data ( ) . toBool ( ) ; bool underline = model -> index ( row , 8 ) . data ( ) . toBool ( ) ; if ( underline ) letter . prepend ( " \' " ) ; if ( italic ) letter . prepend ( " " ) ; if ( bold ) letter . prepend ( " " ) ; QStringList box ; box << letter << left << QString :: number ( imageHeight - bottom ) << right << QString :: number ( imageHeight - top ) << pageNum ; page . append ( box ) ; } pages [ currPage ] = page ; }
Store current page (in table view) to pages vector
Store current page ( in table view ) to pages vector