Questions tagged [model-view]

model-view describes the relationship between the model and the view when using model-view-controller

Model-view-controller is an architecture to separate the model (data) and the view (interface). The model contains the information for a program while the view is the interface with the user. The controller is used to update the model from user input and to update the view when the model changes.

259 questions
4
votes
3 answers

In QML, (how) can I make MapItemGroup as a MapItemView's delegate component?

Situation: I am able to use QML Map item with Model/View/delegate. I am able to work with individual items. Problem: As a next step, I would like to be able to draw multiple items. I need to put multiple QML MapItems (like MapCircle, MapRectangle,…
tegginamaniss
  • 151
  • 10
4
votes
2 answers

I want to apply for-each loop on two models at same time Asp.Net MVC

I want to apply for each loop on two models at the same time. My Controller Action Is: public ActionResult MarkAttendance(int id) { var students = _context.Students.Where(c => c.ClassId == id).ToList(); var status =…
Alamzaib Farooq
  • 190
  • 2
  • 18
4
votes
2 answers

Tree traversal in QML, checking if QModelIndex isValid

In order to expand the nodes of a TreeView to show the currently selected item (set by a shared selection model) I need to call TreeView.expand(QModelIndex) recursively. expand(index) expand(index.parent) expand(index.parent.parent) …
Simon Schmeißer
  • 324
  • 4
  • 12
4
votes
1 answer

Interdependent models in Qt Model-View

How do I implement interdependent models using Qt's Model-View framework? Specifically, how can I create a model that contains fields that reference data in another model? I want data that is changed/removed in the first model to propagate to the…
Terrabits
  • 997
  • 2
  • 15
  • 19
4
votes
2 answers

Sorting QtTableModel - QTableView doesn't get updated

I implemented a custom QAbstractTableModel and I'm using a std::vector for my data objects. Now I wanted to implement the sort() method, to get my table sorted by column. That's basically what I do: void SBStateTableModel::sort (int column,…
Benjamin Maurer
  • 3,602
  • 5
  • 28
  • 49
4
votes
1 answer

QTableView doesn't respond to dataChanged when not focused

I have a QTableView that's connected to a QAbstractTableModel subclass. I'm editing the data owned by the model in response to user input in a different control (not the QTableView), and then I'm calling a method on the model that emits the…
phrixus
  • 81
  • 4
4
votes
0 answers

QTableView to display only leaves of a tree model implemented with QAbstractItemModel

Assume I have a tree structure (tree leaves in bold, sorry for the dots): A A1 A2 B B1 B11 B2 C stored in a QAbstractItemModel (with set parent/child relations). How to display only the tree leaves in a QTableView? Basic idea was to…
hauron
  • 4,550
  • 5
  • 35
  • 52
4
votes
1 answer

QWidget as View Item (Qt Model View Controller)

So what I want is a qlistview that displays selectable widgets(label that displays an image and text for a button(widget is a qwidget based widget which has a horizontal layout with a QLabel and a QPushButton)). The model should store image path and…
Jacob Krieg
  • 2,834
  • 15
  • 68
  • 140
4
votes
2 answers

QTableView cannot hide column

Well, here is the problem: I construct a QTableView and use the setModel(myModel) method which bind the model myModel to myTableView; At first, there's no data in myModel, I use the hideColumn(0) to do the job, and it works well, while after I load…
helsinki
  • 743
  • 7
  • 14
4
votes
1 answer

QComboBox not calling Delegate methods

I want to customize a QComboBox by inserting QWidgets (instead of strings) through a model and a delegate: QComboBox *cb = new QComboBox(this); FeatureModel *featureModel = new FeatureModel(cb); cb->setModel(featureModel); ComboBoxItemDelegate…
Magnus
  • 55
  • 1
  • 6
4
votes
2 answers

OpenGL ES2.0 Modelview matrices 2D

Migrating from OpenGL ES1.1 to 2.0 for 2D purposes (orthographic), and I'm having a little trouble figuring out how apply transformations (matrix multiplication order). I only need rotation on the Z-axis, and scaling on X and Y which is the always…
user1137704
  • 349
  • 1
  • 3
  • 12
4
votes
1 answer

Is properly tracking source model row movement a part of QSortFilterProxyModel's contract?

Suppose I have a source model, within which the row movements are decorated with beginMoveRows() endMoveRows() (and hence emit layoutChanged()). Then, there's a QSortFilterProxyModel instance set up to filter rows of the source model. As I get it…
mlvljr
  • 4,066
  • 8
  • 44
  • 61
4
votes
1 answer

How to set width of QTableView columns by model?

I'm using QTableView with a subclass of QAbstractTableModel as its model. By implementing data() and headerdata() in the subclassed model, it is feasible to control many properties of the table like data, header values, font, and so on. In my case,…
sjtaheri
  • 4,409
  • 3
  • 19
  • 15
3
votes
1 answer

Replace Default PK slug with Multiple Lookup Fields for ModelViewSet

I have two slugs, against which I run queries. Thanks to base class MultipleFieldLookupMixin, which my view class is inherited from and thus allows me to have multiple lookup_fields. We know that when ModelViewSet is used with DefaultRouter, appends…
Muhammad Naufil
  • 2,420
  • 2
  • 17
  • 48
3
votes
1 answer

unwanted empty rows in a proxy model

I have a question regarding Qt's model/view architecture. I have implemented a class TestModel inheriting from QAbstractItemModel, with a custom method TestModel.addRevision(...) to insert new rows and TestModel.removeRevision(...) to remove rows.…
marc
  • 264
  • 1
  • 2
  • 17
1
2
3
17 18