1 /****************************************************************************
3 ** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
4 ** All rights reserved.
5 ** Contact: http://www.qt-project.org/
7 ** This file is part of the test suite of the Qt Toolkit.
9 ** $QT_BEGIN_LICENSE:LGPL$
10 ** GNU Lesser General Public License Usage
11 ** This file may be used under the terms of the GNU Lesser General Public
12 ** License version 2.1 as published by the Free Software Foundation and
13 ** appearing in the file LICENSE.LGPL included in the packaging of this
14 ** file. Please review the following information to ensure the GNU Lesser
15 ** General Public License version 2.1 requirements will be met:
16 ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
18 ** In addition, as a special exception, Nokia gives you certain additional
19 ** rights. These rights are described in the Nokia Qt LGPL Exception
20 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
22 ** GNU General Public License Usage
23 ** Alternatively, this file may be used under the terms of the GNU General
24 ** Public License version 3.0 as published by the Free Software Foundation
25 ** and appearing in the file LICENSE.GPL included in the packaging of this
26 ** file. Please review the following information to ensure the GNU General
27 ** Public License version 3.0 requirements will be met:
28 ** http://www.gnu.org/copyleft/gpl.html.
31 ** Alternatively, this file may be used in accordance with the terms and
32 ** conditions contained in a signed written agreement between you and Nokia.
40 ****************************************************************************/
45 height: 360; width: 640
47 Connections { target: pointvalue; onReset: { textelement.font.pointSize = 12 } }
55 height: parent.height - 20; width: parent.width - 20
56 anchors.centerIn: parent
58 text: { textvalue.model.get(textvalue.currentIndex).value }
59 textFormat: { formatvalue.model.get(formatvalue.currentIndex).value }
60 color: { colorvalue.model.get(colorvalue.currentIndex).value }
61 elide: { elidevalue.model.get(elidevalue.currentIndex).value }
62 font.bold: { boldvalue.model.get(boldvalue.currentIndex).value }
63 font.italic: { italicsvalue.model.get(italicsvalue.currentIndex).value }
64 font.capitalization: { capsvalue.model.get(capsvalue.currentIndex).value }
65 font.family: { familyvalue.model.get(familyvalue.currentIndex).value }
66 font.strikeout: strikeoutvalue.currentIndex
67 font.underline: underlinevalue.currentIndex
68 font.letterSpacing: { lspacingvalue.model.get(lspacingvalue.currentIndex).value }
69 font.wordSpacing: { wspacingvalue.model.get(wspacingvalue.currentIndex).value }
70 font.weight: { weightvalue.model.get(weightvalue.currentIndex).value }
71 font.pointSize: { pointvalue.model.get(pointvalue.currentIndex).value }
72 font.pixelSize: { pixelvalue.model.get(pixelvalue.currentIndex).value }
73 horizontalAlignment: { halignvalue.model.get(halignvalue.currentIndex).value }
74 verticalAlignment: { valignvalue.model.get(valignvalue.currentIndex).value }
75 wrapMode: { wrapvalue.model.get(wrapvalue.currentIndex).value }
76 maximumLineCount: { maxlinevalue.model.get(maxlinevalue.currentIndex).value }
77 lineHeight: { lineheightvalue.model.get(lineheightvalue.currentIndex).value }
78 lineHeightMode: { lineheightmodevalue.model.get(lineheightmodevalue.currentIndex).value }
79 smooth: { smoothvalue.model.get(smoothvalue.currentIndex).value }
80 style: { stylevalue.model.get(stylevalue.currentIndex).value }
81 styleColor: { stylecolorvalue.model.get(stylecolorvalue.currentIndex).value }
83 Rectangle{ color: "transparent"; border.color: "green"; anchors.fill: parent }
88 anchors { left: parent.left; leftMargin: 10; bottom: parent.bottom }
89 height: 150; color: "black"; width: 150
90 function elidename() {
91 switch (textelement.elide) {
92 case Text.ElideNone: return "None";
93 case Text.ElideLeft: return "Left";
94 case Text.ElideMiddle: return "Middle";
95 case Text.ElideRight: return "Right";
99 "LineCount: "+textelement.lineCount+" of "+textelement.maximumLineCount+
100 "\nPaintedHeight/Width: "+textelement.paintedHeight+"/"+textelement.paintedWidth+
101 "\nPointSize: "+textelement.font.pointSize+
102 "\nPixelSize: "+textelement.font.pixelSize+
103 "\nTruncated: "+textelement.truncated+
104 "\nElide: "+ elidename()
111 width: 200; height: parent.height
112 anchors.right: parent.right
113 Rectangle { anchors.fill: parent; color: "transparent"; border.color: "black" }
114 ListView { id: controls; model: controlsmodel; anchors.fill: parent; clip: true; cacheBuffer: 500 }
121 ListModel { id: textmodel }
122 Component.onCompleted: {
123 textmodel.append({ "name": "Basic",
124 "value": "Qt Quick is a collection of technologies that are designed to help developers create the kind of intuitive, "+
125 "modern, fluid user interfaces that are increasingly used on mobile phones, media players, set-top boxes and other "+
126 "portable devices.\n"+
127 "Qt Quick consists of a rich set of user interface elements, a declarative language for describing user interfaces "+
128 "and a language runtime. "+
129 "A collection of C++ APIs is used to integrate these high level features with classic Qt applications."});
130 textmodel.append({ "name": "Short",
131 "value": "Button Text."});
132 textmodel.append({ "name": "Long",
133 "value": "QtQuickisacollectionoftechnologiesthataredesignedtohelpdeveloperscreatethekindofintuitive,"+
134 "modern,fluiduserinterfacesthatareincreasinglyusedonmobilephones,mediaplayers,set-topboxesandother"+
135 "portabledevices."});
136 textmodel.append({ "name": "Rich",
137 "value": "<b>Qt Quick</b> is a collection of technologies that are designed to help developers create the kind of <i>intuitive, "+
138 "modern, fluid</i> user interfaces that are increasingly used on mobile phones, media players, set-top boxes and other "+
139 "portable devices.<br>"+
140 "Qt Quick consists of a rich set of user interface elements, a declarative language for describing user interfaces "+
141 "and a language runtime. "+
142 "A collection of C++ APIs is used to integrate these high level features with classic Qt applications."});
147 controlname: "Format"
148 model: ListModel { ListElement { name: "Auto"; value: Text.AutoText } ListElement { name: "Plain"; value: Text.PlainText }
149 ListElement { name: "Rich"; value: Text.RichText } ListElement { name: "Styled"; value: Text.StyledText } } }
153 model: ListModel { ListElement { name: "Red"; value: "red" }
154 ListElement { name: "Green"; value: "green" } ListElement { name: "Blue"; value: "blue" } }
159 model: ListModel { ListElement { name: "None"; value: Text.ElideNone } ListElement { name: "Left"; value: Text.ElideLeft }
160 ListElement { name: "Middle"; value: Text.ElideMiddle } ListElement { name: "Right"; value: Text.ElideRight } }
165 model: ListModel { ListElement { name: "Off"; value: false } ListElement { name: "On"; value: true } }
169 controlname: "Italic"
170 model: ListModel { ListElement { name: "Off"; value: false } ListElement { name: "On"; value: true } }
174 controlname: "Cap10n"
176 ListElement { name: "Mixed"; value: Font.MixedCase } ListElement { name: "Upper"; value: Font.AllUppercase }
177 ListElement { name: "Lower"; value: Font.AllLowercase } ListElement { name: "SmallCaps"; value: Font.SmallCaps }
178 ListElement { name: "Capitals"; value: Font.Capitalize }
184 property variant fontfamilies
185 function setModel() {
186 familiesmodel.clear();
187 for (var i = 0; i < fontfamilies.length; ++i) {
188 familiesmodel.append({ "name": fontfamilies[i], "value": fontfamilies[i] });
190 familyvalue.currentIndex = 0;
193 ListModel { id: familiesmodel }
194 Component.onCompleted: { fontfamilies = Qt.fontFamilies(); setModel(); }
198 controlname: "LSpacing"
199 model: ListModel { ListElement { name: "0"; value: 0 } ListElement { name: "1"; value: 1 } ListElement { name: "2.5"; value: 2.5 } } }
202 controlname: "WSpacing"
203 model: ListModel { ListElement { name: "-1"; value: -1 } ListElement { name: "8"; value: 8 } ListElement { name: "20"; value: 20 } } }
207 model: ListModel { ListElement { name: "-1"; value: -1 } ListElement { name: "8"; value: 8 } ListElement { name: "20"; value: 20 } } }
211 model: ListModel { ListElement { name: "-1"; value: -1 } ListElement { name: "8"; value: 8 } ListElement { name: "20"; value: 20 } } }
214 controlname: "Strike"
215 model: ListModel { ListElement { name: "Off"; value: false } ListElement { name: "On"; value: true } } }
218 controlname: "U_line"
219 model: ListModel { ListElement { name: "Off"; value: false } ListElement { name: "On"; value: true } } }
222 controlname: "Weight"
223 model: ListModel { ListElement { name: "Light"; value: Font.Light } ListElement { name: "Normal"; value: Font.Normal }
224 ListElement { name: "DemiBold"; value: Font.DemiBold } ListElement { name: "Bold"; value: Font.Bold }
225 ListElement { name: "Black"; value: Font.Black } }
226 Component.onCompleted: { currentIndex = 1 } // set to default
230 controlname: "HAlign"
231 model: ListModel { ListElement { name: "Left"; value: Text.AlignLeft } ListElement { name: "Right"; value: Text.AlignRight }
232 ListElement { name: "Center"; value: Text.AlignHCenter } ListElement { name: "Justify"; value: Text.AlignJustify } } }
235 controlname: "VAlign"
236 model: ListModel { ListElement { name: "Top"; value: Text.AlignTop } ListElement { name: "Bottom"; value: Text.AlignBottom }
237 ListElement { name: "Center"; value: Text.AlignVCenter } } }
241 model: ListModel { ListElement { name: "Max"; value: 2147483647 } ListElement { name: "1"; value: 1 }
242 ListElement { name: "2"; value: 2 } ListElement { name: "10"; value: 10 }} }
245 controlname: "LHeight"
246 model: ListModel { ListElement { name: "1"; value: 1.0 } ListElement { name: "2"; value: 2.0 } ListElement { name: "30"; value: 30.0 }} }
248 id: lineheightmodevalue
249 controlname: "LHMode"
251 ListElement { name: "Multiply"; value: Text.ProportionalHeight } ListElement { name: "Fixed"; value: Text.FixedHeight } } }
254 controlname: "Smooth"
255 model: ListModel { ListElement { name: "Off"; value: false } ListElement { name: "On"; value: true } } }
259 model: ListModel { ListElement { name: "Normal"; value: Text.Normal } ListElement { name: "Outline"; value: Text.Outline }
260 ListElement { name: "Raised"; value: Text.Raised } ListElement { name: "Sunken"; value: Text.Sunken } } }
263 controlname: "SColor"
264 model: ListModel { ListElement { name: "Green"; value: "green" } ListElement { name: "Blue"; value: "blue" } } }
268 model: ListModel { ListElement { name: "None"; value: Text.NoWrap } ListElement { name: "Word"; value: Text.WordWrap }
269 ListElement { name: "Anywhere"; value: Text.WrapAnywhere } ListElement { name: "Wrap"; value: Text.Wrap } } }