summaryrefslogtreecommitdiffstats
path: root/src/declarative
diff options
context:
space:
mode:
authorAaron Kennedy <aaron.kennedy@nokia.com>2010-04-12 05:24:42 (GMT)
committerAaron Kennedy <aaron.kennedy@nokia.com>2010-04-12 05:24:42 (GMT)
commitdaf297de1837d9462f172c213c5d49eca775491a (patch)
treeb07d9286323dae9ec952eb0d5fcada4650d2bb97 /src/declarative
parent4d7733adc414fa55b4b5596249197344806b8ab0 (diff)
parentb3854b33242b0ce38d194cebb2d3a86b85e0df4b (diff)
downloadQt-daf297de1837d9462f172c213c5d49eca775491a.zip
Qt-daf297de1837d9462f172c213c5d49eca775491a.tar.gz
Qt-daf297de1837d9462f172c213c5d49eca775491a.tar.bz2
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/qt-qml into 4.7
Diffstat (limited to 'src/declarative')
-rw-r--r--src/declarative/graphicsitems/qdeclarativetext.cpp112
-rw-r--r--src/declarative/graphicsitems/qdeclarativetextedit.cpp105
-rw-r--r--src/declarative/graphicsitems/qdeclarativetextinput.cpp104
-rw-r--r--src/declarative/util/qdeclarativelistmodel.cpp15
4 files changed, 331 insertions, 5 deletions
diff --git a/src/declarative/graphicsitems/qdeclarativetext.cpp b/src/declarative/graphicsitems/qdeclarativetext.cpp
index 69e3543..f31f5aa 100644
--- a/src/declarative/graphicsitems/qdeclarativetext.cpp
+++ b/src/declarative/graphicsitems/qdeclarativetext.cpp
@@ -122,14 +122,116 @@ QDeclarativeTextPrivate::~QDeclarativeTextPrivate()
/*!
\qmlproperty string Text::font.family
+
+ Sets the family name of the font.
+
+ The family name is case insensitive and may optionally include a foundry name, e.g. "Helvetica [Cronyx]".
+ If the family is available from more than one foundry and the foundry isn't specified, an arbitrary foundry is chosen.
+ If the family isn't available a family will be set using the font matching algorithm.
+*/
+
+/*!
\qmlproperty bool Text::font.bold
+
+ Sets the font's weight to bold.
+*/
+
+/*!
+ \qmlproperty enumeration Text::font.weight
+
+ Sets the font's weight.
+
+ The weight can be one of:
+ \list
+ \o Light
+ \o Normal - the default
+ \o DemiBold
+ \o Bold
+ \o Black
+ \endlist
+
+ \qml
+ Text { text: "Hello"; font.weight: Font.DemiBold }
+ \endqml
+*/
+
+/*!
\qmlproperty bool Text::font.italic
+
+ Sets the style of the text to italic.
+*/
+
+/*!
\qmlproperty bool Text::font.underline
+
+ Set the style of the text to underline.
+*/
+
+/*!
+ \qmlproperty bool Text::font.outline
+
+ Set the style of the text to outline.
+*/
+
+/*!
+ \qmlproperty bool Text::font.strikeout
+
+ Set the style of the text to strikeout.
+*/
+
+/*!
\qmlproperty real Text::font.pointSize
+
+ Sets the font size in points. The point size must be greater than zero.
+*/
+
+/*!
\qmlproperty int Text::font.pixelSize
- Set the Text's font attributes.
+ Sets the font size in pixels.
+
+ Using this function makes the font device dependent.
+ Use \c pointSize to set the size of the font in a device independent manner.
*/
+
+/*!
+ \qmlproperty real Text::font.letterSpacing
+
+ Sets the letter spacing for the font.
+
+ Letter spacing changes the default spacing between individual letters in the font.
+ A value of 100 will keep the spacing unchanged; a value of 200 will enlarge the spacing after a character by
+ the width of the character itself.
+*/
+
+/*!
+ \qmlproperty real Text::font.wordSpacing
+
+ Sets the word spacing for the font.
+
+ Word spacing changes the default spacing between individual words.
+ A positive value increases the word spacing by a corresponding amount of pixels,
+ while a negative value decreases the inter-word spacing accordingly.
+*/
+
+/*!
+ \qmlproperty enumeration Text::font.capitalization
+
+ Sets the capitalization for the text.
+
+ \list
+ \o MixedCase - This is the normal text rendering option where no capitalization change is applied.
+ \o AllUppercase - This alters the text to be rendered in all uppercase type.
+ \o AllLowercase - This alters the text to be rendered in all lowercase type.
+ \o SmallCaps - This alters the text to be rendered in small-caps type.
+ \o Capitalize - This alters the text to be rendered with the first character of each word as an uppercase character.
+ \endlist
+
+ \qml
+ Text { text: "Hello"; font.capitalization: Font.AllLowercase }
+ \endqml
+*/
+
QFont QDeclarativeText::font() const
{
Q_D(const QDeclarativeText);
@@ -458,7 +560,13 @@ void QDeclarativeText::setTextFormat(TextFormat format)
This property cannot be used with wrapping enabled or with rich text.
- Eliding can be \c ElideNone (the default), \c ElideLeft, \c ElideMiddle, or \c ElideRight.
+ Eliding can be:
+ \list
+ \o ElideNone - the default
+ \o ElideLeft
+ \o ElideMiddle
+ \o ElideRight
+ \endlist
If the text is a multi-length string, and the mode is not \c ElideNone,
the first string that fits will be used, otherwise the last will be elided.
diff --git a/src/declarative/graphicsitems/qdeclarativetextedit.cpp b/src/declarative/graphicsitems/qdeclarativetextedit.cpp
index 25d7e2a..1fec484 100644
--- a/src/declarative/graphicsitems/qdeclarativetextedit.cpp
+++ b/src/declarative/graphicsitems/qdeclarativetextedit.cpp
@@ -118,13 +118,114 @@ QString QDeclarativeTextEdit::text() const
/*!
\qmlproperty string TextEdit::font.family
+
+ Sets the family name of the font.
+
+ The family name is case insensitive and may optionally include a foundry name, e.g. "Helvetica [Cronyx]".
+ If the family is available from more than one foundry and the foundry isn't specified, an arbitrary foundry is chosen.
+ If the family isn't available a family will be set using the font matching algorithm.
+*/
+
+/*!
\qmlproperty bool TextEdit::font.bold
+
+ Sets the font's weight to bold.
+*/
+
+/*!
+ \qmlproperty enumeration TextEdit::font.weight
+
+ Sets the font's weight.
+
+ The weight can be one of:
+ \list
+ \o Light
+ \o Normal - the default
+ \o DemiBold
+ \o Bold
+ \o Black
+ \endlist
+
+ \qml
+ TextEdit { text: "Hello"; font.weight: Font.DemiBold }
+ \endqml
+*/
+
+/*!
\qmlproperty bool TextEdit::font.italic
+
+ Sets the style of the text to italic.
+*/
+
+/*!
\qmlproperty bool TextEdit::font.underline
+
+ Set the style of the text to underline.
+*/
+
+/*!
+ \qmlproperty bool TextEdit::font.outline
+
+ Set the style of the text to outline.
+*/
+
+/*!
+ \qmlproperty bool TextEdit::font.strikeout
+
+ Set the style of the text to strikeout.
+*/
+
+/*!
\qmlproperty real TextEdit::font.pointSize
+
+ Sets the font size in points. The point size must be greater than zero.
+*/
+
+/*!
\qmlproperty int TextEdit::font.pixelSize
- Set the TextEdit's font attributes.
+ Sets the font size in pixels.
+
+ Using this function makes the font device dependent.
+ Use \c pointSize to set the size of the font in a device independent manner.
+*/
+
+/*!
+ \qmlproperty real TextEdit::font.letterSpacing
+
+ Sets the letter spacing for the font.
+
+ Letter spacing changes the default spacing between individual letters in the font.
+ A value of 100 will keep the spacing unchanged; a value of 200 will enlarge the spacing after a character by
+ the width of the character itself.
+*/
+
+/*!
+ \qmlproperty real TextEdit::font.wordSpacing
+
+ Sets the word spacing for the font.
+
+ Word spacing changes the default spacing between individual words.
+ A positive value increases the word spacing by a corresponding amount of pixels,
+ while a negative value decreases the inter-word spacing accordingly.
+*/
+
+/*!
+ \qmlproperty enumeration TextEdit::font.capitalization
+
+ Sets the capitalization for the text.
+
+ \list
+ \o MixedCase - This is the normal text rendering option where no capitalization change is applied.
+ \o AllUppercase - This alters the text to be rendered in all uppercase type.
+ \o AllLowercase - This alters the text to be rendered in all lowercase type.
+ \o SmallCaps - This alters the text to be rendered in small-caps type.
+ \o Capitalize - This alters the text to be rendered with the first character of each word as an uppercase character.
+ \endlist
+
+ \qml
+ TextEdit { text: "Hello"; font.capitalization: Font.AllLowercase }
+ \endqml
*/
/*!
@@ -688,7 +789,7 @@ void QDeclarativeTextEdit::componentComplete()
*/
void QDeclarativeTextEdit::setReadOnly(bool r)
{
- Q_D(QDeclarativeTextEdit);
+ Q_D(QDeclarativeTextEdit);
if (r == isReadOnly())
return;
diff --git a/src/declarative/graphicsitems/qdeclarativetextinput.cpp b/src/declarative/graphicsitems/qdeclarativetextinput.cpp
index 1b8b84b..187b035 100644
--- a/src/declarative/graphicsitems/qdeclarativetextinput.cpp
+++ b/src/declarative/graphicsitems/qdeclarativetextinput.cpp
@@ -97,14 +97,116 @@ void QDeclarativeTextInput::setText(const QString &s)
/*!
\qmlproperty string TextInput::font.family
+
+ Sets the family name of the font.
+
+ The family name is case insensitive and may optionally include a foundry name, e.g. "Helvetica [Cronyx]".
+ If the family is available from more than one foundry and the foundry isn't specified, an arbitrary foundry is chosen.
+ If the family isn't available a family will be set using the font matching algorithm.
+*/
+
+/*!
\qmlproperty bool TextInput::font.bold
+
+ Sets the font's weight to bold.
+*/
+
+/*!
+ \qmlproperty enumeration TextInput::font.weight
+
+ Sets the font's weight.
+
+ The weight can be one of:
+ \list
+ \o Light
+ \o Normal - the default
+ \o DemiBold
+ \o Bold
+ \o Black
+ \endlist
+
+ \qml
+ TextInput { text: "Hello"; font.weight: Font.DemiBold }
+ \endqml
+*/
+
+/*!
\qmlproperty bool TextInput::font.italic
+
+ Sets the style of the text to italic.
+*/
+
+/*!
\qmlproperty bool TextInput::font.underline
+
+ Set the style of the text to underline.
+*/
+
+/*!
+ \qmlproperty bool TextInput::font.outline
+
+ Set the style of the text to outline.
+*/
+
+/*!
+ \qmlproperty bool TextInput::font.strikeout
+
+ Set the style of the text to strikeout.
+*/
+
+/*!
\qmlproperty real TextInput::font.pointSize
+
+ Sets the font size in points. The point size must be greater than zero.
+*/
+
+/*!
\qmlproperty int TextInput::font.pixelSize
- Set the TextInput's font attributes.
+ Sets the font size in pixels.
+
+ Using this function makes the font device dependent.
+ Use \c pointSize to set the size of the font in a device independent manner.
+*/
+
+/*!
+ \qmlproperty real TextInput::font.letterSpacing
+
+ Sets the letter spacing for the font.
+
+ Letter spacing changes the default spacing between individual letters in the font.
+ A value of 100 will keep the spacing unchanged; a value of 200 will enlarge the spacing after a character by
+ the width of the character itself.
*/
+
+/*!
+ \qmlproperty real TextInput::font.wordSpacing
+
+ Sets the word spacing for the font.
+
+ Word spacing changes the default spacing between individual words.
+ A positive value increases the word spacing by a corresponding amount of pixels,
+ while a negative value decreases the inter-word spacing accordingly.
+*/
+
+/*!
+ \qmlproperty enumeration TextInput::font.capitalization
+
+ Sets the capitalization for the text.
+
+ \list
+ \o MixedCase - This is the normal text rendering option where no capitalization change is applied.
+ \o AllUppercase - This alters the text to be rendered in all uppercase type.
+ \o AllLowercase - This alters the text to be rendered in all lowercase type.
+ \o SmallCaps - This alters the text to be rendered in small-caps type.
+ \o Capitalize - This alters the text to be rendered with the first character of each word as an uppercase character.
+ \endlist
+
+ \qml
+ TextInput { text: "Hello"; font.capitalization: Font.AllLowercase }
+ \endqml
+*/
+
QFont QDeclarativeTextInput::font() const
{
Q_D(const QDeclarativeTextInput);
diff --git a/src/declarative/util/qdeclarativelistmodel.cpp b/src/declarative/util/qdeclarativelistmodel.cpp
index 37bbb14..e3680f2 100644
--- a/src/declarative/util/qdeclarativelistmodel.cpp
+++ b/src/declarative/util/qdeclarativelistmodel.cpp
@@ -248,6 +248,20 @@ QDeclarativeListModelParser::ListInstruction *QDeclarativeListModelParser::ListM
*/
+/*
+ A ListModel internally uses either a NestedListModel or FlatListModel.
+
+ A NestedListModel can contain lists of ListElements (which
+ when retrieved from get() is accessible as a list model within the list
+ model) whereas a FlatListModel cannot.
+
+ ListModel uses a NestedListModel to begin with, and if the model is later
+ used from a WorkerScript, it changes to use a FlatListModel instead. This
+ is because ModelNode (which abstracts the nested list model data) needs
+ access to the declarative engine and script engine, which cannot be
+ safely used from outside of the main thread.
+*/
+
QDeclarativeListModel::QDeclarativeListModel(QObject *parent)
: QListModelInterface(parent), m_agent(0), m_nested(new NestedListModel(this)), m_flat(0), m_isWorkerCopy(false)
{
@@ -1351,6 +1365,7 @@ ModelObject::ModelObject()
void ModelObject::setValue(const QByteArray &name, const QVariant &val)
{
_mo->setValue(name, val);
+ setProperty(name.constData(), val);
}