Abdelrazak Younes wrote:
Jean-Marc Lasgouttes wrote:
Now, if you have a better idea to fix the problem, I am all ears.
I am not sure I understand the problem but, IIUC, it's the job of the
frontend to remember the position of the last selected error item. In
your patch this is kind-of done by the controller.
I mean something like the attached (not tested and against trunk/qt4).
Abdel.
Index: QErrorList.C
===================================================================
--- QErrorList.C (revision 14623)
+++ QErrorList.C (working copy)
@@ -35,14 +35,15 @@
{
dialog_.reset(new QErrorListDialog(this));
bcview().setCancel(dialog_->closePB);
+ saved_pos_ = 0;
}
void QErrorList::select(QListWidgetItem * wi)
{
- int const item = dialog_->errorsLW->row(wi);
- controller().goTo(item);
-
dialog_->descriptionTB->setPlainText(toqstr(controller().errorList()[item].description));
+ save_pos_ = dialog_->errorsLW->row(wi);
+ controller().goTo(save_pos_);
+
dialog_->descriptionTB->setPlainText(toqstr(controller().errorList()[save_pos_].description));
}
@@ -58,8 +59,8 @@
dialog_->errorsLW->addItem(toqstr(it->error));
}
- dialog_->errorsLW->setCurrentRow(0);
- select(dialog_->errorsLW->item(0));
+ dialog_->errorsLW->setCurrentRow(saved_pos_);
+ select(dialog_->errorsLW->item(saved_pos_));
}
} // namespace frontend
Index: QErrorList.h
===================================================================
--- QErrorList.h (revision 14623)
+++ QErrorList.h (working copy)
@@ -38,6 +38,9 @@
virtual void build_dialog();
/// update contents
virtual void update_contents();
+
+ /// current selected position.
+ int save_pos_;
};
} // namespace frontend