summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorMartin Jones <martin.jones@nokia.com>2009-09-08 00:14:12 (GMT)
committerMartin Jones <martin.jones@nokia.com>2009-09-08 00:14:12 (GMT)
commitf6c08f5e68c90338a8402c0912cd6be72e84b1e6 (patch)
treed928f975e686b752cd1fc47eca812f376d9d0a03 /examples
parent276a44c0867a76a90b425baa8dcbda733d25b3fb (diff)
parent0cbbc9cb9e87a3a39ee1597f4cea1c2b77d8f8da (diff)
downloadQt-f6c08f5e68c90338a8402c0912cd6be72e84b1e6.zip
Qt-f6c08f5e68c90338a8402c0912cd6be72e84b1e6.tar.gz
Qt-f6c08f5e68c90338a8402c0912cd6be72e84b1e6.tar.bz2
Merge branch '4.6' of git@scm.dev.nokia.troll.no:qt/qt into kinetic-declarativeui
Diffstat (limited to 'examples')
-rw-r--r--examples/effects/customshader/blureffect.cpp4
-rw-r--r--examples/effects/customshader/blureffect.h4
-rw-r--r--examples/effects/customshader/customshadereffect.h2
-rw-r--r--examples/graphicsview/flowlayout/flowlayout.cpp28
-rw-r--r--examples/graphicsview/flowlayout/main.cpp1
-rw-r--r--examples/graphicsview/flowlayout/window.cpp2
6 files changed, 23 insertions, 18 deletions
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) {