Defaultsheet and Composersheet are used in QML applications.

Source: Internet
Author: User

In the application sometimes we want to insert a window that shows content without interrupting the application interface navigation. We can use Defaultsheet and composersheet to show what we need. In fact, in our previous dialog tutorial, there were similar features, although the presentation was a little different.


Let's do an exercise:


Import QtQuick 2.0import ubuntu.components 1.1import Ubuntu.Components.Popups 0.1/*! \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: "Sheet.liu-xiao-guo"/* T The 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 (height:units.gu) page {title:i18n.tr ("sheet") Component {id:defaultsheet Defaultsheet {id:sheet title:i18n.tr (                    "Default sheet Title")//donebutton:true Label {anchors.fill:parent Wrapmode:text.                    WordWrap text: "Lorem ipsum dolor sit amet, consectetur adipiscing elit." + "Integer et ante at erat malesuada accumsan in eget mauris." + "Nunc ultrices tristique LA Oreet. In non tristique lorem. "+" Donec in libero ut libero pretium lacinia. Proin dictum Faucibus Viverra.                "}}} Component {Id:composersheet Composersheet {  Id:sheet title:i18n.tr ("Composer sheet") Label {anchors.fill: Parent WrapMode:Text.WordWrap Text: "Lorem ipsum dolor sit amet , Consectetur adipiscing elit. "+" Integer et ante at erat malesuada accumsan in eget mauris. "+" Nunc ultrices t Ristique Laoreet. In non tristique lorem. "+" Donec in libero ut libero pretium lacinia. Proin dictum Faucibus Viverra. "} onCancelClicked:PopupUtils.close (sheet) OnConfirmClicked:PopupUtils.clo            SE (Sheet)}} Row {anchors.centerIn:parent spacing:units.gu (2) button {text: "Default sheet" onclicked: {popuputils.open (Defaultshee  T, NULL)}} button {text: "Composer Sheet" onclicked:        {Popuputils.open (Composersheet, NULL)}} }    }}


To run our application:



For Defaultsheet, we can see a "Close" button, of course, we can also set its properties "Donebutton" is true, so there will be "done" button. Of course, these two buttons can not appear at the same time:




For Composersheet, it has two button "Cancel" and "Confirm". This allows us to use these two buttons to confirm or discard our changes in the sheet (if there is an edit and an option).


In conjunction with our previous dialog, there are some similar places to show. But the dialog is not so wide, and the color of the background shows the black.


In our previous tutorial, "Create an Ubuntu app from scratch-a small RSS reader." In the first part of the exercise, we can even use Defaultsheet to show our RSS content without having to create a new component.


The source code for the entire project is: Git clone https://gitcafe.com/ubuntu/sheet.git



Defaultsheet and Composersheet are used in QML applications.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.