From c147617c3f33872a412318d9cd660e5391229619 Mon Sep 17 00:00:00 2001 From: Tom Cooksey Date: Tue, 30 Mar 2010 16:17:10 +0200 Subject: Change the ifdef for resolving function ptrs to match declaration Reviewed-By: TrustMe --- src/gui/egl/qegl.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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"); -- cgit v0.12 From 1a4ee517638e1ba3cdc622af70b3d53561d23392 Mon Sep 17 00:00:00 2001 From: Zeno Albisser Date: Thu, 25 Mar 2010 17:39:41 +0100 Subject: Added variable QMAKE_TARGET.arch to qmake to be used with MSVC++ The variable QMAKE_TARGET.arch shall be used to determine cross compiling for x64 on a x32 system. Reviewed-by: Marius Storm-Olsen Task-number: QTBUG-9160 --- qmake/project.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) 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[%s]", qPrintable(var), qPrintable(place[var].join("::"))); return place[var]; } -- cgit v0.12 From a354e98838e67e9bbd9473d4cd42b89f45d0e3fe Mon Sep 17 00:00:00 2001 From: Johan Hauan Date: Tue, 6 Apr 2010 11:34:57 +0200 Subject: Sunstudio12.1(5.10): Fix compile errors GTK style and other minor compile errors GTK Style A QHashableLatin1Literal was a bit too clever for sunstudio. Added and alternate constructor for sunstudio(ifdef) Should not affect other compilers. Other: Minor compile fixes, extra semicolon after macros etc. Merge-request: 547 Reviewed-by: Benjamin Poulain --- examples/qtconcurrent/map/main.cpp | 2 +- src/gui/styles/qgtkstyle_p.h | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) 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 thumbnails = QtConcurrent::blockingMapped(images, scale); + QList thumbnails = QtConcurrent::blockingMapped >(images, scale); return 0; } diff --git a/src/gui/styles/qgtkstyle_p.h b/src/gui/styles/qgtkstyle_p.h index 5bb7550..f0aee46 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 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) -- cgit v0.12 From 822efb6807d6164304bc454f39c5f739bbe1f8e5 Mon Sep 17 00:00:00 2001 From: Benjamin Poulain Date: Tue, 6 Apr 2010 11:46:19 +0200 Subject: Fix a coding style issue of the GTK style A tab was introduced in 16614121f8eff813efadc999a7db9ce47eae769e --- src/gui/styles/qgtkstyle_p.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/styles/qgtkstyle_p.h b/src/gui/styles/qgtkstyle_p.h index f0aee46..68a04e9 100644 --- a/src/gui/styles/qgtkstyle_p.h +++ b/src/gui/styles/qgtkstyle_p.h @@ -87,7 +87,7 @@ public: #ifdef __SUNPRO_CC QHashableLatin1Literal(const char* str) - : m_size(strlen(str)), m_data(str) {} + : m_size(strlen(str)), m_data(str) {} #else template QHashableLatin1Literal(const char (&str)[N]) -- cgit v0.12 From 0c442405a9f85f402d508af2be0a668f34f35caf Mon Sep 17 00:00:00 2001 From: Carlos Manuel Duclos Vergara Date: Tue, 6 Apr 2010 13:47:24 +0200 Subject: [Cocoa] QDialogs with WindowStayOnStopHint parent The problem is with beginModalSession which reorders the windows and sends our window back. This patch queries the window level before calling beginModalSession and sets it after beginModalSession. Task-number: QTBUG-9392 Reviewed-by: Richard Moe Gustavsen --- src/gui/kernel/qeventdispatcher_mac.mm | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) 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; } -- cgit v0.12 From ce0af99f47c1728a6d8145ea89f41b1c9207104a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Tue, 6 Apr 2010 16:08:20 +0200 Subject: Prevented unnecessary copy in QImage::setAlphaChannel(). If the formats don't match the detch is unnecessary as operator= will anyways destroy the detached QImageData and substitute it with the newly created QImageData from convertToFormat. Task-number: QTBUG-9640 Reviewed-by: Trond --- src/gui/image/qimage.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) 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()) { -- cgit v0.12 From 06e8d0cae3651beaf95de05e89696cbab4978740 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Tue, 6 Apr 2010 16:23:34 +0200 Subject: Fix painting artifacts on text The height of the row is not only decided by the maximum height of the set of glyphs currently being added to the glyph cache, but also the height of the glyphs previously added to the current line in the glyph cache. To minimize the space used, we now calculate the maximum height for glyphs per line, and use this as the vertical advancement when positioning the next line in the cache. The change also removes a redundant test ((c_x + c.w > c.h) is caught earlier on and will always be false at this point.) Task-number: QTBUG-9176 Reviewed-by: Trond --- src/gui/painting/qtextureglyphcache.cpp | 14 +++++--------- src/gui/painting/qtextureglyphcache_p.h | 3 ++- 2 files changed, 7 insertions(+), 10 deletions(-) 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 }; -- cgit v0.12 From 253b87180e0a6c5db0feaaed7e321139c4ff1643 Mon Sep 17 00:00:00 2001 From: Gabriel de Dietrich Date: Tue, 6 Apr 2010 17:04:20 +0200 Subject: Moved item wouldn't follow mouse cursor when ItemIgnoresTransformations is set Since the introduction of transform properties in QGraphicsItem, QGraphicsItem::transform() is no longer enough to get the correct transform of an item. No auto-test as it involves mouse dragging. Reviewed-by: Yoann Task-number: QTBUG-9295 --- src/gui/graphicsview/qgraphicsitem.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp index f106b3d..d6daf4d 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)))); -- cgit v0.12 From 30f4ad046123449e53b8d4cf936300753df126ec Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Tue, 6 Apr 2010 18:09:15 +0200 Subject: Doc: Remove QDBusServer from the public documentation. Task-number: QTBUG-5066 --- src/dbus/qdbusserver.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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. -- cgit v0.12 From d65d3becc292523f0962aac9d2bf7b96d9c47c04 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Tue, 6 Apr 2010 18:15:00 +0200 Subject: Doc: update the QDBusPendingCallWatcher example to show where to delete Task-number: QTBUG-8865 --- doc/src/snippets/code/src.qdbus.qdbuspendingcall.cpp | 1 + 1 file changed, 1 insertion(+) 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] -- cgit v0.12 From f2d08b168a116dd048ec1a38dd3b710de08a4a8e Mon Sep 17 00:00:00 2001 From: Yann Bodson Date: Wed, 7 Apr 2010 13:56:54 +1000 Subject: Cleanup minehunt example Make it more touchscreen friendly Use QML coding conventions Task-number: QTBUG-9361 --- demos/declarative/minehunt/minehunt.qml | 274 +++++++++++++------------------- 1 file changed, 114 insertions(+), 160 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() } } - } } -- cgit v0.12