Merge "Merge remote-tracking branch 'origin/5.0'"

This commit is contained in:
The Qt Project
2021-09-20 11:51:42 +00:00
152 changed files with 1191 additions and 1506 deletions

View File

@@ -7,7 +7,7 @@ instructions:
variableValue: "RelWithDebInfo" variableValue: "RelWithDebInfo"
- type: EnvironmentVariable - type: EnvironmentVariable
variableName: QTC_QT_BASE_URL variableName: QTC_QT_BASE_URL
variableValue: "http://ci-files02-hki.intra.qt.io/packages/jenkins/archive/qt/6.2/6.2.0-beta4-released/" variableValue: "http://ci-files02-hki.intra.qt.io/packages/jenkins/archive/qt/6.2/6.2.0-rc-released/"
- type: EnvironmentVariable - type: EnvironmentVariable
variableName: QTC_QT_MODULES variableName: QTC_QT_MODULES
variableValue: "qt5compat qtbase qtdeclarative qtimageformats qtquick3d qtquickcontrols2 qtquicktimeline qtserialport qtshadertools qtsvg qttools qttranslations" variableValue: "qt5compat qtbase qtdeclarative qtimageformats qtquick3d qtquickcontrols2 qtquicktimeline qtserialport qtshadertools qtsvg qttools qttranslations"

Binary file not shown.

Before

Width:  |  Height:  |  Size: 484 B

After

Width:  |  Height:  |  Size: 218 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 494 B

After

Width:  |  Height:  |  Size: 208 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 208 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 218 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.3 KiB

After

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 82 KiB

After

Width:  |  Height:  |  Size: 46 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 75 KiB

After

Width:  |  Height:  |  Size: 46 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 32 KiB

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 28 KiB

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 25 KiB

After

Width:  |  Height:  |  Size: 102 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 61 KiB

After

Width:  |  Height:  |  Size: 17 KiB

View File

@@ -146,6 +146,7 @@
\li \l{Scene Environment} \li \l{Scene Environment}
\li \l{Morph Target} \li \l{Morph Target}
\li \l{Repeater3D} \li \l{Repeater3D}
\li \l{Loader3D}
\endlist \endlist
\li \l {Creating Component Instances} \li \l {Creating Component Instances}
\li \l {Creating Custom Components} \li \l {Creating Custom Components}

View File

@@ -25,7 +25,7 @@
/*! /*!
\page quick-component-instances.html \page quick-component-instances.html
\previouspage studio-3d-repeater-3d.html \previouspage studio-3d-loader-3d.html
\nextpage quick-components-creating.html \nextpage quick-components-creating.html
\title Creating Component Instances \title Creating Component Instances

View File

@@ -212,6 +212,9 @@
\if defined(qtdesignstudio) \if defined(qtdesignstudio)
\section1 Iso Icon \section1 Iso Icon
\note The Iso Icon component is not available if you selected
\uicontrol {Qt 6} when \l{Creating Projects}{creating the project}.
The Iso Icon component specifies an icon from an ISO 7000 icon library as a The Iso Icon component specifies an icon from an ISO 7000 icon library as a
\l [QtQuickExtras] {Picture} component. The icon to use for the type and \l [QtQuickExtras] {Picture} component. The icon to use for the type and
its color can be specified. its color can be specified.
@@ -223,7 +226,7 @@
\image studio-iso-icon.png \image studio-iso-icon.png
You can use the \l{Picking Colors}{color picker} in \l Properties to You can use the \l{Picking Colors}{color picker} in \l Properties to
set the icon color. set the value of \uicontrol {Icon color}.
\image iso-icon-browser.png \image iso-icon-browser.png
\endif \endif
@@ -270,6 +273,8 @@
\li \li
\li An icon from an ISO 7000 icon library specified as a \l Picture \li An icon from an ISO 7000 icon library specified as a \l Picture
component. You can select the icon to use and its color. component. You can select the icon to use and its color.
\note This component is not supported on Qt 6.
\endif \endif
\endtable \endtable
*/ */

View File

@@ -84,6 +84,7 @@
\li \l {Scene Environment} \li \l {Scene Environment}
\li \l {Morph Target} \li \l {Morph Target}
\li \l {Repeater3D} \li \l {Repeater3D}
\li \l {Loader3D}
\endlist \endlist
When you import 3D scenes from files that you exported from 3D graphics When you import 3D scenes from files that you exported from 3D graphics

View File

@@ -50,6 +50,11 @@
Similarly, you can add custom properties for your own components that are Similarly, you can add custom properties for your own components that are
based on preset components. based on preset components.
Any content that is data-driven should be exported as a public property
(alias property) of the relevant component. For example, a speedometer
should have an \e int or \e real property for speed to which the UI is
bound.
You can add properties for components in \l {Connection View} > You can add properties for components in \l {Connection View} >
\uicontrol Properties. \uicontrol Properties.

View File

@@ -93,7 +93,7 @@
For examples of using the \uicontrol {Connections} view, see: For examples of using the \uicontrol {Connections} view, see:
\list \list
\li \l{Connecting Buttons to States} in \l{Log In UI - Part 3} \li \l{Connecting Buttons to States} in \l{Log In UI - States}
\li \l{Connecting Buttons to State Changes} in \l{Washing Machine UI} \li \l{Connecting Buttons to State Changes} in \l{Washing Machine UI}
\endlist \endlist
\endif \endif

View File

@@ -61,7 +61,7 @@
state change. state change.
\if defined(qtdesignstudio) \if defined(qtdesignstudio)
The \l{Log In UI - Part 3} example illustrates using states to create The \l{Log In UI - States} example illustrates using states to create
two UI screens and signals emitted by buttons to apply the states. two UI screens and signals emitted by buttons to apply the states.
The button components also switch states when they are pressed down. The button components also switch states when they are pressed down.

View File

@@ -58,7 +58,7 @@
by using a \l{Creating Custom Controls}{wizard template}. For more by using a \l{Creating Custom Controls}{wizard template}. For more
information about editing the states within the button component and information about editing the states within the button component and
hiding and showing buttons to create several screens, see hiding and showing buttons to create several screens, see
\l{Log In UI - Part 1} and \l{Log In UI - Part 3}. \l{Log In UI - Components} and \l{Log In UI - States}.
\endif \endif
To add motion to a screen, you can change the position of a component To add motion to a screen, you can change the position of a component

View File

@@ -69,7 +69,7 @@
\youtube V3Po15bNErw \youtube V3Po15bNErw
\if defined(qtdesignstudio) \if defined(qtdesignstudio)
To try it yourself, follow the \l{Log In UI - Part 4} tutorial. To try it yourself, follow the \l{Log In UI - Timeline} tutorial.
\endif \endif

View File

@@ -69,7 +69,8 @@ excludedirs += ../../qtcreator/examples/accelbubble \
exampledirs = ../examples/ \ exampledirs = ../examples/ \
../../qtcreator/examples ../../qtcreator/examples
examples.fileextensions += *.qml *.svg *.ts *.qm examples.fileextensions += *.qml *.ts *.qm
examples.imageextensions = "*.svg *.png *.jpg *.gif"
depends += qtwidgets \ depends += qtwidgets \
qtcore \ qtcore \

Binary file not shown.

After

Width:  |  Height:  |  Size: 37 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 47 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 37 KiB

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 49 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 57 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 75 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 59 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.0 KiB

After

Width:  |  Height:  |  Size: 9.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 45 KiB

After

Width:  |  Height:  |  Size: 40 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 87 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 45 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 83 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 86 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 53 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 63 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.0 KiB

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 45 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 38 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 540 KiB

After

Width:  |  Height:  |  Size: 58 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.9 KiB

After

Width:  |  Height:  |  Size: 7.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 9.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 593 KiB

After

Width:  |  Height:  |  Size: 167 KiB

View File

