Summary: | Adding new entry is slow | ||
---|---|---|---|
Product: | [Applications] KBibTeX | Reporter: | Juergen Spitzmueller <juergen> |
Component: | User interface | Assignee: | Thomas Fischer <fischer> |
Status: | RESOLVED FIXED | ||
Severity: | normal | ||
Priority: | NOR | ||
Version: | 0.6 | ||
Target Milestone: | --- | ||
Platform: | Compiled Sources | ||
OS: | Linux | ||
Latest Commit: | http://commits.kde.org/kbibtex/98e55392df85285a67d628209ac77bd5ed3b071b | Version Fixed In: | |
Attachments: |
Proposed fix
Updated patch (addressing the mentioned additional issue) |
Description
Juergen Spitzmueller
2016-10-23 09:05:21 UTC
BTW, independent of my patch, the selection of the new entry fails if (1.) the database has comments or macros and (2.) if "Show comments" or "Show macros" is disabled in the prefs. Presumably due to a mismatch of the rows in the file model and the QAbstractItemModel. I had a look but did not find a solution how these can be synchronized. Created attachment 101718 [details]
Updated patch (addressing the mentioned additional issue)
I found the solution to the index mismatching problem: We have to use sortFilterProxyModel()->mapFromSource.
The updated patch does this.
Git commit 98e55392df85285a67d628209ac77bd5ed3b071b by Thomas Fischer, on behalf of Juergen Spitzmueller. Committed on 23/10/2016 at 13:50. Pushed by thomasfischer into branch 'kbibtex/0.6'. Speeding up selection of elements The old code manually iterated over all columns of rows to be selected, which was expensive in the case of many columns (e.g. for BibLaTeX) and large files (many rows). This patch uses a Qt-internal flag when selecting elements to select the full row with a single call. Furthermore, the unused function 'setSelectedElement(QList<QSharedPointer<Element> > &)' has been completely removed as it was unused. Signed-off-by: Thomas Fischer <fischer@unix-ag.uni-kl.de> M +3 -20 src/gui/file/fileview.cpp M +0 -1 src/gui/file/fileview.h http://commits.kde.org/kbibtex/98e55392df85285a67d628209ac77bd5ed3b071b (In reply to Juergen Spitzmueller from comment #2) > Created attachment 101718 [details] > Updated patch (addressing the mentioned additional issue) > > I found the solution to the index mismatching problem: We have to use > sortFilterProxyModel()->mapFromSource. > > The updated patch does this. Thank you for your bug report and patch! I was not aware that QItemSelectionModel::Select and QItemSelectionModel::Rows combined have such an effect. I modified your patch in two ways: 1. Removed setSelectedElements as it is not used anywhere. 2. Made both variables row and idx 'const'. |