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
3
votes
1 answer

Why is MyModel::data() not being called (subclassing QSqlQueryModel)

Hi I can't figure out why my data() function is never called when populating QTableView I subclassed QSqlQueryModel. The header is like: class TicketModel : public QSqlQueryModel { Q_OBJECT public: explicit TicketModel(QObject *parent =…
L Co
  • 805
  • 11
  • 17
3
votes
2 answers

Qt Model/View programming with complicated data structures

I am not a professional application developer so am probably not as familiar with the model/view design pattern as I should be. Nonetheless, I am trying to use it in a hobby app and failing miserably. The primary problem I am having is that the data…
Dan O
  • 4,323
  • 5
  • 29
  • 44
3
votes
1 answer

How to use presentModalViewController in Android?

Currently i am working in Android application, In iphone application Using presentModalViewController to animate view from bottom to top on a screen, similarly in Android application, How to use presentModalViewController Control in Android? Is it…
SampathKumar
  • 2,525
  • 8
  • 47
  • 82
3
votes
1 answer

QListView with checkboxes for viewing of filesystem

It is necessary to list of directories by given path in QListView whith icons and checkboxes, then transmit names of marked folders to the program. For list directories i use code: #include #include #include…
2
votes
3 answers

How to make a constant correct read only model/view architecture in Qt?

Suppose I want to implement a model/view architecture using the QTableView and QAbstractTableModel classes. So I subclass the QAbstractTableModel to create class MyModel and implement the QAbstractTableModel interface. Then connect the instance of…
Martin Drozdik
  • 12,742
  • 22
  • 81
  • 146
2
votes
1 answer

How to display a manipulated model content in QAbstractItemView

I have a QSqlTableModel and a QTableView displaying the contents of the model. I've managed to customize the editing of models subclassing QStyledItemDelegate and reimplementing the methods setEditorData, setModelData and updateEditorGeometry. What…
borges
  • 3,627
  • 5
  • 29
  • 44
2
votes
1 answer

Updating a record in QSqlTableModel

I am trying to update a record and i have this: tableModel->select(); QModelIndex index = ui.tableView->currentIndex(); QString sqlQuery = QString("UPDATE %1 SET firstname=:firstname, lastname=:lastname, country=:country, city=:city WHERE…
Gandalf
  • 1
  • 29
  • 94
  • 165
2
votes
1 answer

QHeaderView with checkbox - how to differentiate clicking right on the header checkbox from clicking anywhere in the cell

I have a custom header QProduitCartoHeaderView defined in a class inheriting from QHeaderView. In my header I have a checkbox used to check/uncheck all the checkboxes in the same column for all rows of data. Currently when I click anywhere in the…
Pat. ANDRIA
  • 2,330
  • 1
  • 13
  • 27
2
votes
2 answers

For MVVM design pattern, where does table view cell height belong to?

I have a view model that contains my model and other properties used by my table view delegate methods in my view controller. For heightForRowAt delegate method, I’m passing a computed property from my viewmodel to dynamically calculate the height…
iamarnold
  • 705
  • 1
  • 8
  • 22
2
votes
2 answers

Qt - QListView with a custom widget that represents multiple attributes

I'm developing a Qt5 app that includes a widget whose role is to show the user a list of objects (vertical list, single column), each entry containing 3 or 4 attributes. I also need to reuse a custom widget that was designed to represent each…
RAM
  • 2,257
  • 2
  • 19
  • 41
2
votes
0 answers

Why did we chose to orient OpenGL view camera along -z axis?

everyone seems to know the camera is oriented along the -Z instead of +Z but i can't find anywhere an explanation to that arbitrary choice. Can anyone help? Thanks in advance.
Roulbacha
  • 457
  • 7
  • 20
2
votes
1 answer

What is difference between Model and ViewModel in asp.net core mvc?

I have a Account class for account models. public class Account { [Key] public Int64 UID { get; set; } [Required] public string ID { get; set; } [Required] public string PassWord { get; set; } [Required] public…
HelloWorld
  • 626
  • 2
  • 10
  • 21
2
votes
0 answers

canFetchMore() and fetchMore() are not working as expected

I have problems implementing Qt tree model with lazy loading using canFetchMore() and fetchMore(). I have this code: from PySide.QtCore import Qt, QAbstractItemModel, QModelIndex from PySide.QtWidgets import QTreeView, QApplication BATCH_SIZE =…
2
votes
1 answer

Qt Best Control For Multi Column List?

I want to display a multi column list, so when one column is filled to the bottom of the window subsequent items will be displayed in the next column, something like this: Item1 Item4 Item7 Item2 Item5 Item8 Item3 Item6 Item9 If the window is…
Assoluto
  • 199
  • 3
  • 12
2
votes
1 answer

How to display sub-rows of QAbstractItemModel in QTableView

I have my own class that inherits from QAbstractItemModel which has tree structure. I use a couple of views, that display filtered data of this model, using classes derived from QSortFilterProxyModel. My model structure looks like this: root | --…
paws
  • 197
  • 1
  • 2
  • 13