Important: Please read the Qt Code of Conduct -

Questions concerning QTableView and QListView

  • Hello everyone,

    I have to views that are QTableView and QListView, I could drag items from QTableView to QListView, I have some questions about this matter:
    -If I drag items to the white space of QListView it gonna append the list, but if the list view is full ( the vertical scroll bar appear) there is no longer white space, so it's impossible to append items to the list view, I could only drag on the last item of the list and insert the new one between the last item and the rest. Is there anyway to add some white space to the end of the list?
    -The QTableView items I had is really wide horizontally, so when I drag it has this big widget sticking to the mouse cursor. How can I change the UI of what I'm dragging?
    -I want to add some button on QTableView items whenever the user selected an item (it works similar to when you select a song in Groove Music, two buttons will appear). How to do this?

  • Lifetime Qt Champion


    1. Don't remember for that one
    2. You can subclass your model and reimplement startDrag, there you can set the image you want on the QDrag object.
    3. Implement your own QStyledItemDelegate

  • @SGaist Hello thank for you answer. I want to know one more thing is that how could I perform a middle mouse scroll while dragging. I need to move items in a view but it doesn't allow me to scroll.

  • Lifetime Qt Champion

    I don't know right now if it's implemented but it should rather be the view scrolling up/down when you are close to one of the uppper/lower edge.

Log in to reply