src/ChildWidget.cpp
// Put moved row back to original location
Put moved row back to original location
Put moved row back to original location
void ChildWidget::undoMoveBack2(UndoItem& ui, bool bIsRedo) {
  if (DMESS > 10) qDebug() << Q_FUNC_INFO;
  int firstrow = ui.m_origrow;
  int secondrow = ui.m_extrarow;
  if (bIsRedo) {
    firstrow = ui.m_extrarow;
    secondrow = ui.m_origrow;
  }
  if (firstrow < secondrow)
      secondrow++;
  else
      firstrow++;
  model->insertRow(firstrow);
  for (int i = 0; i < model->columnCount() - 1; i++) {
    model->setData(model->index(firstrow, i), ui.m_vdata[i]);
  }
  createModelItemBox(firstrow);
  model->removeRow(secondrow);
  if (firstrow > secondrow) firstrow--;
  table->setCurrentIndex(model->index(firstrow, 0));
  table->setFocus();
  updateSelectionRects();
  if (bIsRedo)
    m_undostack.push(ui, false);
  else
    m_redostack.push(ui);
}
void ChildWidget :: undoMoveBack2 ( UndoItem & ui , bool bIsRedo ) { if ( DMESS > 10 ) qDebug ( ) << Q_FUNC_INFO ; int firstrow = ui . m_origrow ; int secondrow = ui . m_extrarow ; if ( bIsRedo ) { firstrow = ui . m_extrarow ; secondrow = ui . m_origrow ; } if ( firstrow < secondrow ) secondrow ++ ; else firstrow ++ ; model -> insertRow ( firstrow ) ; for ( int i = 0 ; i < model -> columnCount ( ) - 1 ; i ++ ) { model -> setData ( model -> index ( firstrow , i ) , ui . m_vdata [ i ] ) ; } createModelItemBox ( firstrow ) ; model -> removeRow ( secondrow ) ; if ( firstrow > secondrow ) firstrow -- ; table -> setCurrentIndex ( model -> index ( firstrow , 0 ) ) ; table -> setFocus ( ) ; updateSelectionRects ( ) ; if ( bIsRedo ) m_undostack . push ( ui , false ) ; else m_redostack . push ( ui ) ; }
Put moved row back to original location
Put moved row back to original location