← Back to team overview

ubuntu-sdk-bugs team mailing list archive

[Bug 1460897] [NEW] Captions API sample code is not working on vivid

 

Public bug reported:

The original sample code at:

https://developer.ubuntu.com/api/apps/qml/sdk-15.04/Ubuntu.Components.Captions/

is not working.

The correct one:

import QtQuick 2.4
import Ubuntu.Components 1.2
import QtQuick.Layouts 1.1   // THIS SHOULD BE ADDED

/*!
    \brief MainView with a Label and Button elements.
*/

MainView {
    // objectName for functional testing purposes (autopilot-qt5)
    objectName: "mainView"

    // Note! applicationName needs to match the "name" field of the click manifest
    applicationName: "captions.liu-xiao-guo"

    /*
     This property enables the application to change orientation
     when the device is rotated. The default is false.
    */
    //automaticOrientation: true

    // Removes the old toolbar and enables new features of the new header.
//    useDeprecatedToolbar: false

    width: units.gu(60)
    height: units.gu(85)

    Page {
        title: i18n.tr("captions")

        ListItem {
            RowLayout {
                anchors.fill: parent    // THIS SHOULD BE ADDED

                Captions {
                    title.text: "Caption"
                    subtitle.text: "Subtitle text"
                    // attached properties of an Item type property
                    // can be changed only with assignment
                    Component.onCompleted: subtitle.Layout.alignment = Qt.AlignRight
                }
                Captions {
                    captionStyle: Ubuntu.SummaryCaptionStyle
                    title.text: "Text"
                    subtitle.text: "Text"
                }
            }

        }
    }
}

The module:

import QtQuick.Layouts 1.1   // THIS SHOULD BE ADDED

and also

  anchors.fill: parent    // THIS SHOULD BE ADDED

Otherwise, nothing will be displayed.

** Affects: ubuntu-ui-toolkit (Ubuntu)
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of Ubuntu
SDK bug tracking, which is subscribed to ubuntu-ui-toolkit in Ubuntu.
https://bugs.launchpad.net/bugs/1460897

Title:
  Captions API sample code is not working on vivid

Status in ubuntu-ui-toolkit package in Ubuntu:
  New

Bug description:
  The original sample code at:

  https://developer.ubuntu.com/api/apps/qml/sdk-15.04/Ubuntu.Components.Captions/

  is not working.

  The correct one:

  import QtQuick 2.4
  import Ubuntu.Components 1.2
  import QtQuick.Layouts 1.1   // THIS SHOULD BE ADDED

  /*!
      \brief MainView with a Label and Button elements.
  */

  MainView {
      // objectName for functional testing purposes (autopilot-qt5)
      objectName: "mainView"

      // Note! applicationName needs to match the "name" field of the click manifest
      applicationName: "captions.liu-xiao-guo"

      /*
       This property enables the application to change orientation
       when the device is rotated. The default is false.
      */
      //automaticOrientation: true

      // Removes the old toolbar and enables new features of the new header.
  //    useDeprecatedToolbar: false

      width: units.gu(60)
      height: units.gu(85)

      Page {
          title: i18n.tr("captions")

          ListItem {
              RowLayout {
                  anchors.fill: parent    // THIS SHOULD BE ADDED

                  Captions {
                      title.text: "Caption"
                      subtitle.text: "Subtitle text"
                      // attached properties of an Item type property
                      // can be changed only with assignment
                      Component.onCompleted: subtitle.Layout.alignment = Qt.AlignRight
                  }
                  Captions {
                      captionStyle: Ubuntu.SummaryCaptionStyle
                      title.text: "Text"
                      subtitle.text: "Text"
                  }
              }

          }
      }
  }

  The module:

  import QtQuick.Layouts 1.1   // THIS SHOULD BE ADDED

  and also

    anchors.fill: parent    // THIS SHOULD BE ADDED

  Otherwise, nothing will be displayed.

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/ubuntu-ui-toolkit/+bug/1460897/+subscriptions


Follow ups

References