Questions tagged [qabstractitemview]

The QAbstractItemView class provides the basic functionality for item view classes.

The QAbstractItemView class provides the basic functionality for item view classes.

QAbstractItemView class is the base class for every standard view that uses a QAbstractItemModel. QAbstractItemView is an abstract class and cannot itself be instantiated. It provides a standard interface for interoperating with models through the signals and slots mechanism, enabling subclasses to be kept up-to-date with changes to their models. This class provides standard support for keyboard and mouse navigation, viewport scrolling, item editing, and selections.

Reference: http://qt-project.org/doc/qt-4.8/qabstractitemview.html

44 questions
9
votes
5 answers

How to get list of visible QModelIndex in QAbstractItemView

Is there any way to get a list of currently visible items in QAbstractItemView? And, if it possible, to receive any notifications about changing of this list. Upd: I'm asking exactly about QAbstractItemView or QTreeView with non-plain structure, not…
Dmitry Sazonov
  • 8,801
  • 1
  • 35
  • 61
8
votes
1 answer

How to loop over QAbstractItemView indexes?

I want to fire QAbstractItemView::doubleClicked slot programaticaly for an item that has specific text. I want to do this using QAbstractItemView class and not it's implementations if possible. This task boils down to looping over items and…
Tomáš Zato
  • 50,171
  • 52
  • 268
  • 778
5
votes
5 answers

Copy/Paste multiple items from QTableView in pyqt4?

We can select multiple items(partial rows and partial columns) from QTableView using self.tableView.setSelectionMode(QAbstractItemView.ExtendedSelection), but after selecting some rows and columns(partial and partial) if I do CTRL+C and paste it in…
learncode
  • 1,105
  • 4
  • 18
  • 36
5
votes
1 answer

QComboBox with checkboxes

I'm creating QComboBox with checkboxes. How I can prevent collapsing of view on mouse clicking? I want to be able to set up checkboxes, but each time I click on item - drop-down of QComboBox is collapsed. Note: currently I'm debugging Qt sources and…
Dmitry Sazonov
  • 8,801
  • 1
  • 35
  • 61
4
votes
1 answer

Clear selection when clicking on blank area of Item View

I made a tree structure with QTreeWidget, and it works well. But I have a problem with that. Commonly, with a tree structure, if I want to deselect all, I click on a blank area of the tree-widget. But QTreeWidget does not seem to support that (or I…
Hyun-geun Kim
  • 919
  • 3
  • 22
  • 37
4
votes
1 answer

Why does QAbstractItemView removes elements after a MoveAction drag and drop?

I noticed in the source code of QAbstractItemView that the method void startDrag(Qt::DropActions supportedActions) calls some clearOrRemove() private after a drag whose type is MoveAction(), which removes selected items. Point is, when the drop…
Lithy
  • 817
  • 12
  • 23
4
votes
1 answer

Qt: remove model from view

We usually set view's model in Qt like this: view->setModel(model); But is there any way to remove a model from view? I mean literally leave a view empty like it was just created and there was not any model set to it yet. If you ask me a reason of…
Nikolai Shalakin
  • 1,349
  • 2
  • 13
  • 25
3
votes
1 answer

Programmatically select QModelIndexes in QAbstractItemView

I am trying to select items of abstract item view in Qt given their string values. I have already written function that finds any QModelIndex based on it's string content. I am now trying to put all those QModelIndexes that I find into single…
Tomáš Zato
  • 50,171
  • 52
  • 268
  • 778
3
votes
2 answers

How to Copy - Paste Multiple Items form QTableView created by QStandardItemModel to a text/excel file?

How can I copy and paste multiple items/values of a QTableView to a text/ excel file? My Code: tab_table_view = QtGui.QWidget() self.Tab.insertTab(0, tab_table_view, self.File_Name) self.tableView =…
learncode
  • 1,105
  • 4
  • 18
  • 36
3
votes
1 answer

QTreeView - how to tell if a drag/drop event is a reorder or a move between parents?

I have subclasses of QTreeView and QAbstractItemModel and currently I'm using drag-drop to move items from one parent index to another. I want to also add the ability to rearrange the order of items within the same parent index. When the user…
Carlton
  • 4,217
  • 2
  • 24
  • 40
3
votes
2 answers

How to remove horizontal borders from QHeaderView

I Have QTableView object with horizontal headerView, (vertical I have hidden). I set setShowGrid(false) to remove grid from qtableView, but how can I remove separator borders between QTableView and its horizontal header. I…
tokafr
  • 109
  • 2
  • 12
3
votes
2 answers

QComboBox drop-down item margin

I want to style my QComboBox with margin for the drop down items. This is how it looks like now: And I would like something like this: I tried with QComboBox QAbstractItemView::item { margin: 3px; } but it doesn't work. Can you help me with…
Jacob Krieg
  • 2,834
  • 15
  • 68
  • 140
2
votes
1 answer

Qt: What to emit when inserting items into my model to hint to the view to recheck canFetchMore?

I have a custom model (extends QAbstractTableModel) where row data is added pragmatically. For performance reasons, I am using the fetch functionality (canFetchMore, fetchMore) to avoid UI lag when items are not visible. When a new row is inserted,…
2
votes
1 answer

How to keep an item view scrolled to the bottom when items are added?

When appending items at the end of a model shown by a QAbstractItemView, I wish to keep the view at the bottom of the data, showing the most recent added items. The default behavior is to retain the most recently displayed item's position, but not…
2
votes
2 answers

How to close an editor created by a custom QItemDelegate::createEditor()

I have created a custom item delegate which lets users edit a list of file paths: I have achieved this through a custom class DirEdit. Now the selected path is commited and the editor is closed when the user presses enter, but I would like to add…
bgp2000
  • 1,070
  • 13
  • 32
1
2 3