PDA

View Full Version : Model View Controller in Qt



iVAn94fi
28th July 2014, 16:07
Hi everyone this is my first post on this forum and since i'm a Qt newbie, I' ll try to make my answer as clear as possible.

As many other not-so-expert programmers I'm struggling to understand how to use Model-View-Controller in Qt. As far as I understood reading Qt docs and other question, there isn't a real MVC implementation in Qt, but there's a Model-View-Delegate paradigm, which is similar. However I can't understand how should I use the pre-defined Qt classes.

My application should be a image comparator: You load two images from the filesystem, and the program displays them side by side so that you can actually see the differences. The problem is that I have to do that using MVC. So for the Model I choose the QStandardItemModel: with this I would store the images as QPixmap (At least I think.. :rolleyes: ). But for the View part I don't know what to use: there are QColumnView, QHeaderView, QListView, QTableView, and QTreeView.

Here is my issue. How can any of these classes be useful to display two images side by side?? I just can't figure it out. So if you could help me I' d be grateful!! Thank you!!

wysota
28th July 2014, 16:57
I think you should rather have a custom model operating directly on QImage and use two QTableView instances for displaying the images.