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

QMLBridges: BindConnection annotation

    XMLWordPrintable

Details

    • Task
    • Resolution: Unresolved
    • P2: Important
    • None
    • None
    • QML: Bridges
    • None

    Description

      @BindConnection was introduced to register connection in QML side without the need of manual emitting of the signal 

      interface MyMainViewModelCallback {
          fun duplicateFound(item: String)
          fun erased()
          fun blankFound()
      } 
      /////
      @BindConnection
      private var qtCallback: MyMainViewModelCallback? = null

      By annotating the interface we get:

      public final class MainViewModel_MyMainViewModelCallbackImpl implements MyMainViewModelCallback {
          private final MainViewModel viewModel;
      
          public MainViewModel_MyMainViewModelCallbackImpl(MainViewModel var1) {
              this.viewModel = var1;
          }
      
          public void erased() {
              this.viewModel.emit("erased", new Object[0]);
          }
      
          public void blankFound() {
              this.viewModel.emit("blankFound", new Object[0]);
          }
      
          public void duplicateFound(String var1) {
              this.viewModel.emit("duplicateFound", new Object[]{var1});
          }
      }
       

      This is done however it needs to be improved as it requires to be within a QtViewModel which inherits from at QObject

      Attachments

        Issue Links

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

          Activity

            People

              ahmedelkhazari Ahmed El Khazari
              ahmedelkhazari Ahmed El Khazari
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:

                Gerrit Reviews

                  There are no open Gerrit changes