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
1
vote
1 answer

Qt: Attempt to add Drag and Drop to Editable Tree Model example not working

I'm trying to learn how to implement Drag and Drop to model/view settings in Qt. As an exercise, I attempted to do that to the Editable Tree Model example available at the Qt web site: To extend it with Drag and Drop, I followed the instructions in…
user118967
  • 4,895
  • 5
  • 33
  • 54
1
vote
1 answer

qt permanently display delegate in view

How do you use QStyledItemDelegate / QItemDelegate to permanently display a complex widget, i.e. to handle the Qt.DisplayRole, not just Qt.EditRole? The documentation eludes to using paint()... but that's just way to complex! Let's take for example…
hansonap
  • 461
  • 1
  • 4
  • 16
1
vote
0 answers

QTableView - How to handle a lot of dataChanged signals?

I have to program a table view that should be able to handle tens thousands of cells containing images (image is different for every cell). All in python using PySide2. I implemented the loading of my images using a thread pool. The problem is that…
Vlad
  • 27
  • 4
1
vote
0 answers

QAbstractItemView - fetchMoreTimer

I created dynamic loading model that supplies data to a modified qTreeView. Everything seemed to work fine. Until I realized that sometimes the GUI "waits" for something. It showed up that fetchMore of my model is called every now and then. I found…
Kapitan
  • 73
  • 8
1
vote
1 answer

Multiple Selection table, without selection of mouse dragging

I would like to have QAbstractItemView that will allow multi-selection of items only with ctrl button toggle. I can't use QAbstractItemView::ExtandedSelection because it also allow multiple items selection by dragging the mouse over them.
1
vote
1 answer

Customize selection behavior for QTreeView

I have QTreeView and I want multi selection behavior in case if node is leaf, otherwise single selection behavior, so do not allow to select non-leaf node if some node already selected, and do not allow to select any other node if non-leaf node is…
1
vote
0 answers

Why QAbstractItemView::dragEnterEvent is always accepted?

Why QAbstractItemView::dragEnterEvent doesn't​ check model's canDropMimeData method? This results in incorrect 1-pixel area along widget boundary which is always "positive-drop" without taking into account if model can actually accept data after…
groaner
  • 540
  • 4
  • 12
1
vote
0 answers

How to return a special text color from a QAbstractItemModel depending on its widget being enabled/disabled

For some columns in my QAbstractItemModel, I need the text to appear in a special color. I am doing this by returning that color in data() where role == Qt::TextColorRole. This is fine, until the view that displays this model is disabled, then…
jtooker
  • 1,043
  • 1
  • 8
  • 22
1
vote
1 answer

QAbstractItemView::setIndexWidget as editor

Is there any specific reason not to use QAbstractItemView::setIndexWidget for an editor in a QTreeView? I am having a hell of a time using QStyledItemDelegate's and setItemDelegateForColumn, with data not showing up in editors, checkboxes not…
Lars
  • 1,869
  • 2
  • 14
  • 26
1
vote
1 answer

Force current index to be shown in QAbstractItemView even after losing focus

I have an instance of QAbstractItemView say QListView with selectionMode set to Qt::NoSelection. When I activate the widget, I can see the current index highlighted. However, when I focus another widget, the current index of the QListView is no…
tach
  • 663
  • 12
  • 19
1
vote
0 answers

QListView whitespace

I have a QListView with some items in it. I would like to know the bounding box of the content that is presented. Here is an illustration: As you can see, the geometry of the ListView (whole black area) does not match the geometry of the contents.…
ypnos
  • 50,202
  • 14
  • 95
  • 141
1
vote
0 answers

How to display widgets in subclass of QAbstractItemView?

I want to display contents of a data model customly, that is, display every row of the model using a widget. I have subclassed QAbstractItemView and tried to display widgets by creating a layout, asigning it to the viewport and then adding items to…
Srv19
  • 3,458
  • 6
  • 44
  • 75
1
vote
1 answer

QTableView shows 1d data in exactly one row/column. How to show it two-dimensionally?

Say I have a one-dimensional QStandardItemModel and a QTableView instance: QStandardItemModel model; for (int i = 1; i < 10; ++i) { QStandardItem *item = new QStandardItem(QString::number(i)); model.appendRow(item); } QTableView…
arenio
  • 11
  • 2
0
votes
0 answers

QCombobox - text jumps around and the dropdown list needs padding

I am modifying an existing Qt .qss stylesheet and am having some issues with readability. Currently, the text in the Qcombobox has no padding when inactive and the padding is applied as soon as I click upon the dropdown. I would also like to apply…
Hologram
  • 101
0
votes
0 answers

Locking selection in QTableView/QTreeView

Is it possible to "lock" selection in QAbstractView? I have a form with: A list of objects I can edit (QTableView).Objects are stored in a database, the list shows their ID. A New button, whose effect is to append an empty row I can edit to create…
Atmo
  • 2,281
  • 1
  • 2
  • 21