mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-06-12 09:04:53 -07:00
Fix bug with next/prev buttons in PrintingSelector (#6453)
* Hacky fix and debug messages * remove debug * add todo
This commit is contained in:
parent
daa7db7ce3
commit
968be8a06f
1 changed files with 9 additions and 0 deletions
|
|
@ -571,6 +571,15 @@ void DeckEditorDeckDockWidget::changeSelectedCard(int changeBy)
|
||||||
// Get the current index of the selected item
|
// Get the current index of the selected item
|
||||||
auto deckViewCurrentIndex = deckView->currentIndex();
|
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);
|
auto nextIndex = deckViewCurrentIndex.siblingAtRow(deckViewCurrentIndex.row() + changeBy);
|
||||||
if (!nextIndex.isValid()) {
|
if (!nextIndex.isValid()) {
|
||||||
nextIndex = deckViewCurrentIndex;
|
nextIndex = deckViewCurrentIndex;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue