From 3b103ec9a15710c9d82a4d164a497fcd2cb29ffb Mon Sep 17 00:00:00 2001 From: Yann Bodson Date: Mon, 17 Aug 2009 10:13:33 +1000 Subject: Doc cleanup. --- src/declarative/fx/qfxwebview.cpp | 86 ++++----------------------------------- src/declarative/fx/qfxwebview.h | 5 ++- 2 files changed, 11 insertions(+), 80 deletions(-) diff --git a/src/declarative/fx/qfxwebview.cpp b/src/declarative/fx/qfxwebview.cpp index 797e6cb..868e009 100644 --- a/src/declarative/fx/qfxwebview.cpp +++ b/src/declarative/fx/qfxwebview.cpp @@ -165,8 +165,8 @@ public: public: WindowObjectList(QFxWebViewPrivate *p) : priv(p) {} - virtual void append(QObject *v) { - QmlConcreteList::append(v); + virtual void append(QObject *v) { + QmlConcreteList::append(v); priv->updateWindowObjects(); } private: @@ -279,10 +279,6 @@ void QFxWebView::componentComplete() \qmlproperty real WebView::progress This property holds the progress of loading the current URL, from 0 to 1. */ -/*! - \property QFxWebView::progress - \brief the progress of loading the current URL, from 0 to 1. -*/ qreal QFxWebView::progress() const { Q_D(const QFxWebView); @@ -320,18 +316,6 @@ void QFxWebView::doLoadFinished(bool ok) before the change is notified, as this only happens when loading of the URL successfully starts. */ -/*! - \property QFxWebView::url - \brief the URL to the page displayed in this item. - - \sa urlChanged() -*/ -/*! - \fn void QFxWebView::urlChanged() - - Emitted when loading of the URL successfully starts after - setUrl() is called. -*/ QUrl QFxWebView::url() const { return page()->mainFrame()->url(); @@ -363,10 +347,6 @@ void QFxWebView::setUrl(const QUrl &url) \qmlproperty int WebView::idealWidth This property holds the ideal width for displaying the current URL. */ -/*! - \property QFxWebView::idealWidth - \brief the ideal width for displaying the current URL. -*/ int QFxWebView::idealWidth() const { Q_D(const QFxWebView); @@ -386,10 +366,6 @@ void QFxWebView::setIdealWidth(int iw) \qmlproperty int WebView::idealHeight This property holds the ideal height for displaying the current URL. */ -/*! - \property QFxWebView::idealHeight - \brief the ideal height for displaying the current URL. -*/ int QFxWebView::idealHeight() const { Q_D(const QFxWebView); @@ -408,15 +384,9 @@ void QFxWebView::setIdealHeight(int ih) /*! \qmlproperty bool WebView::interactive - This property holds controls whether the item responds to mouse and + This property controls whether the item responds to mouse and key events. */ - -/*! - \property QFxWebView::interactive - - \brief controls whether the item responds to mouse and key events. -*/ bool QFxWebView::interactive() const { Q_D(const QFxWebView); @@ -431,10 +401,10 @@ void QFxWebView::setInteractive(bool i) emit interactiveChanged(); } -/*! - Evaluates the \a scriptSource JavaScript inside the main frame +/*! + Evaluates the \a scriptSource JavaScript inside the main frame context and returns the result of the last executed statement. -*/ +*/ QVariant QFxWebView::evaluateJavaScript(const QString &scriptSource) { return this->page()->mainFrame()->evaluateJavaScript(scriptSource); @@ -460,7 +430,7 @@ void QFxWebView::expandToWebPage() } } -void QFxWebView::geometryChanged(const QRectF &newGeometry, +void QFxWebView::geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) { if (newGeometry.size() != oldGeometry.size()) @@ -484,14 +454,6 @@ void QFxWebView::paintPage(const QRect& r) allow. The default is 0.1 megapixels. The cache will not be larger than the (unscaled) size of the WebView. */ - -/*! - \property QFxWebView::cacheSize - - The maximum number of pixels of image cache to allow. The default - is 0.1 megapixels. The cache will not be larger than the (unscaled) - size of the QFxWebView. -*/ int QFxWebView::cacheSize() const { Q_D(const QFxWebView); @@ -535,7 +497,7 @@ void QFxWebView::setCacheSize(int pixels) \qml WebView { - javaScriptWindowObjects: Object { + javaScriptWindowObjects: Object { WebView.windowObjectName: "coordinates" } } @@ -546,15 +508,6 @@ void QFxWebView::setCacheSize(int pixels) If Javascript is not enabled for this page, then this property does nothing. */ - -/*! - \property QFxWebView::javaScriptWindowObjects - - The list of object that are available from within - the webview's JavaScript context. - - \sa QWebFrame::addToJavaScriptWindowObject -*/ QmlList *QFxWebView::javaScriptWindowObjects() { Q_D(QFxWebView); @@ -862,14 +815,6 @@ QAction *QFxWebView::stopAction() const By default, this property contains an empty string. */ -/*! - \property QFxWebView::title - This property holds the title of the web page currently viewed - - By default, this property contains an empty string. - - \sa titleChanged() -*/ QString QFxWebView::title() const { return page()->mainFrame()->title(); @@ -881,14 +826,6 @@ QString QFxWebView::title() const \qmlproperty pixmap WebView::icon This property holds the icon associated with the web page currently viewed */ -/*! - \property QFxWebView::icon - \brief the icon associated with the web page currently viewed - - By default, this property contains a null icon. - - \sa iconChanged(), QWebSettings::iconForUrl() -*/ QPixmap QFxWebView::icon() const { return page()->mainFrame()->icon().pixmap(QSize(256,256)); @@ -899,18 +836,11 @@ QPixmap QFxWebView::icon() const \qmlproperty real WebView::textSizeMultiplier This property holds the multiplier used to scale the text in a Web page */ -/*! - Sets the value of the multiplier used to scale the text in a Web page to - the \a factor specified. -*/ void QFxWebView::setTextSizeMultiplier(qreal factor) { page()->mainFrame()->setTextSizeMultiplier(factor); } -/*! - Returns the value of the multiplier used to scale the text in a Web page. -*/ qreal QFxWebView::textSizeMultiplier() const { return page()->mainFrame()->textSizeMultiplier(); diff --git a/src/declarative/fx/qfxwebview.h b/src/declarative/fx/qfxwebview.h index 9003377..ef5a395 100644 --- a/src/declarative/fx/qfxwebview.h +++ b/src/declarative/fx/qfxwebview.h @@ -92,6 +92,7 @@ class Q_DECLARATIVE_EXPORT QFxWebView : public QFxPaintedItem Q_PROPERTY(int idealWidth READ idealWidth WRITE setIdealWidth NOTIFY idealWidthChanged) Q_PROPERTY(int idealHeight READ idealHeight WRITE setIdealHeight NOTIFY idealHeightChanged) + Q_PROPERTY(int cacheSize READ cacheSize WRITE setCacheSize) Q_PROPERTY(QUrl url READ url WRITE setUrl NOTIFY urlChanged) Q_PROPERTY(qreal progress READ progress NOTIFY progressChanged) @@ -186,7 +187,7 @@ Q_SIGNALS: void doubleClick(); public Q_SLOTS: - QVariant evaluateJavaScript (const QString&); + QVariant evaluateJavaScript (const QString&); private Q_SLOTS: void expandToWebPage(); @@ -209,7 +210,7 @@ protected: void keyPressEvent(QKeyEvent* event); void keyReleaseEvent(QKeyEvent* event); void timerEvent(QTimerEvent *event); - virtual void geometryChanged(const QRectF &newGeometry, + virtual void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry); private: -- cgit v0.12 From 5872a38a2f2ccc67b590d580a258e110ee2d80dc Mon Sep 17 00:00:00 2001 From: Yann Bodson Date: Mon, 17 Aug 2009 13:49:10 +1000 Subject: Doc cleanup. --- src/declarative/fx/qfxanchors.cpp | 22 ++----- src/declarative/fx/qfxflickable.cpp | 70 +--------------------- src/declarative/fx/qfxflipable.cpp | 2 +- src/declarative/fx/qfxgridview.cpp | 9 --- src/declarative/fx/qfximage.cpp | 8 --- src/declarative/fx/qfximagebase.cpp | 8 --- src/declarative/fx/qfxlineedit.cpp | 24 +++----- src/declarative/fx/qfxlistview.cpp | 9 --- src/declarative/fx/qfxmouseregion.cpp | 28 --------- src/declarative/fx/qfxpositioners.cpp | 107 ++-------------------------------- src/declarative/fx/qfxrect.cpp | 39 ------------- src/declarative/fx/qfxscalegrid.cpp | 43 -------------- src/declarative/fx/qfxtextedit.cpp | 90 +++------------------------- 13 files changed, 26 insertions(+), 433 deletions(-) diff --git a/src/declarative/fx/qfxanchors.cpp b/src/declarative/fx/qfxanchors.cpp index b60990c..64eaaaf 100644 --- a/src/declarative/fx/qfxanchors.cpp +++ b/src/declarative/fx/qfxanchors.cpp @@ -181,7 +181,7 @@ void QFxAnchorsPrivate::centerInChanged() void QFxAnchorsPrivate::clearItem(QFxItem *item) { - if (fill == item) + if (fill == item) fill = 0; if (centerIn == item) centerIn = 0; @@ -220,7 +220,7 @@ void QFxAnchorsPrivate::addDepend(QFxItem *item) Q_Q(QFxAnchors); if (!item) return; - QFxItemPrivate *p = + QFxItemPrivate *p = static_cast(QGraphicsItemPrivate::get(item)); p->dependantAnchors.append(q); } @@ -230,7 +230,7 @@ void QFxAnchorsPrivate::remDepend(QFxItem *item) Q_Q(QFxAnchors); if (!item) return; - QFxItemPrivate *p = + QFxItemPrivate *p = static_cast(QGraphicsItemPrivate::get(item)); p->dependantAnchors.removeAll(q); } @@ -319,13 +319,6 @@ void QFxAnchorsPrivate::update(QFxItem *, const QRectF &newG, const QRectF &oldG updateVerticalAnchors(); } -/*! - \property QFxAnchors::fill - \brief which item the item should fill. - - This is a convenience property. It is the same as anchoring the left, right, top, and bottom - to another item's left, right, top, and bottom. -*/ QFxItem *QFxAnchors::fill() const { Q_D(const QFxAnchors); @@ -348,16 +341,9 @@ void QFxAnchors::setFill(QFxItem *f) d->fill = f; d->addDepend(d->fill); - d->fillChanged(); + d->fillChanged(); } -/*! - \property QFxAnchors::centerIn - \brief which item the item should stay centered in. - - This is a convenience property. It is the same as anchoring the horizontalCenter - and verticalCenter to another item's horizontalCenter and verticalCenter. -*/ QFxItem *QFxAnchors::centerIn() const { Q_D(const QFxAnchors); diff --git a/src/declarative/fx/qfxflickable.cpp b/src/declarative/fx/qfxflickable.cpp index d413e42..1cb8336 100644 --- a/src/declarative/fx/qfxflickable.cpp +++ b/src/declarative/fx/qfxflickable.cpp @@ -264,7 +264,7 @@ QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,Flickable,QFxFlickable) \ingroup group_widgets QFxFlickable allows its children to be dragged and flicked. - + \code Flickable { width: 320; height: 480; viewportWidth: image.width; viewportHeight: image.height @@ -304,13 +304,6 @@ QFxFlickable::~QFxFlickable() corner of the Flickable. For example, if you flick an image up 100 pixels, \c yPosition will be 100. */ - -/*! - \property QFxFlickable::xPosition - \brief the x position of the view. - - The xPosition represents the left-most visible coordinate in the view. -*/ qreal QFxFlickable::xPosition() const { Q_D(const QFxFlickable); @@ -328,12 +321,6 @@ void QFxFlickable::setXPosition(qreal pos) } } -/*! - \property QFxFlickable::yPosition - \brief the y position of the view. - - The yPosition represents the top-most visible coordinate in the view. -*/ qreal QFxFlickable::yPosition() const { Q_D(const QFxFlickable); @@ -357,16 +344,9 @@ void QFxFlickable::setYPosition(qreal pos) A user cannot drag or flick a Flickable that is locked. This property is useful for temporarily disabling flicking. This allows - special interaction with Flickable's children: for example, you might want to + special interaction with Flickable's children: for example, you might want to freeze a flickable map while viewing detailed information on a location popup that is a child of the Flickable. */ - -/*! - \property QFxFlickable::locked - \brief determines whether the user can move the view. - - If the Flickable is locked, the user cannot move the view. -*/ bool QFxFlickable::isLocked() const { Q_D(const QFxFlickable); @@ -384,17 +364,6 @@ void QFxFlickable::setLocked(bool lock) This property contains the kind of 'physics' applied when dragging the surface. Two modes are supported: - \list - \i Hard - the view follows the user's input exactly. - \i Elastic - the view moves elastically in response to the user's input. - \endlist -*/ - -/*! - \property QFxFlickable::dragMode - \brief sets the kind of 'physics' applied when dragging the view. - - Two modes are supported: \list \i Hard - the view follows the user's input exactly. \i Elastic - the view moves elastically in response to the user's input. @@ -418,21 +387,12 @@ void QFxFlickable::setDragMode(DragMode mode) The instantaneous velocity of movement along the x and y axes, in pixels/sec. */ - -/*! - \property QFxFlickable::xVelocity - \brief provides the instantaneous velocity of movement in the x-axis (pixels/sec). -*/ qreal QFxFlickable::xVelocity() const { Q_D(const QFxFlickable); return d->xVelocity.value(); } -/*! - \property QFxFlickable::yVelocity - \brief provides the instantaneous velocity of movement in the y-axis (pixels/sec). -*/ qreal QFxFlickable::yVelocity() const { Q_D(const QFxFlickable); @@ -868,16 +828,6 @@ QmlList *QFxFlickable::flickableChildren() the feeling that the edges of the view are soft, rather than a hard physical boundary. */ - -/*! - \property QFxFlickable::overShoot - \brief the number of pixels the view may overshoot the boundaries when flicked. - - If overShoot is non-zero the contents can be flicked beyond the boundary - of the view before being moved back to the boundary. This provides - the feeling that the edges of the view are soft, rather than a hard - physical boundary. -*/ bool QFxFlickable::overShoot() const { Q_D(const QFxFlickable); @@ -904,11 +854,6 @@ void QFxFlickable::setOverShoot(bool o) } \endcode */ - -/*! - \property QFxFlickable::viewportWidth - \brief the width of the view. -*/ int QFxFlickable::viewportWidth() const { Q_D(const QFxFlickable); @@ -957,10 +902,6 @@ void QFxFlickable::heightChange() } } -/*! - \property QFxFlickable::viewportHeight - \brief the height of the view. -*/ int QFxFlickable::viewportHeight() const { Q_D(const QFxFlickable); @@ -1069,7 +1010,7 @@ bool QFxFlickable::sceneEventFilter(QGraphicsItem *i, QEvent *e) switch (e->type()) { case QEvent::GraphicsSceneMousePress: case QEvent::GraphicsSceneMouseMove: - case QEvent::GraphicsSceneMouseRelease: + case QEvent::GraphicsSceneMouseRelease: return sendMouseEvent(static_cast(e)); default: break; @@ -1082,11 +1023,6 @@ bool QFxFlickable::sceneEventFilter(QGraphicsItem *i, QEvent *e) \qmlproperty int Flickable::maximumFlickVelocity This property holds the maximum velocity that the user can flick the view. */ - -/*! - \property QFxFlickable::maximumFlickVelocity - \brief the maximum velocity that the user can flick the view. -*/ int QFxFlickable::maximumFlickVelocity() const { Q_D(const QFxFlickable); diff --git a/src/declarative/fx/qfxflipable.cpp b/src/declarative/fx/qfxflipable.cpp index 228d938..8e56e43 100644 --- a/src/declarative/fx/qfxflipable.cpp +++ b/src/declarative/fx/qfxflipable.cpp @@ -69,7 +69,7 @@ public: Flipable allows you to specify a front and a back and then flip between those sides. \qml -Flipable { + Flipable { id: flipable width: 40 height: 40 diff --git a/src/declarative/fx/qfxgridview.cpp b/src/declarative/fx/qfxgridview.cpp index 7e755fb..448a41a 100644 --- a/src/declarative/fx/qfxgridview.cpp +++ b/src/declarative/fx/qfxgridview.cpp @@ -961,15 +961,6 @@ void QFxGridView::setWrapEnabled(bool wrap) and below the bottom of the view to cache. Setting this value can make scrolling the view smoother at the expense of additional memory usage. */ - -/*! - \property QFxGridView::cacheBuffer - \brief sets the number of off-screen pixels to cache. - - This property determines the number of pixels above the top of the view - and below the bottom of the view to cache. Setting this value can make - scrolling the view smoother at the expense of additional memory usage. -*/ int QFxGridView::cacheBuffer() const { Q_D(const QFxGridView); diff --git a/src/declarative/fx/qfximage.cpp b/src/declarative/fx/qfximage.cpp index ec3fdab..6e24fdf 100644 --- a/src/declarative/fx/qfximage.cpp +++ b/src/declarative/fx/qfximage.cpp @@ -141,14 +141,6 @@ QFxImage::~QFxImage() { } -/*! - \property QFxImage::pixmap - \brief the image displayed in this item. - - This property contains the pixmap currently being displayed by this item, - which may be empty if nothing is currently displayed. Setting the source - property overrides any setting of this property. -*/ QPixmap QFxImage::pixmap() const { Q_D(const QFxImage); diff --git a/src/declarative/fx/qfximagebase.cpp b/src/declarative/fx/qfximagebase.cpp index e3760f3..5aa87db 100644 --- a/src/declarative/fx/qfximagebase.cpp +++ b/src/declarative/fx/qfximagebase.cpp @@ -81,14 +81,6 @@ qreal QFxImageBase::progress() const return d->progress; } - -/*! - \property QFxImage::source - \brief the url of the image to be displayed in this item. - - The content specified can be of any image type loadable by QImage. Alternatively, - you can specify an sci format file, which specifies both an image and it's scale grid. -*/ QUrl QFxImageBase::source() const { Q_D(const QFxImageBase); diff --git a/src/declarative/fx/qfxlineedit.cpp b/src/declarative/fx/qfxlineedit.cpp index de850f8..6e93782 100644 --- a/src/declarative/fx/qfxlineedit.cpp +++ b/src/declarative/fx/qfxlineedit.cpp @@ -52,7 +52,7 @@ QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,QIntValidator,QIntValidator); /*! \qmlclass LineEdit - \brief The LineEdit item allows you to add an editable line of text to a scene. + The LineEdit item allows you to add an editable line of text to a scene. */ QFxLineEdit::QFxLineEdit(QFxItem* parent) : QFxPaintedItem(*(new QFxLineEditPrivate), parent) @@ -145,11 +145,6 @@ void QFxLineEdit::setColor(const QColor &c) The text highlight color, used behind selections. */ - -/*! - \property QFxLineEdit::highlightColor - \brief the line edit's default text highlight color -*/ QColor QFxLineEdit::highlightColor() const { Q_D(const QFxLineEdit); @@ -171,11 +166,6 @@ void QFxLineEdit::setHighlightColor(const QColor &color) The highlighted text color, used in selections. */ - -/*! - \property QFxLineEdit::highlightedTextColor - \brief the line edit's default highlighted text color -*/ QColor QFxLineEdit::highlightedTextColor() const { Q_D(const QFxLineEdit); @@ -229,8 +219,8 @@ void QFxLineEdit::setMaxLength(int ml) } /*! - \qmlproperty LineEdit::cursorVisible - \brief If true the text edit shows a cursor. + \qmlproperty bool LineEdit::cursorVisible + If true the text edit shows a cursor. This property is set and unset when the line edit gets focus, but it can also be set directly (useful, for example, if a KeyProxy might forward keys to it). @@ -252,8 +242,8 @@ void QFxLineEdit::setCursorVisible(bool on) } /*! - \qmlproperty LineEdit::cursorPosition - \brief The position of the cursor in the LineEdit. + \qmlproperty int LineEdit::cursorPosition + The position of the cursor in the LineEdit. */ int QFxLineEdit::cursorPosition() const { @@ -380,8 +370,8 @@ void QFxLineEdit::setEchoMode(uint echo) } /*! - \qmlproperty LineEdit::cursorDelegate - \brief The delegate for the cursor in the LineEdit. + \qmlproperty Component LineEdit::cursorDelegate + The delegate for the cursor in the LineEdit. If you set a cursorDelegate for a LineEdit, this delegate will be used for drawing the cursor instead of the standard cursor. An instance of the diff --git a/src/declarative/fx/qfxlistview.cpp b/src/declarative/fx/qfxlistview.cpp index 9e08b69..cb74910 100644 --- a/src/declarative/fx/qfxlistview.cpp +++ b/src/declarative/fx/qfxlistview.cpp @@ -1194,15 +1194,6 @@ void QFxListView::setWrapEnabled(bool wrap) and below the bottom of the list to cache. Setting this value can make scrolling the list smoother at the expense of additional memory usage. */ - -/*! - \property QFxListView::cacheBuffer - \brief sets the number of off-screen pixels to cache. - - This property determines the number of pixels above the top of the list - and below the bottom of the list to cache. Setting this value can make - scrolling the list smoother at the expense of additional memory usage. -*/ int QFxListView::cacheBuffer() const { Q_D(const QFxListView); diff --git a/src/declarative/fx/qfxmouseregion.cpp b/src/declarative/fx/qfxmouseregion.cpp index 42e024d..e3eec04 100644 --- a/src/declarative/fx/qfxmouseregion.cpp +++ b/src/declarative/fx/qfxmouseregion.cpp @@ -79,12 +79,6 @@ void QFxDrag::setAxis(const QString &a) _axis = a; } -/*! - \property QFxDrag::xmin - \brief the minimum x position for the target - - If x-axis dragging is enabled, xmin limits how far to the left the target can be dragged. If x-axis dragging is not enabled, this property has no effect. -*/ qreal QFxDrag::xmin() const { return _xmin; @@ -95,12 +89,6 @@ void QFxDrag::setXmin(qreal m) _xmin = m; } -/*! - \property QFxDrag::xmax - \brief the maximum x position for the target - - If x-axis dragging is enabled, xmax limits how far to the right the target can be dragged. If x-axis dragging is not enabled, this property has no effect. -*/ qreal QFxDrag::xmax() const { return _xmax; @@ -111,12 +99,6 @@ void QFxDrag::setXmax(qreal m) _xmax = m; } -/*! - \property QFxDrag::ymin - \brief the minimum y position for the target - - If y-axis dragging is enabled, ymin limits how far up the target can be dragged. If y-axis dragging is not enabled, this property has no effect. -*/ qreal QFxDrag::ymin() const { return _ymin; @@ -127,12 +109,6 @@ void QFxDrag::setYmin(qreal m) _ymin = m; } -/*! - \property QFxDrag::ymax - \brief the maximum y position for the target - - If y-axis dragging is enabled, ymax limits how far down the target can be dragged. If y-axis dragging is not enabled, this property has no effect. -*/ qreal QFxDrag::ymax() const { return _ymax; @@ -520,10 +496,6 @@ void QFxMouseRegion::setPressed(bool p) } } -/*! - \property QFxMouseRegion::drag - \brief The current drag being performed on the Mouse Region. -*/ QFxDrag *QFxMouseRegion::drag() { Q_D(QFxMouseRegion); diff --git a/src/declarative/fx/qfxpositioners.cpp b/src/declarative/fx/qfxpositioners.cpp index 270524d..df733b4 100644 --- a/src/declarative/fx/qfxpositioners.cpp +++ b/src/declarative/fx/qfxpositioners.cpp @@ -55,16 +55,6 @@ QT_BEGIN_NAMESPACE /*! \internal \class QFxBasePositioner - \brief The QFxBasePositioner class provides a base for QFx layouts. - - To create a QFx Layout, simple subclass QFxBasePositioner and implement - doLayout(), which is automatically called when the layout might need - updating. - - It is strongly recommended that in your implementation of doLayout() - that you use the move, remove and add transitions when those conditions - arise. - \ingroup group_layouts */ QFxBasePositioner::QFxBasePositioner(AutoUpdateType at, QFxItem *parent) @@ -81,12 +71,6 @@ QFxBasePositioner::QFxBasePositioner(QFxBasePositionerPrivate &dd, AutoUpdateTyp d->init(at); } -/*! - \property QFxBasePositioner::spacing - \brief the amount of spacing between items (in px) - - Note that the subclass is repsonsible for ensuring this. -*/ int QFxBasePositioner::spacing() const { Q_D(const QFxBasePositioner); @@ -102,11 +86,6 @@ void QFxBasePositioner::setSpacing(int s) preLayout(); } -/*! - \property QFxBasePositioner::margin - \brief the size of the margin around all items (in px) - -*/ int QFxBasePositioner::margin() const { Q_D(const QFxBasePositioner); @@ -122,24 +101,6 @@ void QFxBasePositioner::setMargin(int s) preLayout(); } - -/*! - \property QFxBasePositioner::move - \brief the transition when moving an item. - - \qml -BaseLayout { - id: layout - y: 0 - move: Transition { - NumberAnimation { - properties: "y" - ease: "easeOutBounce" - } - } -} - \endqml -*/ QmlTransition *QFxBasePositioner::move() const { Q_D(const QFxBasePositioner); @@ -152,26 +113,6 @@ void QFxBasePositioner::setMove(QmlTransition *mt) d->moveTransition = mt; } -/*! - \property QFxBasePositioner::add - \brief the transition when adding an item. - - \qml -BaseLayout { - id: layout - y: 0 - add: Transition { - NumberAnimation { - target: layout.item - properties: "opacity" - from: 0 - to: 1 - duration: 500 - } - } -} - \endqml -*/ QmlTransition *QFxBasePositioner::add() const { Q_D(const QFxBasePositioner); @@ -184,29 +125,6 @@ void QFxBasePositioner::setAdd(QmlTransition *add) d->addTransition = add; } - -/*! - \property QFxBasePositioner::remove - \brief the transition when removing an item. - - Note that the item may be 'removed' because its opacity is zero. This can make certain - transitions difficult to see. - \qml -BaseLayout { - id: layout - y: 0 - remove: Transition { - NumberAnimation { - target: layout.item - properties: "opacity" - from: 1 - to: 0 - duration: 500 - } - } -} - \endqml -*/ QmlTransition *QFxBasePositioner::remove() const { Q_D(const QFxBasePositioner); @@ -219,13 +137,6 @@ void QFxBasePositioner::setRemove(QmlTransition *remove) d->removeTransition = remove; } -/*! - \property QFxBasePositioner::item - - The item that is currently being laid out. Used to target transitions that apply - only to the item being laid out, such as in the add transition. -*/ - QFxItem *QFxBasePositioner::layoutItem() const { Q_D(const QFxBasePositioner); @@ -475,7 +386,7 @@ void QFxBasePositioner::applyRemove(const QList >& chan QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,VerticalPositioner,QFxVerticalPositioner) /*! \qmlclass VerticalPositioner - \brief The VerticalPositioner item arranges its children in a vertical layout. + \brief The VerticalPositioner item lines up its children vertically. \inherits Item The VerticalPositioner item arranges its child items so that they are vertically @@ -678,7 +589,7 @@ void QFxVerticalPositioner::doLayout() QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,HorizontalPositioner,QFxHorizontalPositioner) /*! \qmlclass HorizontalPositioner - \brief The HorizontalPositioner item arranges its children in a horizontal layout. + \brief The HorizontalPositioner item lines up its children horizontally. \inherits Item The HorizontalPositioner item arranges its child items so that they are horizontally aligned and not overlapping. Spacing can be added between the items, and a margin around all items can also be added. It also provides for transitions to be set when items are added, moved, or removed in the layout. Adding and removing apply both to items which are deleted or have their position in the document changed so as to no longer be children of the layout, as well as to items which have their opacity set to or from zero so as to appear or disappear. @@ -844,7 +755,7 @@ QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,GridPositioner,QFxGridPositioner /*! \qmlclass GridPositioner QFxGridPositioner - \brief The GridPositioner item arranges its children in a grid layout. + \brief The GridPositioner item positions its children in a grid. \inherits Item The GridPositioner item arranges its child items so that they are @@ -867,7 +778,7 @@ QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,GridPositioner,QFxGridPositioner example demonstrates this. \table - \row + \row \o \image gridLayout_example.png \o \qml @@ -1018,16 +929,6 @@ QFxGridPositioner::QFxGridPositioner(QFxItem *parent) : many rows some rows will be of zero width. */ -/*! - \property QFxGridPositioner::columns - \brief the number of columns in the grid. -*/ - -/*! - \property QFxGridPositioner::rows - \brief the number of rows in the grid. -*/ - void QFxGridPositioner::doLayout() { int c=_columns,r=_rows;//Actual number of rows/columns diff --git a/src/declarative/fx/qfxrect.cpp b/src/declarative/fx/qfxrect.cpp index 0bd240e..3a7e350 100644 --- a/src/declarative/fx/qfxrect.cpp +++ b/src/declarative/fx/qfxrect.cpp @@ -65,32 +65,6 @@ QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,Gradient,QFxGradient) \endqml */ -/*! \property QFxPen::width - \brief the width of the border. - - A width of 1 is a single-pixel line on the border of the item being painted. - - If the width is less than 1 the pen is considered invalid and won't be used. -*/ - -/*! - \property QFxPen::color - \brief the color of the border. - - color is most commonly specified in hexidecimal notation (#RRGGBB) - or as an \l {http://www.w3.org/TR/SVG/types.html#ColorKeywords}{SVG color keyword name} - (as defined by the World Wide Web Consortium). For example: - \qml - // rect with green border using hexidecimal notation - Rect { border.color: "#00FF00" } - - // rect with steelblue border using SVG color name - Rect { border.color: "steelblue" } - \endqml - - For the full set of ways to specify color, see Qt's QColor::setNamedColor documentation. -*/ - void QFxPen::setColor(const QColor &c) { _color = c; @@ -98,19 +72,6 @@ void QFxPen::setColor(const QColor &c) emit updated(); } -/*! - \property QFxPen::width - \brief the width of the border. - - \qml - Rect { border.width: 4 } - \endqml - - A width of 1 creates a thin line. For no line, use a width of 0 or a transparent color. - - To keep the border smooth (rather than blurry), odd pen widths cause the rect to be painted at - a half-pixel offset; -*/ void QFxPen::setWidth(int w) { _width = w; diff --git a/src/declarative/fx/qfxscalegrid.cpp b/src/declarative/fx/qfxscalegrid.cpp index 53c63a5..f0c5758 100644 --- a/src/declarative/fx/qfxscalegrid.cpp +++ b/src/declarative/fx/qfxscalegrid.cpp @@ -50,27 +50,6 @@ QT_BEGIN_NAMESPACE \internal \class QFxScaleGrid \brief The QFxScaleGrid class allows you to specify a 3x3 grid to use in scaling an image. - - A scale grid uses 4 grid lines (2 horizontal and 2 vertical) to break an image into 9 sections, as shown below: - \image scalegrid.png - - When the image is scaled: - \list - \i the corners (sections 1, 3, 7, and 9) are not scaled at all - \i the middle (section 5) is scaled both horizontally and vertically - \i sections 2 and 8 are scaled horizontally - \i sections 4 and 6 are scaled vertically - \endlist - - A common way of specifying a scale grid is to create an sci file. An sci file uses a simple - text-based format that specifies each grid line, as well as the associated image file. An example of an sci file's contents: - \code - gridLeft: 10 - gridTop: 10 - gridBottom: 10 - gridRight: 10 - imageFile: picture.png - \endcode */ QML_DEFINE_NOCREATE_TYPE(QFxScaleGrid) @@ -87,10 +66,6 @@ bool QFxScaleGrid::isNull() const return !_left && !_top && !_right && !_bottom; } -/*! - \property QFxScaleGrid::left - \brief the position of the left grid line as an offset from the left side of the image. -*/ void QFxScaleGrid::setLeft(int pos) { if (_left != pos) { @@ -99,10 +74,6 @@ void QFxScaleGrid::setLeft(int pos) } } -/*! - \property QFxScaleGrid::top - \brief the position of the top grid line as an offset from the top of the image. -*/ void QFxScaleGrid::setTop(int pos) { if (_top != pos) { @@ -111,10 +82,6 @@ void QFxScaleGrid::setTop(int pos) } } -/*! - \property QFxScaleGrid::right - \brief the position of the right grid line as an offset from the right side of the image. -*/ void QFxScaleGrid::setRight(int pos) { if (_right != pos) { @@ -123,10 +90,6 @@ void QFxScaleGrid::setRight(int pos) } } -/*! - \property QFxScaleGrid::bottom - \brief the position of the bottom grid line as an offset from the bottom of the image. -*/ void QFxScaleGrid::setBottom(int pos) { if (_bottom != pos) { @@ -135,12 +98,6 @@ void QFxScaleGrid::setBottom(int pos) } } -/*! - \fn void QFxScaleGrid::borderChanged() - - This signal is emitted when one of the border properties is changed. -*/ - QFxGridScaledImage::QFxGridScaledImage() : _l(-1), _r(-1), _t(-1), _b(-1), _h(QFxBorderImage::Stretch), _v(QFxBorderImage::Stretch) diff --git a/src/declarative/fx/qfxtextedit.cpp b/src/declarative/fx/qfxtextedit.cpp index 628d49b..5014185 100644 --- a/src/declarative/fx/qfxtextedit.cpp +++ b/src/declarative/fx/qfxtextedit.cpp @@ -136,18 +136,6 @@ QString QFxTextEdit::text() const automatically determine whether the text should be treated as rich text. This determination is made using Qt::mightBeRichText(). */ - -/*! - \property QFxTextEdit::text - \brief the text edit's text - - If the text format is set to AutoText the text edit will try to - automatically determine whether the text should be treated as - rich text. This determination is made using Qt::mightBeRichText(). - - \sa textFormat -*/ - void QFxTextEdit::setText(const QString &text) { Q_D(QFxTextEdit); @@ -199,20 +187,6 @@ VerticalPositioner { \o \image declarative-textformat.png \endtable */ - -/*! - \property QFxTextEdit::textFormat - \brief this property describes how the text set on the text edit - should be interpreted. - - Valid values are \c AutoText, \c PlainText and \c RichText. The - default value is \c AutoText, meaning the text edit will attempt - to guess how the text should be interpreted using the - Qt::mightBeRichText() function. - - \sa text -*/ - QFxTextEdit::TextFormat QFxTextEdit::textFormat() const { Q_D(const QFxTextEdit); @@ -237,11 +211,6 @@ void QFxTextEdit::setTextFormat(TextFormat format) d->format = format; } -/*! - \property QFxTextEdit::font - \brief the text edit's default font -*/ - QFont QFxTextEdit::font() const { Q_D(const QFxTextEdit); @@ -276,11 +245,6 @@ TextEdit { color: "#00FF00"; ... } TextEdit { color: "steelblue"; ... } \endqml */ - -/*! - \property QFxTextEdit::color - \brief the text edit's default text color -*/ QColor QFxTextEdit::color() const { Q_D(const QFxTextEdit); @@ -306,11 +270,6 @@ void QFxTextEdit::setColor(const QColor &color) The text highlight color, used behind selections. */ - -/*! - \property QFxTextEdit::highlightColor - \brief the text edit's default text highlight color -*/ QColor QFxTextEdit::highlightColor() const { Q_D(const QFxTextEdit); @@ -336,11 +295,6 @@ void QFxTextEdit::setHighlightColor(const QColor &color) The highlighted text color, used in selections. */ - -/*! - \property QFxTextEdit::highlightedTextColor - \brief the text edit's default highlighted text color -*/ QColor QFxTextEdit::highlightedTextColor() const { Q_D(const QFxTextEdit); @@ -372,13 +326,6 @@ void QFxTextEdit::setHighlightedTextColor(const QColor &color) \c AlignHCenter. The valid values for \c vAlign are \c AlignTop, \c AlignBottom and \c AlignVCenter. */ - -/*! - \property QFxTextEdit::hAlign - \brief the horizontal alignment of the text. - - Valid values are \c AlignLeft, \c AlignRight, and \c AlignHCenter. The default value is \c AlignLeft. -*/ QFxTextEdit::HAlignment QFxTextEdit::hAlign() const { Q_D(const QFxTextEdit); @@ -395,12 +342,6 @@ void QFxTextEdit::setHAlign(QFxTextEdit::HAlignment alignment) updateSize(); } -/*! - \property QFxTextEdit::vAlign - \brief the vertical alignment of the text. - - Valid values are \c AlignTop, \c AlignBottom, and \c AlignVCenter. The default value is \c AlignTop. -*/ QFxTextEdit::VAlignment QFxTextEdit::vAlign() const { Q_D(const QFxTextEdit); @@ -431,12 +372,6 @@ bool QFxTextEdit::wrap() const Wrapping is done on word boundaries (i.e. it is a "word-wrap"). Wrapping is off by default. */ - -/*! - \property QFxTextEdit::wrap - \brief If true the text edit wraps text based on the width of the - text edit. -*/ void QFxTextEdit::setWrap(bool w) { Q_D(QFxTextEdit); @@ -448,8 +383,8 @@ void QFxTextEdit::setWrap(bool w) } /*! - \qmlproperty TextEdit::cursorVisible - \brief If true the text edit shows a cursor. + \qmlproperty bool TextEdit::cursorVisible + If true the text edit shows a cursor. This property is set and unset when the text edit gets focus, but it can also be set directly (useful, for example, if a KeyProxy might forward keys to it). @@ -473,8 +408,8 @@ void QFxTextEdit::setCursorVisible(bool on) } /*! - \qmlproperty TextEdit::cursorPosition - \brief The position of the cursor in the TextEdit. + \qmlproperty int TextEdit::cursorPosition + The position of the cursor in the TextEdit. */ int QFxTextEdit::cursorPosition() const { @@ -493,8 +428,8 @@ void QFxTextEdit::setCursorPosition(int pos) } /*! - \qmlproperty TextEdit::cursorDelegate - \brief The delegate for the cursor in the TextEdit. + \qmlproperty Component TextEdit::cursorDelegate + The delegate for the cursor in the TextEdit. If you set a cursorDelegate for a TextEdit, this delegate will be used for drawing the cursor instead of the standard cursor. An instance of the @@ -710,22 +645,11 @@ void QFxTextEdit::componentComplete() /*! \qmlproperty bool TextEdit::readOnly - Whether the user an interact with the TextEdit item. If this + Whether the user an interact with the TextEdit item. If this property is set to true the text cannot be edited by user interaction. By default this property is false. */ - -/*! - \property QFxTextEdit::readOnly - \brief If this property is true the text can not be edited by user interaction. - - Changing this property will modify the text interaction flags. If - you require more specific control about how user interaction - with the text edit is handled, use setTextInteractionFlags() instead. - - \sa setTextInteractionFlags() -*/ void QFxTextEdit::setReadOnly(bool r) { Q_D(QFxTextEdit); -- cgit v0.12 From d272b9197c9cc40ac50a1cfa2703c648c962f0f2 Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Tue, 18 Aug 2009 08:19:16 +1000 Subject: No need to copy pixmap. --- src/declarative/fx/qfximage.cpp | 34 ++++++++++++++++------------------ 1 file changed, 16 insertions(+), 18 deletions(-) diff --git a/src/declarative/fx/qfximage.cpp b/src/declarative/fx/qfximage.cpp index ec3fdab..61c1411 100644 --- a/src/declarative/fx/qfximage.cpp +++ b/src/declarative/fx/qfximage.cpp @@ -258,77 +258,75 @@ void QFxImage::paint(QPainter *p, const QStyleOptionGraphicsItem *, QWidget *) if (d->smooth) p->setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform, d->smooth); - QPixmap pix = d->pix; - - if (width() != pix.width() || height() != pix.height()) { + if (width() != d->pix.width() || height() != d->pix.height()) { if (d->fillMode >= Tile) { p->save(); p->setClipRect(0, 0, width(), height(), Qt::IntersectClip); if (d->fillMode == Tile) { - const int pw = pix.width(); - const int ph = pix.height(); + const int pw = d->pix.width(); + const int ph = d->pix.height(); int yy = 0; while(yy < height()) { int xx = 0; while(xx < width()) { - p->drawPixmap(xx, yy, pix); + p->drawPixmap(xx, yy, d->pix); xx += pw; } yy += ph; } } else if (d->fillMode == TileVertically) { - const int ph = pix.height(); + const int ph = d->pix.height(); int yy = 0; while(yy < height()) { - p->drawPixmap(QRect(0, yy, width(), ph), pix); + p->drawPixmap(QRect(0, yy, width(), ph), d->pix); yy += ph; } } else { - const int pw = pix.width(); + const int pw = d->pix.width(); int xx = 0; while(xx < width()) { - p->drawPixmap(QRect(xx, 0, pw, height()), pix); + p->drawPixmap(QRect(xx, 0, pw, height()), d->pix); xx += pw; } } p->restore(); } else { - qreal widthScale = width() / qreal(pix.width()); - qreal heightScale = height() / qreal(pix.height()); + qreal widthScale = width() / qreal(d->pix.width()); + qreal heightScale = height() / qreal(d->pix.height()); QTransform scale; if (d->fillMode == PreserveAspectFit) { if (widthScale < heightScale) { heightScale = widthScale; - scale.translate(0, (height() - heightScale * pix.height()) / 2); + scale.translate(0, (height() - heightScale * d->pix.height()) / 2); } else if(heightScale < widthScale) { widthScale = heightScale; - scale.translate((width() - widthScale * pix.width()) / 2, 0); + scale.translate((width() - widthScale * d->pix.width()) / 2, 0); } } else if (d->fillMode == PreserveAspectCrop) { if (widthScale < heightScale) { widthScale = heightScale; - scale.translate((width() - widthScale * pix.width()) / 2, 0); + scale.translate((width() - widthScale * d->pix.width()) / 2, 0); } else if(heightScale < widthScale) { heightScale = widthScale; - scale.translate(0, (height() - heightScale * pix.height()) / 2); + scale.translate(0, (height() - heightScale * d->pix.height()) / 2); } } scale.scale(widthScale, heightScale); QTransform old = p->transform(); p->setWorldTransform(scale * old); - p->drawPixmap(0, 0, pix); + p->drawPixmap(0, 0, d->pix); p->setWorldTransform(old); } } else { - p->drawPixmap(0, 0, pix); + p->drawPixmap(0, 0, d->pix); } if (d->smooth) { -- cgit v0.12 From c9f4ad424949085209acda6cff07babbe8d29001 Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Tue, 18 Aug 2009 10:22:01 +1000 Subject: Change Item.contents to Item.childrenRect. --- examples/declarative/clock/display.qml | 4 +- .../1_Drawing_and_animation.qml | 2 +- .../tutorials/contacts/2_Reuse/2_Reuse.qml | 2 +- .../contacts/3_Collections/3_Collections.qml | 4 +- examples/declarative/xmldata/daringfireball.qml | 2 +- examples/declarative/xmldata/yahoonews.qml | 2 +- src/declarative/fx/qfxitem.cpp | 54 ++++++++++------------ src/declarative/fx/qfxitem.h | 37 ++------------- src/declarative/fx/qfxitem_p.h | 27 +++++++++++ 9 files changed, 62 insertions(+), 72 deletions(-) diff --git a/examples/declarative/clock/display.qml b/examples/declarative/clock/display.qml index cd6dcf7..00af9b3 100644 --- a/examples/declarative/clock/display.qml +++ b/examples/declarative/clock/display.qml @@ -1,7 +1,7 @@ import Qt 4.6 Rect { - width: contents.width - height: contents.height + width: childrenRect.width + height: childrenRect.height Clock { id: Clock } } diff --git a/examples/declarative/tutorials/contacts/1_Drawing_and_Animation/1_Drawing_and_animation.qml b/examples/declarative/tutorials/contacts/1_Drawing_and_Animation/1_Drawing_and_animation.qml index a70ef16..1087d6a 100644 --- a/examples/declarative/tutorials/contacts/1_Drawing_and_Animation/1_Drawing_and_animation.qml +++ b/examples/declarative/tutorials/contacts/1_Drawing_and_Animation/1_Drawing_and_animation.qml @@ -7,7 +7,7 @@ Rect { color: "white" VerticalPositioner { id: layout - width: contents.width + width: childrenRect.width GroupBox { contents: "1/RemoveButton.qml" label: "Rectangle Component" diff --git a/examples/declarative/tutorials/contacts/2_Reuse/2_Reuse.qml b/examples/declarative/tutorials/contacts/2_Reuse/2_Reuse.qml index 7ac513e..70b8b95 100644 --- a/examples/declarative/tutorials/contacts/2_Reuse/2_Reuse.qml +++ b/examples/declarative/tutorials/contacts/2_Reuse/2_Reuse.qml @@ -9,7 +9,7 @@ Rect { id: layout columns: 2 rows: 4 - width: contents.width + width: childrenRect.width GroupBox { contents: "1/ContactField.qml" label: "Loading: simple" diff --git a/examples/declarative/tutorials/contacts/3_Collections/3_Collections.qml b/examples/declarative/tutorials/contacts/3_Collections/3_Collections.qml index d61705c..5a22b1c 100644 --- a/examples/declarative/tutorials/contacts/3_Collections/3_Collections.qml +++ b/examples/declarative/tutorials/contacts/3_Collections/3_Collections.qml @@ -13,8 +13,8 @@ Rect { // component removes focus from any previous element GridPositioner { id: layout - width: contents.width - height: contents.height + width: childrenRect.width + height: childrenRect.height GroupBox { contents: "1/ContactView.qml" label: "list only" diff --git a/examples/declarative/xmldata/daringfireball.qml b/examples/declarative/xmldata/daringfireball.qml index 4fb12af..a93483e 100644 --- a/examples/declarative/xmldata/daringfireball.qml +++ b/examples/declarative/xmldata/daringfireball.qml @@ -26,7 +26,7 @@ Rect { Component { id: feedDelegate Item { - height: contents.height + 20 + height: childrenRect.height + 20 Text { x: 10 id: TitleText diff --git a/examples/declarative/xmldata/yahoonews.qml b/examples/declarative/xmldata/yahoonews.qml index 156eb31..22586b8 100644 --- a/examples/declarative/xmldata/yahoonews.qml +++ b/examples/declarative/xmldata/yahoonews.qml @@ -66,7 +66,7 @@ Rect { states: [ State { name: "Details" - SetProperties { target: Wrapper; height: contents.height + 10 } + SetProperties { target: Wrapper; height: childrenRect.height + 10 } SetProperties { target: Description; opacity: 1 } } ] diff --git a/src/declarative/fx/qfxitem.cpp b/src/declarative/fx/qfxitem.cpp index 0b86a54..f5f502c 100644 --- a/src/declarative/fx/qfxitem.cpp +++ b/src/declarative/fx/qfxitem.cpp @@ -69,7 +69,6 @@ QT_BEGIN_NAMESPACE #define FLT_MAX 1E+37 #endif -QML_DEFINE_NOCREATE_TYPE(QFxContents) QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,Item,QFxItem) QML_DEFINE_NOCREATE_TYPE(QGraphicsTransform); @@ -210,40 +209,30 @@ QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,Rotation,QGraphicsRotation) */ -QFxContents::QFxContents() : m_height(0), m_width(0) +QFxContents::QFxContents() : m_x(0), m_y(0), m_width(0), m_height(0) { } /*! - \qmlproperty qreal Item::contents.width - \qmlproperty qreal Item::contents.height + \qmlproperty qreal Item::childrenRect.x + \qmlproperty qreal Item::childrenRect.y + \qmlproperty qreal Item::childrenRect.width + \qmlproperty qreal Item::childrenRect.height - The contents properties allow an item access to the size of its + The childrenRect properties allow an item access to the geometry of its children. This property is useful if you have an item that needs to be sized to fit its children. */ -/*! - \property QFxContents::height - \brief The height of the contents. -*/ -qreal QFxContents::height() const +QRectF QFxContents::rectF() const { - return m_height; -} - -/*! - \property QFxContents::width - \brief The width of the contents. -*/ -qreal QFxContents::width() const -{ - return m_width; + return QRectF(m_x, m_y, m_width, m_height); } //TODO: optimization: only check sender(), if there is one void QFxContents::calcHeight() { + qreal oldy = m_y; qreal oldheight = m_height; qreal top = FLT_MAX; @@ -258,15 +247,18 @@ void QFxContents::calcHeight() if (y < top) top = y; } + if (!children.isEmpty()) + m_y = top; m_height = qMax(bottom - top, qreal(0.0)); - if (m_height != oldheight) - emit heightChanged(); + if (m_height != oldheight || m_y != oldy) + emit rectChanged(); } //TODO: optimization: only check sender(), if there is one void QFxContents::calcWidth() { + qreal oldx = m_x; qreal oldwidth = m_width; qreal left = FLT_MAX; @@ -281,10 +273,12 @@ void QFxContents::calcWidth() if (x < left) left = x; } + if (!children.isEmpty()) + m_x = left; m_width = qMax(right - left, qreal(0.0)); - if (m_width != oldwidth) - emit widthChanged(); + if (m_width != oldwidth || m_x != oldx) + emit rectChanged(); } void QFxContents::setItem(QFxItem *item) @@ -298,6 +292,7 @@ void QFxContents::setItem(QFxItem *item) connect(child, SIGNAL(yChanged()), this, SLOT(calcHeight())); connect(child, SIGNAL(widthChanged()), this, SLOT(calcWidth())); connect(child, SIGNAL(xChanged()), this, SLOT(calcWidth())); + connect(this, SIGNAL(rectChanged()), m_item, SIGNAL(childrenRectChanged())); } calcHeight(); @@ -1285,13 +1280,12 @@ QmlList *QFxItem::data() } /*! - \property QFxItem::contents - \brief An object that knows about the size of an item's children. + \property QFxItem::childrenRect + \brief The geometry of an item's children. - contents provides an easy way to access the (collective) width and - height of the item's children. + childrenRect provides an easy way to access the (collective) position and size of the item's children. */ -QFxContents *QFxItem::contents() +QRectF QFxItem::childrenRect() { Q_D(QFxItem); if (!d->_contents) { @@ -1299,7 +1293,7 @@ QFxContents *QFxItem::contents() d->_contents->setParent(this); d->_contents->setItem(this); } - return d->_contents; + return d->_contents->rectF(); } bool QFxItem::clip() const diff --git a/src/declarative/fx/qfxitem.h b/src/declarative/fx/qfxitem.h index d8fb983..3485985 100644 --- a/src/declarative/fx/qfxitem.h +++ b/src/declarative/fx/qfxitem.h @@ -57,37 +57,6 @@ QT_BEGIN_NAMESPACE QT_MODULE(Declarative) -class QGraphicsTransform; - -class QFxItem; -class Q_DECLARATIVE_EXPORT QFxContents : public QObject -{ - Q_OBJECT - Q_PROPERTY(qreal height READ height NOTIFY heightChanged) - Q_PROPERTY(qreal width READ width NOTIFY widthChanged) -public: - QFxContents(); - - qreal height() const; - - qreal width() const; - - void setItem(QFxItem *item); - -public Q_SLOTS: - void calcHeight(); - void calcWidth(); - -Q_SIGNALS: - void heightChanged(); - void widthChanged(); - -private: - QFxItem *m_item; - qreal m_height; - qreal m_width; -}; - class QmlState; class QFxAnchorLine; class QmlTransition; @@ -109,7 +78,7 @@ class Q_DECLARATIVE_EXPORT QFxItem : public QGraphicsObject, public QmlParserSta Q_PROPERTY(QString state READ state WRITE setState NOTIFY stateChanged) Q_PROPERTY(qreal width READ width WRITE setWidth NOTIFY widthChanged FINAL) Q_PROPERTY(qreal height READ height WRITE setHeight NOTIFY heightChanged FINAL) - Q_PROPERTY(QFxContents * contents READ contents DESIGNABLE false CONSTANT FINAL) + Q_PROPERTY(QRectF childrenRect READ childrenRect NOTIFY childrenRectChanged DESIGNABLE false FINAL) Q_PROPERTY(QFxAnchors * anchors READ anchors DESIGNABLE false CONSTANT FINAL) Q_PROPERTY(QFxAnchorLine left READ left CONSTANT FINAL) Q_PROPERTY(QFxAnchorLine right READ right CONSTANT FINAL) @@ -147,7 +116,7 @@ public: QmlList *resources(); QFxAnchors *anchors(); - QFxContents *contents(); + QRectF childrenRect(); bool clip() const; void setClip(bool); @@ -190,6 +159,7 @@ Q_SIGNALS: void yChanged(); void widthChanged(); void heightChanged(); + void childrenRectChanged(); void baselineOffsetChanged(); void stateChanged(const QString &); void focusChanged(); @@ -251,7 +221,6 @@ QDebug Q_DECLARATIVE_EXPORT operator<<(QDebug debug, QFxItem *item); QT_END_NAMESPACE -QML_DECLARE_TYPE(QFxContents) QML_DECLARE_TYPE(QFxItem) QML_DECLARE_TYPE(QGraphicsTransform) QML_DECLARE_TYPE(QGraphicsScale) diff --git a/src/declarative/fx/qfxitem_p.h b/src/declarative/fx/qfxitem_p.h index 0e916b2..1d4bef3 100644 --- a/src/declarative/fx/qfxitem_p.h +++ b/src/declarative/fx/qfxitem_p.h @@ -69,6 +69,32 @@ QT_BEGIN_NAMESPACE class QNetworkReply; class QFxKeysAttached; +//### merge into private? +class QFxContents : public QObject +{ + Q_OBJECT +public: + QFxContents(); + + QRectF rectF() const; + + void setItem(QFxItem *item); + +public Q_SLOTS: + void calcHeight(); + void calcWidth(); + +Q_SIGNALS: + void rectChanged(); + +private: + QFxItem *m_item; + qreal m_x; + qreal m_y; + qreal m_width; + qreal m_height; +}; + class QFxItemPrivate : public QGraphicsItemPrivate { Q_DECLARE_PUBLIC(QFxItem) @@ -200,4 +226,5 @@ public: }; QT_END_NAMESPACE + #endif // QFXITEM_P_H -- cgit v0.12 From 8f5e72298fc4b8a5838bee1291a2cc422750b6b8 Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Tue, 18 Aug 2009 10:43:02 +1000 Subject: MouseRegion API changes following review. --- demos/declarative/flickr/content/Slider.qml | 2 +- examples/declarative/dial/dial.qml | 2 +- examples/declarative/minehunt/Description.qml | 8 ++--- examples/declarative/mouseregion/mouse.qml | 4 +-- examples/declarative/scrollbar/display.qml | 2 ++ examples/declarative/slideswitch/Switch.qml | 2 +- examples/declarative/velocity/Day.qml | 8 ++--- src/declarative/fx/qfxmouseregion.cpp | 46 ++++++++++++++++++++++++--- src/declarative/fx/qfxmouseregion.h | 26 +++++++++------ src/declarative/fx/qfxmouseregion_p.h | 2 +- 10 files changed, 74 insertions(+), 28 deletions(-) diff --git a/demos/declarative/flickr/content/Slider.qml b/demos/declarative/flickr/content/Slider.qml index 51385bc..a2ec420 100644 --- a/demos/declarative/flickr/content/Slider.qml +++ b/demos/declarative/flickr/content/Slider.qml @@ -29,7 +29,7 @@ Item { MouseRegion { anchors.fill: parent; drag.target: parent - drag.axis: "x"; drag.xmin: 2; drag.xmax: Slider.xMax+2 + drag.axis: "x"; drag.minimumX: 2; drag.maximumX: Slider.xMax+2 onPositionChanged: { value = (maximum - minimum) * (Handle.x-2) / Slider.xMax + minimum; } } } diff --git a/examples/declarative/dial/dial.qml b/examples/declarative/dial/dial.qml index 3773bcc..75bd9b1 100644 --- a/examples/declarative/dial/dial.qml +++ b/examples/declarative/dial/dial.qml @@ -26,7 +26,7 @@ Rect { } MouseRegion { anchors.fill: parent - drag.target: parent; drag.axis: "x"; drag.xmin: 2; drag.xmax: 128 + drag.target: parent; drag.axis: "x"; drag.minimumX: 2; drag.maximumX: 128 } } } diff --git a/examples/declarative/minehunt/Description.qml b/examples/declarative/minehunt/Description.qml index 9ad6522..cf02bff 100644 --- a/examples/declarative/minehunt/Description.qml +++ b/examples/declarative/minehunt/Description.qml @@ -8,10 +8,10 @@ Item { anchors.fill: parent drag.target: Page drag.axis: "xy" - drag.xmin: 0 - drag.xmax: 1000 - drag.ymin: 0 - drag.ymax: 1000 + drag.minimumX: 0 + drag.maximumX: 1000 + drag.minimumY: 0 + drag.maximumY: 1000 } Rect { radius: 10 diff --git a/examples/declarative/mouseregion/mouse.qml b/examples/declarative/mouseregion/mouse.qml index d9db106..34c6e66 100644 --- a/examples/declarative/mouseregion/mouse.qml +++ b/examples/declarative/mouseregion/mouse.qml @@ -25,8 +25,8 @@ Rect { MouseRegion { drag.target: parent drag.axis: "x" - drag.xmin: 0 - drag.xmax: 150 + drag.minimumX: 0 + drag.maximumX: 150 onPressed: { print('press') } onReleased: { print('release (isClick: ' + mouse.isClick + ') (wasHeld: ' + mouse.wasHeld + ')') } onClicked: { print('click' + '(wasHeld: ' + mouse.wasHeld + ')') } diff --git a/examples/declarative/scrollbar/display.qml b/examples/declarative/scrollbar/display.qml index 03a40d3..d8bd187 100644 --- a/examples/declarative/scrollbar/display.qml +++ b/examples/declarative/scrollbar/display.qml @@ -44,6 +44,7 @@ Rect { height: View.height-12 anchors.right: View.right } + /* ScrollBar { id: SBH opacity: 0 @@ -54,4 +55,5 @@ Rect { width: View.width-12 anchors.bottom: View.bottom } + */ } diff --git a/examples/declarative/slideswitch/Switch.qml b/examples/declarative/slideswitch/Switch.qml index 91627c7..b5de9ec 100644 --- a/examples/declarative/slideswitch/Switch.qml +++ b/examples/declarative/slideswitch/Switch.qml @@ -36,7 +36,7 @@ Item { anchors.fill: Knob onClicked: { toggle() } onReleased: { dorelease() } - drag.target: Knob; drag.axis: "x"; drag.xmin: 1; drag.xmax: 78 + drag.target: Knob; drag.axis: "x"; drag.minimumX: 1; drag.maximumX: 78 } states: [ State { diff --git a/examples/declarative/velocity/Day.qml b/examples/declarative/velocity/Day.qml index 59a31af..c959b0c 100644 --- a/examples/declarative/velocity/Day.qml +++ b/examples/declarative/velocity/Day.qml @@ -71,10 +71,10 @@ Rect { anchors.fill: parent drag.target: StickyPage drag.axis: "xy" - drag.ymin: 0 - drag.ymax: 500 - drag.xmin: 0 - drag.xmax: 400 + drag.minimumY: 0 + drag.maximumY: 500 + drag.minimumX: 0 + drag.maximumX: 400 } } } diff --git a/src/declarative/fx/qfxmouseregion.cpp b/src/declarative/fx/qfxmouseregion.cpp index 42e024d..22d64cb 100644 --- a/src/declarative/fx/qfxmouseregion.cpp +++ b/src/declarative/fx/qfxmouseregion.cpp @@ -296,7 +296,10 @@ bool QFxMouseRegion::isEnabled() const void QFxMouseRegion::setEnabled(bool a) { Q_D(QFxMouseRegion); - d->absorb = a; + if (a != d->absorb) { + d->absorb = a; + emit enabledChanged(); + } } void QFxMouseRegion::mousePressEvent(QGraphicsSceneMouseEvent *event) @@ -473,9 +476,9 @@ void QFxMouseRegion::timerEvent(QTimerEvent *event) \warning This property is only partially implemented -- it is only valid when the mouse is pressed, and not for hover events. */ -bool QFxMouseRegion::hovered() +bool QFxMouseRegion::hovered() const { - Q_D(QFxMouseRegion); + Q_D(const QFxMouseRegion); return d->hovered; } @@ -483,9 +486,9 @@ bool QFxMouseRegion::hovered() \qmlproperty bool MouseRegion::pressed This property holds whether the mouse region is currently pressed. */ -bool QFxMouseRegion::pressed() +bool QFxMouseRegion::pressed() const { - Q_D(QFxMouseRegion); + Q_D(const QFxMouseRegion); return d->pressed; } @@ -499,6 +502,39 @@ void QFxMouseRegion::setHovered(bool h) } } +/*! + \qmlproperty Qt::MouseButtons MouseRegion::acceptedButtons + This property holds the mouse buttons that the mouse region reacts to. + + The available buttons are: + \list + \o Qt.LeftButton + \o Qt.RightButton + \o Qt.MiddleButton + \endlist + + To accept more than one button the flags can be combined with the + "|" (or) operator: + + \code + MouseRegion { acceptedButtons: Qt.LeftButton | Qt.RightButton } + \endcode + + The default is to accept the Left button. +*/ +Qt::MouseButtons QFxMouseRegion::acceptedButtons() const +{ + return acceptedMouseButtons(); +} + +void QFxMouseRegion::setAcceptedButtons(Qt::MouseButtons buttons) +{ + if (buttons != acceptedMouseButtons()) { + setAcceptedMouseButtons(buttons); + emit acceptedButtonsChanged(); + } +} + void QFxMouseRegion::setPressed(bool p) { Q_D(QFxMouseRegion); diff --git a/src/declarative/fx/qfxmouseregion.h b/src/declarative/fx/qfxmouseregion.h index 418434a..f2d22d3 100644 --- a/src/declarative/fx/qfxmouseregion.h +++ b/src/declarative/fx/qfxmouseregion.h @@ -55,11 +55,12 @@ class Q_DECLARATIVE_EXPORT QFxDrag : public QObject Q_OBJECT Q_PROPERTY(QFxItem *target READ target WRITE setTarget) - Q_PROPERTY(QString axis READ axis WRITE setAxis) - Q_PROPERTY(qreal xmin READ xmin WRITE setXmin) - Q_PROPERTY(qreal xmax READ xmax WRITE setXmax) - Q_PROPERTY(qreal ymin READ ymin WRITE setYmin) - Q_PROPERTY(qreal ymax READ ymax WRITE setYmax) + Q_PROPERTY(QString axis READ axis WRITE setAxis) //### enum + Q_PROPERTY(qreal minimumX READ xmin WRITE setXmin) + Q_PROPERTY(qreal maximumX READ xmax WRITE setXmax) + Q_PROPERTY(qreal minimumY READ ymin WRITE setYmin) + Q_PROPERTY(qreal maximumY READ ymax WRITE setYmax) + //### consider drag and drop public: QFxDrag(QObject *parent=0); ~QFxDrag(); @@ -97,8 +98,10 @@ class Q_DECLARATIVE_EXPORT QFxMouseRegion : public QFxItem Q_PROPERTY(qreal mouseY READ mouseY NOTIFY positionChanged) Q_PROPERTY(bool containsMouse READ hovered NOTIFY hoveredChanged) Q_PROPERTY(bool pressed READ pressed NOTIFY pressedChanged) - Q_PROPERTY(bool enabled READ isEnabled WRITE setEnabled) - Q_PROPERTY(QFxDrag *drag READ drag) + Q_PROPERTY(bool enabled READ isEnabled WRITE setEnabled NOTIFY enabledChanged) + Q_PROPERTY(Qt::MouseButtons acceptedButtons READ acceptedButtons WRITE setAcceptedButtons NOTIFY acceptedButtonsChanged) + Q_PROPERTY(QFxDrag *drag READ drag) //### add flicking to QFxDrag or add a QFxFlick ??? + //### trackingEnabled? public: QFxMouseRegion(QFxItem *parent=0); ~QFxMouseRegion(); @@ -109,17 +112,22 @@ public: bool isEnabled() const; void setEnabled(bool); - bool hovered(); - bool pressed(); + bool hovered() const; + bool pressed() const; void setHovered(bool); void setPressed(bool); + Qt::MouseButtons acceptedButtons() const; + void setAcceptedButtons(Qt::MouseButtons buttons); + QFxDrag *drag(); Q_SIGNALS: void hoveredChanged(); void pressedChanged(); + void enabledChanged(); + void acceptedButtonsChanged(); void positionChanged(QFxMouseEvent *mouse); void pressed(QFxMouseEvent *mouse); diff --git a/src/declarative/fx/qfxmouseregion_p.h b/src/declarative/fx/qfxmouseregion_p.h index f03c334..1501a81 100644 --- a/src/declarative/fx/qfxmouseregion_p.h +++ b/src/declarative/fx/qfxmouseregion_p.h @@ -73,7 +73,7 @@ public: void init() { Q_Q(QFxMouseRegion); - q->setAcceptedMouseButtons(Qt::LeftButton | Qt::RightButton); + q->setAcceptedMouseButtons(Qt::LeftButton); q->setAcceptHoverEvents(true); } -- cgit v0.12 From 146abce0f1c6b5f019f3e8f6d191fb4c6cf5b9f7 Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Tue, 18 Aug 2009 12:19:24 +1000 Subject: Slightly change implementation of scope chain. Preparation for merge of QtScript's JSC backend. --- src/declarative/qml/qmlcontext.cpp | 3 +++ src/declarative/qml/qmlexpression.cpp | 13 +++---------- src/declarative/util/qmlscript.cpp | 21 ++++----------------- 3 files changed, 10 insertions(+), 27 deletions(-) diff --git a/src/declarative/qml/qmlcontext.cpp b/src/declarative/qml/qmlcontext.cpp index 451dbcc..009c799 100644 --- a/src/declarative/qml/qmlcontext.cpp +++ b/src/declarative/qml/qmlcontext.cpp @@ -105,6 +105,9 @@ void QmlContextPrivate::init() QScriptEngine *scriptEngine = QmlEnginePrivate::getScriptEngine(engine); QScriptValue scopeObj = scriptEngine->newObject(QmlEnginePrivate::get(engine)->contextClass, scriptEngine->newVariant(QVariant::fromValue((QObject*)q))); + //### no longer need to push global object once we switch to JSC (test with objects added to globalObject) + //if (parent) + // scopeChain = parent->d_func()->scopeChain; if (!parent) scopeChain.append(scriptEngine->globalObject()); else diff --git a/src/declarative/qml/qmlexpression.cpp b/src/declarative/qml/qmlexpression.cpp index f8e78d7..00454a1 100644 --- a/src/declarative/qml/qmlexpression.cpp +++ b/src/declarative/qml/qmlexpression.cpp @@ -225,13 +225,9 @@ QVariant QmlExpressionPrivate::evalQtScript() ctxtPriv->defaultObjects.insert(ctxtPriv->highPriorityCount, me); QScriptEngine *scriptEngine = QmlEnginePrivate::getScriptEngine(engine); - QScriptValueList oldScopeChain = - scriptEngine->currentContext()->scopeChain(); - - for (int i = 0; i < oldScopeChain.size(); ++i) - scriptEngine->currentContext()->popScope(); + QScriptContext *scriptContext = scriptEngine->pushContext(); for (int i = ctxtPriv->scopeChain.size() - 1; i > -1; --i) - scriptEngine->currentContext()->pushScope(ctxtPriv->scopeChain.at(i)); + scriptContext->pushScope(ctxtPriv->scopeChain.at(i)); if (!expressionFunctionValid) { @@ -305,10 +301,7 @@ QVariant QmlExpressionPrivate::evalQtScript() if (rv.isNull()) rv = svalue.toVariant(); - for (int i = 0; i < ctxtPriv->scopeChain.size(); ++i) - scriptEngine->currentContext()->popScope(); - for (int i = oldScopeChain.size() - 1; i > -1; --i) - scriptEngine->currentContext()->pushScope(oldScopeChain.at(i)); + scriptEngine->popContext(); return rv; } diff --git a/src/declarative/util/qmlscript.cpp b/src/declarative/util/qmlscript.cpp index 5651981..6bc21a2 100644 --- a/src/declarative/util/qmlscript.cpp +++ b/src/declarative/util/qmlscript.cpp @@ -187,18 +187,11 @@ void QmlScriptPrivate::addScriptToEngine(const QString &script, const QString &s QmlContext *context = qmlContext(q); QScriptEngine *scriptEngine = QmlEnginePrivate::getScriptEngine(engine); - QScriptContext *currentContext = scriptEngine->currentContext(); - QScriptValueList oldScopeChain = currentContext->scopeChain(); - QScriptValue oldact = currentContext->activationObject(); - - for (int i = 0; i < oldScopeChain.size(); ++i) { - currentContext->popScope(); - } + QScriptContext *scriptContext = scriptEngine->pushContext(); for (int i = context->d_func()->scopeChain.size() - 1; i > -1; --i) { - currentContext->pushScope(context->d_func()->scopeChain.at(i)); + scriptContext->pushScope(context->d_func()->scopeChain.at(i)); } - - currentContext->setActivationObject(context->d_func()->scopeChain.at(0)); + scriptContext->setActivationObject(context->d_func()->scopeChain.at(0)); QScriptValue val = scriptEngine->evaluate(script, source); if (scriptEngine->hasUncaughtException()) { @@ -215,13 +208,7 @@ void QmlScriptPrivate::addScriptToEngine(const QString &script, const QString &s } } - currentContext->setActivationObject(oldact); - - for (int i = 0; i < context->d_func()->scopeChain.size(); ++i) - currentContext->popScope(); - - for (int i = oldScopeChain.size() - 1; i > -1; --i) - currentContext->pushScope(oldScopeChain.at(i)); + scriptEngine->popContext(); } QT_END_NAMESPACE -- cgit v0.12 From e03276273b77006df4fe7bad4361998a8f894466 Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Tue, 18 Aug 2009 14:51:33 +1000 Subject: Some Text cleanup. --- src/declarative/fx/qfxtext.cpp | 13 ++++++------- src/declarative/fx/qfxtext.h | 9 +++------ src/declarative/fx/qfxtextedit.h | 6 +++--- 3 files changed, 12 insertions(+), 16 deletions(-) diff --git a/src/declarative/fx/qfxtext.cpp b/src/declarative/fx/qfxtext.cpp index 11fef69..216374c 100644 --- a/src/declarative/fx/qfxtext.cpp +++ b/src/declarative/fx/qfxtext.cpp @@ -480,13 +480,6 @@ void QFxText::setElideMode(Qt::TextElideMode mode) d->updateSize(); } - -QString QFxText::activeLink() const -{ - Q_D(const QFxText); - return d->activeLink; -} - void QFxText::geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) { @@ -854,6 +847,12 @@ void QFxText::mousePressEvent(QGraphicsSceneMouseEvent *event) } /*! + \qmlsignal Text::linkActivated(link) + + This handler is called when the user clicks on a link embedded in the text. +*/ + +/*! \overload Handles the given mouse \a event. */ diff --git a/src/declarative/fx/qfxtext.h b/src/declarative/fx/qfxtext.h index edf6031..4349432 100644 --- a/src/declarative/fx/qfxtext.h +++ b/src/declarative/fx/qfxtext.h @@ -68,7 +68,6 @@ class Q_DECLARATIVE_EXPORT QFxText : public QFxItem Q_PROPERTY(bool wrap READ wrap WRITE setWrap) Q_PROPERTY(TextFormat textFormat READ textFormat WRITE setTextFormat) Q_PROPERTY(Qt::TextElideMode elide READ elideMode WRITE setElideMode) - Q_PROPERTY(QString activeLink READ activeLink) public: QFxText(QFxItem *parent=0); @@ -84,9 +83,9 @@ public: Outline, Raised, Sunken }; - enum TextFormat { AutoText, - PlainText, - RichText }; + enum TextFormat { PlainText = Qt::PlainText, + RichText = Qt::RichText, + AutoText = Qt::AutoText}; QString text() const; void setText(const QString &); @@ -118,8 +117,6 @@ public: Qt::TextElideMode elideMode() const; void setElideMode(Qt::TextElideMode); - QString activeLink() const; - void paint(QPainter *, const QStyleOptionGraphicsItem *, QWidget *); virtual void componentComplete(); diff --git a/src/declarative/fx/qfxtextedit.h b/src/declarative/fx/qfxtextedit.h index f2f163b..752a174 100644 --- a/src/declarative/fx/qfxtextedit.h +++ b/src/declarative/fx/qfxtextedit.h @@ -103,9 +103,9 @@ public: }; enum TextFormat { - AutoText, - PlainText, - RichText, + PlainText = Qt::PlainText, + RichText = Qt::RichText, + AutoText = Qt::AutoText }; QString text() const; -- cgit v0.12 From da856f75cc7631d09647adaf76cbaa9d1c0405b0 Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Tue, 18 Aug 2009 14:53:53 +1000 Subject: Proposed changes following API review. --- src/declarative/fx/qfxlineedit.h | 14 ++++++++------ src/declarative/fx/qfxtext.h | 20 ++++++++++---------- src/declarative/fx/qfxtextedit.h | 23 ++++++++++------------- 3 files changed, 28 insertions(+), 29 deletions(-) diff --git a/src/declarative/fx/qfxlineedit.h b/src/declarative/fx/qfxlineedit.h index 0218fb0..1f4a5c6 100644 --- a/src/declarative/fx/qfxlineedit.h +++ b/src/declarative/fx/qfxlineedit.h @@ -55,6 +55,7 @@ QT_MODULE(Declarative) class QFxLineEditPrivate; class QValidator; +//### class QFxTextInput?? class Q_DECLARATIVE_EXPORT QFxLineEdit : public QFxPaintedItem { Q_OBJECT @@ -62,10 +63,10 @@ class Q_DECLARATIVE_EXPORT QFxLineEdit : public QFxPaintedItem Q_PROPERTY(QString text READ text WRITE setText NOTIFY textChanged) Q_PROPERTY(QColor color READ color WRITE setColor) - Q_PROPERTY(QColor highlightColor READ highlightColor WRITE setHighlightColor) - Q_PROPERTY(QColor highlightedTextColor READ highlightedTextColor WRITE setHighlightedTextColor) + Q_PROPERTY(QColor highlightColor READ highlightColor WRITE setHighlightColor) //### selectionColor + Q_PROPERTY(QColor highlightedTextColor READ highlightedTextColor WRITE setHighlightedTextColor) //### selectedTextColor Q_PROPERTY(QFont font READ font WRITE setFont) - Q_PROPERTY(HAlignment hAlign READ hAlign WRITE setHAlign) + Q_PROPERTY(HAlignment hAlign READ hAlign WRITE setHAlign) //### horizontalAlignment Q_PROPERTY(bool readOnly READ isReadOnly WRITE setReadOnly) Q_PROPERTY(bool cursorVisible READ isCursorVisible WRITE setCursorVisible) @@ -75,11 +76,12 @@ class Q_DECLARATIVE_EXPORT QFxLineEdit : public QFxPaintedItem Q_PROPERTY(int selectionEnd READ selectionEnd WRITE setSelectionEnd NOTIFY selectionEndChanged) Q_PROPERTY(QString selectedText READ selectedText NOTIFY selectedTextChanged) - Q_PROPERTY(int maxLength READ maxLength WRITE setMaxLength) - Q_PROPERTY(QObject* validator READ validator WRITE setValidator) + Q_PROPERTY(int maxLength READ maxLength WRITE setMaxLength) //### maximumLength + Q_PROPERTY(QObject* validator READ validator WRITE setValidator) //### QValidator * Q_PROPERTY(QString inputMask READ inputMask WRITE setInputMask) Q_PROPERTY(bool acceptableInput READ hasAcceptableInput NOTIFY acceptableInputChanged) - Q_PROPERTY(uint echoMode READ echoMode WRITE setEchoMode) + Q_PROPERTY(uint echoMode READ echoMode WRITE setEchoMode) //### enum + //### Q_PROPERTY(bool focusOnPress READ focusOnPress WRITE setFocusOnPress) public: QFxLineEdit(QFxItem* parent=0); diff --git a/src/declarative/fx/qfxtext.h b/src/declarative/fx/qfxtext.h index edf6031..8eb19f4 100644 --- a/src/declarative/fx/qfxtext.h +++ b/src/declarative/fx/qfxtext.h @@ -63,12 +63,12 @@ class Q_DECLARATIVE_EXPORT QFxText : public QFxItem Q_PROPERTY(QColor color READ color WRITE setColor) Q_PROPERTY(TextStyle style READ style WRITE setStyle) Q_PROPERTY(QColor styleColor READ styleColor WRITE setStyleColor) - Q_PROPERTY(HAlignment hAlign READ hAlign WRITE setHAlign) - Q_PROPERTY(VAlignment vAlign READ vAlign WRITE setVAlign) - Q_PROPERTY(bool wrap READ wrap WRITE setWrap) + Q_PROPERTY(HAlignment hAlign READ hAlign WRITE setHAlign) // ### horizontalAlignment? + Q_PROPERTY(VAlignment vAlign READ vAlign WRITE setVAlign) // ### verticalAlignment? + 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) - Q_PROPERTY(QString activeLink READ activeLink) + Q_PROPERTY(Qt::TextElideMode elide READ elideMode WRITE setElideMode) //### elideMode? + Q_PROPERTY(QString activeLink READ activeLink) // ### remove public: QFxText(QFxItem *parent=0); @@ -84,9 +84,9 @@ public: Outline, Raised, Sunken }; - enum TextFormat { AutoText, - PlainText, - RichText }; + enum TextFormat { PlainText = Qt::PlainText, + RichText = Qt::RichText, + AutoText = Qt::AutoText }; QString text() const; void setText(const QString &); @@ -118,7 +118,7 @@ public: Qt::TextElideMode elideMode() const; void setElideMode(Qt::TextElideMode); - QString activeLink() const; + QString activeLink() const; // ### remove void paint(QPainter *, const QStyleOptionGraphicsItem *, QWidget *); @@ -126,7 +126,7 @@ public: Q_SIGNALS: void textChanged(const QString &text); - void linkActivated(const QString &link); + void linkActivated(const QString &link); // ### document protected: QFxText(QFxTextPrivate &dd, QFxItem *parent); diff --git a/src/declarative/fx/qfxtextedit.h b/src/declarative/fx/qfxtextedit.h index f2f163b..0bdf16a 100644 --- a/src/declarative/fx/qfxtextedit.h +++ b/src/declarative/fx/qfxtextedit.h @@ -56,9 +56,8 @@ QT_BEGIN_HEADER QT_BEGIN_NAMESPACE QT_MODULE(Declarative) -/*! -WARNING: SHORT TERM CLASS. INTENDED TO MERGE INTO QFxTextItem -*/ + + class QFxTextEditPrivate; class Q_DECLARATIVE_EXPORT QFxTextEdit : public QFxPaintedItem { @@ -69,12 +68,12 @@ class Q_DECLARATIVE_EXPORT QFxTextEdit : public QFxPaintedItem Q_PROPERTY(QString text READ text WRITE setText NOTIFY textChanged) Q_PROPERTY(QColor color READ color WRITE setColor) - Q_PROPERTY(QColor highlightColor READ highlightColor WRITE setHighlightColor) - Q_PROPERTY(QColor highlightedTextColor READ highlightedTextColor WRITE setHighlightedTextColor) + Q_PROPERTY(QColor highlightColor READ highlightColor WRITE setHighlightColor) //### selectionColor + Q_PROPERTY(QColor highlightedTextColor READ highlightedTextColor WRITE setHighlightedTextColor) //### selectedTextColor Q_PROPERTY(QFont font READ font WRITE setFont) - Q_PROPERTY(HAlignment hAlign READ hAlign WRITE setHAlign) - Q_PROPERTY(VAlignment vAlign READ vAlign WRITE setVAlign) - Q_PROPERTY(bool wrap READ wrap WRITE setWrap) + Q_PROPERTY(HAlignment hAlign READ hAlign WRITE setHAlign) //### horizontalAlignment + Q_PROPERTY(VAlignment vAlign READ vAlign WRITE setVAlign) //### verticalAlignment + Q_PROPERTY(bool wrap READ wrap WRITE setWrap) //### other wrap modes Q_PROPERTY(TextFormat textFormat READ textFormat WRITE setTextFormat) Q_PROPERTY(bool readOnly READ isReadOnly WRITE setReadOnly) Q_PROPERTY(bool cursorVisible READ isCursorVisible WRITE setCursorVisible) @@ -102,11 +101,9 @@ public: AlignVCenter = Qt::AlignVCenter }; - enum TextFormat { - AutoText, - PlainText, - RichText, - }; + enum TextFormat { PlainText = Qt::PlainText, + RichText = Qt::RichText, + AutoText = Qt::AutoText }; QString text() const; void setText(const QString &); -- cgit v0.12