Coder Social home page Coder Social logo

Shift select behavior bug about memento HOT 6 CLOSED

ripose-jp avatar ripose-jp commented on May 30, 2024
Shift select behavior bug

from memento.

Comments (6)

ripose-jp avatar ripose-jp commented on May 30, 2024

I've look into it and it seems like this is just how QAbstractItemView::ExtendedSelection works. Basically the last item you click becomes the current item, and when you shift-click another item, all the items from the current item to the item you clicked have their selections flipped.

You can work around this in several ways:

  1. Click the first item you wish to select, then shift-click the second item you wish to select. This will always produce the behavior you expect.
  2. Click and drag from the starting item to the ending item.
  3. Ctrl-click the items you wish to select.

I'm temped to put a wontfix on this just because it doesn't seem like a trivial fix from what I've read so far.

The other option is to use QAbstractItemView::MultiSelection which disables shift-clicking entirely. I find it more annoying to use, though, so I probably not going to do that.

You can read more here:
https://doc.qt.io/qt-5/qabstractitemview.html#SelectionMode-enum

from memento.

Calvin-Xu avatar Calvin-Xu commented on May 30, 2024

Hmm...but at the beginning of the gif, when the highlight is on 897 (し… しかし 今回の計画は\n各国の注目を集めており―), why does shift clicking on 898 (共和国側も\n我々の情報を欲しています) select all the way down to 900?

Edit: I wonder if you mean that the currently highlighted subtitle is not the current item unless I click on it first. But this was not the behavior before. It reminds me that post my PR and your refractor of subtitlelistwidget, because there are now multiple entries to highlight if they are all on screen, we have switched to setting the QTableWidgetItems selected, instead of table->setCurrentItem(subtitleItem) on the one (flattened) item. Perhaps this is causing the issue?

I agree this might not be a trivial fix because as I tried setting the current item clears selections.

from memento.

ripose-jp avatar ripose-jp commented on May 30, 2024

If the user presses the Shift key while clicking on an item, all items between the current item and the clicked item are selected or unselected, depending on the state of the clicked item.

It's important to note that the current item and selected items aren't necessarily the same.

For some reason though it seems like the current item that is reported programmatically is not the item deciding where shift-clicking starts from contrary to what the documentation says. Rather the last item that was clicked is the item where shift-clicking is anchored to. Seems like a bug in Qt, which if it is, I can't fix it.

from memento.

ripose-jp avatar ripose-jp commented on May 30, 2024

I tried something else. Seems to work well. It's up on master.

from memento.

ripose-jp avatar ripose-jp commented on May 30, 2024

I've tested the last fix I put out quite a bit and the issue seems fixed. If there continues to be any problems, feel free to reopen the issue.

from memento.

Calvin-Xu avatar Calvin-Xu commented on May 30, 2024

Thank you! Works really great.

from memento.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.