diff options
author | Warwick Allison <warwick.allison@nokia.com> | 2009-09-08 03:48:58 (GMT) |
---|---|---|
committer | Warwick Allison <warwick.allison@nokia.com> | 2009-09-08 03:48:58 (GMT) |
commit | 0e4fce8fe2023ce6e16096c55b429c7e16899e19 (patch) | |
tree | f78fe3a8bae7f36d4a96326cb50bc724bb47dc23 /examples | |
parent | 28ccffc53df374f7b890510f481e2dae2e01ed74 (diff) | |
parent | 58c35181a67aaa3d02ad5055303ec48777e47b8c (diff) | |
download | Qt-0e4fce8fe2023ce6e16096c55b429c7e16899e19.zip Qt-0e4fce8fe2023ce6e16096c55b429c7e16899e19.tar.gz Qt-0e4fce8fe2023ce6e16096c55b429c7e16899e19.tar.bz2 |
Merge branch 'kinetic-declarativeui' of git@scm.dev.nokia.troll.no:qt/kinetic into kinetic-declarativeui
Diffstat (limited to 'examples')
-rw-r--r-- | examples/declarative/tutorials/helloworld/t3/tutorial3.qml | 4 | ||||
-rw-r--r-- | examples/effects/customshader/blureffect.cpp | 4 | ||||
-rw-r--r-- | examples/effects/customshader/blureffect.h | 4 | ||||
-rw-r--r-- | examples/effects/customshader/customshadereffect.h | 2 | ||||
-rw-r--r-- | examples/graphicsview/flowlayout/flowlayout.cpp | 28 | ||||
-rw-r--r-- | examples/graphicsview/flowlayout/main.cpp | 1 | ||||
-rw-r--r-- | examples/graphicsview/flowlayout/window.cpp | 2 |
7 files changed, 25 insertions, 20 deletions
diff --git a/examples/declarative/tutorials/helloworld/t3/tutorial3.qml b/examples/declarative/tutorials/helloworld/t3/tutorial3.qml index 81e1f6a..426640d 100644 --- a/examples/declarative/tutorials/helloworld/t3/tutorial3.qml +++ b/examples/declarative/tutorials/helloworld/t3/tutorial3.qml @@ -15,7 +15,7 @@ Rectangle { states: [ State { name: "down" - when: MouseRegion.pressed == true + when: MouseRegionId.pressed == true PropertyChanges { target: HelloText y: 160 @@ -39,7 +39,7 @@ Rectangle { } ] } - MouseRegion { id: MouseRegion; anchors.fill: HelloText } + MouseRegion { id: MouseRegionId; anchors.fill: HelloText } Grid { id: ColorPicker x: 0 diff --git a/examples/effects/customshader/blureffect.cpp b/examples/effects/customshader/blureffect.cpp index 6fe8e86..f9e046e 100644 --- a/examples/effects/customshader/blureffect.cpp +++ b/examples/effects/customshader/blureffect.cpp @@ -56,10 +56,10 @@ void BlurEffect::adjustForItem() setBlurRadius(radius); } -QRectF BlurEffect::boundingRectFor(const QRectF &rect) const +QRectF BlurEffect::boundingRect() const { const_cast<BlurEffect *>(this)->adjustForItem(); - return QGraphicsBlurEffect::boundingRectFor(rect); + return QGraphicsBlurEffect::boundingRect(); } void BlurEffect::draw(QPainter *painter, QGraphicsEffectSource *source) diff --git a/examples/effects/customshader/blureffect.h b/examples/effects/customshader/blureffect.h index 0cafd80..7c12ccf 100644 --- a/examples/effects/customshader/blureffect.h +++ b/examples/effects/customshader/blureffect.h @@ -52,9 +52,9 @@ public: void setBaseLine(qreal y) { m_baseLine = y; } - QRectF boundingRectFor(const QRectF &) const; + QRectF boundingRect() const; - void draw(QPainter *painter, QGraphicsEffectSource*); + void draw(QPainter *painter, QGraphicsEffectSource *source); private: void adjustForItem(); diff --git a/examples/effects/customshader/customshadereffect.h b/examples/effects/customshader/customshadereffect.h index 9ba5f15..6892d96 100644 --- a/examples/effects/customshader/customshadereffect.h +++ b/examples/effects/customshader/customshadereffect.h @@ -43,7 +43,7 @@ #define CUSTOMSHADEREFFECT_H #include <QGraphicsEffect> -#include <QGraphicsShaderEffect> +#include <QtOpenGL/private/qgraphicsshadereffect_p.h> #include <QGraphicsItem> class CustomShaderEffect: public QGraphicsShaderEffect diff --git a/examples/graphicsview/flowlayout/flowlayout.cpp b/examples/graphicsview/flowlayout/flowlayout.cpp index d4fc49d..32a2830 100644 --- a/examples/graphicsview/flowlayout/flowlayout.cpp +++ b/examples/graphicsview/flowlayout/flowlayout.cpp @@ -98,12 +98,10 @@ void FlowLayout::setGeometry(const QRectF &geom) qreal FlowLayout::doLayout(const QRectF &geom, bool applyNewGeometry) const { - QPointF tl = geom.topLeft(); - qreal maxw = geom.width(); - qreal left, top, right, bottom; getContentsMargins(&left, &top, &right, &bottom); - maxw = maxw - left - right; + const qreal maxw = geom.width() - left - right; + qreal x = 0; qreal y = 0; qreal maxRowHeight = 0; @@ -139,9 +137,11 @@ QSizeF FlowLayout::minSize(const QSizeF &constraint) const QSizeF size(0, 0); qreal left, top, right, bottom; getContentsMargins(&left, &top, &right, &bottom); - if (constraint.width() > 0) { // height for width - qreal height = doLayout(QRectF(QPointF(0,0), constraint), false); + if (constraint.width() >= 0) { // height for width + const qreal height = doLayout(QRectF(QPointF(0,0), constraint), false); size = QSizeF(constraint.width(), height); + } else if (constraint.height() >= 0) { // width for height? + // not supported } else { QGraphicsLayoutItem *item; foreach (item, m_items) @@ -153,8 +153,8 @@ QSizeF FlowLayout::minSize(const QSizeF &constraint) const QSizeF FlowLayout::prefSize() const { - qreal left, top, right, bottom; - getContentsMargins(&left, &top, &right, &bottom); + qreal left, right; + getContentsMargins(&left, 0, &right, 0); QGraphicsLayoutItem *item; qreal maxh = 0; @@ -196,15 +196,19 @@ QSizeF FlowLayout::maxSize() const QSizeF FlowLayout::sizeHint(Qt::SizeHint which, const QSizeF &constraint) const { + QSizeF sh = constraint; switch (which) { case Qt::PreferredSize: - return prefSize(); + sh = prefSize(); + break; case Qt::MinimumSize: - return minSize(constraint); + sh = minSize(constraint); + break; case Qt::MaximumSize: - return maxSize(); + sh = maxSize(); + break; default: break; } - return constraint; + return sh; } diff --git a/examples/graphicsview/flowlayout/main.cpp b/examples/graphicsview/flowlayout/main.cpp index 206f604..e672ae6 100644 --- a/examples/graphicsview/flowlayout/main.cpp +++ b/examples/graphicsview/flowlayout/main.cpp @@ -50,6 +50,7 @@ int main(int argc, char **argv) QGraphicsView *view = new QGraphicsView(&scene); Window *w = new Window; scene.addItem(w); + view->resize(400, 300); view->show(); return app.exec(); } diff --git a/examples/graphicsview/flowlayout/window.cpp b/examples/graphicsview/flowlayout/window.cpp index 2d98026..017659a 100644 --- a/examples/graphicsview/flowlayout/window.cpp +++ b/examples/graphicsview/flowlayout/window.cpp @@ -49,7 +49,7 @@ Window::Window() { FlowLayout *lay = new FlowLayout; QLatin1String wiseWords("I am not bothered by the fact that I am unknown." - "I am bothered when I do not know others. (Confucius)"); + " I am bothered when I do not know others. (Confucius)"); QString sentence(wiseWords); QStringList words = sentence.split(QLatin1Char(' '), QString::SkipEmptyParts); for (int i = 0; i < words.count(); ++i) { |