summaryrefslogtreecommitdiffstats
path: root/src/declarative/fx
diff options
context:
space:
mode:
authorAlan Alpert <alan.alpert@nokia.com>2009-10-28 08:26:20 (GMT)
committerAlan Alpert <alan.alpert@nokia.com>2009-10-28 08:26:20 (GMT)
commit07e1b6615e868af6434bb8e42dc2d44a51075204 (patch)
tree5bc94729576e561eae6bb9470dda0ab61b439f18 /src/declarative/fx
parent1d14bbef27945d7823e9c32745e51d187093f1b7 (diff)
parent30d8810bfab9c8157f80e5e38beda1ad8c0acfb0 (diff)
downloadQt-07e1b6615e868af6434bb8e42dc2d44a51075204.zip
Qt-07e1b6615e868af6434bb8e42dc2d44a51075204.tar.gz
Qt-07e1b6615e868af6434bb8e42dc2d44a51075204.tar.bz2
Merge branch 'kinetic-declarativeui' of git@scm.dev.nokia.troll.no:qt/kinetic into kinetic-declarativeui
Conflicts: doc/src/declarative/globalobject.qdoc
Diffstat (limited to 'src/declarative/fx')
-rw-r--r--src/declarative/fx/qfximage.cpp8
-rw-r--r--src/declarative/fx/qfxitem.cpp29
-rw-r--r--src/declarative/fx/qfxmouseregion.cpp4
-rw-r--r--src/declarative/fx/qfxpositioners.cpp20
-rw-r--r--src/declarative/fx/qfxtext.cpp28
-rw-r--r--src/declarative/fx/qfxtext.h15
-rw-r--r--src/declarative/fx/qfxtext_p.h4
7 files changed, 71 insertions, 37 deletions
diff --git a/src/declarative/fx/qfximage.cpp b/src/declarative/fx/qfximage.cpp
index 860af66..45a481c 100644
--- a/src/declarative/fx/qfximage.cpp
+++ b/src/declarative/fx/qfximage.cpp
@@ -82,7 +82,7 @@ QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,Image,QFxImage)
\o fillMode: Tile
\qml
Image {
- fillMode: "Tile"
+ fillMode: Image.Tile
width: 160; height: 160
source: "pics/qtlogo.png"
}
@@ -92,7 +92,7 @@ QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,Image,QFxImage)
\o fillMode: TileVertically
\qml
Image {
- fillMode: "TileVertically"
+ fillMode: Image.TileVertically
width: 160; height: 160
source: "pics/qtlogo.png"
}
@@ -102,7 +102,7 @@ QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,Image,QFxImage)
\o fillMode: TileHorizontally
\qml
Image {
- fillMode: "TileHorizontally"
+ fillMode: Image.TileHorizontally
width: 160; height: 160
source: "pics/qtlogo.png"
}
@@ -161,7 +161,7 @@ void QFxImage::setPixmap(const QPixmap &pix)
}
/*!
- \qmlproperty FillMode Image::fillMode
+ \qmlproperty enumeration Image::fillMode
Set this property to define what happens when the image set for the item is smaller
than the size of the item.
diff --git a/src/declarative/fx/qfxitem.cpp b/src/declarative/fx/qfxitem.cpp
index e714494..ed07696 100644
--- a/src/declarative/fx/qfxitem.cpp
+++ b/src/declarative/fx/qfxitem.cpp
@@ -79,6 +79,19 @@ QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,Rotation,QGraphicsRotation)
#include "qfxeffects.cpp"
/*!
+ \qmlclass Transform
+ \brief The Transform elements provide a way of building advanced transformations on Items.
+
+ The Transform elements let you create and control advanced transformations that can be configured
+ independently using specialized properties.
+
+ You can assign any number of Transform elements to an Item. Each Transform is applied in order,
+ one at a time, to the Item it's assigned to.
+
+ \sa Rotation, Scale
+*/
+
+/*!
\qmlclass Scale
\brief The Scale object provides a way to scale an Item.
@@ -1199,7 +1212,7 @@ QFxKeysAttached *QFxKeysAttached::qmlAttachedProperties(QObject *obj)
/*!
\class QFxItem
- \brief QFxItem is the most basic of all visual items in QML.
+ \brief The QFxItem class provides the most basic of all visual items in QML.
All visual items in Qt Declarative inherit from QFxItem. Although QFxItem
has no visual appearance, it defines all the properties that are
@@ -1295,7 +1308,7 @@ QFxKeysAttached *QFxKeysAttached::qmlAttachedProperties(QObject *obj)
This signal is emitted when the \a state of the item changes.
- \sa states-transitions
+ \sa {qmlstates}{States}
*/
/*!
@@ -2315,14 +2328,14 @@ QmlList<QObject *> *QFxItem::resources()
}
\endqml
- \sa {states-transitions}{States and Transitions}
+ \sa {qmlstate}{States}
*/
/*!
\property QFxItem::states
This property holds a list of states defined by the item.
- \sa {states-transitions}{States and Transitions}
+ \sa {qmlstate}{States}
*/
QmlList<QmlState *>* QFxItem::states()
{
@@ -2344,14 +2357,14 @@ QmlList<QmlState *>* QFxItem::states()
}
\endqml
- \sa {states-transitions}{States and Transitions}
+ \sa {state-transitions}{Transitions}
*/
/*!
\property QFxItem::transitions
This property holds a list of transitions defined by the item.
- \sa {states-transitions}{States and Transitions}
+ \sa {state-transitions}{Transitions}
*/
QmlList<QmlTransition *>* QFxItem::transitions()
{
@@ -2423,7 +2436,7 @@ QmlList<QmlTransition *>* QFxItem::transitions()
set), \c state will be a blank string. Likewise, you can return an
item to its base state by setting its current state to \c ''.
- \sa {states-transitions}{States and Transitions}
+ \sa {qmlstates}{States}
*/
/*!
@@ -2449,7 +2462,7 @@ QmlList<QmlTransition *>* QFxItem::transitions()
set), \c state will be a blank string. Likewise, you can return an
item to its base state by setting its current state to \c ''.
- \sa {states-transitions}{States and Transitions}
+ \sa {qmlstates}{States}
*/
QString QFxItem::state() const
{
diff --git a/src/declarative/fx/qfxmouseregion.cpp b/src/declarative/fx/qfxmouseregion.cpp
index 4b31fd4..315a273 100644
--- a/src/declarative/fx/qfxmouseregion.cpp
+++ b/src/declarative/fx/qfxmouseregion.cpp
@@ -319,8 +319,8 @@ void QFxMouseRegion::setEnabled(bool a)
\code
Text {
text: mr.pressedButtons & Qt.RightButton ? "right" : ""
- horizontalAlignment: "AlignHCenter"
- verticalAlignment: "AlignVCenter"
+ horizontalAlignment: Text.AlignHCenter
+ verticalAlignment: Text.AlignVCenter
MouseRegion {
id: mr
acceptedButtons: Qt.LeftButton | Qt.RightButton
diff --git a/src/declarative/fx/qfxpositioners.cpp b/src/declarative/fx/qfxpositioners.cpp
index f8e7213..86a069d 100644
--- a/src/declarative/fx/qfxpositioners.cpp
+++ b/src/declarative/fx/qfxpositioners.cpp
@@ -375,6 +375,10 @@ Column {
\endqml
\endtable
+ Note that the positioner assumes that the x and y positions of its children
+ will not change. If you manually change the x or y properties in script, bind
+ the x or y properties, or use anchors on a child of a positioner, then the
+ positioner may exhibit strange behaviour.
*/
/*!
@@ -539,6 +543,11 @@ Row {
\endqml
\image horizontalpositioner_example.png
+ Note that the positioner assumes that the x and y positions of its children
+ will not change. If you manually change the x or y properties in script, bind
+ the x or y properties, or use anchors on a child of a positioner, then the
+ positioner may exhibit strange behaviour.
+
*/
/*!
\qmlproperty Transition Row::remove
@@ -659,8 +668,10 @@ void QFxRow::doPositioning()
child->setX(hoffset);
setMovingItem(0);
}
- hoffset += child->width();
- hoffset += spacing();
+ if(child->width() && child->height()){//don't advance for invisible children
+ hoffset += child->width();
+ hoffset += spacing();
+ }
}
}
@@ -705,6 +716,11 @@ Grid {
}
\endqml
\endtable
+
+ Note that the positioner assumes that the x and y positions of its children
+ will not change. If you manually change the x or y properties in script, bind
+ the x or y properties, or use anchors on a child of a positioner, then the
+ positioner may exhibit strange behaviour.
*/
/*!
\qmlproperty Transition Grid::remove
diff --git a/src/declarative/fx/qfxtext.cpp b/src/declarative/fx/qfxtext.cpp
index 4d02f0d..4a01cbd 100644
--- a/src/declarative/fx/qfxtext.cpp
+++ b/src/declarative/fx/qfxtext.cpp
@@ -231,9 +231,9 @@ QColor QFxText::color() const
\qml
Row {
Text { font.pointSize: 24; text: "Normal" }
- Text { font.pointSize: 24; text: "Raised"; style: "Raised"; styleColor: "#AAAAAA" }
- Text { font.pointSize: 24; text: "Outline"; style: "Outline"; styleColor: "red" }
- Text { font.pointSize: 24; text: "Sunken"; style: "Sunken"; styleColor: "#AAAAAA" }
+ Text { font.pointSize: 24; text: "Raised"; style: Text.Raised; styleColor: "#AAAAAA" }
+ Text { font.pointSize: 24; text: "Outline"; style: Text.Outline; styleColor: "red" }
+ Text { font.pointSize: 24; text: "Sunken"; style: Text.Sunken; styleColor: "#AAAAAA" }
}
\endqml
@@ -420,28 +420,28 @@ void QFxText::setTextFormat(TextFormat format)
}
/*!
- \qmlproperty Qt::TextElideMode Text::elide
+ \qmlproperty enumeration Text::elide
Set this property to elide parts of the text fit to the Text item's width.
The text will only elide if an explicit width has been set.
This property cannot be used with wrap enabled or with rich text.
- Eliding can be ElideNone (the default), ElideLeft, ElideMiddle, or ElideRight.
+ Eliding can be \c ElideNone (the default), \c ElideLeft, \c ElideMiddle, or \c ElideRight.
- If the text is a multi-length string, and the mode is not ElideNone,
+ 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.
Multi-length strings are ordered from longest to shortest, separated by the
- Unicode "String Terminator" character U009C (write this in QML with "\\x9C").
+ Unicode "String Terminator" character \c U009C (write this in QML with \c{"\\x9C"}).
*/
-Qt::TextElideMode QFxText::elideMode() const
+QFxText::TextElideMode QFxText::elideMode() const
{
Q_D(const QFxText);
return d->elideMode;
}
-void QFxText::setElideMode(Qt::TextElideMode mode)
+void QFxText::setElideMode(QFxText::TextElideMode mode)
{
Q_D(QFxText);
if (mode == d->elideMode)
@@ -458,7 +458,7 @@ void QFxText::geometryChanged(const QRectF &newGeometry,
{
Q_D(QFxText);
if (newGeometry.width() != oldGeometry.width()) {
- if (d->wrap || d->elideMode != Qt::ElideNone) {
+ if (d->wrap || d->elideMode != QFxText::ElideNone) {
d->imgDirty = true;
d->updateSize();
}
@@ -486,8 +486,8 @@ void QFxTextPrivate::updateSize()
tmp = text;
tmp.replace(QLatin1Char('\n'), QChar::LineSeparator);
singleline = !tmp.contains(QChar::LineSeparator);
- if (singleline && elideMode != Qt::ElideNone && q->widthValid())
- tmp = fm.elidedText(tmp,elideMode,q->width()); // XXX still worth layout...?
+ if (singleline && elideMode != QFxText::ElideNone && q->widthValid())
+ tmp = fm.elidedText(tmp,(Qt::TextElideMode)elideMode,q->width()); // XXX still worth layout...?
layout.clearLayout();
layout.setFont(font);
layout.setText(tmp);
@@ -586,7 +586,7 @@ QSize QFxTextPrivate::setupTextLayout(QTextLayout *layout)
qreal lineWidth = 0;
//set manual width
- if ((wrap || elideMode != Qt::ElideNone) && q->widthValid())
+ if ((wrap || elideMode != QFxText::ElideNone) && q->widthValid())
lineWidth = q->width();
layout->beginLayout();
@@ -596,7 +596,7 @@ QSize QFxTextPrivate::setupTextLayout(QTextLayout *layout)
if (!line.isValid())
break;
- if ((wrap || elideMode != Qt::ElideNone) && q->widthValid())
+ if ((wrap || elideMode != QFxText::ElideNone) && q->widthValid())
line.setLineWidth(lineWidth);
}
layout->endLayout();
diff --git a/src/declarative/fx/qfxtext.h b/src/declarative/fx/qfxtext.h
index 763e2aa..cdb8025 100644
--- a/src/declarative/fx/qfxtext.h
+++ b/src/declarative/fx/qfxtext.h
@@ -57,6 +57,7 @@ class Q_DECLARATIVE_EXPORT QFxText : public QFxItem
Q_ENUMS(VAlignment)
Q_ENUMS(TextStyle)
Q_ENUMS(TextFormat)
+ Q_ENUMS(TextElideMode)
Q_PROPERTY(QString text READ text WRITE setText NOTIFY textChanged)
Q_PROPERTY(QFont font READ font WRITE setFont)
@@ -67,7 +68,7 @@ class Q_DECLARATIVE_EXPORT QFxText : public QFxItem
Q_PROPERTY(VAlignment verticalAlignment READ vAlign WRITE setVAlign)
Q_PROPERTY(bool wrap READ wrap WRITE setWrap) //### there are several wrap modes in Qt
Q_PROPERTY(TextFormat textFormat READ textFormat WRITE setTextFormat)
- Q_PROPERTY(Qt::TextElideMode elide READ elideMode WRITE setElideMode) //### elideMode?
+ Q_PROPERTY(TextElideMode elide READ elideMode WRITE setElideMode) //### elideMode?
public:
QFxText(QFxItem *parent=0);
@@ -84,8 +85,12 @@ public:
Raised,
Sunken };
enum TextFormat { PlainText = Qt::PlainText,
- RichText = Qt::RichText,
- AutoText = Qt::AutoText };
+ RichText = Qt::RichText,
+ AutoText = Qt::AutoText };
+ enum TextElideMode { ElideLeft = Qt::ElideLeft,
+ ElideRight = Qt::ElideRight,
+ ElideMiddle = Qt::ElideMiddle,
+ ElideNone = Qt::ElideNone };
QString text() const;
void setText(const QString &);
@@ -114,8 +119,8 @@ public:
TextFormat textFormat() const;
void setTextFormat(TextFormat format);
- Qt::TextElideMode elideMode() const;
- void setElideMode(Qt::TextElideMode);
+ TextElideMode elideMode() const;
+ void setElideMode(TextElideMode);
void paint(QPainter *, const QStyleOptionGraphicsItem *, QWidget *);
diff --git a/src/declarative/fx/qfxtext_p.h b/src/declarative/fx/qfxtext_p.h
index 8b24c66..a10cdfa 100644
--- a/src/declarative/fx/qfxtext_p.h
+++ b/src/declarative/fx/qfxtext_p.h
@@ -70,7 +70,7 @@ class QFxTextPrivate : public QFxItemPrivate
public:
QFxTextPrivate()
: color((QRgb)0), style(QFxText::Normal), imgDirty(true),
- hAlign(QFxText::AlignLeft), vAlign(QFxText::AlignTop), elideMode(Qt::ElideNone),
+ hAlign(QFxText::AlignLeft), vAlign(QFxText::AlignTop), elideMode(QFxText::ElideNone),
dirty(true), wrap(false), richText(false), singleline(false), control(0), doc(0),
format(QFxText::AutoText)
{
@@ -97,7 +97,7 @@ public:
QPixmap imgStyleCache;
QFxText::HAlignment hAlign;
QFxText::VAlignment vAlign;
- Qt::TextElideMode elideMode;
+ QFxText::TextElideMode elideMode;
bool dirty;
bool wrap;
bool richText;