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

vertical/horizontal alignment property is not available when referencing a Text defined as Component by id from a Loader

XMLWordPrintable

    • All
    • 53d4495b, 509cc84a, 8a2038c3

      Here is an example code, the horizontal / vertical alignment causes the build error.

      Code:  

      import QtQuick
      
      Rectangle {
          Component {
              id: textComp
              Text {
                  width: 128
                  height: 64
                  font.pixelSize: 16
                  text: "Build Error"
                  horizontalAlignment: Text.AlignHCenter
                  verticalAlignment: Text.AlignVCenter
              }
          }
          Loader {
              sourceComponent: textComp
              active: true
          }
      } 

      Error message: 

      C:/work/QTMCU341/build/Qt_for_MCUs_2_8_Desktop_32bpp_MINGW-Debug/CMakeFiles/QTMCU341.dir/QTMCU341.cpp: In constructor 'QTMCU341::text_2::text_2(QTMCU341*)':
      C:/work/QTMCU341/build/Qt_for_MCUs_2_8_Desktop_32bpp_MINGW-Debug/CMakeFiles/QTMCU341.dir/QTMCU341.cpp:71:5: error: 'horizontalAlignment' was not declared in this scope
         71 |     horizontalAlignment.setValue(Qul::Private::Items::Text::AlignHCenter);
            |     ^~~~~~~~~~~~~~~~~~~
      C:/work/QTMCU341/build/Qt_for_MCUs_2_8_Desktop_32bpp_MINGW-Debug/CMakeFiles/QTMCU341.dir/QTMCU341.cpp:74:5: error: 'verticalAlignment' was not declared in this scope
         74 |     verticalAlignment.setValue(Qul::Private::Items::Text::AlignVCenter);
            |     ^~~~~~~~~~~~~~~~~

       

        1. QTMCU341.zip
          2 kB
        2. error.log
          3 kB
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            k0rahman Karim Abdelrahman
            wataru Wataru Higashiyama
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes