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
2
votes
2 answers

How to replace a row in QAbstractItemModel?

In QAbstractItemModel, some functions, such as beginInsertRows, beginRemoveRows, can be used to insert and remove rows. But how to implement replacing a row item by another one?
user1899020
  • 13,167
  • 21
  • 79
  • 154
2
votes
0 answers

How to define MODELVIEW matrix in Open GL

I am doing Camera Calibration, and I have my intrinsic and extrinsic parameters. I have few virtual cameras, and need to draw frustums for each. I have almost solved that, finding out Projection matrix (m[int]*m[ext]=Projection Matrix), but I still…
SuTron
  • 387
  • 5
  • 16
1
vote
1 answer

Qt QAbstractItemModel slow when scrolling in treeview

I made a simple model without any data, just showing some text. It works out okay if data returns a string. If I change it to return QString("%1").arg(index.row()); it starts becoming slow when scrolling in my treeview. QModelIndex…
Poul K. Sørensen
  • 16,950
  • 21
  • 126
  • 283
1
vote
2 answers

Where is the BEST PRACTICES place to put a list of Countries in a MVC Application?

In a heavy enviroment application, we have Users, Locations, bla bla bla... and we use in many situations a call to a service where we retrieve the list of countries. Where is the 'best practice' or 'proper way' to implement this. This method is…
Bart Calixto
  • 19,210
  • 11
  • 78
  • 114
1
vote
1 answer

Qt: QSqlTableModel + QTableView sync with PostgreSQL

I'm writing a database access app for storing some data and want to ask a few questions about the model/view architecture. (Using: Qt 4.7.4, own build; PostgreSQL 9.0; Targets: WinXP, Win7 (32/64 bit)) Let me first explain what I am trying to…
Itzuke
  • 43
  • 4
1
vote
2 answers

How to update QSqlTableModel after database connection has been changed changed

I have class which is derived from QSqlRelationalTableModel. I use SQLite database. And I need to change database file. I close old database file, call SetDatabaseName("path to new file") and open new database file. Now I just call select() for the…
Funt
  • 399
  • 8
  • 23
1
vote
2 answers

Laravel Resources VS ViewModel

I'm starting to work on an API service with Laravel. Now, I'm using a DDD approach (and learning it at the same time). Currently my structure looks like this: MyApp app (laravel app…
MrCujo
  • 1,218
  • 3
  • 31
  • 56
1
vote
0 answers

webgl - camera position affecting spotlight

I have been trying to implement a spotlight in my project. It works but at some point I noticed that when moving the camera around, the light was following the camera, and this is not what I wanted. I found a way to fix the spotlight position so…
1
vote
1 answer

insert nested relationships in DB django

Need help , i am trying to push nested relations inside DB don't know where I am going wrong in this, is there something wrong with validated_data , which is a list of dict here , thanks in advance class…
1
vote
1 answer

ModelView to ModelView communication

Please, what do you suggest is the best (in terms of architectural quality) approach to the following scenario: ModelViewA (parent) - requires collection from ModelViewB to display data - access collection multiple times even when the collection…
Ondrej Stastny
  • 159
  • 1
  • 13
1
vote
2 answers

QML: Canvas like a view

I have a set of rectangles provided by c++ backend, and I'd like to paint each of them on qml side with some extra decorations, colors opacity etc (respecting rectangles' positions and sizes). I was hoping for some special kind of view which would…
Michał Walenciak
  • 4,257
  • 4
  • 33
  • 61
1
vote
1 answer

Cameras and Modelview in OpenGL ES (WebGL)

I'm having a little trouble with my OpenGL transformations -- I have a vertex shader that sets gl_Position to projection * view * model * vertex. I have code that generates a view matrix by inverting the model matrix of a camera in space, but when I…
user193476
1
vote
1 answer

QML: Custom draggable point delegate for ChartView series

Is it possible to use custom delegates for draggable points (i.e. Items, icons, Rectangles, etc) in Qt Charts or other 3rd party libraries like it is easily possible in Qt Location for MapItemView, MapQuickItem and their delegate property? Or it is…
Aleksey Kontsevich
  • 4,671
  • 4
  • 46
  • 101
1
vote
2 answers

PyQt model/view: which type of model for programmatic changes?

I recently started rewriting an application and I'm trying to port it to model/view to reduce the number of kludges I have there. So far I was able to succcessfully make a read-only model inheriting from QAbstractTableModel. This model is something…
Einar
  • 4,727
  • 7
  • 49
  • 64
1
vote
2 answers

How to draw on a view?

There is a model, containing strings, and a list view. The QListView is a descendant of QPaintDevice, so you can override paintEvent (QPaintEvent *) in it and draw something on it. For example, you need to draw image cheker.png: #include…
ibse
  • 439
  • 1
  • 4
  • 13