jeudi 5 février 2015

Should this be in model or view?

I am using QFileSystemModel to populate my tree view. User can right click on a tree node (a folder) and perform an operation (exports all certain data files under this folderz).


I have this export under the on_tree_clicked() but I feel like this operation belongs to model.


Will it better if I derive my own QFileSystemModelWithExportfrom QFileSystemModeland added the export function? From on_tree_clicked(), I then just call it?


Is there another way to do this nicely? I want my on_tree_clicked() to be shorter and cleaner.


Also I am quite new to Qt, how do we derive from Qt core class like QFileSystemModel? When I am adding class, it lets me derive from QObject, QWidget etc but not from any model class.


Aucun commentaire:

Enregistrer un commentaire