Uploaded image for project: 'Qt for MCUs'
  1. Qt for MCUs
  2. QTMCU-12

Anchors on a provided parent item do not work in custom item

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P2: Important
    • Qt for MCUs 1.5
    • Qt for MCUs 1.4
    • QML, QML Engine
    • None
    • All
    • 0
    • UL Sprint 3.7

    Description

      If a custom control gets as property its parent item. The custom control can not anchor to that parent item, because it creates corrupted c++ code

      root qml code test.qml

      Rectangle {
          id: parentRect
          width: 1280
          height: 720
      
      
          Rect {
              id: rect
              parentRect: parentRect
              width: 100
              height: 200
          }
      }
      

      custom qml control code Rect.qml

      Rectangle{
          id: rect
          property Rectangle parentRect: Rectangle{}
      
          anchors.horizontalCenter: parentRect.horizontalCenter
      }
      
      

      Genereated corrupted c++ code, Rect.cpp:

      .
      .
      .
      int Rect::_x_anchor_bindingFunctor::operator()(Rect *self) const {
          struct horizontalCenter_funcFunctor {
              Rect *self;
              ItemBase::HorizontalAnchorLine operator()() const {
                  Qul::Private::Items::ItemBase::HorizontalAnchorLine r2__horizontalCenter;
                  Qul::Private::Items::Rectangle * r2;
                  // anchors.horizontalCenter: parentRect.horizontalCenter
                  // line 7  "Test/Rect.qml"
                  r2 = self->parentRect.value();
                  r2__horizontalCenter = r2->horizontalCenterAnchor();
                  return r2__horizontalCenter;
                  
              }
          } horizontalCenter_func = { self };
          ItemBase::HorizontalAnchorLine horizontalCenter = horizontalCenter_func();
              return horizontalCenter.valueFor(&self->) - ((self->width.value())/2);
      };
      
      .
      .
      .

       

      Attachments

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

        Activity

          People

            ckamm Christian Kamm
            _joerg_ Jörg Hedrich
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes