mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-01-02 00:00:07 -08:00
Fix bug with next/prev buttons in PrintingSelector (#6453)
* Hacky fix and debug messages * remove debug * add todo
This commit is contained in:
@@ -571,6 +571,15 @@ void DeckEditorDeckDockWidget::changeSelectedCard(int changeBy)
|
||||
// Get the current index of the selected item
|
||||
auto deckViewCurrentIndex = deckView->currentIndex();
|
||||
|
||||
// For some reason, if the deckModel is modified but the view is not manually reselected,
|
||||
// currentIndex will return an index for the underlying deckModel instead of the proxy.
|
||||
// That index will return an invalid index when indexBelow/indexAbove crosses a header node,
|
||||
// causing the selection to fail to move down.
|
||||
/// \todo Figure out why it's happening so we can do a proper fix instead of a hacky workaround
|
||||
if (deckViewCurrentIndex.model() == proxy->sourceModel()) {
|
||||
deckViewCurrentIndex = proxy->mapFromSource(deckViewCurrentIndex);
|
||||
}
|
||||
|
||||
auto nextIndex = deckViewCurrentIndex.siblingAtRow(deckViewCurrentIndex.row() + changeBy);
|
||||
if (!nextIndex.isValid()) {
|
||||
nextIndex = deckViewCurrentIndex;
|
||||
|
||||
Reference in New Issue
Block a user