1 /****************************************************************************
3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
4 ** All rights reserved.
5 ** Contact: Nokia Corporation (qt-info@nokia.com)
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
46 property int intmax: 2147483647
48 Connections { target: pointvalue; onReset: { texteditelement.font.pointSize = 12 } }
56 height: parent.height - 20; width: parent.width - 20
57 anchors.centerIn: parent
59 text: { textvalue.model.get(textvalue.currentIndex).value }
60 textFormat: { formatvalue.model.get(formatvalue.currentIndex).value }
61 color: { colorvalue.model.get(colorvalue.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 smooth: { smoothvalue.model.get(smoothvalue.currentIndex).value }
77 selectByMouse: { mousevalue.model.get(mousevalue.currentIndex).value }
78 onLinkActivated: { bordercolor.border.color = "red" }
79 Rectangle { id: bordercolor; color: "transparent"; border.color: "green"; anchors.fill: parent }
84 anchors { left: parent.left; leftMargin: 10; bottom: parent.bottom }
85 height: 150; color: "black"; width: 150
87 "LineCount: "+texteditelement.lineCount+
88 "\nPaintedHeight/Width: "+texteditelement.paintedHeight+"/"+texteditelement.paintedWidth+
89 "\nPointSize: "+texteditelement.font.pointSize+"\nPixelSize: "+texteditelement.font.pixelSize+
90 "\nCan Paste: "+texteditelement.canPaste
96 anchors.right: texteditelement.right; anchors.bottom: texteditelement.bottom
97 Button { buttontext: "Select Word"; width: parent.width/3; onClicked: { texteditelement.selectWord() } }
98 Button { buttontext: "Select All"; width: parent.width/3; onClicked: { texteditelement.selectAll() } }
99 Button { buttontext: "Select None"; width: parent.width/3; onClicked: { texteditelement.deselect() } }
104 anchors.right: texteditelement.right; anchors.bottom: selectionbuttons.top
105 Button { buttontext: "Cut"; width: parent.width/3; onClicked: { texteditelement.cut() } }
106 Button { buttontext: "Copy"; width: parent.width/3; onClicked: { texteditelement.copy() } }
107 Button { buttontext: "Paste"; width: parent.width/3; onClicked: { texteditelement.paste() } }
113 width: 200; height: parent.height
114 anchors.right: parent.right
115 Rectangle { anchors.fill: parent; color: "transparent"; border.color: "black" }
116 ListView { id: controls; model: controlsmodel; anchors.fill: parent; clip: true; cacheBuffer: 500 }
123 ListModel { id: textmodel }
124 Component.onCompleted: {
125 textmodel.append({ "name": "Basic",
126 "value": "Qt Quick is a collection of technologies that are designed to help developers create the kind of intuitive, "+
127 "modern, fluid user interfaces that are increasingly used on mobile phones, media players, set-top boxes and other "+
128 "portable devices."+texteditelement.newline+
129 "Qt Quick consists of a rich set of user interface elements, a declarative language for describing user interfaces "+
130 "and a language runtime.\n"+
131 "A collection of C++ APIs is used to integrate these high level features with classic Qt applications."});
132 textmodel.append({ "name": "Short",
133 "value": "Hello World"});
134 textmodel.append({ "name": "Long",
135 "value": "QtQuickisacollectionoftechnologiesthataredesignedtohelpdeveloperscreatethekindofintuitive,"+
136 "modern,fluiduserinterfacesthatareincreasinglyusedonmobilephones,mediaplayers,set-topboxesandother"+
137 "portabledevices."});
138 textmodel.append({ "name": "Rich",
139 "value": "<b>Qt Quick</b> is a collection of technologies that are designed to help developers create the kind of <i>intuitive, "+
140 "modern, fluid</i> user interfaces that are increasingly used on mobile phones, media players, set-top boxes and other "+
141 "portable devices.<br>"+
142 "Qt Quick consists of a rich set of user interface elements, a declarative language for describing user interfaces "+
143 "and a language runtime. "+
144 "A collection of C++ APIs is used to integrate these high level features with classic Qt applications."});
145 textmodel.append({ "name": "Links",
146 "value": "This is a link - <a href=\"http://doc.qt.nokia.com\">Qt Docs</a>"});
151 controlname: "Format"
152 model: ListModel { ListElement { name: "Auto"; value: Text.AutoText } ListElement { name: "Plain"; value: Text.PlainText }
153 ListElement { name: "Rich"; value: Text.RichText } ListElement { name: "Styled"; value: Text.StyledText } } }
157 model: ListModel { ListElement { name: "Red"; value: "red" }
158 ListElement { name: "Green"; value: "green" } ListElement { name: "Blue"; value: "blue" } }
163 model: ListModel { ListElement { name: "Off"; value: false } ListElement { name: "On"; value: true } }
167 controlname: "Italic"
168 model: ListModel { ListElement { name: "Off"; value: false } ListElement { name: "On"; value: true } }
172 controlname: "Cap10n"
174 ListElement { name: "Mixed"; value: Font.MixedCase } ListElement { name: "Upper"; value: Font.AllUppercase }
175 ListElement { name: "Lower"; value: Font.AllLowercase } ListElement { name: "SmallCaps"; value: Font.SmallCaps }
176 ListElement { name: "Capitals"; value: Font.Capitalize }
182 property variant fontfamilies
183 function setModel() {
184 familiesmodel.clear();
185 for (var i = 0; i < fontfamilies.length; ++i) {
186 familiesmodel.append({ "name": fontfamilies[i], "value": fontfamilies[i] });
188 familyvalue.currentIndex = 0;
191 ListModel { id: familiesmodel }
192 Component.onCompleted: { fontfamilies = Qt.fontFamilies(); setModel(); }
196 controlname: "LSpacing"
197 model: ListModel { ListElement { name: "0"; value: 0 } ListElement { name: "1"; value: 1 } ListElement { name: "2.5"; value: 2.5 } } }
200 controlname: "WSpacing"
201 model: ListModel { ListElement { name: "-1"; value: -1 } ListElement { name: "8"; value: 8 } ListElement { name: "20"; value: 20 } } }
205 model: ListModel { ListElement { name: "-1"; value: -1 } ListElement { name: "8"; value: 8 } ListElement { name: "20"; value: 20 } } }
209 model: ListModel { ListElement { name: "-1"; value: -1 } ListElement { name: "8"; value: 8 } ListElement { name: "20"; value: 20 } } }
212 controlname: "Strike"
213 model: ListModel { ListElement { name: "Off"; value: false } ListElement { name: "On"; value: true } } }
216 controlname: "U_line"
217 model: ListModel { ListElement { name: "Off"; value: false } ListElement { name: "On"; value: true } } }
220 controlname: "Weight"
221 model: ListModel { ListElement { name: "Light"; value: Font.Light } ListElement { name: "Normal"; value: Font.Normal }
222 ListElement { name: "DemiBold"; value: Font.DemiBold } ListElement { name: "Bold"; value: Font.Bold }
223 ListElement { name: "Black"; value: Font.Black } }
224 Component.onCompleted: { currentIndex = 1 } // set to default
229 model: ListModel { ListElement { name: "Off"; value: false } ListElement { name: "On"; value: true } } }
232 controlname: "HAlign"
233 model: ListModel { ListElement { name: "Left"; value: Text.AlignLeft } ListElement { name: "Right"; value: Text.AlignRight }
234 ListElement { name: "Center"; value: Text.AlignHCenter } ListElement { name: "Justify"; value: Text.AlignJustify } } }
237 controlname: "VAlign"
238 model: ListModel { ListElement { name: "Top"; value: Text.AlignTop } ListElement { name: "Bottom"; value: Text.AlignBottom }
239 ListElement { name: "Center"; value: Text.AlignVCenter } } }
242 controlname: "Smooth"
243 model: ListModel { ListElement { name: "Off"; value: false } ListElement { name: "On"; value: true } } }
247 model: ListModel { ListElement { name: "None"; value: Text.NoWrap } ListElement { name: "Word"; value: Text.WordWrap }
248 ListElement { name: "Anywhere"; value: Text.WrapAnywhere } ListElement { name: "Wrap"; value: Text.Wrap } } }