@@ -27,20 +27,20 @@
\example loginui1 \example loginui1
\ingroup studioexamples \ingroup studioexamples
\ingroup gstutorials \ingroup gstutorials
\nextpage {Log In UI - Part 2} \nextpage {Log In UI - Positioning}
\title Log In UI - Part 1 \title Log In UI - Components
\brief Illustrates how to use wizard templates to create a simple UI that \brief Illustrates how to use wizard templates to create a simple UI
contains a text label, push buttons, and a logo. wireframe that contains a text label, images, and push buttons.
\image loginui1.png \image loginui1.jpg
\e{Log In UI - Part 1} is the first in a series of tutorials that build on \e{Log In UI - Components} is the first in a series of tutorials that build
each other to illustrate how to use \QDS to create a simple UI with some on each other to illustrate how to use \QDS to create a simple UI with some
basic UI components, such as pages, buttons, and fields. Part 1 describes basic UI components, such as pages, buttons, and fields. The first tutorial
how to use the \QDS wizard templates to create a project and a in the series describes how to use the \QDS wizard templates to create a
button UI control, and how to modify the files generated by the wizard project and a button UI control, and how to modify the files generated by
templates to design your own UI. the wizard templates to wireframe the UI.
The \e {Learn More} sections provide additional information about the The \e {Learn More} sections provide additional information about the
tasks performed by the wizards and about other basic tasks and concepts. tasks performed by the wizards and about other basic tasks and concepts.
@@ -67,9 +67,10 @@
\li Select \uicontrol Next (or \uicontrol Continue on \macos) to \li Select \uicontrol Next (or \uicontrol Continue on \macos) to
continue to the \uicontrol {Define Project Details} page. continue to the \uicontrol {Define Project Details} page.
\li In the \uicontrol {Screen resolution} field, select the initial \li In the \uicontrol {Screen resolution} field, select the initial
size of the UI. In this tutorial, we use the smallest predefined size of the UI. In this tutorial, we use the predefined size
size, \e {640 x 480}. You can easily change the screen size later \e {720 x 1280 (HD)} (portrait) instead of the default size
in \l Properties. (landscape). You can easily change the screen size later in
\l Properties.
\li Select \uicontrol Finish (or \uicontrol Done on \macos) to create \li Select \uicontrol Finish (or \uicontrol Done on \macos) to create
the project. the project.
\endlist \endlist
@@ -115,41 +116,55 @@
\li The \e {qtquickcontrols2.conf} file specifies the selected \li The \e {qtquickcontrols2.conf} file specifies the selected
\l {Styling Qt Quick Controls}{UI style} and some style-specific \l {Styling Qt Quick Controls}{UI style} and some style-specific
arguments. arguments.
\li The \e imports folder contains a \e {Constants.qml} file that \li The \e imports folder contains \e {Constants.qml} and
specifies a font loader for the Arial font and a \e qmldir module \e {DirectoryFontLoader.qml} files that specify a font loader
definition file that declares the Constant component. For more and a \e qmldir module definition file that declares the Constant
information, see \l {Module Definition qmldir Files}. The component. For more information, see
\e EventListModel.qml and \e EventListSimulator.qml files are \l {Module Definition qmldir Files}. The \e EventListModel.qml and
not used in this example, so you can ignore them for now. \e EventListSimulator.qml files are not used in this example, so
you can ignore them for now.
\endlist \endlist
UI files define a hierarchy of components with a highly-readable, structured \l{UI Files}{UI files} define a hierarchy of components with a
layout. Every UI file consists of two parts: an imports section and an highly-readable, structured layout. Every UI file consists of two parts:
component declaration section. The components and functionality most common to an imports section and an component declaration section. The components and
UIs are provided in the QtQuick import. You can view the code of an functionality most common to UIs are provided in the \c QtQuick import. You
.ui.qml file in the \l{Text Editor} view. can view the code of a \e .ui.qml file in the \l{Text Editor} view.
Next, you will edit the values of the properties of the component instances Next, you will edit the values of the properties of the component instances
to create the main page of the UI. to create the main page of the UI.
\section1 Creating the Main Page \section1 Creating the Main Page
You will now change the values of the properties of the \l{basic-rectangle} You will now change the values of the properties of the \l Text component
{Rectangle} component instance to add a gradient to the UI background and instance to create a tag line using a custom font. You will add the font
those of the \l Text component instance to set the title text in a larger as an asset and set it to be used in the properties of the component.
strong font. In addition, you will import an image as an asset and add it In addition, you will import a background image and logo as assets and
to the page. add them to the page as instances of the \l{Images}{Image} component.
To add an image to your UI, you should first click You can download the logo and the background image from here:
\l {https://doc.qt.io/qtdesignstudio/images/used-in-examples/loginui1/qt_logo_green_64x64px.png}
{here} to open the Qt logo in a browser and save it as a file on your \list
computer. Next, you need to add the image to \l Library: \li \l{https://doc.qt.io/qtdesignstudio/images/used-in-examples/loginui1/qt_logo_green_128x128px.png}
{qt_logo_green_128x128px.png}
\li \l{https://doc.qt.io/qtdesignstudio/images/used-in-examples/loginui1/adventurePage.jpg}
{Background image} (\e adventurePage.jpg)
Photo by \l{https://unsplash.com/photos/a2MgJdG6UvE}
{Benjamin DeYoung} on \l{https://unsplash.com}{Unsplash}.
\endlist
You can download the font from
\l{https://fonts.google.com/specimen/Titillium+Web#standard-styles}
{Titillium Web ExtraLight font} or use Arial as a substitute.
To add the assets to \l Library:
\list 1 \list 1
\li Select \uicontrol Library > \uicontrol Assets \li Select \uicontrol Library > \uicontrol Assets
> \inlineimage plus.png > \inlineimage plus.png
. .
\li Select the image file, and then select \uicontrol Open. \li Select the asset files, and then select \uicontrol Open.
\li Select the location where the image will be saved in the \li Select the location where the files will be saved in the
\uicontrol {Add Resources} dialog. \uicontrol {Add Resources} dialog.
\li Select \uicontrol OK. \li Select \uicontrol OK.
\endlist \endlist
@@ -166,42 +181,35 @@
To modify the \e Screen01 component in \uicontrol {Form Editor}: To modify the \e Screen01 component in \uicontrol {Form Editor}:
\list 1 \list 1
\li Select the \e Rectangle instance in the \l Navigator view to display \li Drag-and-drop the background image from \uicontrol Library >
its properties in the \l Properties view. \uicontrol Assets to the rectangle in \l Navigator.
\li In the \uicontrol Color field, select the \image loginui1-library-assets.jpg "Library view Assets tab"
\inlineimage icon_color_gradient.png \li \QDS automatically creates an instance of the \l{Images}{Image}
(\uicontrol {Linear Gradient}) button to add a linear gradient to component for you with the path to the image file set as the
the screen background. Click the start point (1) and end point (2) value of \l Properties > \uicontrol Image > \uicontrol Source.
to specify the gradient colors. Drag-and-drop the points along the
gradient bar to specify where the gradient starts and ends. In this
tutorial, the color changes from white to green (#41cd52), starting
mid-screen, at position 0.5. You can use your favorite colors or
select a predefined gradient in the \uicontrol {Gradient Picker}.
For more information, see \l{Picking Gradients}.
\image loginui1-background-gradient.png "Rectangle color properties"
\li Select \e Text in \uicontrol Navigator to display its properties in
\uicontrol Properties.
\list a
\li In the \uicontrol ID field, enter the ID \e pageTitle,
so that you can easily find the title component in
\uicontrol Navigator and other \QDS views.
\image loginui1-text-properties.png "Text properties"
\li In the \uicontrol Text field, enter the page title:
\e {Qt Account}.
\li In the \uicontrol Font group, \uicontrol Size field,
set the font size of the title: \e 24 pixels.
\image loginui1-text-font-properties.png "Font properties"
\li In the \uicontrol {Font style} field, select the
\uicontrol B button to use a strong font.
\endlist
\li Drag-and-drop the Qt logo from \uicontrol Library > \uicontrol Assets
to the top-left corner of the rectangle.
\image loginui1-library-assets.png "Library view Assets tab"
\QDS automatically creates an instance of the \l{Images}{Image}
component for you with the path to the image file set as the value of
the \uicontrol Source field in \uicontrol Properties.
\image loginui1-image-properties.png "Image properties" \image loginui1-image-properties.png "Image properties"
\li In the \uicontrol ID field, change the ID of the image to \e logo. \li Drag-and-drop the Qt logo from \uicontrol Assets to the rectangle
in \uicontrol Navigator and move it to the top-center of the
background image in \uicontrol {Form Editor}.
\li Select \e Text in \uicontrol Navigator and drag it below the logo
in \uicontrol {Form Editor}. If the text is hidden behind the
background, select \inlineimage icons/navigator-arrowdown.png
in \uicontrol Navigator to move the text as the last item in the
component tree structure. The text should then appear on top
of the background.
\li Edit text properties in \uicontrol Properties:
\list a
\li In \uicontrol Component > \uicontrol ID, enter the ID
\e tagLine.
\li In \uicontrol Character > \uicontrol Text, enter the tag
line: \e {Are you ready to explore?}.
\image loginui1-text-properties.png "Text properties"
\li In \uicontrol Font, select \e {Titillium Web ExtraLight}.
\li In \uicontrol Size, set the font size of the tag line to
\e 50 pixels (\uicontrol px).
\li In \uicontrol {Text color}, set the text color to white
(\e #ffffff).
\endlist
\li Select \uicontrol File > \uicontrol Save or press \key {Ctrl+S} \li Select \uicontrol File > \uicontrol Save or press \key {Ctrl+S}
to save your changes. to save your changes.
\endlist \endlist
@@ -209,7 +217,9 @@
Your UI should now look something like this in \uicontrol {Form Editor} Your UI should now look something like this in \uicontrol {Form Editor}
and live preview: and live preview:
\image loginui1-main-page.png "Modified UI in the Design mode" \image loginui1-main-page.jpg "Modified UI in the Design mode"
You can resize the preview dialog to display the whole screen.
\section2 Learn More - Components \section2 Learn More - Components
@@ -236,7 +246,7 @@
The \l {basic-rectangle}{Rectangle}, \l Text, and \l {Images}{Image} The \l {basic-rectangle}{Rectangle}, \l Text, and \l {Images}{Image}
components used in this tutorial are based on the \l Item component. components used in this tutorial are based on the \l Item component.
It is the base component for all visual elements, with implementation It is the base component for all visual elements, with implementation
of basic functions and properties, such as component name, ID, position, of basic functions and properties, such as component type, ID, position,
size, and visibility. size, and visibility.
For more information, see \l{Use Case - Visual Elements In QML}. For For more information, see \l{Use Case - Visual Elements In QML}. For
@@ -264,19 +274,6 @@
properties for each text component, such as size in points or pixels, properties for each text component, such as size in points or pixels,
weight, style, and spacing. weight, style, and spacing.
To add custom fonts in the list of available fonts in \l Properties:
\list 1
\li Select \uicontrol Library > \l Assets
> \inlineimage plus.png
.
\li Browse to the folder that contains the font files and select them,
and then select \uicontrol Open.
\li Select the location where the file will be saved in the
\uicontrol {Add Resources} dialog.
\li Select \uicontrol OK to save the fonts.
\endlist
If you want to create a label with a background, use the \l Label component If you want to create a label with a background, use the \l Label component
from the \uicontrol {Qt Quick Controls} module instead of the Text component. from the \uicontrol {Qt Quick Controls} module instead of the Text component.
@@ -284,9 +281,8 @@
The \l {Images}{Image} component is used for adding images to the UI in several The \l {Images}{Image} component is used for adding images to the UI in several
supported formats, including bitmap formats such as PNG and JPEG and vector supported formats, including bitmap formats such as PNG and JPEG and vector
graphics formats such as SVG. To add an image you wish to use in your graphics formats such as SVG. To add an image to \uicontrol Library, select
designs to \uicontrol Library, select \uicontrol Library > \uicontrol Assets \uicontrol Assets > \inlineimage plus.png
> \inlineimage plus.png
, and then select the image file. , and then select the image file.
If you need to display animated images, use the \l {Animated Image} If you need to display animated images, use the \l {Animated Image}
@@ -298,11 +294,11 @@
You can use another wizard template to create a push button and to add it to You can use another wizard template to create a push button and to add it to
the project. The wizard template creates a reusable button component that the project. The wizard template creates a reusable button component that
appears in \uicontrol Library > \uicontrol Components > appears in \uicontrol Library > \uicontrol Components >
\uicontrol {My Components}. You can drag-and-drop it to \l {Form Editor} \uicontrol {My Components}. You can drag-and-drop it to \l Navigator
to create button instances and modify their properties in the to create button instances and modify their properties in the
\uicontrol Properties view to change their appearance and functionality. \uicontrol Properties view to change their appearance and functionality.
If you find that you cannot use the wizard template nor the preset If you cannot use the wizard template nor the preset
button controls available in \uicontrol Library > \uicontrol Components > button controls available in \uicontrol Library > \uicontrol Components >
\uicontrol {Qt Quick Controls} to create the kind of push button that you \uicontrol {Qt Quick Controls} to create the kind of push button that you
want, you can create your button from scratch using default components. For want, you can create your button from scratch using default components. For
@@ -316,9 +312,9 @@
\uicontrol {Files and Classes} > \uicontrol {Qt Quick Controls} > \uicontrol {Files and Classes} > \uicontrol {Qt Quick Controls} >
\uicontrol {Custom Button} > \uicontrol Choose. \uicontrol {Custom Button} > \uicontrol Choose.
\li In the \uicontrol {Component name} field, enter a name for your \li In the \uicontrol {Component name} field, enter a name for your
button component: \e {PushButton}. button component: \e {EntryField}.
\li Select \uicontrol Finish (or \uicontrol Done on \macos) to create \li Select \uicontrol Finish (or \uicontrol Done on \macos) to create
the button. the button UI file, \e EntryField.ui.qml.
\endlist \endlist
Your button should now look something like this in the \uicontrol Design Your button should now look something like this in the \uicontrol Design
@@ -336,20 +332,20 @@
you to set text, display an icon, react to mouse clicks, and so on. you to set text, display an icon, react to mouse clicks, and so on.
To be able to use the functionality of the Button control, the wizard template To be able to use the functionality of the Button control, the wizard template
adds the following \e import statements to the \e PushButton.ui.qml file: adds the following \e import statements to the \e EntryField.ui.qml file:
\quotefromfile loginui1/PushButton.ui.qml \quotefromfile loginui1/EntryField.ui.qml
\skipto import \skipto import
\printuntil Controls \printuntil Controls
Next, you will change the appearance of the PushButton component by Next, you will change the appearance of the EntryField component by
modifying its properties. modifying its properties.
\section1 Styling the Button \section1 Styling the Button
You can now modify the properties of the PushButton component to your You can now modify the properties of the EntryField component to your
liking. To make the changes apply to all the PushButton instances, you liking. To make the changes apply to all the EntryField instances, you
must make them in the \e PushButton.ui.qml file. must make them in the \e EntryField.ui.qml file.
The Custom Button wizard template adds a \e normal state and a \e down state The Custom Button wizard template adds a \e normal state and a \e down state
to change the button background and text color when the button is clicked. to change the button background and text color when the button is clicked.
@@ -357,98 +353,149 @@
button in the \e base state, they are automatically applied to the other button in the \e base state, they are automatically applied to the other
states. However, the property values that have been explicitly changed in states. However, the property values that have been explicitly changed in
the \e normal or \e down state are not changed automatically and you have the \e normal or \e down state are not changed automatically and you have
to change them separately in that state. to either reset them to the base state or set them separately in that state.
To change the button property values: To change the button property values:
\list 1 \list 1
\li Select \e control in \uicontrol Navigator to display its
properties in \uicontrol Properties.
\li In \uicontrol {Geometry - 2D} > \uicontrol Size, set button
width (\uicontrol W) to \e 500 and height (\uicontrol H)
to \e 100, to match the width of the tag line.
\li In the \uicontrol Control section, deselect the \uicontrol Hover
check box because we don't want the hover effect for the button.
\li Select the button background in \uicontrol Navigator to display its \li Select the button background in \uicontrol Navigator to display its
properties in \uicontrol Properties. properties in \uicontrol Properties.
\li In the \uicontrol Color field, select \li In \uicontrol Rectangle > \uicontrol {Fill color}, set the color to
\inlineimage icon_color_none.png transparent light gray (\e #28e7e7e7) in \uicontrol Hex. You can
to use a solid background color (white) instead of transparent. also use the \l{Picking Colors}{color picker} to set the color.
\li In the \uicontrol {Border Color} field, select \li In \uicontrol {Border Color}, select white (\e #ffffff).
\inlineimage icons/action-icon.png \li In \uicontrol Radius, enter \e 50 to give the button
(\uicontrol Actions) > \uicontrol {Set Binding} to use the
gradient color (\e #41cd52) as the border color. You can also
use the color picker to change the color.
\image loginui1-binding-editor.png "Binding Editor"
\li Press \key Enter or select \uicontrol OK to save the new value.
\li In the \uicontrol Radius field, enter 20 to give the button
rounded corners. rounded corners.
\li In the \uicontrol States view, select the \e normal state and set \li Select the text component in \uicontrol Navigator to display its
the background color to white and the border color to green, as properties in \uicontrol Properties.
instructed above. Repeat for the \e down state. \li In \uicontrol Character > \uicontrol Font, select
\li Select the \e base state, and then select the text component \e {Titillium Web ExtraLight}.
in \uicontrol Navigator to display its properties in \li In \uicontrol Size, set the font size to \e 34 pixels
\uicontrol Properties. (\uicontrol px).
\li In the \uicontrol {Text Color} field, select \uicontrol Actions > \li In \uicontrol {Text color}, set the text color to white
\uicontrol Reset to reset the text color to the default color, (\e #ffffff).
black. \li In \uicontrol {Alignment H}, select the \uicontrol Left button to
\li In the \uicontrol {Font style} field, select the \uicontrol B button align the text horizontally to the left.
to use the strong font. \li In the \uicontrol Padding section > \uicontrol Horizontal >
\li In the \uicontrol States view, select the \e down state to set the \uicontrol Left, set the padding in the field between background
button text color to the same green as the border. border and text to \e 50.
\image loginui1-text-properties-button.png "Text properties"
\li In the \uicontrol States view, select the \e normal state and
repeat the changes in the background color and text properties,
as necessary. Repeat for the \e down state.
\li Select \uicontrol File > \uicontrol Save or press \key {Ctrl+S} \li Select \uicontrol File > \uicontrol Save or press \key {Ctrl+S}
to save your changes. to save your changes.
\endlist \endlist
Your button should now look something like this: Your button should now look something like this:
\image loginui1-button-styled.png "Modified button in the Form Editor" \image loginui1-entry-field-styled.jpg "Modified button in the Form Editor"
\section2 Learn More - Property Bindings Next, you will add instances of the \e EntryField component to the
\e Screen01 component and modify their properties.
A component's property can be assigned a static value which stays constant \section1 Adding Entry Fields to the UI
until it is explicitly assigned a new value. In this tutorial, the color
values you set in \uicontrol {Binding Editor} are static.
However, to make the fullest use of the built-in support for dynamic You will now add EntryField instances to the UI and modify their properties.
component behavior, you can use property bindings that specify relationships
between different component properties. When a property's dependencies change
in value, the property is automatically updated according to the specified
relationship.
Behind the scenes, the property's dependencies are monitored (that is, the \list 1
variables in the binding expression). When a change is detected, the binding \li Double-click \e Screen01.ui.qml in \uicontrol Projects
expression is re-evaluated and the new result is applied to the property. to open it in \uicontrol {Form Editor}.
\li Drag-and-drop two instances of the EntryField component from
\uicontrol Library > \uicontrol Components >
\uicontrol {My Components} to the rectangle in \uicontrol Navigator.
\image loginui1-library.jpg "My Components tab of Library view"
\li Select the first EntryField instance in \uicontrol Navigator
to modify its ID and text in \uicontrol Properties.
\li In \uicontrol Component > \uicontrol ID, enter \e username.
\li In \uicontrol {Button Content} > \uicontrol Text, enter
\e {Username or Email} and select \uicontrol tr to mark the text
\l {Internationalization and Localization with Qt Quick}
{translatable}.
\li Select the second EntryField instance, and change its ID to
\e password and text to \e Password. Again, mark the text
translatable.
\li Move the cursor on the selected button instance to make the
selection icon appear. You can now drag the button instance
to another position in \uicontrol {Form Editor}. Use the
guidelines to align the button instances below the tag line:
\image loginui1-align-buttons.jpg
\li Select \uicontrol File > \uicontrol Save or press \key {Ctrl+S}
to save your changes.
\endlist
For more information, see \l {Property Binding}. \section1 Creating Another Button
Next, you will add two instances of the \e PushButton component to the We want to center-align the text of two additional push buttons and use
\e Screen01 component and modify their text labels. brighter colors for them, so we create a second button component as
instructed in \l{Creating a Push Button}. This time we call it
\e PushButton.
\section1 Adding Buttons to the UI To make the changes apply to all the PushButton instances, you
must make them in the \e PushButton.ui.qml file.
You will now add two PushButton instances to the UI and modify their labels. To change the button property values:
\list 1
\li Select \e control in \uicontrol Navigator to display its
properties in \uicontrol Properties.
\li In \uicontrol {Geometry - 2D} > \uicontrol Size, set button
width (\uicontrol W) to \e 500 and height (\uicontrol H)
to \e 100.
\li In the \uicontrol Control section, deselect the \uicontrol Hover
check box because we don't want the hover effect for the button.
\li Select the button background in \uicontrol Navigator to display its
properties in \uicontrol Properties.
\li In \uicontrol Rectangle > \uicontrol {Border color}, select the
green used in the logo (\e #41cd52).
\li In \uicontrol Radius, enter \e 50 to give the button rounded
corners.
\li Select the the text component in \uicontrol Navigator to display
its properties in \uicontrol Properties.
\li In \uicontrol Character > \uicontrol Font, select
\e {Titillium Web ExtraLight}.
\li In \uicontrol Size, set the font size to \e 34 pixels.
\li In \uicontrol {Text color}, set the text color to \e #41cd52.
\li In the \uicontrol States view, select the \e normal state and repeat
the changes, as necessary.
\li Repeat for the \e down state. However, in \uicontrol Rectangle >
\uicontrol {Fill color}, set the color to green (\e #41cd52) to
turn the button background green when the button is pressed down.
Also, in \uicontrol Text > \uicontrol Character >
\uicontrol {Text color}, keep the text color as white (\e #ffffff).
\li Select \uicontrol File > \uicontrol Save or press \key {Ctrl+S}
to save your changes.
\endlist
\section1 Adding Push Buttons to the UI
You will now add PushButton instances to the UI and modify their properties.
\list 1 \list 1
\li Double-click \e Screen01.ui.qml in \uicontrol Projects \li Double-click \e Screen01.ui.qml in \uicontrol Projects
to open it in \uicontrol {Form Editor}. to open it in \uicontrol {Form Editor}.
\li Drag-and-drop two instances of the PushButton component from \li Drag-and-drop two instances of the PushButton component from
\uicontrol Library > \uicontrol Components > \uicontrol {My Components} \uicontrol Library > \uicontrol Components >
to \uicontrol {Form Editor}. \uicontrol {My Components} to the rectangle in \uicontrol Navigator.
\image loginui1-library.png "My Components tab of Library view" \li Drag the button instances to the bottom of the background image in
\li Select one of the PushButton instances in \uicontrol Navigator \uicontrol {Form Editor}. Use the guidelines to align the button
instances horizontally with the entry fields.
\li Select the first PushButton instance in \uicontrol Navigator
to modify its ID and text label in \uicontrol Properties. to modify its ID and text label in \uicontrol Properties.
\li In the \uicontrol ID field, enter \e loginButton. \li In \uicontrol Component > \uicontrol ID, enter \e login.
\li In the \uicontrol Text field, enter \e {Log In} and select \li In \uicontrol {Button Content} > \uicontrol Text, enter
\uicontrol tr to mark the text \e Continue and select \uicontrol tr to mark the text
\l {Internationalization and Localization with Qt Quick} translatable.
{translatable}. \li Select the second PushButton instance, and change its ID to
\li Select the other PushButton instance, and change its ID to \e createAccount and text label to \e {Create Account}. Again,
\e registerButton and text label to \e {Create Account}. mark the text translatable.
Again, mark the text translatable.
\li When a component instance is selected, selection handles are
displayed in its corners and on its sides. Use the selection
handles to resize the button instances so that the text fits
comfortably on the button background.
In this tutorial, the button width is set to 120 pixels.
\li Move the cursor on the selected button instance to make the
selection icon appear. You can now drag the button instance
to another position in \uicontrol {Form Editor}. Use the
guidelines to align the button instances below the page title:
\image loginui1-align-buttons.png
\li Select \uicontrol File > \uicontrol Save or press \key {Ctrl+S} \li Select \uicontrol File > \uicontrol Save or press \key {Ctrl+S}
to save your changes. to save your changes.
\endlist \endlist
@@ -456,7 +503,7 @@
The first iteration of your UI is now ready and should now look something The first iteration of your UI is now ready and should now look something
like this in \uicontrol {Form Editor} and live preview: like this in \uicontrol {Form Editor} and live preview:
\image loginui1-ready.png "The finished UI in Form Editor" \image loginui1-ready.jpg "The finished UI in Form Editor"
\section2 Learn More - Component IDs \section2 Learn More - Component IDs
@@ -472,7 +519,7 @@
To learn how to add more UI controls and position them on the page using To learn how to add more UI controls and position them on the page using
anchors and layouts so that the UI is scalable, see the next tutorial in anchors and layouts so that the UI is scalable, see the next tutorial in
the series, \l {Log In UI - Part 2}. the series, \l {Log In UI - Positioning}.
For a more advanced example of creating a menu button and using it to For a more advanced example of creating a menu button and using it to
construct a button bar, see \l {Side Menu}. construct a button bar, see \l {Side Menu}.

View File

@@ -27,39 +27,41 @@
\example loginui2 \example loginui2
\ingroup studioexamples \ingroup studioexamples
\ingroup gstutorials \ingroup gstutorials
\previouspage {Log In UI - Part 1} \previouspage {Log In UI - Components}
\nextpage {Log In UI - Part 3} \nextpage {Log In UI - States}
\title Log In UI - Part 2 \title Log In UI - Positioning
\brief Illustrates how to position UI components on pages using anchors and \brief Illustrates how to position UI components on pages using anchors and
positioners. positioners.
\image loginui2.png "Log In UI" \image loginui1.jpg "Log In UI"
\e{Log In UI - Part 2} is the second in a series of tutorials that build \e{Log In UI - Positioning} is the second in a series of tutorials that build
on each other to illustrate how to use \QDS to create a simple UI with on each other to illustrate how to use \QDS to create a simple UI with
some basic UI components, such as pages, buttons, and entry fields. Part 2 some basic UI components, such as pages, buttons, and entry fields. The
describes how to position the UI components on pages to create a scalable second tutorial in the series describes how to position the UI components
UI. on pages to create a scalable UI.
To ensure that the layout is responsive and all the UI components stay in To ensure that the layout is responsive and all the UI components stay in
their proper places when you resize the UI on the desktop or on devices their proper places when you resize the UI on the desktop or on devices
with different screen sizes, you will use anchors and positioners. with different screen sizes, you will use anchors and positioners.
These instructions build on \l {Log In UI - Part 1}. These instructions build on \l {Log In UI - Components}.
The \e {Learn More} sections provide additional information about the The \e {Learn More} sections provide additional information about the
task at hand. task at hand.
\section1 Anchoring UI Components \section1 Anchoring UI Components
First, you will \l {Setting Anchors and Margins}{anchor} the static page First, you will \l {Setting Anchors and Margins}{anchor} the
elements, logo image (\e logo) and page title (\e pageTitle), to the page. static page elements, background image (\e adventurePage), logo
When you created the project using the new project wizard template (\e qt_logo_green_128x128px), and tag line (\e tagLine), to the page.
in Part 1 of this tutorial, the wizard template anchored \e pageTitle to the
vertical and horizontal center of the page. Therefore, you will only When you created the project using the project wizard template
need to replace the vertical anchor of \e pageTitle with a top anchor in \l {Log In UI - Components}, the wizard template anchored \e tagLine to
to align it with \e logo on the page. the vertical and horizontal center of the page. Therefore, you will only
need to replace the vertical anchor of \e tagLine with a top anchor and
adjust the margins to align it with \e qt_logo_green_128x128px on the page.
To preview the changes that you make to the UI while you make To preview the changes that you make to the UI while you make
them, select the \inlineimage live_preview.png them, select the \inlineimage live_preview.png
@@ -71,17 +73,40 @@
\list 1 \list 1
\li Open \e {Screen01.ui.qml} for editing in the \li Open \e {Screen01.ui.qml} for editing in the
\uicontrol {Form Editor} view. \uicontrol {Form Editor} view.
\li Select \e logo in the \l Navigator view. \li Select \e adventurePage in the \l Navigator view to display its
\li In the \l Properties view, \uicontrol Layout tab, properties in the \l Properties view.
select the \inlineimage icons/anchor-top.png \li In \uicontrol Properties > \uicontrol Layout, select
(\uicontrol Top) and \inlineimage icons/anchor-left.png the \inlineimage icons/anchor-fill.png
(\uicontrol Left) anchor buttons to anchor \e logo to the top left anchor button to anchor \e adventurePage to its
corner of its parent with 10-pixel margins. parent in the \uicontrol Target field. This attaches the background
\li Select \e pageTitle in \uicontrol Navigator. image to the rectangle on all sides.
\li Deselect the \inlineimage icons/anchor-center-vertical.png \image loginui2-layout.png "Layout properties"
(\uicontrol {Vertical Center}) button to remove the \li Select \e qt_logo_green_128x128px in \l Navigator.
anchor, and then select the \uicontrol Top button to anchor the \li In \uicontrol Properties > \uicontrol Layout, select the
title to the top of the page with a 70-pixel margin. \inlineimage icons/anchor-top.png
and \inlineimage icons/anchor-center-horizontal.png
anchor buttons to anchor \e qt_logo_green_128x128px to the top of
its parent in the \uicontrol Target field with a 40-pixel margin
and to center it horizontally. This attaches the logo to the
rectangle at the top, while keeping its horizontal center aligned
with that of the rectangle.
\li Select \e tagLine in \uicontrol Navigator.
\li In \uicontrol Properties > \uicontrol Layout, deselect the
\inlineimage icons/anchor-center-vertical.png
button to remove the vertical center anchor, and then select the
\inlineimage icons/anchor-top.png
button to anchor the tag line to
\e qt_logo_green_128x128px in the \uicontrol Target field with a
40-pixel margin. This attaches the top of the tag line to the
bottom of the logo, while keeping its horizontal center aligned
with that of the rectangle.
\image loginui2-layout-text.png "Text Layout properties"
\note You can anchor component instances to their parent and sibling
components. If a component instance is not listed in the
\uicontrol Target field, check that the component instance is
located in the correct place in the component hierarchy in
\uicontrol Navigator. For more information,
see \l{Arranging Components}.
\li Select \uicontrol File > \uicontrol Save or press \key {Ctrl+S} \li Select \uicontrol File > \uicontrol Save or press \key {Ctrl+S}
to save your changes. to save your changes.
\endlist \endlist
@@ -89,7 +114,7 @@
Your page now should look something like this in the \uicontrol Design mode Your page now should look something like this in the \uicontrol Design mode
and live preview: and live preview:
\image loginui2-loginpage.png "Login page in the Design mode" \image loginui2-loginpage.jpg "Login page in the Design mode and live preview"
\section2 Learn More - Anchors \section2 Learn More - Anchors
@@ -107,74 +132,50 @@
\section1 Using Column Positioners \section1 Using Column Positioners
You will now add two entry fields to the page and position them in a column You will now position the entry fields and buttons in columns
to learn another method of \l{Using Positioners}{positioning components}. to learn another method of \l{Using Positioners}{positioning components}.
Next, you will position the push buttons on the page in another column. Then, you will anchor the columns to the page to enable their positions
Finally, you will anchor the columns to the page to enable their positions
to change when the screen size changes. to change when the screen size changes.
To add entry fields to the page: To position the fields and buttons as columns:
\list 1 \list 1
\li Drag-and-drop two instances of the \uicontrol {Text Field} \li Select \e username and \e password in \uicontrol Navigator
component from \l Library > \uicontrol Components > (press and hold the \key Shift or \key Ctrl key for
\uicontrol {Qt Quick Controls} to \l {Form Editor}. \l {Multiselection}{multiple selection}), and right-click
\li Select one of the text fields in \l Navigator, and
change its ID to \e usernameField in \l Properties.
\li In the \uicontrol Geometry group, \uicontrol Size field,
make the field wide enough to accommodate long user names
by setting its width to \e 300 pixels.
\li In the \uicontrol Placeholder field, set the text to display
inside the field before users type in it to \e Username
\li Select \uicontrol tr to mark the text translatable.
\image loginui2-field-properties.png "Text field properties"
\li Select the other text field, and change its ID to
\e passwordField, placeholder text to \e Password,
and width to \e 300 pixels.
\endlist
The Text Field component has additional properties that you can use to change
its appearance. For example, you can change the color, font, alignment, or
word and letter spacing of the placeholder text.
You will now position the fields and buttons as columns:
\list 1
\li Select \e usernameField and \e passwordField in \uicontrol Navigator
(press the \key Shift key for multiple selection), and right-click
either of them to open a context menu. either of them to open a context menu.
\li Select \uicontrol Position > \uicontrol {Position in Column} \li Select \uicontrol Position > \uicontrol {Position in Column}
to position the fields on top of each other in to position the fields on top of each other in
\uicontrol {Form Editor}. \uicontrol {Form Editor}.
\li Select the column in \uicontrol Navigator and change its ID \li Select the column in \uicontrol Navigator and change its ID
to \e fieldColumn in \uicontrol Properties. to \e fields in \uicontrol Properties.
\li In the \uicontrol Spacing field, set the spacing between the \li In \uicontrol Column > \uicontrol Spacing, set the spacing between
fields to 5 pixels. the fields to 20 pixels.
\image loginui2-column-properties.png "Column properties" \image loginui2-column-properties.png "Column properties"
\li Select \e loginButton and \e registerButton, and then select \li Select \e login and \e createAccount, and then select
\uicontrol Position > \uicontrol {Position in Column} to position \uicontrol Position > \uicontrol {Position in Column} to position
them in a column. them in a column.
\li Select the button column, change its ID to \e buttonColumn, and \li Select the button column, change its ID to \e buttons, and
set the spacing between the buttons to 5 pixels, as above. set the spacing between the buttons to 20 pixels, as above.
\endlist \endlist
You will now anchor the field and button columns to the page: You will now anchor the field and button columns to the page:
\list 1 \list 1
\li Select \e fieldColumn in \uicontrol Navigator. \li Select \e fields in \uicontrol Navigator.
\li In \uicontrol Properties > \uicontrol Layout, select the \li In \uicontrol Properties > \uicontrol Layout, select the
\uicontrol Top button to anchor the top of the button column to \inlineimage icons/anchor-top.png
the top of its parent with a 200-pixel margin. button to anchor the top of the field column to
the bottom of \e tagLine with a 170-pixel margin.
\li Select the \inlineimage icons/anchor-center-horizontal.png \li Select the \inlineimage icons/anchor-center-horizontal.png
(\uicontrol {Horizontal Center}) button to center the field button to anchor the column horizontally to its parent.
column horizontally on the page. \li Select \e buttons in \uicontrol Navigator.
\li Select \e buttonColumn in \uicontrol Navigator.
\li In \uicontrol Properties > \uicontrol Layout, select the \li In \uicontrol Properties > \uicontrol Layout, select the
\inlineimage icons/anchor-bottom.png \inlineimage icons/anchor-bottom.png
(\uicontrol Bottom) button to anchor the bottom of the button button to anchor the button column to the bottom of its parent
column to the bottom of its parent with a 50-pixel margin. with a 50-pixel margin.
\li Select the \uicontrol {Horizontal Center} button to center \li Select the \inlineimage icons/anchor-center-horizontal.png
the button column horizontally on the page. button to anchor the column horizontally to its parent.
\li Select \uicontrol File > \uicontrol Save or press \key {Ctrl+S} \li Select \uicontrol File > \uicontrol Save or press \key {Ctrl+S}
to save your changes. to save your changes.
\endlist \endlist
@@ -182,7 +183,7 @@
The second iteration of your UI is now ready and should look something like The second iteration of your UI is now ready and should look something like
this in the \uicontrol Design mode and live preview: this in the \uicontrol Design mode and live preview:
\image loginui2-loginpage-ready.png "Login page in the Design mode" \image loginui2-loginpage-ready.jpg "Login page in the Design mode and live preview"
\section1 Learn More - Positioners \section1 Learn More - Positioners
@@ -197,6 +198,6 @@
\section1 Next Steps \section1 Next Steps
To learn how to add a second page and move to it from the main page, see To learn how to add a second page and move to it from the main page, see
the next tutorial in the series, \l {Log In UI - Part 3}. the next tutorial in the series, \l {Log In UI - States}.
*/ */

View File

@@ -28,29 +28,30 @@
\ingroup studioexamples \ingroup studioexamples
\ingroup gstutorials \ingroup gstutorials
\title Log In UI - Part 3 \title Log In UI - States
\brief Illustrates how to use states to create a second UI page. \brief Illustrates how to use states to create a second UI page.
\previouspage {Log In UI - Part 2} \previouspage {Log In UI - Positioning}
\nextpage {Log In UI - Part 4} \nextpage {Log In UI - Timeline}
\image loginui3.gif "Log In UI" \image loginui3.gif "Log In UI"
\e{Log In UI - Part 3} is the third in a series of tutorials that build \e{Log In UI - States} is the third in a series of tutorials that build
on each other to illustrate how to use \QDS to create a simple UI with on each other to illustrate how to use \QDS to create a simple UI with
some basic UI components, such as pages, buttons, and entry fields. Part 3 some basic UI components, such as pages, buttons, and entry fields. The
describes how to use \e states to add a second page to the UI. On the third tutorial in the series describes how to use \e states to add a
first page, users can enter a username and password to log in. On the second page to the UI. On the first page, users can enter a username
second page, they can register if they do not already have an account. and password to log in. On the second page, they can register if they
do not already have an account.
Because the second page will contain most of the same UI components as the Because the second page will contain most of the same UI components as the
login page, you will use \e states to show and hide UI components as necessary login page, you will use \e states to show and hide UI components as necessary
when a user selects the \uicontrol {Create Account} button. when a user selects the \e {Create Account} button.
These instructions build on: These instructions build on:
\list \list
\li \l {Log In UI - Part 1} \li \l {Log In UI - Components}
\li \l {Log In UI - Part 2} \li \l {Log In UI - Positioning}
\endlist \endlist
The \e {Learn More} sections provide additional information relevant to the The \e {Learn More} sections provide additional information relevant to the
@@ -58,93 +59,82 @@
\section1 Adding UI Components \section1 Adding UI Components
You will add another text field for verifying the password that users You will add another entry field for verifying the password that users
enter to create an account and a back button for returning to the login enter to create an account. You are already familiar with the tasks in
page. You are already familiar with the tasks in this section from Part 1 this section from previous parts of the tutorial.
and Part 2 of this tutorial.
To preview the changes that you make to the UI while you make To preview the changes that you make to the UI while you make
them, select the \inlineimage live_preview.png them, select the \inlineimage live_preview.png
(\uicontrol {Show Live Preview}) button on the \l {Form Editor} (\uicontrol {Show Live Preview}) button on the \l {Form Editor}
toolbar or press \key {Alt+P}. toolbar or press \key {Alt+P}.
To add the text field and a back button needed on the registration page To add the entry field needed on the second page to the \e Screen01
to the \e Screen01 component: component:
\list 1 \list 1
\li Open \e {Screen01.ui.qml} in \uicontrol {Form Editor} for editing. \li Double-click \e Screen01.ui.qml in \uicontrol Projects to open it
\li Drag-and-drop a \uicontrol {Text Field} from \l Library in \uicontrol {Form Editor}.
> \uicontrol Components > \uicontrol {Qt Quick Controls} to \li Drag-and-drop an instance of the EntryField component from
\e fieldColumn in \l Navigator. \uicontrol Library > \uicontrol Components >
\li In \l Properties, change the ID of the text field to \uicontrol {My Components} to \e fields in \l Navigator.
\e verifyPasswordField. \li Select the EntryField instance in \uicontrol Navigator to modify
\li In the \uicontrol Geometry group, \uicontrol Size field, set the its ID and text in \uicontrol Properties.
width of the field to \e 300 pixels to match the size of the \li In \uicontrol Component > \uicontrol ID, enter
existing fields. \e repeatPassword.
\li In the \uicontrol Placeholder field, set the placeholder text to \li In \uicontrol {Button Content} > \uicontrol Text, enter
\e {Verify password} and mark the text translatable. \e {Repeat Password} and select \uicontrol tr to mark the text
\li Drag-and-drop a PushButton component from \uicontrol Library > translatable.
\uicontrol Components > \uicontrol {My Components} to the root
rectangle in \uicontrol Navigator.
\li Select the button in \uicontrol Navigator and change its ID to
\e backButton in \uicontrol Properties.
\li In the \uicontrol Geometry group, \uicontrol Size field, set the
button width to \e 40 pixels to create a small round button.
\li In the \uicontrol Text field, enter \e <.
\li In the \uicontrol Font group, \uicontrol Size field, set the font
size to \e 24 pixels.
\li Under \uicontrol Layout, select the \inlineimage icons/anchor-top.png
(\uicontrol Top) and \inlineimage icons/anchor-right.png
(\uicontrol Right) anchor buttons to anchor \e backButton to
the top right corner of its parent with 20- and 10-pixel margins,
respectively.
\li Select \uicontrol File > \uicontrol Save or press \key {Ctrl+S} \li Select \uicontrol File > \uicontrol Save or press \key {Ctrl+S}
to save your changes. to save your changes.
\endlist \endlist
\e Screen01 should now look something like this in the \uicontrol Design \e Screen01 should now look something like this in \uicontrol {Form Editor}:
mode and live preview:
\image loginui3-base-state.png "Login page with new UI components" \image loginui3-base-state.jpg "Login page with a Repeat Password field"
Next, you will add states for the login page and the registration page, Next, you will add states for the login page and the account creation page,
where you use the visibility property to hide the password verification where you use the visibility property to hide the repeat password field on
field and the back button on the login page and the login button on the the login page and the \e {Create Account} button on the account creation
registration page. page.
\section1 Using States to Simulate Page Changes \section1 Using States to Simulate Page Changes
You will now add \l{Adding States}{states} to the UI to show and hide UI You will now add \l{Adding States}{states} to the UI to show and hide UI
components in the \uicontrol {Form Editor}, depending on the current page: components in \uicontrol {Form Editor}, depending on the current page:
\list 1 \list 1
\li In the \l States view, select \uicontrol {Create New State}. \li In the \l States view, select \uicontrol {Create New State}.
\image loginui3-login-state.png "States view" \li Enter \e login as the state name.
\li Enter \e loginState as the state name. \image loginui3-login-state.jpg "States view"
\li Select \e verifyPasswordField in the \uicontrol Navigator, \li Select \e repeatPassword in \uicontrol Navigator to display its
and deselect the \uicontrol Visibility check box in properties in \uicontrol Properties.
\uicontrol Properties to hide the verify password field in \li In the \uicontrol Visibility section, deselect the
the login state. \uicontrol Visible check box to hide the repeat
password field in the login state.
\image loginui3-visibility.png \image loginui3-visibility.png
\li Repeat the above step for \e backButton to hide it, too.
\li In \uicontrol States, select \inlineimage icons/action-icon.png \li In \uicontrol States, select \inlineimage icons/action-icon.png
for \e loginState to open the \uicontrol Actions menu, and then for \e login to open the \uicontrol Actions menu, and then
select \uicontrol {Set as Default} to determine that \e loginState select \uicontrol {Set as Default} to determine that the \e login
is applied when the application starts. state is applied when the application starts.
\li With the base state selected, add another state and name it \li With the base state selected, add another state and name it
\e registerState. This state should now look identical to the base \e createAccount. This state should now look identical to the base
state.
\li Select \e createAccount in the \uicontrol Navigator to display its
properties in \uicontrol Properties.
\li In \uicontrol Visibility, deselect the \uicontrol Visible check box
to hide the \e {Create Account} button in the account creation
state. state.
\li Select \e loginButton in the \uicontrol Navigator, and deselect
the \uicontrol Visibility check box in \uicontrol Properties to
hide the login button in the registration state.
\li Select \uicontrol File > \uicontrol Save or press \key {Ctrl+S} \li Select \uicontrol File > \uicontrol Save or press \key {Ctrl+S}
to save your changes. to save your changes.
\endlist \endlist
You can now see all the states in the \uicontrol States view. The live You can now see all the states in the \uicontrol States view:
preview displays the default state, \e loginState:
\image loginui3-states.png "States view" \image loginui3-states.jpg "All states in the States view"
The live preview displays the default state, \e login:
\image loginui3-login-state-preview.jpg "Preview of the login state"
\section2 Learn More - States \section2 Learn More - States
@@ -171,9 +161,7 @@
Next, you will create connections to specify that clicking the Next, you will create connections to specify that clicking the
\uicontrol {Create Account} button on the login page triggers a \uicontrol {Create Account} button on the login page triggers a
transition to the registration page and that clicking the back transition to the account creation page.
button on the registration page triggers a transition to the login
page.
\section1 Connecting Buttons to States \section1 Connecting Buttons to States
@@ -183,35 +171,27 @@
is clicked within the area. is clicked within the area.
You will now use \l {Connection View} to You will now use \l {Connection View} to
\l{Connecting Components to Signals}{connect} the clicked signal of \l{Connecting Components to Signals}{connect} the clicked signal of the
\e registerButton to \e registerState and that of \e backButton \e createAccount button to \e createAccount state:
to \e loginState:
\list 1 \list 1
\li Select \uicontrol View > \uicontrol Views > \li Select \uicontrol View > \uicontrol Views >
\uicontrol {Connection View} to open the \uicontrol Connections tab. \uicontrol {Connection View} to open the \uicontrol Connections tab.
\li Select \e registerButton in the \uicontrol Navigator. \li Select \e createAccount in \uicontrol Navigator.
\li In the \uicontrol Connections tab, select the \inlineimage plus.png \li In the \uicontrol Connections tab, select the \inlineimage plus.png
button to add the action that the \c onClicked signal handler of button to add the action that the \c onClicked signal handler of
\e registerButton should apply. \e createAccount should apply.
\li Double-click the value \uicontrol Action column and select \li Double-click the value \uicontrol Action column and select
\uicontrol {Change state to registerState} in the drop-down menu. \uicontrol {Change state to createAccount} in the drop-down menu.
\li Repeat the steps above to connect \e backButton to \e loginState \image loginui3-connections.png "Connections tab"
by selecting \uicontrol {Change state to loginState} in the last
step.
\li Select \uicontrol File > \uicontrol Save or press \key {Ctrl+S} \li Select \uicontrol File > \uicontrol Save or press \key {Ctrl+S}
to save your changes. to save your changes.
\endlist \endlist
You can now see the following connections in the \uicontrol Design mode:
\image loginui3-connections.png "Connections tab"
In the live preview, you can now click the \uicontrol {Create Account} In the live preview, you can now click the \uicontrol {Create Account}
button to go to the registration page and the back button to return to button to go to the account creation page.
the login page.
\image loginui3.gif "Moving between login page and registration page" \image loginui3.gif "Moving between login page and account creation page"
\section2 Learn More - Signal and Event Handlers \section2 Learn More - Signal and Event Handlers
@@ -220,11 +200,11 @@
needs to know that the user has clicked on it. In response, the button may needs to know that the user has clicked on it. In response, the button may
change color to indicate its state and perform an action. change color to indicate its state and perform an action.
A \e {signal-and-handler} mechanism is used, where the \e signal is the To accomplish this, a \e {signal-and-handler} mechanism is used, where the
event that is responded to through a \e {signal handler}. When a signal is \e signal is the event that is responded to through a \e {signal handler}.
emitted, the corresponding signal handler is invoked. Placing logic, such When a signal is emitted, the corresponding signal handler is invoked.
as a script or other operations, in the handler allows the component to Placing logic, such as a script or other operations, in the handler allows
respond to the event. the component to respond to the event.
For more information, see \l{Signal and Handler Event System}. For more information, see \l{Signal and Handler Event System}.
@@ -236,6 +216,6 @@
\l{Lists and Other Data Models}. \l{Lists and Other Data Models}.
To learn how to use a timeline to animate the transition between the login To learn how to use a timeline to animate the transition between the login
and registration pages, see the next tutorial in the series, and account creation pages, see the next tutorial in the series,
\l {Log In UI - Part 4}. \l {Log In UI - Timeline}.
*/ */

View File

@@ -28,30 +28,31 @@
\ingroup studioexamples \ingroup studioexamples
\ingroup gstutorials \ingroup gstutorials
\title Log In UI - Part 4 \title Log In UI - Timeline
\brief Illustrates how to use the timeline and states to animate UI \brief Illustrates how to use the timeline and states to animate UI
components. components.
\previouspage {Log In UI - Part 3} \previouspage {Log In UI - States}
\image loginui4.gif "Log In UI" \image loginui4.gif "Log In UI"
\e{Log In UI - Part 4} is the fourth in a series of tutorials that build \e{Log In UI - Timeline} is the fourth in a series of tutorials that build
on each other to illustrate how to use \QDS to create a simple UI with on each other to illustrate how to use \QDS to create a simple UI with
some basic UI components, such as pages, buttons, and entry fields. Part 4 some basic UI components, such as pages, buttons, and entry fields. The
describes how to use the timeline and states to animate UI components. fourth part of the tutorial describes how to use the timeline and states
to animate UI components.
In Part 3, you learned how to use states to simulate page changes In \l {Log In UI - States}, you learned how to use states to simulate page
in a UI and connections to provide user interaction with it. In changes in a UI and connections to provide user interaction with it. In
Part 4, you will now learn another way of animating the UI by creating this part, you will now learn another way of animating the UI by creating
\l{Creating Timeline Animations}{timeline animations} that you bind \l{Creating Timeline Animations}{timeline animations} that you bind
to states. to states.
These instructions build on: These instructions build on:
\list \list
\li \l {Log In UI - Part 1} \li \l {Log In UI - Components}
\li \l {Log In UI - Part 2} \li \l {Log In UI - Positioning}
\li \l {Log In UI - Part 3} \li \l {Log In UI - States}
\endlist \endlist
The \e {Learn More} sections provide additional information relevant to the The \e {Learn More} sections provide additional information relevant to the
@@ -59,18 +60,18 @@
\section1 Animating UI Components \section1 Animating UI Components
In Part 3, you changed the visibility property in different states to In \l {Log In UI - States}, you changed the visibility property in different
simulate changing pages. To make sure that those changes won't interfere states to simulate changing pages. To make sure that those changes won't
with the changes to the opacity property you will make in Part 4, you will interfere with the changes to the opacity property you will make next, you
first remove the states. will first remove the states.
Then, you will add a timeline and insert keyframes for the opacity property Then, you will add a timeline and insert keyframes for the opacity property
to hide the password verification field and back button on the login page to hide the \e {Retype Password} field on the login page and the
and the login button on the registration page. Because we want the password \e {Create Account} button on the account creation page. Because we want the
verification field to appear to slide down from the password field, you will retype password field to appear to slide down from the password field, you
also need to insert a keyframe for its anchor margin property. To be able to will also need to insert a keyframe for its anchor margin property. To be
animate the anchor, you also need to pull out the fields from the fields able to animate the anchor, you also need to pull out the fields from the
column and anchor them to the page and to each other instead. column component and anchor them to the rectangle and to each other instead.
To preview the changes that you make to the UI while you make To preview the changes that you make to the UI while you make
them, select the \inlineimage live_preview.png them, select the \inlineimage live_preview.png
@@ -82,39 +83,47 @@
First, you will prepare the \e Screen01 component for adding animation: First, you will prepare the \e Screen01 component for adding animation:
\list 1 \list 1
\li Open \e {Screen01.ui.qml} in \l {Form Editor} for editing. \li Double-click \e Screen01.ui.qml in \l Projects to open it
\li In the \l States view, select the \inlineimage close.png in \l {Form Editor}.
(\uicontrol Close) button in \e loginState and \e registerState \li In the \l States view, select \e login, and then select
to remove the states. \inlineimage close.png
\li Select the fields in \e fieldColumn in \l Navigator to remove the state. Repeat for the \e createAccount state.
and drag and drop them to their parent rectangle to prepare for \li Select \e username in \l Navigator, and then select
deleting the column component. \inlineimage arrowleft.png
\li Select \e fieldColumn in \uicontrol Navigator and press to move it into the parent rectangle to prepare for
\key Delete to delete it. deleting the \e fields column component instance.
\li Select \e usernameField in \uicontrol Navigator. \li Select \inlineimage icons/navigator-arrowup.png
\li In \l Properties > \uicontrol Layout, select the to move \e username below \e tagLine in \uicontrol Navigator
\inlineimage icons/anchor-top.png to preserve the \l{Arranging Components}{component hierarchy}.
(\uicontrol Top) button to anchor the top of the field to the top \li Repeat for \e password and \e repeatPassword.
of its parent. \QDS will suggest an appropriate margin based on \li Select \e fields in \uicontrol Navigator and press \key Delete to
the current position of the field on the y axis, 200 pixels. delete it.
\li Select the \inlineimage icons/anchor-center-horizontal.png \li Select \e username in \uicontrol Navigator to display its properties
(\uicontrol {Horizontal Center}) button to anchor in \l Properties.
the horizontal center of the field to that of its parent. \li Select \uicontrol Layout > \inlineimage icons/anchor-top.png
\li Select \e passwordField, and then select the \uicontrol Top to anchor the top of \e username to the bottom of \e tagLine in the
button in \uicontrol Properties > \uicontrol Layout. \uicontrol Target field. \QDS will suggest an appropriate margin
\li In the \uicontrol Target field, select \e usernameField to anchor based on the current position of the field on the y axis, 170
the top of \e passwordField to the bottom of \e usernameField pixels.
with a 5-pixel margin. \li Select \inlineimage icons/anchor-center-horizontal.png
\li Select the \uicontrol {Horizontal Center} button to anchor the to anchor \e username horizontally to its parent in the
horizontal center of \e passwordField to that of \e usernameField. \uicontrol Target field.
\li Repeat the above steps to anchor the top of \e verifyPasswordField \li Select \e password in \uicontrol Navigator to display its properties
to the bottom of \e passwordField with a 5-pixel margin and to in \uicontrol Properties.
anchor its horizontal center to that of \e passwordField. \li Select \uicontrol Layout > \inlineimage icons/anchor-top.png
to anchor the top of \e password to the bottom of \e username in
the \uicontrol Target field with a 20-pixel margin.
\li Select \inlineimage icons/anchor-center-horizontal.png
to anchor \e password horizontally to its parent in the
\uicontrol Target field.
\li Repeat the above steps to anchor the top of \e repeatPassword
to the bottom of \e password with a 20-pixel margin and to
anchor it horizontally to its parent.
\li Select \uicontrol File > \uicontrol Save or press \key {Ctrl+S} \li Select \uicontrol File > \uicontrol Save or press \key {Ctrl+S}
to save your changes. to save your changes.
\endlist \endlist
You could also animate the y-position property of the verify password You could also animate the y-position property of the repeat password
field for a similar effect. In that case, you would need to use absolute field for a similar effect. In that case, you would need to use absolute
positioning for the field. This is less flexible if you export your positioning for the field. This is less flexible if you export your
design from a design tool, such as Adobe Photoshop, and decide to change design from a design tool, such as Adobe Photoshop, and decide to change
@@ -122,18 +131,13 @@
would probably stay the same, even if the positions of the fields on the would probably stay the same, even if the positions of the fields on the
page would change. page would change.
\e Screen01 should now look something like this in the \uicontrol Design \e Screen01 should not display visible changes in \uicontrol {Form Editor}:
mode and live preview:
\image loginui4-page.png "UI with all the buttons and fields in the Design mode" \image loginui3-base-state.jpg "UI with all the buttons and fields in the Design mode"
\section2 Adding a Timeline and Animation Settings \section2 Adding a Timeline and Animation Settings
You are now ready to add the \l{Creating Timeline Animations}{timeline}. You will You are now ready to add the \l{Creating Timeline Animations}{timeline}.
need two animations, one for moving into the registration page and another
for returning to the login page. You can use the same animation for both
cases, by running it either from the beginning to the end or from the
end to the beginning.
To add a timeline with settings for running the animation: To add a timeline with settings for running the animation:
@@ -143,18 +147,12 @@
\li In \uicontrol Timeline, select \inlineimage plus.png \li In \uicontrol Timeline, select \inlineimage plus.png
to add a 1000-frame timeline and settings for running the animation. to add a 1000-frame timeline and settings for running the animation.
\image loginui4-timeline-settings.png \image loginui4-timeline-settings.png
\li In the \uicontrol {Animation ID} field, enter \e toLoginState. \li In the \uicontrol {Animation ID} field, enter
\li Deselect the \uicontrol {Running in base state} check box, because \e toCreateAccountState.
\li Deselect the \uicontrol {Running in base state} check box because
you want the animation to run only after the user clicks the you want the animation to run only after the user clicks the
\uicontrol {Create Account} button. You can use the default settings \uicontrol {Create Account} button. You can use the default settings
for the other fields. for the other fields.
\li Select \inlineimage plus.png
next to the \uicontrol {Animation Settings} group to add settings
for running the animation when the user clicks the back button.
\li In the \uicontrol {Animation ID} field, enter \e toRegisterState.
\li To run the animation backwards when the user clicks the back button,
enter \e 1000 in the \uicontrol {Start frame} field and \e 0 in the
\uicontrol {End frame} field.
\li Select \uicontrol Close in the \uicontrol {Timeline Settings} view \li Select \uicontrol Close in the \uicontrol {Timeline Settings} view
to save the timeline and the animation settings. to save the timeline and the animation settings.
\endlist \endlist
@@ -167,14 +165,17 @@
\uicontrol Timeline: \uicontrol Timeline:
\list 1 \list 1
\li Select \e backButton in \uicontrol Navigator. \li Select \e repeatPassword in \uicontrol Navigator to display its
\li In \uicontrol Properties > \uicontrol Opacity > \uicontrol Settings, properties in \uicontrol Properties.
select \uicontrol {Insert Keyframe} to insert a keyframe for the \li In \uicontrol Visibility > \uicontrol Opacity, select
opacity property of the button. \inlineimage icons/action-icon.png
> \uicontrol {Insert Keyframe} to insert a keyframe for the
opacity property of the component.
\image loginui4-keyframe-opacity.png "Inserting keyframe for opacity property"
\li In \uicontrol Timeline, check that the playhead is in \li In \uicontrol Timeline, check that the playhead is in
frame 0, and select the \inlineimage recordfill.png frame 0, and select the \inlineimage recordfill.png
(\uicontrol {Per Property Recording}) button for the (\uicontrol {Per Property Recording}) button for the
\uicontrol opacity property of \e backButton to start \uicontrol opacity property of \e repeatPassword to start
recording property changes. recording property changes.
\image loginui4-timeline-opacity.png "Record button for the opacity property" \image loginui4-timeline-opacity.png "Record button for the opacity property"
\li In the field next to the opacity property name on that same line, \li In the field next to the opacity property name on that same line,
@@ -188,12 +189,8 @@
\li Select the record button again to stop recording property changes. \li Select the record button again to stop recording property changes.
If you forget this, all the following changes will be recorded, and If you forget this, all the following changes will be recorded, and
the results will be unpredictable. the results will be unpredictable.
\li Select \e verifyPasswordField in \uicontrol Navigator, \li Select \e createAccount in \uicontrol Navigator, and repeat
and repeat the above steps to insert a keyframe for the the above steps to insert a keyframe for the \uicontrol Opacity
\uicontrol opacity property of the field and to record
changes for it.
\li Select \e loginButton in \uicontrol Navigator, and repeat
the above steps to insert a keyframe for the \uicontrol opacity
property of the button and to record changes for it. However, this property of the button and to record changes for it. However, this
time the opacity value needs to be 1 in frame 0 and 0 in frame 1000. time the opacity value needs to be 1 in frame 0 and 0 in frame 1000.
\li Select \uicontrol File > \uicontrol Save or press \key {Ctrl+S} \li Select \uicontrol File > \uicontrol Save or press \key {Ctrl+S}
@@ -201,30 +198,34 @@
\endlist \endlist
When you move the playhead along the timeline, you can see how the login When you move the playhead along the timeline, you can see how the login
button fades out while the verify password field and back button fade in. button fades out while the repeat password field fades in.
You will now animate the top anchor margin of the verify password field You will now animate the top anchor margin of the repeat password field
to make it appear to slide down from the password field. to make it appear to slide down from the password field.
\section2 Animating Anchors \section2 Animating Anchors
To animate the top anchor margin of the verify password field: To animate the top anchor margin of the repeat password field:
\list 1 \list 1
\li Select \e verifyPasswordField in \uicontrol Navigator. \li Select \e repeatPassword in \uicontrol Navigator to display its
\li Select \uicontrol Properties > \uicontrol Layout > \uicontrol Margin properties in \uicontrol Properties.
\li In \uicontrol Layout > \uicontrol Margin (under
\inlineimage icons/anchor-top.png
), select \inlineimage icons/action-icon.png
> \uicontrol {Insert Keyframe} to insert a keyframe for the top > \uicontrol {Insert Keyframe} to insert a keyframe for the top
anchor margin of \e verifyPasswordField. anchor margin of \e repeatPassword.
\image loginui4-keyframe-top-anchor-margin.png "Inserting keyframe for top anchor margin"
\li In \uicontrol Timeline, check that the playhead is in \li In \uicontrol Timeline, check that the playhead is in
frame 0, and select the record button for the \e anchors.topMargin frame 0, and select the record button for the \e anchors.topMargin
property of \e verifyPasswordField. property of \e repeatPassword.
\li In the field next to the property, set a negative value for the \li In the field next to the property, set a negative value for the
top anchor margin, -40, to place \e verifyPasswordField on top of top anchor margin, -40, to place \e repeatPassword on top of
\e passwordField. \e password.
\li Move the playhead to frame 1000 and change the top anchor margin \li Move the playhead to frame 1000 and change the top anchor margin
to 5, so that, combined with the change in the opacity value, to 20, so that, combined with the change in the \uicontrol Opacity
\e verifyPasswordField appears to slide down and settle below value, \e repeatPassword appears to slide down and settle below
\e passwordField. \e password.
\li Select the record button again to stop recording property changes. \li Select the record button again to stop recording property changes.
\li Select \uicontrol File > \uicontrol Save or press \key {Ctrl+S} \li Select \uicontrol File > \uicontrol Save or press \key {Ctrl+S}
to save your changes. to save your changes.
@@ -239,6 +240,7 @@
\li Click the keyframe marker \inlineimage keyframe_linear_inactive.png \li Click the keyframe marker \inlineimage keyframe_linear_inactive.png
for the \e anchors.topMargin property at frame 1000 on the for the \e anchors.topMargin property at frame 1000 on the
timeline to select it. timeline to select it.
\image loginui4-easing-curve-top-anchor-margin.png "Top anchor margin keyframe marker"
\li Right-click the keyframe marker to open a context menu, and \li Right-click the keyframe marker to open a context menu, and
select \uicontrol {Edit Easing Curve} to add an easing curve select \uicontrol {Edit Easing Curve} to add an easing curve
to the animation. to the animation.
@@ -256,7 +258,7 @@
\image loginui4-timeline.png "Timeline view with the recorded property changes" \image loginui4-timeline.png "Timeline view with the recorded property changes"
Next, you'll create states for the login and registration pages and bind Next, you'll create states for the login and account creation pages and bind
them to the animation settings. them to the animation settings.
\section1 Binding Animation to States \section1 Binding Animation to States
@@ -267,27 +269,30 @@
\list 1 \list 1
\li In \uicontrol States, select \uicontrol {Create New State} twice to \li In \uicontrol States, select \uicontrol {Create New State} twice to
add two states called \e loginState and \e registerState. You don't add two states called \e login and \e createAccount. You don't
need to make any property changes this time, because you'll bind the need to make any property changes this time because you'll bind the
states to property animations. states to property animations.
\li In \uicontrol States, select \inlineimage icons/action-icon.png
for \e login to open the \uicontrol Actions menu, and then
select \uicontrol {Set as Default} to determine that the \e login
state is applied when the application starts.
\li In \uicontrol Timeline, select the \inlineimage animation.png \li In \uicontrol Timeline, select the \inlineimage animation.png
(\uicontrol {Timeline Settings (S)}) button on the toolbar (or press (\uicontrol {Timeline Settings (S)}) button on the toolbar (or press
\key S to open the \uicontrol {Timeline Settings} dialog. \key S) to open the \uicontrol {Timeline Settings} dialog.
\image loginui4-timeline-settings-states.png \image loginui4-timeline-settings-states.png
\li Double-click the cell in the \uicontrol Timeline column on the \li Double-click the cell in the \uicontrol Timeline column on the
\e loginState row, and select \e timeline in the list. \e createAccount row, and select \e timeline in the list.
\li Double-click the cell in the \uicontrol Animation column on the \li Double-click the cell in the \uicontrol Animation column on the
\e loginState row, and select \e toRegisterState. \e createAccount row, and select \e toCreateAccountState.
\li Repeat these steps for \e registerState row, but select
\e toLoginState in the \uicontrol Animation column.
\li Click \uicontrol Close to save the timeline settings. \li Click \uicontrol Close to save the timeline settings.
\li Select \uicontrol File > \uicontrol Save or press \key {Ctrl+S}
to save your changes.
\endlist \endlist
In the live preview, you can now click the \uicontrol {Create Account} In the live preview, you can now click the \uicontrol {Create Account}
button to go to the registration page and the back button to return to button to go to the account creation page.
the login page.
\image loginui4.gif "Moving between login page and registration page" \image loginui4.gif "Moving between login page and account creation page"
\section2 Learn More - Timeline \section2 Learn More - Timeline

View File

@@ -1,4 +1,5 @@
/**************************************************************************** /****************************************************************************
** **
** Copyright (C) 2021 The Qt Company Ltd. ** Copyright (C) 2021 The Qt Company Ltd.
@@ -53,6 +54,8 @@ import QtQuick.Controls 2.12
Button { Button {
id: control id: control
width: 500
height: 100
implicitWidth: Math.max( implicitWidth: Math.max(
buttonBackground ? buttonBackground.implicitWidth : 0, buttonBackground ? buttonBackground.implicitWidth : 0,
@@ -64,26 +67,31 @@ Button {
rightPadding: 4 rightPadding: 4
text: "My Button" text: "My Button"
hoverEnabled: false
background: buttonBackground background: buttonBackground
Rectangle { Rectangle {
id: buttonBackground id: buttonBackground
color: "#00000000"
implicitWidth: 100 implicitWidth: 100
implicitHeight: 40 implicitHeight: 40
opacity: enabled ? 1 : 0.3 opacity: enabled ? 1 : 0.3
radius: 20 radius: 50
border.color: "#41cd52" border.color: "#ffffff"
} }
contentItem: textItem contentItem: textItem
Text { Text {
id: textItem id: textItem
text: control.text text: control.text
font.pixelSize: 34
opacity: enabled ? 1.0 : 0.3 opacity: enabled ? 1.0 : 0.3
horizontalAlignment: Text.AlignHCenter color: "#ffffff"
horizontalAlignment: Text.AlignLeft
verticalAlignment: Text.AlignVCenter verticalAlignment: Text.AlignVCenter
font.bold: true leftPadding: 50
font.family: "Titillium Web ExtraLight"
} }
states: [ states: [
@@ -91,9 +99,14 @@ Button {
name: "normal" name: "normal"
when: !control.down when: !control.down
PropertyChanges {
target: textItem
font.family: "Titillium Web ExtraLight"
}
PropertyChanges { PropertyChanges {
target: buttonBackground target: buttonBackground
border.color: "#41cd52" color: "#28e7e7e7"
} }
}, },
State { State {
@@ -101,12 +114,13 @@ Button {
when: control.down when: control.down
PropertyChanges { PropertyChanges {
target: textItem target: textItem
color: "#41cd52" color: "#ffffff"
} }
PropertyChanges { PropertyChanges {
target: buttonBackground target: buttonBackground
border.color: "#41cd52" color: "#e7e7e7"
border.color: "#ffffff"
} }
} }
] ]

View File

@@ -1,4 +1,5 @@
/**************************************************************************** /****************************************************************************
** **
** Copyright (C) 2021 The Qt Company Ltd. ** Copyright (C) 2021 The Qt Company Ltd.
@@ -53,6 +54,8 @@ import QtQuick.Controls 2.12
Button { Button {
id: control id: control
width: 500
height: 100
implicitWidth: Math.max( implicitWidth: Math.max(
buttonBackground ? buttonBackground.implicitWidth : 0, buttonBackground ? buttonBackground.implicitWidth : 0,
@@ -64,14 +67,16 @@ Button {
rightPadding: 4 rightPadding: 4
text: "My Button" text: "My Button"
hoverEnabled: false
background: buttonBackground background: buttonBackground
Rectangle { Rectangle {
id: buttonBackground id: buttonBackground
color: "#00000000"
implicitWidth: 100 implicitWidth: 100
implicitHeight: 40 implicitHeight: 40
opacity: enabled ? 1 : 0.3 opacity: enabled ? 1 : 0.3
radius: 20 radius: 50
border.color: "#41cd52" border.color: "#41cd52"
} }
@@ -79,11 +84,13 @@ Button {
Text { Text {
id: textItem id: textItem
text: control.text text: control.text
font.pixelSize: 34
opacity: enabled ? 1.0 : 0.3 opacity: enabled ? 1.0 : 0.3
color: "#41cd52"
horizontalAlignment: Text.AlignHCenter horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter verticalAlignment: Text.AlignVCenter
font.bold: true font.family: "Titillium Web ExtraLight"
} }
states: [ states: [
@@ -93,7 +100,7 @@ Button {
PropertyChanges { PropertyChanges {
target: buttonBackground target: buttonBackground
border.color: "#41cd52" color: "#00000000"
} }
}, },
State { State {
@@ -101,13 +108,20 @@ Button {
when: control.down when: control.down
PropertyChanges { PropertyChanges {
target: textItem target: textItem
color: "#41cd52" color: "#ffffff"
} }
PropertyChanges { PropertyChanges {
target: buttonBackground target: buttonBackground
border.color: "#41cd52" color: "#41cd52"
border.color: "#00000000"
} }
} }
] ]
} }
/*##^##
Designer {
D{i:0;height:100;width:500}
}
##^##*/

View File

@@ -1,7 +1,8 @@
/**************************************************************************** /****************************************************************************
** **
** Copyright (C) 2019 The Qt Company Ltd. ** Copyright (C) 2021 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/ ** Contact: https://www.qt.io/licensing/
** **
** This file is part of the examples of the Qt Design Studio. ** This file is part of the examples of the Qt Design Studio.
@@ -48,69 +49,76 @@
** $QT_END_LICENSE$ ** $QT_END_LICENSE$
** **
****************************************************************************/ ****************************************************************************/
import QtQuick 2.15 import QtQuick
import QtQuick.Studio.Components 1.0 import QtQuick.Controls
import QtQuick.Controls 2.15
import loginui1 1.0 import loginui1 1.0
Rectangle { Rectangle {
color: "#ffffff" width: Constants.width
gradient: Gradient { height: Constants.height
GradientStop {
position: 0.5
color: "#ffffff"
}
GradientStop { color: Constants.backgroundColor
position: 1
color: "#41cd52"
}
}
Text {
id: pageTitle
x: 273
y: 33
text: qsTr("Qt Account")
font.pixelSize: 24
font.bold: true
font.weight: Font.ExtraBold
anchors.verticalCenterOffset: -180
anchors.horizontalCenterOffset: 0
anchors.centerIn: parent
font.family: Constants.font.family
}
Image { Image {
id: logo id: adventurePage
x: 8 x: 0
y: 19 y: 0
source: "qt_logo_green_64x64px.png" source: "images/adventurePage.jpg"
fillMode: Image.PreserveAspectFit fillMode: Image.PreserveAspectFit
} }
PushButton { Image {
id: loginButton id: qt_logo_green_128x128px
x: 260 x: 296
y: 352 y: 40
width: 120 source: "images/qt_logo_green_128x128px.png"
height: 40 fillMode: Image.PreserveAspectFit
text: "Log In" }
Text {
id: tagLine
width: 541
height: 78
color: "#ffffff"
text: qsTr("Are you ready to explore?")
font.pixelSize: 50
font.family: "Titillium Web ExtraLight"
anchors.verticalCenterOffset: -391
anchors.horizontalCenterOffset: 18
anchors.centerIn: parent
}
EntryField {
id: username
x: 128
y: 470
text: "Username or Email"
}
EntryField {
id: password
x: 128
y: 590
text: qsTr("Password")
} }
PushButton { PushButton {
id: registerButton id: login
x: 260 x: 102
y: 398 y: 966
width: 120 text: qsTr("Continue")
height: 40 }
PushButton {
id: createAccount
x: 102
y: 1088
text: qsTr("Create Account") text: qsTr("Create Account")
} }
} }
/*##^## /*##^##
Designer { Designer {
D{i:0;autoSize:true;formeditorZoom:0.5;height:480;width:640} D{i:0;formeditorZoom:0.33}
} }
##^##*/ ##^##*/

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

View File

@@ -1,24 +1,23 @@
pragma Singleton pragma Singleton
import QtQuick 2.10 import QtQuick
QtObject { QtObject {
readonly property int width: 1280 readonly property int width: 720
readonly property int height: 720 readonly property int height: 1280
readonly property FontLoader mySystemFont: FontLoader { name: "Arial" }
property alias fontDirectory: directoryFontLoader.fontDirectory property alias fontDirectory: directoryFontLoader.fontDirectory
property alias relativeFontDirectory: directoryFontLoader.relativeFontDirectory property alias relativeFontDirectory: directoryFontLoader.relativeFontDirectory
/* Edit this comment to add your custom font */ /* Edit this comment to add your custom font */
readonly property font font: Qt.font({ readonly property font font: Qt.font({
family: mySystemFont.name, family: Qt.application.font.family,
pixelSize: Qt.application.font.pixelSize pixelSize: Qt.application.font.pixelSize
}) })
readonly property font largeFont: Qt.font({ readonly property font largeFont: Qt.font({
family: mySystemFont.name, family: Qt.application.font.family,
pixelSize: Qt.application.font.pixelSize * 1.6 pixelSize: Qt.application.font.pixelSize * 1.6
}) })
readonly property color backgroundColor: "#c2c2c2" readonly property color backgroundColor: "#c2c2c2"
property DirectoryFontLoader directoryFontLoader: DirectoryFontLoader { property DirectoryFontLoader directoryFontLoader: DirectoryFontLoader {

View File

@@ -1,6 +1,6 @@
/**************************************************************************** /****************************************************************************
** **
** Copyright (C) 2020 The Qt Company Ltd. ** Copyright (C) 2021 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/ ** Contact: https://www.qt.io/licensing/
** **
** This file is part of the examples of the Qt Design Studio. ** This file is part of the examples of the Qt Design Studio.
@@ -48,7 +48,7 @@
** **
****************************************************************************/ ****************************************************************************/
import QtQuick 2.12 import QtQuick
import loginui1 1.0 import loginui1 1.0
Item { Item {
@@ -57,4 +57,5 @@ Item {
Screen01 { Screen01 {
} }
} }

View File

@@ -37,6 +37,8 @@ Project {
QT_AUTO_SCREEN_SCALE_FACTOR: "1" QT_AUTO_SCREEN_SCALE_FACTOR: "1"
} }
qt6Project: true
/* List of plugin directories passed to QML runtime */ /* List of plugin directories passed to QML runtime */
importPaths: [ "imports", "asset_imports" ] importPaths: [ "imports", "asset_imports" ]

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

View File

@@ -1,3 +1,6 @@
; This file can be edited to change the style of the application ; This file can be edited to change the style of the application
; Read "Qt Quick Controls 2 Configuration File" for details: ; Read "Qt Quick Controls 2 Configuration File" for details:
; https://doc.qt.io/qt/qtquickcontrols2-configuration.html ; http://doc.qt.io/qt-5/qtquickcontrols2-configuration.html
[Controls]
Style=Default

View File

@@ -2,10 +2,10 @@
/**************************************************************************** /****************************************************************************
** **
** Copyright (C) 2020 The Qt Company Ltd. ** Copyright (C) 2021 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/ ** Contact: https://www.qt.io/licensing/
** **
** This file is part of the examples of the Qt Toolkit. ** This file is part of the examples of the Qt Design Studio.
** **
** $QT_BEGIN_LICENSE:BSD$ ** $QT_BEGIN_LICENSE:BSD$
** Commercial License Usage ** Commercial License Usage
@@ -49,98 +49,89 @@
** $QT_END_LICENSE$ ** $QT_END_LICENSE$
** **
****************************************************************************/ ****************************************************************************/
import QtQuick 2.10 import QtQuick
import QtQuick.Controls
import loginui2 1.0 import loginui2 1.0
import QtQuick.Controls 2.3
Rectangle { Rectangle {
id: rectangle
width: Constants.width width: Constants.width
height: Constants.height height: Constants.height
gradient: Gradient {
GradientStop {
position: 0.50157
color: "#ffffff"
}
GradientStop { color: Constants.backgroundColor
position: 1
color: "#41cd52"
}
}
Text {
id: pageTitle
x: 258
y: 70
width: 135
height: 40
text: qsTr("Qt Account")
anchors.horizontalCenter: parent.horizontalCenter
anchors.top: parent.top
anchors.topMargin: 70
font.pixelSize: 24
font.bold: true
}
Image { Image {
id: logo id: adventurePage
x: 10 anchors.fill: parent
y: 10 source: "images/adventurePage.jpg"
width: 100
height: 100
anchors.topMargin: 10
anchors.left: parent.left
anchors.leftMargin: 10
anchors.top: parent.top
source: "qt_logo_green_64x64px.png"
fillMode: Image.PreserveAspectFit fillMode: Image.PreserveAspectFit
} }
Column { Image {
id: fieldColumn id: qt_logo_green_128x128px
x: 170 x: 296
y: 200
width: 300
height: 85
spacing: 5
anchors.horizontalCenter: parent.horizontalCenter
anchors.top: parent.top anchors.top: parent.top
anchors.topMargin: 200 source: "images/qt_logo_green_128x128px.png"
anchors.horizontalCenter: parent.horizontalCenter
TextField { anchors.topMargin: 40
id: usernameField fillMode: Image.PreserveAspectFit
width: 300 }
placeholderText: qsTr("Username") Text {
font.pointSize: 10 id: tagLine
width: 541
height: 78
color: "#ffffff"
text: qsTr("Are you ready to explore?")
anchors.top: qt_logo_green_128x128px.bottom
font.pixelSize: 50
anchors.topMargin: 40
anchors.horizontalCenter: parent.horizontalCenter
font.family: "Titillium Web ExtraLight"
} }
TextField { Column {
id: passwordField id: fields
width: 300 x: 128
placeholderText: qsTr("Password") anchors.top: tagLine.bottom
font.pointSize: 10 anchors.horizontalCenter: parent.horizontalCenter
anchors.topMargin: 170
spacing: 20
EntryField {
id: username
text: "Username or Email"
}
EntryField {
id: password
text: qsTr("Password")
} }
} }
Column { Column {
id: buttonColumn id: buttons
x: 260 x: 102
y: 345 y: 966
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
anchors.bottomMargin: 50
spacing: 5
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
anchors.bottomMargin: 100
spacing: 20
PushButton { PushButton {
id: loginButton id: login
width: 120 text: qsTr("Continue")
text: qsTr("Log In")
} }
PushButton { PushButton {
id: registerButton id: createAccount
width: 120
text: qsTr("Create Account") text: qsTr("Create Account")
} }
} }
} }
/*##^##
Designer {
D{i:0;formeditorZoom:0.5}D{i:1}D{i:2}D{i:4}
}
##^##*/

View File

@@ -1,76 +1,26 @@
/****************************************************************************
**
** Copyright (C) 2019 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:BSD$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** BSD License Usage
** Alternatively, you may use this file under the terms of the BSD license
** as follows:
**
** "Redistribution and use in source and binary forms, with or without
** modification, are permitted provided that the following conditions are
** met:
** * Redistributions of source code must retain the above copyright
** notice, this list of conditions and the following disclaimer.
** * Redistributions in binary form must reproduce the above copyright
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
** * Neither the name of The Qt Company Ltd nor the names of its
** contributors may be used to endorse or promote products derived
** from this software without specific prior written permission.
**
**
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
**
** $QT_END_LICENSE$
**
****************************************************************************/
pragma Singleton pragma Singleton
import QtQuick 2.10 import QtQuick
QtObject { QtObject {
readonly property int width: 640 readonly property int width: 720
readonly property int height: 480 readonly property int height: 1280
readonly property FontLoader mySystemFont: FontLoader { name: "Arial" }
property alias fontDirectory: directoryFontLoader.fontDirectory
property alias relativeFontDirectory: directoryFontLoader.relativeFontDirectory
/* Edit this comment to add your custom font */ /* Edit this comment to add your custom font */
/* readonly property FontLoader myCustomFont: FontLoader { source: "MyCustomFont.ttf" } */
readonly property font font: Qt.font({ readonly property font font: Qt.font({
family: mySystemFont.name, family: Qt.application.font.family,
pointSize: Qt.application.font.pixelSize pixelSize: Qt.application.font.pixelSize
}) })
readonly property font largeFont: Qt.font({ readonly property font largeFont: Qt.font({
family: mySystemFont.name, family: Qt.application.font.family,
pointSize: Qt.application.font.pixelSize * 1.6 pixelSize: Qt.application.font.pixelSize * 1.6
}) })
readonly property color backgroundColor: "#c2c2c2" readonly property color backgroundColor: "#c2c2c2"
property DirectoryFontLoader directoryFontLoader: DirectoryFontLoader {
id: directoryFontLoader
} }
/*##^## Designer {
D{i:0;autoSize:true;height:480;width:640}
} }
##^##*/

View File

@@ -1 +1,2 @@
singleton Constants 1.0 Constants.qml singleton Constants 1.0 Constants.qml
EventListSimulator 1.0 EventListSimulator.qml

View File

@@ -1,9 +1,9 @@
/**************************************************************************** /****************************************************************************
** **
** Copyright (C) 2019 The Qt Company Ltd. ** Copyright (C) 2021 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/ ** Contact: https://www.qt.io/licensing/
** **
** This file is part of the examples of the Qt Toolkit. ** This file is part of the examples of the Qt Design Studio.
** **
** $QT_BEGIN_LICENSE:BSD$ ** $QT_BEGIN_LICENSE:BSD$
** Commercial License Usage ** Commercial License Usage
@@ -48,7 +48,7 @@
** **
****************************************************************************/ ****************************************************************************/
import QtQuick 2.10 import QtQuick
import loginui2 1.0 import loginui2 1.0
Item { Item {
@@ -57,6 +57,5 @@ Item {
Screen01 { Screen01 {
} }
} }

View File

@@ -28,14 +28,20 @@ Project {
directory: "." directory: "."
} }
Files {
filter: "*.ttf;*.otf"
}
Environment { Environment {
QT_QUICK_CONTROLS_CONF: "qtquickcontrols2.conf" QT_QUICK_CONTROLS_CONF: "qtquickcontrols2.conf"
QT_AUTO_SCREEN_SCALE_FACTOR: "1" QT_AUTO_SCREEN_SCALE_FACTOR: "1"
} }
qt6Project: true
/* List of plugin directories passed to QML runtime */ /* List of plugin directories passed to QML runtime */
importPaths: [ "imports" ] importPaths: [ "imports", "asset_imports" ]
/* Required for deployment */ /* Required for deployment */
targetDirectory: "/opt/loginui2" targetDirectory: "/opt/loginui1"
} }

View File

@@ -1,121 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject>
<!-- Written by QtDesignStudio 1.5.9, 2020-07-02T17:34:24. -->
<qtcreator>
<data>
<variable>EnvironmentId</variable>
<value type="QByteArray">{595d361f-de69-4ff2-b1f6-d89b95edfd27}</value>
</data>
<data>
<variable>ProjectExplorer.Project.ActiveTarget</variable>
<value type="int">0</value>
</data>
<data>
<variable>ProjectExplorer.Project.EditorSettings</variable>
<valuemap type="QVariantMap">
<value type="bool" key="EditorConfiguration.AutoIndent">true</value>
<value type="bool" key="EditorConfiguration.AutoSpacesForTabs">false</value>
<value type="bool" key="EditorConfiguration.CamelCaseNavigation">true</value>
<valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.0">
<value type="QString" key="language">Cpp</value>
<valuemap type="QVariantMap" key="value">
<value type="QByteArray" key="CurrentPreferences">CppGlobal</value>
</valuemap>
</valuemap>
<valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.1">
<value type="QString" key="language">QmlJS</value>
<valuemap type="QVariantMap" key="value">
<value type="QByteArray" key="CurrentPreferences">QmlJSGlobal</value>
</valuemap>
</valuemap>
<value type="int" key="EditorConfiguration.CodeStyle.Count">2</value>
<value type="QByteArray" key="EditorConfiguration.Codec">UTF-8</value>
<value type="bool" key="EditorConfiguration.ConstrainTooltips">false</value>
<value type="int" key="EditorConfiguration.IndentSize">4</value>
<value type="bool" key="EditorConfiguration.KeyboardTooltips">false</value>
<value type="int" key="EditorConfiguration.MarginColumn">80</value>
<value type="bool" key="EditorConfiguration.MouseHiding">true</value>
<value type="bool" key="EditorConfiguration.MouseNavigation">true</value>
<value type="int" key="EditorConfiguration.PaddingMode">1</value>
<value type="bool" key="EditorConfiguration.ScrollWheelZooming">true</value>
<value type="bool" key="EditorConfiguration.ShowMargin">false</value>
<value type="int" key="EditorConfiguration.SmartBackspaceBehavior">0</value>
<value type="bool" key="EditorConfiguration.SmartSelectionChanging">true</value>
<value type="bool" key="EditorConfiguration.SpacesForTabs">true</value>
<value type="int" key="EditorConfiguration.TabKeyBehavior">0</value>
<value type="int" key="EditorConfiguration.TabSize">8</value>
<value type="bool" key="EditorConfiguration.UseGlobal">true</value>
<value type="int" key="EditorConfiguration.Utf8BomBehavior">1</value>
<value type="bool" key="EditorConfiguration.addFinalNewLine">true</value>
<value type="bool" key="EditorConfiguration.cleanIndentation">true</value>
<value type="bool" key="EditorConfiguration.cleanWhitespace">true</value>
<value type="bool" key="EditorConfiguration.inEntireDocument">false</value>
</valuemap>
</data>
<data>
<variable>ProjectExplorer.Project.PluginSettings</variable>
<valuemap type="QVariantMap"/>
</data>
<data>
<variable>ProjectExplorer.Project.Target.0</variable>
<valuemap type="QVariantMap">
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Desktop</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">{8994bd34-5ed9-4c45-8c0a-94c8f33eca4a}</value>
<value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">-1</value>
<value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
<value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
<value type="int" key="ProjectExplorer.Target.BuildConfigurationCount">0</value>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.DeployConfiguration.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">0</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Deploy</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Deploy</value>
</valuemap>
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">1</value>
<valuemap type="QVariantMap" key="ProjectExplorer.DeployConfiguration.CustomData"/>
<value type="bool" key="ProjectExplorer.DeployConfiguration.CustomDataEnabled">false</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.DefaultDeployConfiguration</value>
</valuemap>
<value type="int" key="ProjectExplorer.Target.DeployConfigurationCount">1</value>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.PluginSettings"/>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0">
<value type="bool" key="Analyzer.QmlProfiler.AggregateTraces">false</value>
<value type="bool" key="Analyzer.QmlProfiler.FlushEnabled">false</value>
<value type="uint" key="Analyzer.QmlProfiler.FlushInterval">1000</value>
<value type="QString" key="Analyzer.QmlProfiler.LastTraceFile"></value>
<value type="bool" key="Analyzer.QmlProfiler.Settings.UseGlobalSettings">true</value>
<value type="int" key="PE.EnvironmentAspect.Base">0</value>
<valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">QML Scene</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">QmlProjectManager.QmlRunConfiguration.QmlScene</value>
<value type="QString" key="ProjectExplorer.RunConfiguration.BuildKey"></value>
<value type="QString" key="QmlProjectManager.QmlRunConfiguration.LastUsedLanguage">en</value>
<value type="QString" key="QmlProjectManager.QmlRunConfiguration.MainScript">CurrentFile</value>
<value type="QString" key="QmlProjectManager.QmlRunConfiguration.QDeclarativeViewerArguments"></value>
<value type="bool" key="QmlProjectManager.QmlRunConfiguration.QDeclarativeViewerArguments.multi">false</value>
<value type="bool" key="QmlProjectManager.QmlRunConfiguration.UseMultiLanguage">false</value>
<value type="QString" key="RunConfiguration.OverrideDebuggerStartup"></value>
<value type="bool" key="RunConfiguration.UseCppDebugger">false</value>
<value type="bool" key="RunConfiguration.UseCppDebuggerAuto">true</value>
<value type="bool" key="RunConfiguration.UseMultiProcess">false</value>
<value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
<value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
</valuemap>
<value type="int" key="ProjectExplorer.Target.RunConfigurationCount">1</value>
</valuemap>
</data>
<data>
<variable>ProjectExplorer.Project.TargetCount</variable>
<value type="int">1</value>
</data>
<data>
<variable>ProjectExplorer.Project.Updater.FileVersion</variable>
<value type="int">22</value>
</data>
<data>
<variable>Version</variable>
<value type="int">22</value>
</data>
</qtcreator>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

View File

@@ -1,3 +1,6 @@
; This file can be edited to change the style of the application ; This file can be edited to change the style of the application
; Read "Qt Quick Controls 2 Configuration File" for details: ; Read "Qt Quick Controls 2 Configuration File" for details:
; https://doc.qt.io/qt/qtquickcontrols2-configuration.html ; http://doc.qt.io/qt-5/qtquickcontrols2-configuration.html
[Controls]
Style=Default

View File

@@ -1,113 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2021 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Design Studio.
**
** $QT_BEGIN_LICENSE:BSD$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** BSD License Usage
** Alternatively, you may use this file under the terms of the BSD license
** as follows:
**
** "Redistribution and use in source and binary forms, with or without
** modification, are permitted provided that the following conditions are
** met:
** * Redistributions of source code must retain the above copyright
** notice, this list of conditions and the following disclaimer.
** * Redistributions in binary form must reproduce the above copyright
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
** * Neither the name of The Qt Company Ltd nor the names of its
** contributors may be used to endorse or promote products derived
** from this software without specific prior written permission.
**
**
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
**
** $QT_END_LICENSE$
**
****************************************************************************/
import QtQuick 2.15
import QtQuick.Controls 2.12
Button {
id: control
implicitWidth: Math.max(
buttonBackground ? buttonBackground.implicitWidth : 0,
textItem.implicitWidth + leftPadding + rightPadding)
implicitHeight: Math.max(
buttonBackground ? buttonBackground.implicitHeight : 0,
textItem.implicitHeight + topPadding + bottomPadding)
leftPadding: 4
rightPadding: 4
text: "My Button"
background: buttonBackground
Rectangle {
id: buttonBackground
implicitWidth: 100
implicitHeight: 40
opacity: enabled ? 1 : 0.3
radius: 20
border.color: "#41cd52"
}
contentItem: textItem
Text {
id: textItem
text: control.text
opacity: enabled ? 1.0 : 0.3
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
font.bold: true
}
states: [
State {
name: "normal"
when: !control.down
PropertyChanges {
target: buttonBackground
border.color: "#41cd52"
}
},
State {
name: "down"
when: control.down
PropertyChanges {
target: textItem
color: "#41cd52"
}
PropertyChanges {
target: buttonBackground
border.color: "#41cd52"
}
}
]
}

View File

@@ -1,10 +1,11 @@
/**************************************************************************** /****************************************************************************
** **
** Copyright (C) 2019 The Qt Company Ltd. ** Copyright (C) 2021 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/ ** Contact: https://www.qt.io/licensing/
** **
** This file is part of the examples of the Qt Toolkit. ** This file is part of the examples of the Qt Design Studio.
** **
** $QT_BEGIN_LICENSE:BSD$ ** $QT_BEGIN_LICENSE:BSD$
** Commercial License Usage ** Commercial License Usage
@@ -48,160 +49,113 @@
** $QT_END_LICENSE$ ** $QT_END_LICENSE$
** **
****************************************************************************/ ****************************************************************************/
import QtQuick 2.10 import QtQuick
import QtQuick.Controls
import loginui3 1.0 import loginui3 1.0
import QtQuick.Controls 2.3
Rectangle { Rectangle {
id: root id: rectangle
state: "loginState"
width: Constants.width width: Constants.width
height: Constants.height height: Constants.height
gradient: Gradient {
GradientStop {
position: 0.5
color: "#ffffff"
}
GradientStop { color: Constants.backgroundColor
position: 1 state: "login"
color: "#41cd52"
}
}
PushButton {
id: backButton
x: 590
y: 20
width: 40
text: "<"
font.pixelSize: 24
anchors.right: parent.right
anchors.rightMargin: 10
anchors.top: parent.top
anchors.topMargin: 20
}
Text {
id: pageTitle
x: 258
y: 70
width: 123
height: 40
text: qsTr("Qt Account")
anchors.horizontalCenter: parent.horizontalCenter
anchors.top: parent.top
anchors.topMargin: 70
font.pixelSize: 24
font.bold: true
}
Image { Image {
id: logo id: adventurePage
x: 10 anchors.fill: parent
y: 10 source: "images/adventurePage.jpg"
width: 100
height: 100
anchors.topMargin: 10
anchors.left: parent.left
anchors.leftMargin: 10
anchors.top: parent.top
source: "qt_logo_green_64x64px.png"
fillMode: Image.PreserveAspectFit fillMode: Image.PreserveAspectFit
} }
Connections { Image {
target: registerButton id: qt_logo_green_128x128px
onClicked: { x: 296
root.state = "registerState" anchors.top: parent.top
source: "images/qt_logo_green_128x128px.png"
anchors.horizontalCenter: parent.horizontalCenter
anchors.topMargin: 40
fillMode: Image.PreserveAspectFit
}
Text {
id: tagLine
width: 541
height: 78
color: "#ffffff"
text: qsTr("Are you ready to explore?")
anchors.top: qt_logo_green_128x128px.bottom
font.pixelSize: 50
anchors.topMargin: 40
anchors.horizontalCenter: parent.horizontalCenter
font.family: "Titillium Web ExtraLight"
}
Column {
id: fields
x: 128
anchors.top: tagLine.bottom
anchors.horizontalCenter: parent.horizontalCenter
anchors.topMargin: 170
spacing: 20
EntryField {
id: username
text: "Username or Email"
}
EntryField {
id: password
text: qsTr("Password")
}
EntryField {
id: repeatPassword
text: "Repeat Password"
} }
} }
Connections { Column {
target: backButton id: buttons
onClicked: { x: 102
root.state = "loginState" y: 966
} anchors.bottom: parent.bottom
anchors.horizontalCenter: parent.horizontalCenter
anchors.bottomMargin: 100
spacing: 20
PushButton {
id: login
text: qsTr("Continue")
} }
PushButton {
id: createAccount
text: qsTr("Create Account")
Connections {
target: createAccount
onClicked: rectangle.state = "createAccount"
}
}
}
states: [ states: [
State { State {
name: "loginState" name: "login"
PropertyChanges { PropertyChanges {
target: verifyPasswordField target: repeatPassword
visible: false
}
PropertyChanges {
target: backButton
visible: false visible: false
} }
}, },
State { State {
name: "registerState" name: "createAccount"
PropertyChanges { PropertyChanges {
target: loginButton target: createAccount
visible: false visible: false
} }
} }
] ]
Column {
id: fieldColumn
x: 170
y: 200
width: 300
height: 130
spacing: 5
anchors.horizontalCenter: parent.horizontalCenter
anchors.top: parent.top
anchors.topMargin: 200
TextField {
id: usernameField
width: 300
placeholderText: qsTr("Username")
font.pointSize: 10
}
TextField {
id: passwordField
width: 300
placeholderText: qsTr("Password")
font.pointSize: 10
}
TextField {
id: verifyPasswordField
width: 300
visible: true
font.pointSize: 10
placeholderText: qsTr("Verify password")
}
}
Column {
id: buttonColumn
x: 260
y: 345
anchors.bottom: parent.bottom
anchors.bottomMargin: 50
spacing: 5
anchors.horizontalCenter: parent.horizontalCenter
PushButton {
id: loginButton
width: 120
text: qsTr("Log In")
}
PushButton {
id: registerButton
width: 120
text: qsTr("Create Account")
}
}
} }
/*##^## /*##^##

View File

@@ -1,76 +1,26 @@
/****************************************************************************
**
** Copyright (C) 2019 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the examples of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:BSD$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** BSD License Usage
** Alternatively, you may use this file under the terms of the BSD license
** as follows:
**
** "Redistribution and use in source and binary forms, with or without
** modification, are permitted provided that the following conditions are
** met:
** * Redistributions of source code must retain the above copyright
** notice, this list of conditions and the following disclaimer.
** * Redistributions in binary form must reproduce the above copyright
** notice, this list of conditions and the following disclaimer in
** the documentation and/or other materials provided with the
** distribution.
** * Neither the name of The Qt Company Ltd nor the names of its
** contributors may be used to endorse or promote products derived
** from this software without specific prior written permission.
**
**
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
**
** $QT_END_LICENSE$
**
****************************************************************************/
pragma Singleton pragma Singleton
import QtQuick 2.10 import QtQuick
QtObject { QtObject {
readonly property int width: 640 readonly property int width: 720
readonly property int height: 480 readonly property int height: 1280
readonly property FontLoader mySystemFont: FontLoader { name: "Arial" }
property alias fontDirectory: directoryFontLoader.fontDirectory
property alias relativeFontDirectory: directoryFontLoader.relativeFontDirectory
/* Edit this comment to add your custom font */ /* Edit this comment to add your custom font */
/* readonly property FontLoader myCustomFont: FontLoader { source: "MyCustomFont.ttf" } */
readonly property font font: Qt.font({ readonly property font font: Qt.font({
family: mySystemFont.name, family: Qt.application.font.family,
pointSize: Qt.application.font.pixelSize pixelSize: Qt.application.font.pixelSize
}) })
readonly property font largeFont: Qt.font({ readonly property font largeFont: Qt.font({
family: mySystemFont.name, family: Qt.application.font.family,
pointSize: Qt.application.font.pixelSize * 1.6 pixelSize: Qt.application.font.pixelSize * 1.6
}) })
readonly property color backgroundColor: "#c2c2c2" readonly property color backgroundColor: "#c2c2c2"
property DirectoryFontLoader directoryFontLoader: DirectoryFontLoader {
id: directoryFontLoader
} }
/*##^## Designer {
D{i:0;autoSize:true;height:480;width:640}
} }
##^##*/

View File

@@ -1 +1,2 @@
singleton Constants 1.0 Constants.qml singleton Constants 1.0 Constants.qml
EventListSimulator 1.0 EventListSimulator.qml

View File

@@ -1,9 +1,9 @@
/**************************************************************************** /****************************************************************************
** **
** Copyright (C) 2019 The Qt Company Ltd. ** Copyright (C) 2021 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/ ** Contact: https://www.qt.io/licensing/
** **
** This file is part of the examples of the Qt Toolkit. ** This file is part of the examples of the Qt Design Studio.
** **
** $QT_BEGIN_LICENSE:BSD$ ** $QT_BEGIN_LICENSE:BSD$
** Commercial License Usage ** Commercial License Usage
@@ -48,7 +48,7 @@
** **
****************************************************************************/ ****************************************************************************/
import QtQuick 2.10 import QtQuick
import loginui3 1.0 import loginui3 1.0
Item { Item {
@@ -57,11 +57,5 @@ Item {
Screen01 { Screen01 {
} }
} }
/*##^## Designer {
D{i:0;autoSize:true;height:480;width:640}
}
##^##*/

View File

@@ -28,14 +28,20 @@ Project {
directory: "." directory: "."
} }
Files {
filter: "*.ttf;*.otf"
}
Environment { Environment {
QT_QUICK_CONTROLS_CONF: "qtquickcontrols2.conf" QT_QUICK_CONTROLS_CONF: "qtquickcontrols2.conf"
QT_AUTO_SCREEN_SCALE_FACTOR: "1" QT_AUTO_SCREEN_SCALE_FACTOR: "1"
} }
qt6Project: true
/* List of plugin directories passed to QML runtime */ /* List of plugin directories passed to QML runtime */
importPaths: [ "imports" ] importPaths: [ "imports", "asset_imports" ]
/* Required for deployment */ /* Required for deployment */
targetDirectory: "/opt/loginui3" targetDirectory: "/opt/loginui1"
} }

Some files were not shown because too many files have changed in this diff Show More