summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Jones <martin.jones@nokia.com>2010-04-07 04:03:14 (GMT)
committerMartin Jones <martin.jones@nokia.com>2010-04-07 04:03:14 (GMT)
commitdd9376a096fa4e50cb5c192fc66c749e0e60a467 (patch)
treeb8db380db6670c6bb4139c496695bbcd07c459e3
parentc380aeefbfa2cd1aa2d1d21f45101bfb058a40de (diff)
parentd4e0060d3e8961f0c802289dd6eebf9688be2fc7 (diff)
downloadQt-dd9376a096fa4e50cb5c192fc66c749e0e60a467.zip
Qt-dd9376a096fa4e50cb5c192fc66c749e0e60a467.tar.gz
Qt-dd9376a096fa4e50cb5c192fc66c749e0e60a467.tar.bz2
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/qt-qml into 4.7
-rw-r--r--demos/declarative/minehunt/minehunt.qml274
-rw-r--r--doc/src/snippets/code/src.qdbus.qdbuspendingcall.cpp1
-rw-r--r--examples/qtconcurrent/map/main.cpp2
-rw-r--r--qmake/project.cpp15
-rw-r--r--src/dbus/qdbusserver.cpp2
-rw-r--r--src/gui/egl/qegl.cpp2
-rw-r--r--src/gui/graphicsview/qgraphicsitem.cpp3
-rw-r--r--src/gui/image/qimage.cpp7
-rw-r--r--src/gui/kernel/qeventdispatcher_mac.mm9
-rw-r--r--src/gui/painting/qtextureglyphcache.cpp14
-rw-r--r--src/gui/painting/qtextureglyphcache_p.h3
-rw-r--r--src/gui/styles/qgtkstyle_p.h5
12 files changed, 159 insertions, 178 deletions
diff --git a/demos/declarative/minehunt/minehunt.qml b/demos/declarative/minehunt/minehunt.qml
index 2ca6c4c..2798b4f 100644
--- a/demos/declarative/minehunt/minehunt.qml
+++ b/demos/declarative/minehunt/minehunt.qml
@@ -3,188 +3,142 @@ import "MinehuntCore" 1.0
Item {
id: field
- width: 370
- height: 480
-
- property int clickx : 0
- property int clicky : 0
-
- resources: [
- Component {
- id: tile
- Flipable {
- id: flipable
- width: 40
- height: 40
- property int angle: 0;
- transform: Rotation {
- origin.x: 20
- origin.y: 20
- axis.x: 1
- axis.z: 0
- angle: flipable.angle;
+ property int clickx: 0
+ property int clicky: 0
+
+ width: 450; height: 450
+
+ Component {
+ id: tile
+
+ Flipable {
+ id: flipable
+ property int angle: 0
+
+ width: 40; height: 40
+ transform: Rotation { origin.x: 20; origin.y: 20; axis.x: 1; axis.z: 0; angle: flipable.angle }
+
+ front: Image {
+ source: "MinehuntCore/pics/front.png"; width: 40; height: 40
+
+ Image {
+ anchors.horizontalCenter: parent.horizontalCenter; anchors.verticalCenter: parent.verticalCenter
+ source: "MinehuntCore/pics/flag.png"; opacity: modelData.hasFlag
+
+ Behavior on opacity { NumberAnimation { property: "opacity"; duration: 250 } }
}
- front: Image {
- source: "MinehuntCore/pics/front.png"
- width: 40
- height: 40
- Image {
- anchors.horizontalCenter: parent.horizontalCenter
- anchors.verticalCenter: parent.verticalCenter
- source: "MinehuntCore/pics/flag.png"
- opacity: modelData.hasFlag
- Behavior on opacity {
- NumberAnimation {
- property: "opacity"
- duration: 250
- }
- }
- }
+ }
+
+ back: Image {
+ source: "MinehuntCore/pics/back.png"
+ width: 40; height: 40
+
+ Text {
+ anchors.horizontalCenter: parent.horizontalCenter; anchors.verticalCenter: parent.verticalCenter
+ text: modelData.hint; color: "white"; font.bold: true
+ opacity: !modelData.hasMine && modelData.hint > 0
}
- back: Image {
- source: "MinehuntCore/pics/back.png"
- width: 40
- height: 40
- Text {
- anchors.horizontalCenter: parent.horizontalCenter
- anchors.verticalCenter: parent.verticalCenter
- text: modelData.hint
- color: "white"
- font.bold: true
- opacity: !modelData.hasMine && modelData.hint > 0
- }
- Image {
- anchors.horizontalCenter: parent.horizontalCenter
- anchors.verticalCenter: parent.verticalCenter
- source: "MinehuntCore/pics/bomb.png"
- opacity: modelData.hasMine
- }
- Explosion {
- id: expl
- }
+
+ Image {
+ anchors.horizontalCenter: parent.horizontalCenter; anchors.verticalCenter: parent.verticalCenter
+ source: "MinehuntCore/pics/bomb.png"; opacity: modelData.hasMine
}
- states: [
- State {
- name: "back"
- when: modelData.flipped
- PropertyChanges { target: flipable; angle: 180 }
- }
- ]
- transitions: [
- Transition {
- SequentialAnimation {
- PauseAnimation {
- duration: {
- var ret;
- if(flipable.parent != null)
- ret = Math.abs(flipable.parent.x-field.clickx)
- + Math.abs(flipable.parent.y-field.clicky);
- else
- ret = 0;
- if (ret > 0) {
- if (modelData.hasMine && modelData.flipped) {
- ret*3;
- } else {
- ret;
- }
- } else {
- 0;
- }
+
+ Explosion { id: expl }
+ }
+
+ states: State {
+ name: "back"; when: modelData.flipped
+ PropertyChanges { target: flipable; angle: 180 }
+ }
+
+ transitions: Transition {
+ SequentialAnimation {
+ PauseAnimation {
+ duration: {
+ var ret
+ if (flipable.parent != null)
+ ret = Math.abs(flipable.parent.x - field.clickx)
+ + Math.abs(flipable.parent.y - field.clicky)
+ else
+ ret = 0
+ if (ret > 0) {
+ if (modelData.hasMine && modelData.flipped) {
+ ret * 3
+ } else {
+ ret
}
+ } else {
+ 0
}
- NumberAnimation {
- easing.type: "InOutQuad"
- properties: "angle"
- }
- ScriptAction{
- script: if(modelData.hasMine && modelData.flipped){expl.explode = true;}
- }
- }
- }
- ]
- MouseArea {
- anchors.fill: parent
- acceptedButtons: Qt.LeftButton | Qt.RightButton
- onPressed: {
- field.clickx = flipable.parent.x;
- field.clicky = flipable.parent.y;
- var row = Math.floor(index/9);
- var col = index - (Math.floor(index/9) * 9);
- if (mouse.button==undefined || mouse.button==Qt.RightButton) {
- flag(row,col);
- } else {
- flip(row,col);
}
}
+ NumberAnimation { easing.type: "InOutQuad"; properties: "angle" }
+ ScriptAction { script: if (modelData.hasMine && modelData.flipped) { expl.explode = true } }
}
}
+
+ MouseArea {
+ anchors.fill: parent
+ acceptedButtons: Qt.LeftButton | Qt.RightButton
+ onClicked: {
+ field.clickx = flipable.parent.x
+ field.clicky = flipable.parent.y
+ var row = Math.floor(index / 9)
+ var col = index - (Math.floor(index / 9) * 9)
+ if (mouse.button == undefined || mouse.button == Qt.RightButton)
+ flag(row, col)
+ else
+ flip(row, col)
+ }
+ onPressAndHold: {
+ field.clickx = flipable.parent.x
+ field.clicky = flipable.parent.y
+ var row = Math.floor(index / 9)
+ var col = index - (Math.floor(index / 9) * 9)
+ flag(row, col)
+ }
+ }
}
- ]
- Image {
- source: "MinehuntCore/pics/No-Ones-Laughing-3.jpg"
- fillMode: Image.Tile
}
- Repeater {
- id: repeater
- model: tiles
- x: 1
- y: 1
- Component {
- Loader {
- sourceComponent: tile
- x: (index - (Math.floor(index/9) * 9)) * 41
- y: Math.floor(index/9) * 41
- }
+
+ Image { source: "MinehuntCore/pics/No-Ones-Laughing-3.jpg"; anchors.fill: parent; fillMode: Image.Tile }
+
+ Grid {
+ anchors.horizontalCenter: parent.horizontalCenter
+ columns: 9; spacing: 1
+
+ Repeater {
+ id: repeater
+ model: tiles
+ Component { Loader { sourceComponent: tile } }
}
}
+
Row {
id: gamedata
- // width: 370
- // height: 100
- y: 400
- x: 20
- spacing: 20
+ x: 20; spacing: 20
+ anchors.bottom: field.bottom; anchors.bottomMargin: 15
+
Column {
spacing: 2
- width: childrenRect.width
- Image {
- // x: 100
- // y: 20
- source: "MinehuntCore/pics/bomb-color.png"
- }
- Text {
- // x: 100
- // y: 60
- anchors.horizontalCenter: parent.horizontalCenter
- color: "white"
- text: numMines
- }
+ Image { source: "MinehuntCore/pics/bomb-color.png" }
+ Text { anchors.horizontalCenter: parent.horizontalCenter; color: "white"; text: numMines }
}
+
Column {
spacing: 2
- width: childrenRect.width
- Image {
- // x: 140
- // y: 20
- source: "MinehuntCore/pics/flag-color.png"
- }
- Text {
- // x: 140
- // y: 60
- anchors.horizontalCenter: parent.horizontalCenter
- color: "white"
- text: numFlags
- }
+ Image { source: "MinehuntCore/pics/flag-color.png" }
+ Text { anchors.horizontalCenter: parent.horizontalCenter; color: "white"; text: numFlags }
}
}
+
Image {
- y: 390
- anchors.right: field.right
- anchors.rightMargin: 20
- source: isPlaying ? 'MinehuntCore/pics/face-smile.png' : hasWon ? 'MinehuntCore/pics/face-smile-big.png': 'MinehuntCore/pics/face-sad.png'
- MouseArea {
- anchors.fill: parent
- onPressed: { reset() }
+ anchors.bottom: field.bottom; anchors.bottomMargin: 15
+ anchors.right: field.right; anchors.rightMargin: 20
+ source: isPlaying ? 'MinehuntCore/pics/face-smile.png'
+ : hasWon ? 'MinehuntCore/pics/face-smile-big.png': 'MinehuntCore/pics/face-sad.png'
+
+ MouseArea { anchors.fill: parent; onPressed: reset() }
}
- }
}
diff --git a/doc/src/snippets/code/src.qdbus.qdbuspendingcall.cpp b/doc/src/snippets/code/src.qdbus.qdbuspendingcall.cpp
index 94a9f68..2867bd5a 100644
--- a/doc/src/snippets/code/src.qdbus.qdbuspendingcall.cpp
+++ b/doc/src/snippets/code/src.qdbus.qdbuspendingcall.cpp
@@ -61,5 +61,6 @@ void MyClass::callFinishedSlot(QDBusPendingCallWatcher *call)
QByteArray data = reply.argumentAt<1>();
showReply(text, data);
}
+ call->deleteLater();
}
//! [1]
diff --git a/examples/qtconcurrent/map/main.cpp b/examples/qtconcurrent/map/main.cpp
index 6068d30..6afefca 100644
--- a/examples/qtconcurrent/map/main.cpp
+++ b/examples/qtconcurrent/map/main.cpp
@@ -67,7 +67,7 @@ int main(int argc, char *argv[])
// Use QtConcurrentBlocking::mapped to apply the scale function to all the
// images in the list.
- QList<QImage> thumbnails = QtConcurrent::blockingMapped(images, scale);
+ QList<QImage> thumbnails = QtConcurrent::blockingMapped<QList<QImage> >(images, scale);
return 0;
}
diff --git a/qmake/project.cpp b/qmake/project.cpp
index 01a3843..56707cf 100644
--- a/qmake/project.cpp
+++ b/qmake/project.cpp
@@ -3148,6 +3148,21 @@ QStringList &QMakeProject::values(const QString &_var, QMap<QString, QStringList
if (place[var].isEmpty())
place[var] = QStringList(epocRoot());
}
+#if defined(Q_OS_WIN32) && defined(Q_CC_MSVC)
+ else if(var.startsWith(QLatin1String("QMAKE_TARGET."))) {
+ QString ret, type = var.mid(13);
+ if(type == "arch") {
+ QString paths = qgetenv("PATH");
+ QString vcBin64 = qgetenv("VCINSTALLDIR").append("\\bin\\amd64");
+ QString vcBinX86_64 = qgetenv("VCINSTALLDIR").append("\\bin\\x86_amd64");
+ if(paths.contains(vcBin64,Qt::CaseInsensitive) || paths.contains(vcBinX86_64,Qt::CaseInsensitive))
+ ret = "x86_64";
+ else
+ ret = "x86";
+ }
+ place[var] = QStringList(ret);
+ }
+#endif
//qDebug("REPLACE [%s]->[%s]", qPrintable(var), qPrintable(place[var].join("::")));
return place[var];
}
diff --git a/src/dbus/qdbusserver.cpp b/src/dbus/qdbusserver.cpp
index 8f9323a..13b18a6 100644
--- a/src/dbus/qdbusserver.cpp
+++ b/src/dbus/qdbusserver.cpp
@@ -47,7 +47,7 @@ QT_BEGIN_NAMESPACE
/*!
\class QDBusServer
\inmodule QtDBus
- \since 4.2
+ \internal
\brief The QDBusServer class provides peer-to-peer communication
between processes on the same computer.
diff --git a/src/gui/egl/qegl.cpp b/src/gui/egl/qegl.cpp
index 498245c..6f215cc 100644
--- a/src/gui/egl/qegl.cpp
+++ b/src/gui/egl/qegl.cpp
@@ -556,7 +556,7 @@ EGLDisplay QEgl::display()
}
// Resolve the egl extension function pointers:
-#if !defined(EGL_KHR_image) && !defined(EGL_KHR_image_base)
+#if (defined(EGL_KHR_image) || defined(EGL_KHR_image_base)) && !defined(EGL_EGLEXT_PROTOTYPES)
if (QEgl::hasExtension("EGL_KHR_image") || QEgl::hasExtension("EGL_KHR_image_base")) {
eglCreateImageKHR = (_eglCreateImageKHR) eglGetProcAddress("eglCreateImageKHR");
eglDestroyImageKHR = (_eglDestroyImageKHR) eglGetProcAddress("eglDestroyImageKHR");
diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp
index 3245aec..150343e 100644
--- a/src/gui/graphicsview/qgraphicsitem.cpp
+++ b/src/gui/graphicsview/qgraphicsitem.cpp
@@ -7112,7 +7112,8 @@ void QGraphicsItem::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
// Root items that ignore transformations need to
// calculate their diff by mapping viewport coordinates
// directly to parent coordinates.
- QTransform viewToParentTransform = (item->transform().translate(item->d_ptr->pos.x(), item->d_ptr->pos.y()))
+ // COMBINE
+ QTransform viewToParentTransform = (item->d_func()->transformData->computedFullTransform().translate(item->d_ptr->pos.x(), item->d_ptr->pos.y()))
* (item->sceneTransform() * view->viewportTransform()).inverted();
currentParentPos = viewToParentTransform.map(QPointF(view->mapFromGlobal(event->screenPos())));
buttonDownParentPos = viewToParentTransform.map(QPointF(view->mapFromGlobal(event->buttonDownScreenPos(Qt::LeftButton))));
diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp
index 233c58d..ce1d6d3 100644
--- a/src/gui/image/qimage.cpp
+++ b/src/gui/image/qimage.cpp
@@ -5704,9 +5704,10 @@ void QImage::setAlphaChannel(const QImage &alphaChannel)
return;
}
- detach();
-
- *this = convertToFormat(QImage::Format_ARGB32_Premultiplied);
+ if (d->format == QImage::Format_ARGB32_Premultiplied)
+ detach();
+ else
+ *this = convertToFormat(QImage::Format_ARGB32_Premultiplied);
// Slight optimization since alphachannels are returned as 8-bit grays.
if (alphaChannel.d->depth == 8 && alphaChannel.isGrayscale()) {
diff --git a/src/gui/kernel/qeventdispatcher_mac.mm b/src/gui/kernel/qeventdispatcher_mac.mm
index 62e1e81..a7f1224 100644
--- a/src/gui/kernel/qeventdispatcher_mac.mm
+++ b/src/gui/kernel/qeventdispatcher_mac.mm
@@ -831,7 +831,14 @@ NSModalSession QEventDispatcherMacPrivate::currentModalSession()
QBoolBlocker block1(blockSendPostedEvents, true);
info.nswindow = window;
[(NSWindow*) info.nswindow retain];
- info.session = [NSApp beginModalSessionForWindow:window];
+ // When creating a modal session cocoa will rearrange the windows.
+ // In order to avoid windows to be put behind another we need to
+ // keep the window level.
+ {
+ int level = [window level];
+ info.session = [NSApp beginModalSessionForWindow:window];
+ [window setLevel:level];
+ }
}
currentModalSessionCached = info.session;
}
diff --git a/src/gui/painting/qtextureglyphcache.cpp b/src/gui/painting/qtextureglyphcache.cpp
index cf545be..9eda0ef 100644
--- a/src/gui/painting/qtextureglyphcache.cpp
+++ b/src/gui/painting/qtextureglyphcache.cpp
@@ -133,10 +133,13 @@ void QTextureGlyphCache::populate(QFontEngine *fontEngine, int numGlyphs, const
while (iter != listItemCoordinates.end()) {
Coord c = iter.value();
+ m_currentRowHeight = qMax(m_currentRowHeight, c.h + margin * 2);
+
if (m_cx + c.w > m_w) {
// no room on the current line, start new glyph strip
m_cx = 0;
- m_cy += rowHeight;
+ m_cy += m_currentRowHeight;
+ m_currentRowHeight = 0; // New row
}
if (m_cy + c.h > m_h) {
int new_height = m_h*2;
@@ -153,14 +156,7 @@ void QTextureGlyphCache::populate(QFontEngine *fontEngine, int numGlyphs, const
fillTexture(c, iter.key());
coords.insert(iter.key(), c);
- if (m_cx + c.w > m_w) {
- m_cx = 0;
- m_cy += rowHeight;
- } else {
- // for the Mono case, glyph_width is 8-bit aligned,
- // and therefore so will m_cx
- m_cx += c.w;
- }
+ m_cx += c.w;
++iter;
}
diff --git a/src/gui/painting/qtextureglyphcache_p.h b/src/gui/painting/qtextureglyphcache_p.h
index 803e71b..8c2f5b4 100644
--- a/src/gui/painting/qtextureglyphcache_p.h
+++ b/src/gui/painting/qtextureglyphcache_p.h
@@ -77,7 +77,7 @@ class Q_GUI_EXPORT QTextureGlyphCache : public QFontEngineGlyphCache
public:
QTextureGlyphCache(QFontEngineGlyphCache::Type type, const QTransform &matrix)
: QFontEngineGlyphCache(matrix, type), m_current_fontengine(0),
- m_w(0), m_h(0), m_cx(0), m_cy(0)
+ m_w(0), m_h(0), m_cx(0), m_cy(0), m_currentRowHeight(0)
{ }
virtual ~QTextureGlyphCache() { }
@@ -120,6 +120,7 @@ protected:
int m_h; // image height
int m_cx; // current x
int m_cy; // current y
+ int m_currentRowHeight; // Height of last row
};
diff --git a/src/gui/styles/qgtkstyle_p.h b/src/gui/styles/qgtkstyle_p.h
index 5bb7550..68a04e9 100644
--- a/src/gui/styles/qgtkstyle_p.h
+++ b/src/gui/styles/qgtkstyle_p.h
@@ -85,9 +85,14 @@ public:
int size() const { return m_size; }
const char *data() const { return m_data; }
+#ifdef __SUNPRO_CC
+ QHashableLatin1Literal(const char* str)
+ : m_size(strlen(str)), m_data(str) {}
+#else
template <int N>
QHashableLatin1Literal(const char (&str)[N])
: m_size(N - 1), m_data(str) {}
+#endif
QHashableLatin1Literal(const QHashableLatin1Literal &other)
: m_size(other.m_size), m_data(other.m_data)