Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-62615

Provide a AbstractCommand, similar to XAML or Prism's ICommand



    • Task
    • Resolution: Unresolved
    • Not Evaluated
    • None
    • None
    • Quick: Controls 1
    • None


      The ICommand in the XAML or C#/.NET world provides a type that is bindable to View.qml components. These types get typically implemented in the ViewModel(.cpp).

      The equivalent name for this would be, for example, QAbstractCommand. The ICommand, in XAML, has a bool canExecute property and a void execute() method. The canExecute is typically bound to either the enabled or the disabled of a View's component (a menu item, a button, or another thing that can have an action). The execute() method is typically bound to the action (onClicked, onTapped, onSelected, etc).

      As a freelance developer I visit many sites (customers) that use Qt. I miss standardization on this. I end up convincing my customers that they must do (something like) this. I would prefer this to be defined at the Qt's framework's level. Very much like how in the XAML and WPF world this is defined by Microsoft's Prism4 and Prism5 techniques. I do think these techniques represent a good and well understood set of idioms or, if you will, patterns on how to develop applications. We can all say that Silverlight did not succeed, but we can't say that the architectural concepts of WPF are bad. In fact, they are all brilliant.

      I made an example of how a ICommand, CompositeCommand and DelegateCommand would or could work here: https://github.com/pvanhoof/mvvm

      I think we need something similar in Qt or QtQuick.


        No reviews matched the request. Check your Options in the drop-down menu of this sections header.



            qt.team.quick.subscriptions Qt Quick and Widgets Team
            pvanhoof Philip Van Hoof
            0 Vote for this issue
            1 Start watching this issue



              Gerrit Reviews

                There are no open Gerrit changes