From 2411b42ff4638bc1a707ab9ebe9fbadf2a4a0292 Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Fri, 31 Jul 2009 11:52:29 +1000 Subject: Rename Rect.pen to Rect.border --- demos/declarative/calculator/calculator.qml | 2 +- demos/declarative/contacts/contacts.qml | 2 +- demos/declarative/flickr/content/ImageDetails.qml | 4 +- demos/declarative/flickr/content/Progress.qml | 2 +- demos/declarative/flickr/content/ScrollBar.qml | 4 +- demos/declarative/flickr/content/Slider.qml | 2 +- demos/declarative/samegame/SameGame.qml | 2 +- demos/declarative/samegame/content/Button.qml | 2 +- demos/declarative/samegame/content/Dialog.qml | 2 +- examples/declarative/behaviours/MyRect.qml | 2 +- examples/declarative/flowview/flickr.qml | 2 +- examples/declarative/flowview/rect.qml | 2 +- examples/declarative/listview/recipes.qml | 2 +- examples/declarative/loader/Browser.qml | 4 +- examples/declarative/loader/Button.qml | 2 +- examples/declarative/states/states.qml | 6 +- examples/declarative/states/transitions.qml | 6 +- .../contacts/1_Drawing_and_Animation/GroupBox.qml | 2 +- .../tutorials/contacts/2_Reuse/GroupBox.qml | 2 +- .../tutorials/contacts/3_Collections/GroupBox.qml | 2 +- examples/declarative/velocity/Day.qml | 2 +- src/declarative/fx/qfxrect.cpp | 73 ++++++---------------- src/declarative/fx/qfxrect.h | 4 +- 23 files changed, 48 insertions(+), 85 deletions(-) diff --git a/demos/declarative/calculator/calculator.qml b/demos/declarative/calculator/calculator.qml index 1cc8fa8..576fea9 100644 --- a/demos/declarative/calculator/calculator.qml +++ b/demos/declarative/calculator/calculator.qml @@ -12,7 +12,7 @@ Rect { Rect { id: Container width: 316; height: 60; z: 2 - pen.color: "white"; color: "#343434" + border.color: "white"; color: "#343434" Text { id: CurNum diff --git a/demos/declarative/contacts/contacts.qml b/demos/declarative/contacts/contacts.qml index 6bd7b21..ecafd20 100644 --- a/demos/declarative/contacts/contacts.qml +++ b/demos/declarative/contacts/contacts.qml @@ -213,7 +213,7 @@ Rect { highlight: [ Rect { id: contactHighlight - pen.width: 0 + border.width: 0 color: 'white' opacity: contacts.mode == 'list' ? 1 : 0 opacity: Behavior { diff --git a/demos/declarative/flickr/content/ImageDetails.qml b/demos/declarative/flickr/content/ImageDetails.qml index 2be0e4d..9d5f069 100644 --- a/demos/declarative/flickr/content/ImageDetails.qml +++ b/demos/declarative/flickr/content/ImageDetails.qml @@ -30,7 +30,7 @@ Flipable { Rect { anchors.fill: parent color: "black"; opacity: 0.4 - pen.color: "white"; pen.width: 2 + border.color: "white"; border.width: 2 } MediaButton { @@ -77,7 +77,7 @@ Flipable { back: Item { anchors.fill: Container - Rect { anchors.fill: parent; color: "black"; opacity: 0.4; pen.color: "white"; pen.width: 2 } + Rect { anchors.fill: parent; color: "black"; opacity: 0.4; border.color: "white"; border.width: 2 } Progress { anchors.centerIn: parent; width: 200; height: 18; progress: BigImage.progress; visible: BigImage.status } Flickable { diff --git a/demos/declarative/flickr/content/Progress.qml b/demos/declarative/flickr/content/Progress.qml index 4b092ca..ae6bb18 100644 --- a/demos/declarative/flickr/content/Progress.qml +++ b/demos/declarative/flickr/content/Progress.qml @@ -7,7 +7,7 @@ Item { Rect { id: Container; anchors.fill: parent - pen.color: "white"; pen.width: 0; radius: height/2 - 2 + border.color: "white"; border.width: 0; radius: height/2 - 2 gradient: Gradient { GradientStop { position: 0; color: "#66343434" } GradientStop { position: 1.0; color: "#66000000" } diff --git a/demos/declarative/flickr/content/ScrollBar.qml b/demos/declarative/flickr/content/ScrollBar.qml index 25dca98..e9a461c 100644 --- a/demos/declarative/flickr/content/ScrollBar.qml +++ b/demos/declarative/flickr/content/ScrollBar.qml @@ -9,8 +9,8 @@ Item { radius: 5 color: "black" opacity: 0.3 - pen.color: "white" - pen.width: 2 + border.color: "white" + border.width: 2 x: 0 y: flickableArea.pageYPosition * Container.height width: parent.width diff --git a/demos/declarative/flickr/content/Slider.qml b/demos/declarative/flickr/content/Slider.qml index 4e88c1e..0c15ec6 100644 --- a/demos/declarative/flickr/content/Slider.qml +++ b/demos/declarative/flickr/content/Slider.qml @@ -12,7 +12,7 @@ Item { Rect { id: Container; anchors.fill: parent - pen.color: "white"; pen.width: 0; radius: 8 + border.color: "white"; border.width: 0; radius: 8 gradient: Gradient { GradientStop { position: 0.0; color: "#66343434" } GradientStop { position: 1.0; color: "#66000000" } diff --git a/demos/declarative/samegame/SameGame.qml b/demos/declarative/samegame/SameGame.qml index cb4737a..e74646d 100644 --- a/demos/declarative/samegame/SameGame.qml +++ b/demos/declarative/samegame/SameGame.qml @@ -9,7 +9,7 @@ Rect { Rect { id: gameCanvas property int score: 0 - z:20; y:20; color: "white"; pen.width: 1 + z:20; y:20; color: "white"; border.width: 1 width:parent.width - tileSize - (parent.width % tileSize); height:parent.height - tileSize - (parent.height % tileSize); anchors.horizontalCenter: parent.horizontalCenter diff --git a/demos/declarative/samegame/content/Button.qml b/demos/declarative/samegame/content/Button.qml index 152c996..c7a49f1 100644 --- a/demos/declarative/samegame/content/Button.qml +++ b/demos/declarative/samegame/content/Button.qml @@ -2,7 +2,7 @@ import Qt 4.6 Rect { id: page; color: activePalette.button; width: txtItem.width+20; height: txtItem.height+4 - pen.width: 1; pen.color: activePalette.mid; radius: 10; + border.width: 1; border.color: activePalette.mid; radius: 10; signal clicked property string text: "Button" gradient: Gradient { diff --git a/demos/declarative/samegame/content/Dialog.qml b/demos/declarative/samegame/content/Dialog.qml index 939f66f..7326d73 100644 --- a/demos/declarative/samegame/content/Dialog.qml +++ b/demos/declarative/samegame/content/Dialog.qml @@ -2,7 +2,7 @@ import Qt 4.6 Rect { id: page - color: "white"; pen.width: 1; width: 200; height: 60; + color: "white"; border.width: 1; width: 200; height: 60; property string text: "Hello World!" opacity: 0 opacity: Behavior { diff --git a/examples/declarative/behaviours/MyRect.qml b/examples/declarative/behaviours/MyRect.qml index 1ccf4db..199b33b 100644 --- a/examples/declarative/behaviours/MyRect.qml +++ b/examples/declarative/behaviours/MyRect.qml @@ -2,7 +2,7 @@ import Qt 4.6 Rect { radius: 15 - pen.color: "black" + border.color: "black" width: 100 height: 100 id: Page diff --git a/examples/declarative/flowview/flickr.qml b/examples/declarative/flowview/flickr.qml index 1cf0f73..2abf7a1 100644 --- a/examples/declarative/flowview/flickr.qml +++ b/examples/declarative/flowview/flickr.qml @@ -2,7 +2,7 @@ import Qt 4.6 Rect { radius: 5; - pen.width: 1; + border.width: 1; width:400; height: 120; color: background; diff --git a/examples/declarative/flowview/rect.qml b/examples/declarative/flowview/rect.qml index 9d81fa4..3fecf17 100644 --- a/examples/declarative/flowview/rect.qml +++ b/examples/declarative/flowview/rect.qml @@ -1,4 +1,4 @@ import Qt 4.6 -Rect { radius: 5; pen.width: 1; width:400; height: 120; color: background; } +Rect { radius: 5; border.width: 1; width:400; height: 120; color: background; } diff --git a/examples/declarative/listview/recipes.qml b/examples/declarative/listview/recipes.qml index 788e067..8b12527 100644 --- a/examples/declarative/listview/recipes.qml +++ b/examples/declarative/listview/recipes.qml @@ -24,7 +24,7 @@ Rect { Rect { id: background x: 1; y: 2; width: parent.width-2; height: parent.height-4 - color: "#FEFFEE"; pen.color: "#FFBE4F"; radius: 5 + color: "#FEFFEE"; border.color: "#FFBE4F"; radius: 5 } // This mouse region covers the entire delegate. // When clicked it changes mode to 'Details'. If we are already diff --git a/examples/declarative/loader/Browser.qml b/examples/declarative/loader/Browser.qml index 64df830..96c2a76 100644 --- a/examples/declarative/loader/Browser.qml +++ b/examples/declarative/loader/Browser.qml @@ -82,13 +82,13 @@ Rect { id: TitleBar width: parent.width height: 32 - color: activePalette.button; pen.color: activePalette.mid + color: activePalette.button; border.color: activePalette.mid Rect { id: UpButton width: 30 height: TitleBar.height - pen.color: activePalette.mid; color: "transparent" + border.color: activePalette.mid; color: "transparent" MouseRegion { anchors.fill: parent; onClicked: folders.folder = up(folders.folder) } Image { anchors.centerIn: parent; source: "images/up.png" } } diff --git a/examples/declarative/loader/Button.qml b/examples/declarative/loader/Button.qml index 562e04c..999e180 100644 --- a/examples/declarative/loader/Button.qml +++ b/examples/declarative/loader/Button.qml @@ -8,7 +8,7 @@ Rect { height: Text.height + 10 width: Text.width + 20 - pen.width: 1 + border.width: 1 radius: 4 color: "grey" MouseRegion { anchors.fill: parent; onClicked: Container.clicked() } diff --git a/examples/declarative/states/states.qml b/examples/declarative/states/states.qml index 431f0bc..c4c71b5 100644 --- a/examples/declarative/states/states.qml +++ b/examples/declarative/states/states.qml @@ -6,19 +6,19 @@ Rect { // A target region. Clicking in here sets the state to '' - the default state Rect { x: 0; y: 0; width: 50; height: 50 - color: "transparent"; pen.color: "black" + color: "transparent"; border.color: "black" MouseRegion { anchors.fill: parent; onClicked: { Page.state='' } } } // Another target region. Clicking in here sets the state to 'Position1' Rect { x: 150; y: 50; width: 50; height: 50 - color: "transparent"; pen.color: "black" + color: "transparent"; border.color: "black" MouseRegion { anchors.fill: parent; onClicked: { Page.state='Position1' } } } // Another target region. Clicking in here sets the state to 'Position2' Rect { x: 0; y: 200; width: 50; height: 50 - color: "transparent"; pen.color: "black" + color: "transparent"; border.color: "black" MouseRegion { anchors.fill: parent; onClicked: { Page.state='Position2' } } } // Rect which will be moved when my state changes diff --git a/examples/declarative/states/transitions.qml b/examples/declarative/states/transitions.qml index 7bc7f6c..63ed4d9 100644 --- a/examples/declarative/states/transitions.qml +++ b/examples/declarative/states/transitions.qml @@ -6,19 +6,19 @@ Rect { // A target region. Clicking in here sets the state to '' - the default state Rect { x: 0; y: 0; width: 50; height: 50 - color: "transparent"; pen.color: "black" + color: "transparent"; border.color: "black" MouseRegion { anchors.fill: parent; onClicked: { Page.state='' } } } // Another target region. Clicking in here sets the state to 'Position1' Rect { x: 150; y: 50; width: 50; height: 50 - color: "transparent"; pen.color: "black" + color: "transparent"; border.color: "black" MouseRegion { anchors.fill: parent; onClicked: { Page.state='Position1' } } } // Another target region. Clicking in here sets the state to 'Position2' Rect { x: 0; y: 200; width: 50; height: 50 - color: "transparent"; pen.color: "black" + color: "transparent"; border.color: "black" MouseRegion { anchors.fill: parent; onClicked: { Page.state='Position2' } } } // Rect which will be moved when my state changes diff --git a/examples/declarative/tutorials/contacts/1_Drawing_and_Animation/GroupBox.qml b/examples/declarative/tutorials/contacts/1_Drawing_and_Animation/GroupBox.qml index 29e00d9..d3f626f 100644 --- a/examples/declarative/tutorials/contacts/1_Drawing_and_Animation/GroupBox.qml +++ b/examples/declarative/tutorials/contacts/1_Drawing_and_Animation/GroupBox.qml @@ -16,7 +16,7 @@ FocusRealm { width: groupBox.width-20 height: groupBox.height-20 color: "white" - pen.color: "black" + border.color: "black" Loader { id: subItem source: groupBox.contents diff --git a/examples/declarative/tutorials/contacts/2_Reuse/GroupBox.qml b/examples/declarative/tutorials/contacts/2_Reuse/GroupBox.qml index 29e00d9..d3f626f 100644 --- a/examples/declarative/tutorials/contacts/2_Reuse/GroupBox.qml +++ b/examples/declarative/tutorials/contacts/2_Reuse/GroupBox.qml @@ -16,7 +16,7 @@ FocusRealm { width: groupBox.width-20 height: groupBox.height-20 color: "white" - pen.color: "black" + border.color: "black" Loader { id: subItem source: groupBox.contents diff --git a/examples/declarative/tutorials/contacts/3_Collections/GroupBox.qml b/examples/declarative/tutorials/contacts/3_Collections/GroupBox.qml index 29e00d9..d3f626f 100644 --- a/examples/declarative/tutorials/contacts/3_Collections/GroupBox.qml +++ b/examples/declarative/tutorials/contacts/3_Collections/GroupBox.qml @@ -16,7 +16,7 @@ FocusRealm { width: groupBox.width-20 height: groupBox.height-20 color: "white" - pen.color: "black" + border.color: "black" Loader { id: subItem source: groupBox.contents diff --git a/examples/declarative/velocity/Day.qml b/examples/declarative/velocity/Day.qml index 05e1f07..f7a5a47 100644 --- a/examples/declarative/velocity/Day.qml +++ b/examples/declarative/velocity/Day.qml @@ -7,7 +7,7 @@ Rect { width: 400 height: 500 radius: 7 - pen.color: "black" + border.color: "black" id: Page Image { x: 10 diff --git a/src/declarative/fx/qfxrect.cpp b/src/declarative/fx/qfxrect.cpp index c43e034..93a2997 100644 --- a/src/declarative/fx/qfxrect.cpp +++ b/src/declarative/fx/qfxrect.cpp @@ -52,7 +52,6 @@ QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,Gradient,QFxGradient) /*! \internal \class QFxPen - \ingroup group_utility \brief The QFxPen class provides a pen used for drawing rect borders on a QFxView. By default, the pen is invalid and nothing is drawn. You must either set a color (then the default @@ -62,12 +61,12 @@ QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,Gradient,QFxGradient) Example: \qml - Rect { pen.width: 2; pen.color: "red" ... } + Rect { border.width: 2; border.color: "red" ... } \endqml */ /*! \property QFxPen::width - \brief the width of the pen. + \brief the width of the border. A width of 1 is a single-pixel line on the border of the item being painted. @@ -76,17 +75,17 @@ QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,Gradient,QFxGradient) /*! \property QFxPen::color - \brief the color of the pen. + \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 { pen.color: "#00FF00" } + Rect { border.color: "#00FF00" } // rect with steelblue border using SVG color name - Rect { pen.color: "steelblue" } + Rect { border.color: "steelblue" } \endqml For the full set of ways to specify color, see Qt's QColor::setNamedColor documentation. @@ -101,10 +100,10 @@ void QFxPen::setColor(const QColor &c) /*! \property QFxPen::width - \brief the width of the pen. + \brief the width of the border. \qml - Rect { pen.width: 4 } + 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. @@ -200,8 +199,8 @@ QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,Rect,QFxRect) width: 100 height: 100 color: "red" - pen.color: "black" - pen.width: 5 + border.color: "black" + border.width: 5 radius: 10 } \endqml @@ -213,26 +212,6 @@ QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,Rect,QFxRect) \internal \class QFxRect \brief The QFxRect class provides a rect item that you can add to a QFxView. - - A Rect is painted having a solid fill (color) and an optional border (pen). - You can also create rounded rectangles using the radius property. - - \qml - Rect { - width: 100 - height: 100 - color: "red" - pen.color: "black" - pen.width: 5 - radius: 10 - } - \endqml - - \image declarative-rect.png - - A QFxRect object can be instantiated in Qml using the tag \l Rect. - - \ingroup group_coreitems */ QFxRect::QFxRect(QFxItem *parent) : QFxItem(*(new QFxRectPrivate), parent) @@ -260,16 +239,17 @@ void QFxRect::doUpdate() } /*! - \qmlproperty int Rect::pen.width - \qmlproperty color Rect::pen.color + \qmlproperty int Rect::border.width + \qmlproperty color Rect::border.color - The pen used to draw the border of the rect. -*/ -/*! - \property QFxRect::pen - \brief the pen used to draw the border of the rect. + The width and color used to draw the border of the rect. + + 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 widths cause the rect to be painted at + a half-pixel offset; */ -QFxPen *QFxRect::pen() +QFxPen *QFxRect::border() { Q_D(QFxRect); return d->getPen(); @@ -335,11 +315,6 @@ void QFxRect::setGradient(QFxGradient *gradient) painted as a normal rectangle. The same radius is used by all 4 corners; there is currently no way to specify different radii for different corners. */ - -/*! - \property QFxRect::radius - \brief the corner radius used to draw a rounded rect. -*/ qreal QFxRect::radius() const { Q_D(const QFxRect); @@ -371,11 +346,6 @@ void QFxRect::setRadius(qreal radius) The default color is white. */ - -/*! - \property QFxRect::color - \brief the color used to fill the rect. -*/ QColor QFxRect::color() const { Q_D(const QFxRect); @@ -393,8 +363,6 @@ void QFxRect::setColor(const QColor &c) update(); } - - /*! \qmlproperty color Rect::tintColor This property holds The color to tint the rectangle. @@ -409,11 +377,6 @@ void QFxRect::setColor(const QColor &c) This attribute is not intended to be used with a single color over the lifetime of an user interface. It is most useful when a subtle change is intended to be conveyed due to some event; you can then use the tint color to more effectively tune the visible color. */ - -/*! - \property QFxRect::tintColor - \brief The color to tint the rectangle. -*/ QColor QFxRect::tintColor() const { Q_D(const QFxRect); diff --git a/src/declarative/fx/qfxrect.h b/src/declarative/fx/qfxrect.h index d438459..98f5e67 100644 --- a/src/declarative/fx/qfxrect.h +++ b/src/declarative/fx/qfxrect.h @@ -138,7 +138,7 @@ class Q_DECLARATIVE_EXPORT QFxRect : public QFxItem Q_PROPERTY(QColor color READ color WRITE setColor) Q_PROPERTY(QColor tintColor READ tintColor WRITE setTintColor) Q_PROPERTY(QFxGradient *gradient READ gradient WRITE setGradient) - Q_PROPERTY(QFxPen * pen READ pen) + Q_PROPERTY(QFxPen * border READ border) Q_PROPERTY(qreal radius READ radius WRITE setRadius) public: QFxRect(QFxItem *parent=0); @@ -149,7 +149,7 @@ public: QColor tintColor() const; void setTintColor(const QColor &); - QFxPen *pen(); + QFxPen *border(); QFxGradient *gradient() const; void setGradient(QFxGradient *gradient); -- cgit v0.12