diff options
author | Martin Smith <msmith@trolltech.com> | 2010-04-15 10:23:57 (GMT) |
---|---|---|
committer | Martin Smith <msmith@trolltech.com> | 2010-04-15 10:23:57 (GMT) |
commit | e4282111378ce67a1ae9c235efbd89b327f1bb91 (patch) | |
tree | 175fca0d6b40940f8bcba61e4b6563145f5dde70 | |
parent | 114cb018c088570ff0640eeb0d57594905ff9fcf (diff) | |
parent | b1c8bdc899cd276fcb90ad424b128bd7d8a21e21 (diff) | |
download | Qt-e4282111378ce67a1ae9c235efbd89b327f1bb91.zip Qt-e4282111378ce67a1ae9c235efbd89b327f1bb91.tar.gz Qt-e4282111378ce67a1ae9c235efbd89b327f1bb91.tar.bz2 |
Merge branch '4.7' of git@scm.dev.nokia.troll.no:qt/oslo-staging-1 into 4.7
498 files changed, 7086 insertions, 3962 deletions
@@ -7968,8 +7968,10 @@ if [ "$CFG_OPENSSL" = "linked" ] && [ "$OPENSSL_LIBS" = "" ]; then fi if [ "$PLATFORM_MAC" = "yes" ] && [ "$CFG_FRAMEWORK" = "yes" ] && [ "$CFG_DEBUG" = "yes" ] && [ "$CFG_DEBUG_RELEASE" = "no" ]; then echo - echo "NOTE: Mac OS X frameworks implicitly build debug and release Qt libraries." + echo "Error: debug-only framework builds are not supported. Configure with -no-framework" + echo "if you want a pure debug build." echo + exit 1 fi sepath=`echo "$relpath" | sed -e 's/\\./\\\\./g'` diff --git a/demos/declarative/minehunt/MinehuntCore/Explosion.qml b/demos/declarative/minehunt/MinehuntCore/Explosion.qml index 526cd34..73ada60 100644 --- a/demos/declarative/minehunt/MinehuntCore/Explosion.qml +++ b/demos/declarative/minehunt/MinehuntCore/Explosion.qml @@ -17,11 +17,9 @@ Item { velocity: 100 velocityDeviation: 20 z: 100 - opacity: 1 } - states: [ State { name: "exploding"; when: explode == true - StateChangeScript {script: particles.burst(200); } - } - ] + states: State { name: "exploding"; when: explode + StateChangeScript {script: particles.burst(200); } + } } diff --git a/demos/declarative/minehunt/MinehuntCore/Tile.qml b/demos/declarative/minehunt/MinehuntCore/Tile.qml new file mode 100644 index 0000000..f3620f4 --- /dev/null +++ b/demos/declarative/minehunt/MinehuntCore/Tile.qml @@ -0,0 +1,87 @@ +import Qt 4.7 + +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: "pics/front.png"; width: 40; height: 40 + + Image { + anchors.centerIn: parent + source: "pics/flag.png"; opacity: modelData.hasFlag + + Behavior on opacity { NumberAnimation {} } + } + } + + back: Image { + source: "pics/back.png" + width: 40; height: 40 + + Text { + anchors.centerIn: parent + text: modelData.hint; color: "white"; font.bold: true + opacity: !modelData.hasMine && modelData.hint > 0 + } + + Image { + anchors.centerIn: parent + source: "pics/bomb.png"; opacity: modelData.hasMine + } + + Explosion { id: expl } + } + + states: State { + name: "back"; when: modelData.flipped + PropertyChanges { target: flipable; angle: 180 } + } + + property real pauseDur: 250 + transitions: Transition { + SequentialAnimation { + ScriptAction { + script: { + var ret = Math.abs(flipable.x - field.clickx) + + Math.abs(flipable.y - field.clicky); + if (modelData.hasMine && modelData.flipped) + pauseDur = ret * 3 + else + pauseDur = ret + } + } + PauseAnimation { + duration: pauseDur + } + RotationAnimation { easing.type: "InOutQuad" } + ScriptAction { script: if (modelData.hasMine && modelData.flipped) { expl.explode = true } } + } + } + + MouseArea { + anchors.fill: parent + acceptedButtons: Qt.LeftButton | Qt.RightButton + onClicked: { + field.clickx = flipable.x + field.clicky = flipable.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.x + field.clicky = flipable.y + var row = Math.floor(index / 9) + var col = index - (Math.floor(index / 9) * 9) + flag(row, col) + } + } +} diff --git a/demos/declarative/minehunt/MinehuntCore/qmldir b/demos/declarative/minehunt/MinehuntCore/qmldir index 862c396..95bccc8 100644 --- a/demos/declarative/minehunt/MinehuntCore/qmldir +++ b/demos/declarative/minehunt/MinehuntCore/qmldir @@ -1,2 +1,3 @@ plugin minehunt Explosion 1.0 Explosion.qml +Tile 1.0 Tile.qml diff --git a/demos/declarative/minehunt/README b/demos/declarative/minehunt/README index 1b6cf81..b9f1d2a 100644 --- a/demos/declarative/minehunt/README +++ b/demos/declarative/minehunt/README @@ -1,5 +1,3 @@ To compile the C++ part, do 'qmake && make'. Minehunt will not run properly if the C++ plugin is not compiled. To run, simply load the minehunt.qml file with the qml runtime. - -Note that on X11, this demo has problems with the native graphicssystem. If you are using the X11 window system, please pass -graphicssystem raster to the qml binary. diff --git a/demos/declarative/minehunt/minehunt.cpp b/demos/declarative/minehunt/minehunt.cpp index a953c5a..d4b0039 100644 --- a/demos/declarative/minehunt/minehunt.cpp +++ b/demos/declarative/minehunt/minehunt.cpp @@ -48,11 +48,11 @@ #include <QTime> #include <QTimer> -class Tile : public QObject +class TileData : public QObject { Q_OBJECT public: - Tile() : _hasFlag(false), _hasMine(false), _hint(-1), _flipped(false) {} + TileData() : _hasFlag(false), _hasMine(false), _hint(-1), _flipped(false) {} Q_PROPERTY(bool hasFlag READ hasFlag WRITE setHasFlag NOTIFY hasFlagChanged) bool hasFlag() const { return _hasFlag; } @@ -91,8 +91,8 @@ class MinehuntGame : public QObject public: MinehuntGame(); - Q_PROPERTY(QDeclarativeListProperty<Tile> tiles READ tiles CONSTANT) - QDeclarativeListProperty<Tile> tiles(); + Q_PROPERTY(QDeclarativeListProperty<TileData> tiles READ tiles CONSTANT) + QDeclarativeListProperty<TileData> tiles(); Q_PROPERTY(bool isPlaying READ isPlaying NOTIFY isPlayingChanged) bool isPlaying() {return playing;} @@ -120,11 +120,11 @@ signals: private: bool onBoard( int r, int c ) const { return r >= 0 && r < numRows && c >= 0 && c < numCols; } - Tile *tile( int row, int col ) { return onBoard(row, col) ? _tiles[col+numRows*row] : 0; } + TileData *tile( int row, int col ) { return onBoard(row, col) ? _tiles[col+numRows*row] : 0; } int getHint(int row, int col); void setPlaying(bool b){if(b==playing) return; playing=b; emit isPlayingChanged();} - QList<Tile *> _tiles; + QList<TileData *> _tiles; int numCols; int numRows; bool playing; @@ -134,25 +134,25 @@ private: int nFlags; }; -void tilesPropAppend(QDeclarativeListProperty<Tile>* prop, Tile* value) +void tilesPropAppend(QDeclarativeListProperty<TileData>* prop, TileData* value) { Q_UNUSED(prop); Q_UNUSED(value); return; //Append not supported } -int tilesPropCount(QDeclarativeListProperty<Tile>* prop) +int tilesPropCount(QDeclarativeListProperty<TileData>* prop) { - return static_cast<QList<Tile*>*>(prop->data)->count(); + return static_cast<QList<TileData*>*>(prop->data)->count(); } -Tile* tilesPropAt(QDeclarativeListProperty<Tile>* prop, int index) +TileData* tilesPropAt(QDeclarativeListProperty<TileData>* prop, int index) { - return static_cast<QList<Tile*>*>(prop->data)->at(index); + return static_cast<QList<TileData*>*>(prop->data)->at(index); } -QDeclarativeListProperty<Tile> MinehuntGame::tiles(){ - return QDeclarativeListProperty<Tile>(this, &_tiles, &tilesPropAppend, +QDeclarativeListProperty<TileData> MinehuntGame::tiles(){ + return QDeclarativeListProperty<TileData>(this, &_tiles, &tilesPropAppend, &tilesPropCount, &tilesPropAt, 0); } @@ -164,7 +164,7 @@ MinehuntGame::MinehuntGame() //initialize array for(int ii = 0; ii < numRows * numCols; ++ii) { - _tiles << new Tile; + _tiles << new TileData; } reset(); @@ -172,7 +172,7 @@ MinehuntGame::MinehuntGame() void MinehuntGame::setBoard() { - foreach(Tile* t, _tiles){ + foreach(TileData* t, _tiles){ t->setHasMine(false); t->setHint(-1); } @@ -183,7 +183,7 @@ void MinehuntGame::setBoard() int col = int((double(rand()) / double(RAND_MAX)) * numCols); int row = int((double(rand()) / double(RAND_MAX)) * numRows); - Tile* t = tile( row, col ); + TileData* t = tile( row, col ); if (t && !t->hasMine()) { t->setHasMine( true ); @@ -194,7 +194,7 @@ void MinehuntGame::setBoard() //set hints for (int r = 0; r < numRows; r++) for (int c = 0; c < numCols; c++) { - Tile* t = tile(r, c); + TileData* t = tile(r, c); if (t && !t->hasMine()) { int hint = getHint(r,c); t->setHint(hint); @@ -206,7 +206,7 @@ void MinehuntGame::setBoard() void MinehuntGame::reset() { - foreach(Tile* t, _tiles){ + foreach(TileData* t, _tiles){ t->unflip(); t->setHasFlag(false); } @@ -221,7 +221,7 @@ int MinehuntGame::getHint(int row, int col) int hint = 0; for (int c = col-1; c <= col+1; c++) for (int r = row-1; r <= row+1; r++) { - Tile* t = tile(r, c); + TileData* t = tile(r, c); if (t && t->hasMine()) hint++; } @@ -233,7 +233,7 @@ bool MinehuntGame::flip(int row, int col) if(!playing) return false; - Tile *t = tile(row, col); + TileData *t = tile(row, col); if (!t || t->hasFlag()) return false; @@ -241,7 +241,7 @@ bool MinehuntGame::flip(int row, int col) int flags = 0; for (int c = col-1; c <= col+1; c++) for (int r = row-1; r <= row+1; r++) { - Tile *nearT = tile(r, c); + TileData *nearT = tile(r, c); if(!nearT || nearT == t) continue; if(nearT->hasFlag()) @@ -251,7 +251,7 @@ bool MinehuntGame::flip(int row, int col) return false; for (int c = col-1; c <= col+1; c++) for (int r = row-1; r <= row+1; r++) { - Tile *nearT = tile(r, c); + TileData *nearT = tile(r, c); if (nearT && !nearT->flipped() && !nearT->hasFlag()) { flip( r, c ); } @@ -264,7 +264,7 @@ bool MinehuntGame::flip(int row, int col) if (t->hint() == 0) { for (int c = col-1; c <= col+1; c++) for (int r = row-1; r <= row+1; r++) { - Tile* t = tile(r, c); + TileData* t = tile(r, c); if (t && !t->flipped()) { flip( r, c ); } @@ -274,7 +274,7 @@ bool MinehuntGame::flip(int row, int col) if(t->hasMine()){ for (int r = 0; r < numRows; r++)//Flip all other mines for (int c = 0; c < numCols; c++) { - Tile* t = tile(r, c); + TileData* t = tile(r, c); if (t && t->hasMine()) { flip(r, c); } @@ -295,7 +295,7 @@ bool MinehuntGame::flip(int row, int col) bool MinehuntGame::flag(int row, int col) { - Tile *t = tile(row, col); + TileData *t = tile(row, col); if(!t) return false; @@ -305,8 +305,7 @@ bool MinehuntGame::flag(int row, int col) return true; } -QML_DECLARE_TYPE(Tile); -QML_DECLARE_TYPE(MinehuntGame); +QML_DECLARE_TYPE(TileData); class MinehuntExtensionPlugin : public QDeclarativeExtensionPlugin { @@ -314,8 +313,8 @@ class MinehuntExtensionPlugin : public QDeclarativeExtensionPlugin public: void registerTypes(const char *uri) { - qmlRegisterType<Tile>(uri, 0, 1, "Tile"); - qmlRegisterType<MinehuntGame>(uri, 0, 1, "Game"); + Q_UNUSED(uri); + qmlRegisterType<TileData>(); } void initializeEngine(QDeclarativeEngine *engine, const char *uri) { diff --git a/demos/declarative/minehunt/minehunt.pro b/demos/declarative/minehunt/minehunt.pro index 8a5667d..41640f5 100644 --- a/demos/declarative/minehunt/minehunt.pro +++ b/demos/declarative/minehunt/minehunt.pro @@ -16,6 +16,7 @@ target.path = $$[QT_INSTALL_DEMOS]/declarative/minehunt/MinehuntCore MinehuntCore_sources.files = \ MinehuntCore/Explosion.qml \ + MinehuntCore/Tile.qml \ MinehuntCore/pics \ MinehuntCore/qmldir MinehuntCore_sources.path = $$[QT_INSTALL_DEMOS]/declarative/minehunt/MinehuntCore @@ -26,7 +27,7 @@ symbian:{ load(data_caging_paths) TARGET.EPOCALLOWDLLDATA = 1 include($$QT_SOURCE_TREE/demos/symbianpkgrules.pri) - + TARGET.CAPABILITY = NetworkServices ReadUserData importFiles.sources = minehunt.dll \ MinehuntCore/Explosion.qml \ MinehuntCore/pics \ diff --git a/demos/declarative/minehunt/minehunt.qml b/demos/declarative/minehunt/minehunt.qml index 98955e2..5ed78fb 100644 --- a/demos/declarative/minehunt/minehunt.qml +++ b/demos/declarative/minehunt/minehunt.qml @@ -8,101 +8,6 @@ Item { 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 } } - } - } - - 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 } - } - - 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 - 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"; anchors.fill: parent; fillMode: Image.Tile } Grid { @@ -112,7 +17,7 @@ Item { Repeater { id: repeater model: tiles - Component { Loader { sourceComponent: tile } } + delegate: Tile {} } } @@ -143,8 +48,10 @@ Item { MouseArea { anchors.fill: parent; onPressed: reset() } } Text { - anchors.fill: parent; wrapMode: Text.WordWrap - text: "Minehunt will not run properly if the C++ plugin is not compiled.\nPlease see README." + anchors.centerIn: parent; width: parent.width - 20 + horizontalAlignment: Text.AlignHCenter + wrapMode: Text.WordWrap + text: "Minehunt will not run properly if the C++ plugin is not compiled.\n\nPlease see README." color: "white"; font.bold: true; font.pixelSize: 14 visible: tiles == undefined } diff --git a/demos/declarative/photoviewer/PhotoViewerCore/AlbumDelegate.qml b/demos/declarative/photoviewer/PhotoViewerCore/AlbumDelegate.qml index b494651..cd9ecbc 100644 --- a/demos/declarative/photoviewer/PhotoViewerCore/AlbumDelegate.qml +++ b/demos/declarative/photoviewer/PhotoViewerCore/AlbumDelegate.qml @@ -79,9 +79,9 @@ Component { GridView.onAdd: NumberAnimation { target: albumWrapper; properties: "scale"; from: 0.0; to: 1.0 } GridView.onRemove: SequentialAnimation { - PropertyAction { target: albumWrapper.GridView; property: "delayRemove"; value: true } + PropertyAction { target: albumWrapper; property: "GridView.delayRemove"; value: true } NumberAnimation { target: albumWrapper; property: "scale"; from: 1.0; to: 0.0 } - PropertyAction { target: albumWrapper.GridView; property: "delayRemove"; value: false } + PropertyAction { target: albumWrapper; property: "GridView.delayRemove"; value: false } } transitions: [ diff --git a/demos/declarative/samegame/SamegameCore/BoomBlock.qml b/demos/declarative/samegame/SamegameCore/BoomBlock.qml index db43182..bad1bf4 100644 --- a/demos/declarative/samegame/SamegameCore/BoomBlock.qml +++ b/demos/declarative/samegame/SamegameCore/BoomBlock.qml @@ -26,12 +26,16 @@ Item { id:block anchors.fill: parent } - Particles { id: particles - width:1; height:1; anchors.centerIn: parent; - emissionRate: 0; - lifeSpan: 700; lifeSpanDeviation: 600; + Particles { + id: particles + + width: 1; height: 1 + anchors.centerIn: parent + + emissionRate: 0 + lifeSpan: 700; lifeSpanDeviation: 600 angle: 0; angleDeviation: 360; - velocity: 100; velocityDeviation:30; + velocity: 100; velocityDeviation: 30 source: { if(type == 0){ "pics/redStar.png"; @@ -44,10 +48,13 @@ Item { id:block } states: [ - State{ name: "AliveState"; when: spawned == true && dying == false + State { + name: "AliveState"; when: spawned == true && dying == false PropertyChanges { target: img; opacity: 1 } }, - State{ name: "DeathState"; when: dying == true + + State { + name: "DeathState"; when: dying == true StateChangeScript { script: particles.burst(50); } PropertyChanges { target: img; opacity: 0 } StateChangeScript { script: block.destroy(1000); } diff --git a/demos/declarative/samegame/SamegameCore/Button.qml b/demos/declarative/samegame/SamegameCore/Button.qml index 9c7986b..0faabc9 100644 --- a/demos/declarative/samegame/SamegameCore/Button.qml +++ b/demos/declarative/samegame/SamegameCore/Button.qml @@ -3,23 +3,32 @@ import Qt 4.7 Rectangle { id: container - signal clicked property string text: "Button" - color: activePalette.button; smooth: true - width: txtItem.width + 20; height: txtItem.height + 6 - border.width: 1; border.color: Qt.darker(activePalette.button); radius: 8; + signal clicked + + width: buttonLabel.width + 20; height: buttonLabel.height + 6 + smooth: true + border { width: 1; color: Qt.darker(activePalette.button) } + radius: 8 + color: activePalette.button gradient: Gradient { GradientStop { - id: topGrad; position: 0.0 - color: if (mr.pressed) { activePalette.dark } else { activePalette.light } } + position: 0.0 + color: { + if (mouseArea.pressed) + return activePalette.dark + else + return activePalette.light + } + } GradientStop { position: 1.0; color: activePalette.button } } - MouseArea { id: mr; anchors.fill: parent; onClicked: container.clicked() } + MouseArea { id: mouseArea; anchors.fill: parent; onClicked: container.clicked() } Text { - id: txtItem; text: container.text; anchors.centerIn: container; color: activePalette.buttonText + id: buttonLabel; text: container.text; anchors.centerIn: container; color: activePalette.buttonText } } diff --git a/demos/declarative/samegame/SamegameCore/Dialog.qml b/demos/declarative/samegame/SamegameCore/Dialog.qml index 7f1189e..8784348 100644 --- a/demos/declarative/samegame/SamegameCore/Dialog.qml +++ b/demos/declarative/samegame/SamegameCore/Dialog.qml @@ -2,21 +2,32 @@ import Qt 4.7 Rectangle { id: page + + property Item text: dialogText + + signal closed + function forceClose() { page.closed(); page.opacity = 0; } + function show(txt) { - myText.text = txt; + dialogText.text = txt; page.opacity = 1; } - signal closed(); - property Item text: myText - color: "white"; border.width: 1; width: myText.width + 20; height: myText.height + 40; + + width: dialogText.width + 20; height: dialogText.height + 20 + color: "white" + border.width: 1 opacity: 0 - Behavior on opacity { + + Behavior on opacity { NumberAnimation { duration: 1000 } } - Text { id: myText; anchors.centerIn: parent; text: "Hello World!" } - MouseArea { id: mr; anchors.fill: parent; onClicked: forceClose(); } + + Text { id: dialogText; anchors.centerIn: parent; text: "Hello World!" } + + MouseArea { anchors.fill: parent; onClicked: forceClose(); } } + diff --git a/demos/declarative/samegame/SamegameCore/samegame.js b/demos/declarative/samegame/SamegameCore/samegame.js index a119a88..3888381 100755 --- a/demos/declarative/samegame/SamegameCore/samegame.js +++ b/demos/declarative/samegame/SamegameCore/samegame.js @@ -1,18 +1,18 @@ /* This script file handles the game logic */ -//Note that X/Y referred to here are in game coordinates -var maxX = 10;//Nums are for gameCanvas.tileSize 40 -var maxY = 15; -var maxIndex = maxX*maxY; + +var maxColumn = 10; +var maxRow = 15; +var maxIndex = maxColumn*maxRow; var board = new Array(maxIndex); -var tileSrc = "SamegameCore/BoomBlock.qml"; +var blockSrc = "SamegameCore/BoomBlock.qml"; var scoresURL = "http://qtfx-nokia.trolltech.com.au/samegame/scores.php"; var scoresURL = ""; -var timer; -var component = createComponent(tileSrc); +var gameDuration; +var component = createComponent(blockSrc); //Index function used instead of a 2D array -function index(xIdx,yIdx) { - return xIdx + (yIdx * maxX); +function index(column,row) { + return column + (row * maxColumn); } function timeStr(msecs) { @@ -22,51 +22,48 @@ function timeStr(msecs) { return ret; } -function initBoard() +function startNewGame() { + //Delete blocks from previous game for(var i = 0; i<maxIndex; i++){ - //Delete old blocks if(board[i] != null) board[i].destroy(); } //Calculate board size - maxX = Math.floor(gameCanvas.width/gameCanvas.tileSize); - maxY = Math.floor(gameCanvas.height/gameCanvas.tileSize); - maxIndex = maxY*maxX; + maxColumn = Math.floor(gameCanvas.width/gameCanvas.blockSize); + maxRow = Math.floor(gameCanvas.height/gameCanvas.blockSize); + maxIndex = maxRow*maxColumn; //Close dialogs - scoreName.forceClose(); + nameInputDialog.forceClose(); dialog.forceClose(); - var a = new Date(); //Initialize Board board = new Array(maxIndex); gameCanvas.score = 0; - for(var xIdx=0; xIdx<maxX; xIdx++){ - for(var yIdx=0; yIdx<maxY; yIdx++){ - board[index(xIdx,yIdx)] = null; - createBlock(xIdx,yIdx); + for(var column=0; column<maxColumn; column++){ + for(var row=0; row<maxRow; row++){ + board[index(column,row)] = null; + createBlock(column,row); } } - timer = new Date(); - - //print(timer.valueOf() - a.valueOf()); + gameDuration = new Date(); } -var fillFound;//Set after a floodFill call to the number of tiles found +var fillFound;//Set after a floodFill call to the number of blocks found var floodBoard;//Set to 1 if the floodFill reaches off that node //NOTE: Be careful with vars named x,y, as the calling object's x,y are still in scope function handleClick(x,y) { - var xIdx = Math.floor(x/gameCanvas.tileSize); - var yIdx = Math.floor(y/gameCanvas.tileSize); - if(xIdx >= maxX || xIdx < 0 || yIdx >= maxY || yIdx < 0) + var column = Math.floor(x/gameCanvas.blockSize); + var row = Math.floor(y/gameCanvas.blockSize); + if(column >= maxColumn || column < 0 || row >= maxRow || row < 0) return; - if(board[index(xIdx, yIdx)] == null) + if(board[index(column, row)] == null) return; - //If it's a valid tile, remove it and all connected (does nothing if it's not connected) - floodFill(xIdx,yIdx, -1); + //If it's a valid block, remove it and all connected (does nothing if it's not connected) + floodFill(column,row, -1); if(fillFound <= 0) return; gameCanvas.score += (fillFound - 1) * (fillFound - 1); @@ -74,67 +71,67 @@ function handleClick(x,y) victoryCheck(); } -function floodFill(xIdx,yIdx,type) +function floodFill(column,row,type) { - if(board[index(xIdx, yIdx)] == null) + if(board[index(column, row)] == null) return; var first = false; if(type == -1){ first = true; - type = board[index(xIdx,yIdx)].type; + type = board[index(column,row)].type; //Flood fill initialization fillFound = 0; floodBoard = new Array(maxIndex); } - if(xIdx >= maxX || xIdx < 0 || yIdx >= maxY || yIdx < 0) + if(column >= maxColumn || column < 0 || row >= maxRow || row < 0) return; - if(floodBoard[index(xIdx, yIdx)] == 1 || (!first && type != board[index(xIdx,yIdx)].type)) + if(floodBoard[index(column, row)] == 1 || (!first && type != board[index(column,row)].type)) return; - floodBoard[index(xIdx, yIdx)] = 1; - floodFill(xIdx+1,yIdx,type); - floodFill(xIdx-1,yIdx,type); - floodFill(xIdx,yIdx+1,type); - floodFill(xIdx,yIdx-1,type); + floodBoard[index(column, row)] = 1; + floodFill(column+1,row,type); + floodFill(column-1,row,type); + floodFill(column,row+1,type); + floodFill(column,row-1,type); if(first==true && fillFound == 0) - return;//Can't remove single tiles - board[index(xIdx,yIdx)].dying = true; - board[index(xIdx,yIdx)] = null; + return;//Can't remove single blocks + board[index(column,row)].dying = true; + board[index(column,row)] = null; fillFound += 1; } function shuffleDown() { //Fall down - for(var xIdx=0; xIdx<maxX; xIdx++){ + for(var column=0; column<maxColumn; column++){ var fallDist = 0; - for(var yIdx=maxY-1; yIdx>=0; yIdx--){ - if(board[index(xIdx,yIdx)] == null){ + for(var row=maxRow-1; row>=0; row--){ + if(board[index(column,row)] == null){ fallDist += 1; }else{ if(fallDist > 0){ - var obj = board[index(xIdx,yIdx)]; - obj.targetY += fallDist * gameCanvas.tileSize; - board[index(xIdx,yIdx+fallDist)] = obj; - board[index(xIdx,yIdx)] = null; + var obj = board[index(column,row)]; + obj.targetY += fallDist * gameCanvas.blockSize; + board[index(column,row+fallDist)] = obj; + board[index(column,row)] = null; } } } } //Fall to the left fallDist = 0; - for(xIdx=0; xIdx<maxX; xIdx++){ - if(board[index(xIdx, maxY - 1)] == null){ + for(column=0; column<maxColumn; column++){ + if(board[index(column, maxRow - 1)] == null){ fallDist += 1; }else{ if(fallDist > 0){ - for(yIdx=0; yIdx<maxY; yIdx++){ - obj = board[index(xIdx,yIdx)]; + for(row=0; row<maxRow; row++){ + obj = board[index(column,row)]; if(obj == null) continue; - obj.targetX -= fallDist * gameCanvas.tileSize; - board[index(xIdx-fallDist,yIdx)] = obj; - board[index(xIdx,yIdx)] = null; + obj.targetX -= fallDist * gameCanvas.blockSize; + board[index(column-fallDist,row)] = obj; + board[index(column,row)] = null; } } } @@ -143,40 +140,38 @@ function shuffleDown() function victoryCheck() { - //awards bonuses for no tiles left + //awards bonuses for no blocks left var deservesBonus = true; - for(var xIdx=maxX-1; xIdx>=0; xIdx--) - if(board[index(xIdx, maxY - 1)] != null) + for(var column=maxColumn-1; column>=0; column--) + if(board[index(column, maxRow - 1)] != null) deservesBonus = false; if(deservesBonus) gameCanvas.score += 500; //Checks for game over - if(deservesBonus || !(floodMoveCheck(0,maxY-1, -1))){ - timer = new Date() - timer; - //scoreName.show("You won! Please enter your name: "); - scoreName.show("You won! Please enter your name: "); - scoreName.initialWidth = scoreName.text.width + 20; - scoreName.width = scoreName.initialWidth; - scoreName.text.opacity = 0;//Just a spacer - //dialog.show("Game Over. Your score is " + gameCanvas.score); + if(deservesBonus || !(floodMoveCheck(0,maxRow-1, -1))){ + gameDuration = new Date() - gameDuration; + nameInputDialog.show("You won! Please enter your name: "); + nameInputDialog.initialWidth = nameInputDialog.text.width + 20; + nameInputDialog.width = nameInputDialog.initialWidth; + nameInputDialog.text.opacity = 0;//Just a spacer } } -//only floods up and right, to see if it can find adjacent same-typed tiles -function floodMoveCheck(xIdx, yIdx, type) +//only floods up and right, to see if it can find adjacent same-typed blocks +function floodMoveCheck(column, row, type) { - if(xIdx >= maxX || xIdx < 0 || yIdx >= maxY || yIdx < 0) + if(column >= maxColumn || column < 0 || row >= maxRow || row < 0) return false; - if(board[index(xIdx, yIdx)] == null) + if(board[index(column, row)] == null) return false; - var myType = board[index(xIdx, yIdx)].type; + var myType = board[index(column, row)].type; if(type == myType) return true; - return floodMoveCheck(xIdx + 1, yIdx, myType) || - floodMoveCheck(xIdx, yIdx - 1, board[index(xIdx,yIdx)].type); + return floodMoveCheck(column + 1, row, myType) || + floodMoveCheck(column, row - 1, board[index(column,row)].type); } -function createBlock(xIdx,yIdx){ +function createBlock(column,row){ // Note that we don't wait for the component to become ready. This will // only work if the block QML is a local file. Otherwise the component will // not be ready immediately. There is a statusChanged signal on the @@ -190,14 +185,14 @@ function createBlock(xIdx,yIdx){ } dynamicObject.type = Math.floor(Math.random() * 3); dynamicObject.parent = gameCanvas; - dynamicObject.x = xIdx*gameCanvas.tileSize; - dynamicObject.targetX = xIdx*gameCanvas.tileSize; - dynamicObject.targetY = yIdx*gameCanvas.tileSize; - dynamicObject.width = gameCanvas.tileSize; - dynamicObject.height = gameCanvas.tileSize; + dynamicObject.x = column*gameCanvas.blockSize; + dynamicObject.targetX = column*gameCanvas.blockSize; + dynamicObject.targetY = row*gameCanvas.blockSize; + dynamicObject.width = gameCanvas.blockSize; + dynamicObject.height = gameCanvas.blockSize; dynamicObject.spawned = true; - board[index(xIdx,yIdx)] = dynamicObject; - }else{//isError or isLoading + board[index(column,row)] = dynamicObject; + }else{ print("error loading block component"); print(component.errorsString()); return false; @@ -211,14 +206,14 @@ function saveHighScore(name) { //OfflineStorage var db = openDatabaseSync("SameGameScores", "1.0", "Local SameGame High Scores",100); var dataStr = "INSERT INTO Scores VALUES(?, ?, ?, ?)"; - var data = [name, gameCanvas.score, maxX+"x"+maxY ,Math.floor(timer/1000)]; + var data = [name, gameCanvas.score, maxColumn+"x"+maxRow ,Math.floor(gameDuration/1000)]; db.transaction( function(tx) { tx.executeSql('CREATE TABLE IF NOT EXISTS Scores(name TEXT, score NUMBER, gridSize TEXT, time NUMBER)'); tx.executeSql(dataStr, data); //Only show results for the current grid size - var rs = tx.executeSql('SELECT * FROM Scores WHERE gridSize = "'+maxX+"x"+maxY+'" ORDER BY score desc LIMIT 10'); + var rs = tx.executeSql('SELECT * FROM Scores WHERE gridSize = "'+maxColumn+"x"+maxRow+'" ORDER BY score desc LIMIT 10'); var r = "\nHIGH SCORES for this grid size\n\n" for(var i = 0; i < rs.rows.length; i++){ r += (i+1)+". " + rs.rows.item(i).name +' got ' @@ -233,7 +228,7 @@ function saveHighScore(name) { function sendHighScore(name) { var postman = new XMLHttpRequest() var postData = "name="+name+"&score="+gameCanvas.score - +"&gridSize="+maxX+"x"+maxY +"&time="+Math.floor(timer/1000); + +"&gridSize="+maxColumn+"x"+maxRow +"&time="+Math.floor(gameDuration/1000); postman.open("POST", scoresURL, true); postman.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); postman.onreadystatechange = function() { diff --git a/demos/declarative/samegame/samegame.qml b/demos/declarative/samegame/samegame.qml index 94f5c24..92201f5 100644 --- a/demos/declarative/samegame/samegame.qml +++ b/demos/declarative/samegame/samegame.qml @@ -9,85 +9,95 @@ Rectangle { SystemPalette { id: activePalette } Item { - width: parent.width; anchors.top: parent.top; anchors.bottom: toolBar.top + width: parent.width + anchors { top: parent.top; bottom: toolBar.top } Image { id: background - anchors.fill: parent; source: "SamegameCore/pics/background.png" + anchors.fill: parent + source: "SamegameCore/pics/background.png" fillMode: Image.PreserveAspectCrop - smooth: true } Item { id: gameCanvas property int score: 0 - property int tileSize: 40 + property int blockSize: 40 z: 20; anchors.centerIn: parent - width: parent.width - (parent.width % tileSize); - height: parent.height - (parent.height % tileSize); + width: parent.width - (parent.width % blockSize); + height: parent.height - (parent.height % blockSize); MouseArea { - id: gameMR anchors.fill: parent; onClicked: Logic.handleClick(mouse.x,mouse.y); } } } Dialog { id: dialog; anchors.centerIn: parent; z: 21 } + Dialog { - id: scoreName; anchors.centerIn: parent; z: 22; + id: nameInputDialog + property int initialWidth: 0 - Behavior on width {NumberAnimation{} enabled: initialWidth!=0} + + anchors.centerIn: parent + z: 22; + + Behavior on width { + NumberAnimation {} + enabled: initialWidth != 0 + } + Text { - id: spacer - anchors.left: scoreName.left - anchors.leftMargin: 20 - anchors.verticalCenter: parent.verticalCenter + id: dialogText + anchors { left: nameInputDialog.left; leftMargin: 20; verticalCenter: parent.verticalCenter } text: "You won! Please enter your name: " } + TextInput { - id: editor + id: nameInputText + anchors { verticalCenter: parent.verticalCenter; left: dialogText.right } + focus: true + onTextChanged: { - var newWidth = editor.width + spacer.width + 40; - if((newWidth > scoreName.width && newWidth < screen.width) - || (scoreName.width > scoreName.initialWidth)) - scoreName.width = newWidth; + var newWidth = nameInputText.width + dialogText.width + 40; + if ( (newWidth > nameInputDialog.width && newWidth < screen.width) + || (nameInputDialog.width > nameInputDialog.initialWidth) ) + nameInputDialog.width = newWidth; } onAccepted: { - if(scoreName.opacity==1&&editor.text!="") - Logic.saveHighScore(editor.text); - scoreName.forceClose(); + if (nameInputDialog.opacity == 1 && nameInputText.text != "") + Logic.saveHighScore(nameInputText.text); + nameInputDialog.forceClose(); } - anchors.verticalCenter: parent.verticalCenter - focus: true - anchors.left: spacer.right } } Rectangle { id: toolBar + width: parent.width; height: 32 color: activePalette.window - height: 32; width: parent.width anchors.bottom: screen.bottom Button { - id: btnA; text: "New Game"; onClicked: Logic.initBoard(); - anchors.left: parent.left; anchors.leftMargin: 3 - anchors.verticalCenter: parent.verticalCenter + id: newGameButton + anchors { left: parent.left; leftMargin: 3; verticalCenter: parent.verticalCenter } + text: "New Game" + onClicked: Logic.startNewGame() } Button { - id: btnB; text: "Quit"; onClicked: Qt.quit(); - anchors.left: btnA.right; anchors.leftMargin: 3 - anchors.verticalCenter: parent.verticalCenter + text: "Quit" + anchors { left: newGameButton.right; leftMargin: 3; verticalCenter: parent.verticalCenter } + onClicked: Qt.quit(); } Text { id: score - text: "Score: " + gameCanvas.score; font.bold: true - anchors.right: parent.right; anchors.rightMargin: 3 - anchors.verticalCenter: parent.verticalCenter + anchors { right: parent.right; rightMargin: 3; verticalCenter: parent.verticalCenter } + text: "Score: " + gameCanvas.score + font.bold: true color: activePalette.windowText } } diff --git a/doc/src/declarative/advtutorial.qdoc b/doc/src/declarative/advtutorial.qdoc index 4807fd2..3a70eee 100644 --- a/doc/src/declarative/advtutorial.qdoc +++ b/doc/src/declarative/advtutorial.qdoc @@ -101,6 +101,9 @@ One item you may not recognize here is the \l SystemPalette item. This provides access to the Qt system palette and is used to give the button a more native look-and-feel. +Notice the anchors for the \c Item, \c Button and \c Text elements are set using +\l {Grouped Properties}{group notation} for readability. + \section2 Adding \c Button and \c Block components The \c Button item in the code above is defined in a separate file named \c Button.qml. diff --git a/doc/src/declarative/declarativeui.qdoc b/doc/src/declarative/declarativeui.qdoc index a4f4bc7..a2a5283 100644 --- a/doc/src/declarative/declarativeui.qdoc +++ b/doc/src/declarative/declarativeui.qdoc @@ -77,6 +77,7 @@ completely new applications. QML is fully \l {Extending QML in C++}{extensible \o \l {QML Advanced Tutorial}{Tutorial: 'Same Game'} \o \l {QML Examples and Walkthroughs} \o \l {Using QML in C++ Applications} +\o \l {QML for Qt programmers} \endlist \section1 Core QML Features: @@ -102,6 +103,7 @@ completely new applications. QML is fully \l {Extending QML in C++}{extensible \o \l {QML Elements} \o \l {QML Global Object} \o \l {Extending QML in C++} +\o \l {Integrating QML with existing Qt UI code} \o \l {QML Internationalization} \o \l {QML Security} \o \l {QtDeclarative Module} diff --git a/doc/src/declarative/qdeclarativesecurity.qdoc b/doc/src/declarative/qdeclarativesecurity.qdoc index ab75a57..290d78f 100644 --- a/doc/src/declarative/qdeclarativesecurity.qdoc +++ b/doc/src/declarative/qdeclarativesecurity.qdoc @@ -70,7 +70,7 @@ perform appropriate checks on untrusted data it loads. A non-exhaustive list of the ways you could shoot yourself in the foot is: \list - \i Using \c import to import QML or JavaScropt you do not control. BAD + \i Using \c import to import QML or JavaScript you do not control. BAD \i Using \l Loader to import QML you do not control. BAD \i Using \l{XMLHttpRequest()}{XMLHttpRequest} to load data you do not control and executing it. BAD \endlist diff --git a/doc/src/declarative/qmlruntime.qdoc b/doc/src/declarative/qmlruntime.qdoc index 8bb3ec7..fbe82c6 100644 --- a/doc/src/declarative/qmlruntime.qdoc +++ b/doc/src/declarative/qmlruntime.qdoc @@ -70,7 +70,7 @@ \code qml myQmlFile.qml \endcode - + Deploying a QML application via the \c qml executable allows for QML only deployments, but can also include custom C++ modules just as easily. Below is an example of how you might structure a complex application deployed via the qml runtime, it is a listing of the files that would @@ -101,7 +101,7 @@ import "MyAppCore" import "OtherModule" 1.0 as Other \endcode - + \section1 \c qml application functionality The \c qml application implements some additional functionality to help it serve the role of a launcher for myriad applications. If you implement your own launcher application, you may also wish to reimplement @@ -134,23 +134,25 @@ Any QML can be used in the dummy data files. You could even animate the fictional data! - \section2 Screen Orientation + \section2 Runtime Object + + All applications using the qmlruntime will have access to the 'runtime' + property on the root context. This property contains several information + about the runtime environment of the application. + + \section3 Screen Orientation A special piece of dummy data which is integrated into the runtime is a simple orientation property. The orientation can be set via the settings menu in the application, or by pressing Ctrl+T to toggle it. - To use this from within your QML file, import QDeclarativeViewer 1.0 and create a - Screen object. This object has a property, orientation, which can be either - Screen.Landscape or Screen.Portrait and which can be bound to in your + To use this from within your QML file, access runtime.orientation, + which can be either Orientation.Landscape or Orientation.Portrait and which can be bound to in your application. An example is below: \code - import QDeclarativeViewer 1.0 as QDeclarativeViewer - Item { - QDeclarativeViewer.Screen { id: screen } - state: (screen.orientation == QDeclarativeViewer.Screen.Landscape) ? 'landscape' : '' + state: (runtime.orientation == Orientation.Landscape) ? 'landscape' : '' } \endcode @@ -158,4 +160,28 @@ will automatically update this on some platforms (currently the N900 only) to match the physical screen's orientation. On other plaforms orientation changes will only happen when explictly asked for. + \section3 Window Active + + The runtime.isActiveWindow property tells whether the main window of the qml runtime is currently active + or not. This is specially useful for embedded devices when you want to pause parts of your application, + including animations, when your application looses focus or goes to the background. + + The example below, stops the animation when the application's window is deactivated and resumes on activation: + +\code + Item { + width: 300; height: 200 + Rectangle { + width: 100; height: 100 + color: "green" + SequentialAnimation on x { + running: runtime.isActiveWindow + loops: Animation.Infinite + NumberAnimation {to: 200} + NumberAnimation {to: 0} + } + } + } +\endcode + */ diff --git a/doc/src/declarative/qtbinding.qdoc b/doc/src/declarative/qtbinding.qdoc index 181c504..d024ff2 100644 --- a/doc/src/declarative/qtbinding.qdoc +++ b/doc/src/declarative/qtbinding.qdoc @@ -73,9 +73,9 @@ QML component instances can then be created by calling the QDeclarativeComponent an example of loading a QML document, and creating an object from it. \code -QDeclarativeEngine *engine = new QDeclarativeEngine(parent); -QDeclarativeComponent component(engine, QUrl("main.qml")); -QObject *myObject = component.create(); + QDeclarativeEngine *engine = new QDeclarativeEngine(parent); + QDeclarativeComponent component(engine, QUrl::fromLocalFile("main.qml")); + QObject *myObject = component.create(); \endcode \section1 Exposing Data @@ -91,40 +91,28 @@ the root context is available to all object instances. To expose data to a QML component instance, applications set \l {QDeclarativeContext::setContextProperty()} {context properties} which are then accessible by name from QML \l {Property Binding}s and JavaScript. -The following example shows how to expose a background color to a QML file. +The following example shows how to expose a background color to a QML file through QDeclarativeView: \table \row \o -\code -// main.cpp -QDeclarativeContext *windowContext = new QDeclarativeContext(engine->rootContext()); -windowContext->setContextProperty("backgroundColor", - QColor(Qt::lightsteelblue)); +\c {// main.cpp} +\snippet doc/src/declarative/snippets/qtbinding/contextproperties/main.cpp 0 -QDeclarativeComponent component(&engine, "main.qml"); -QObject *window = component.create(windowContext); -\endcode \o -\code -// main.qml -import Qt 4.7 +\c {// main.qml} +\snippet doc/src/declarative/snippets/qtbinding/contextproperties/main.qml 0 -Rectangle { - color: backgroundColor - - Text { - anchors.centerIn: parent - text: "Hello Light Steel Blue World!" - } -} -\endcode \endtable +Or, if you want \c main.cpp to create the component without showing it in a QDeclarativeView, you could create an instance of QDeclarativeContext using QDeclarativeEngine::rootContext() instead: + +\snippet doc/src/declarative/snippets/qtbinding/contextproperties/main.cpp 1 + Context properties work just like normal properties in QML bindings - if the \c backgroundColor -context property in the previous example was changed to red, the component object instances would +context property in this example was changed to red, the component object instances would all be automatically updated. Note that it is the responsibility of the creator to delete any -QDeclarativeContext it constructs. If the \c windowContext in the example above is no longer needed when +QDeclarativeContext it constructs. If the \c windowContext is no longer needed when the \c window component instantiation is destroyed, the \c windowContext must be destroyed explicitly. The simplest way to ensure this is to set \c window as \c windowContext's parent. @@ -147,78 +135,15 @@ allow QML to set values. The following example creates a \c CustomPalette object, and sets it as the \c palette context property. -\code -class CustomPalette : public QObject -{ -Q_OBJECT -Q_PROPERTY(QColor background READ background WRITE setBackground NOTIFY backgroundChanged) -Q_PROPERTY(QColor text READ text WRITE setText NOTIFY textChanged) -public: - CustomPalette() : m_background(Qt::white), m_text(Qt::black) {} - - QColor background() const { return m_background; } - void setBackground(const QColor &c) { - if (c != m_background) { - m_background = c; - emit backgroundChanged(); - } - } - - QColor text() const { return m_text; } - void setText(const QColor &c) { - if (c != m_text) { - m_text = c; - emit textChanged(); - } - } -signals: - void textChanged(); - void backgroundChanged(): - -private: - QColor m_background; - QColor m_text; -}; +\snippet doc/src/declarative/snippets/qtbinding/custompalette/custompalette.h 0 -int main(int argc, char **argv) -{ - // ... - - QDeclarativeContext *windowContext = new QDeclarativeContext(engine->rootContext()); - windowContext->setContextProperty("palette", new CustomPalette); - - QDeclarativeComponent component(&engine, "main.qml"); - QObject *window = component.create(windowContext); -} -\endcode +\snippet doc/src/declarative/snippets/qtbinding/custompalette/main.cpp 0 The QML that follows references the palette object, and its properties, to set the appropriate background and text colors. When the window is clicked, the palette's text color is changed, and the window text will update accordingly. -\code -// main.qml -import Qt 4.7 - -Rectangle { - width: 240 - height: 320 - color: palette.background - - Text { - anchors.centerIn: parent - color: palette.text - text: "Hello Colorful World!" - } - - MouseArea { - anchors.fill: parent - onClicked: { - palette.text = "blue"; - } - } -} -\endcode +\snippet doc/src/declarative/snippets/qtbinding/custompalette/main.qml 0 To detect when a C++ property value - in this case the \c CustomPalette's \c text property - changes, the property must have a corresponding NOTIFY signal. The NOTIFY signal specifies a signal @@ -254,57 +179,23 @@ the following types: \o QVariant \endlist -This example toggles the "LED Blinker" when the MouseArea is clicked: +This example toggles the "Stopwatch" object on/off when the MouseArea is clicked: \table \row \o -\code -// main.cpp -class LEDBlinker : public QObject -{ - Q_OBJECT -public: - LEDBlinker(); - - Q_INVOKABLE bool isRunning(); +\c {// main.cpp} +\snippet doc/src/declarative/snippets/qtbinding/stopwatch/stopwatch.h 0 +\snippet doc/src/declarative/snippets/qtbinding/stopwatch/main.cpp 0 -public slots: - void start(); - void stop(); -}; - -int main(int argc, char **argv) -{ - // ... - - QDeclarativeContext *context = engine->rootContext(); - context->setContextProperty("ledBlinker", new LEDBlinker); - - // ... -} -\endcode \o -\code -// main.qml -import Qt 4.7 +\c {// main.qml} +\snippet doc/src/declarative/snippets/qtbinding/stopwatch/main.qml 0 -Rectangle { - MouseArea { - anchors.fill: parent - onClicked: { - if (ledBlinker.isRunning()) - ledBlinker.stop() - else - ledBlicker.start(); - } - } -} -\endcode \endtable Note that in this particular example a better way to achieve the same result -is to have a "running" property. This leads to much nicer QML code: +is to have a "running" property in \c main.qml. This leads to much nicer QML code: \table \row @@ -316,13 +207,12 @@ import Qt 4.7 Rectangle { MouseArea { anchors.fill: parent - onClicked: ledBlinker.running = !ledBlinker.running + onClicked: stopwatch.running = !stopwatch.running } } \endcode \endtable - Of course, it is also possible to call \l {Adding new methods}{functions declared in QML from C++}. @@ -367,35 +257,17 @@ void MyApplication::continueLoading() QML content can be loaded from \l {The Qt Resource System} using the \e qrc: URL scheme. For example: -\code -<!DOCTYPE RCC><RCC version="1.0"> -<qresource> - <file>main.qml</file> - <file>images/background.png</file> -</qresource> -</RCC> -\endcode -\code -// main.cpp -MyApplication::MyApplication() -{ - // ... - component = new QDeclarativeComponent(engine, QUrl("qrc:/main.qml")); - if (component->isError()) { - qWarning() << component->errors(); - } else { - QObject *myObject = component->create(); - } -} -\endcode -\code -// main.qml -import Qt 4.7 +\c [project/example.qrc] +\quotefile doc/src/declarative/snippets/qtbinding/resources/example.qrc -Image { - source: "images/background.png" -} -\endcode +\c [project/project.pro] +\quotefile doc/src/declarative/snippets/qtbinding/resources/resources.pro + +\c [project/main.cpp] +\snippet doc/src/declarative/snippets/qtbinding/resources/main.cpp 0 + +\c [project/main.qml] +\snippet doc/src/declarative/snippets/qtbinding/resources/main.qml 0 */ diff --git a/doc/src/declarative/qtdeclarative.qdoc b/doc/src/declarative/qtdeclarative.qdoc index 8013b92..cbb2146 100644 --- a/doc/src/declarative/qtdeclarative.qdoc +++ b/doc/src/declarative/qtdeclarative.qdoc @@ -69,6 +69,10 @@ /*! \macro QML_DECLARE_TYPE() \relates QDeclarativeEngine + + Declares a C++ type to be usable in the QML system. In addition + to this, a type must also be registered with the QML system using + qmlRegisterType(). */ @@ -79,6 +83,7 @@ This template function registers the C++ type in the QML system with the name \a qmlName. in the library imported from \a uri having the version number composed from \a versionMajor and \a versionMinor. + The type should also haved been declared with the QML_DECLARE_TYPE() macro. Returns the QML type id. @@ -109,6 +114,8 @@ This template function registers the C++ type in the QML system under the name \a typeName. + The type should also haved been declared with the QML_DECLARE_TYPE() macro. + Returns the QML type id. */ diff --git a/doc/src/declarative/snippets/qtbinding/contextproperties/contextproperties.pro b/doc/src/declarative/snippets/qtbinding/contextproperties/contextproperties.pro new file mode 100644 index 0000000..68eeaf2 --- /dev/null +++ b/doc/src/declarative/snippets/qtbinding/contextproperties/contextproperties.pro @@ -0,0 +1,2 @@ +QT += declarative +SOURCES += main.cpp diff --git a/doc/src/declarative/snippets/qtbinding/contextproperties/main.cpp b/doc/src/declarative/snippets/qtbinding/contextproperties/main.cpp new file mode 100644 index 0000000..15e3d4c --- /dev/null +++ b/doc/src/declarative/snippets/qtbinding/contextproperties/main.cpp @@ -0,0 +1,79 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include <QDeclarativeComponent> +#include <QDeclarativeEngine> + +//![0] +#include <QApplication> +#include <QDeclarativeView> +#include <QDeclarativeContext> + +int main(int argc, char *argv[]) +{ + QApplication app(argc, argv); + + QDeclarativeView view; + QDeclarativeContext *context = view.rootContext(); + context->setContextProperty("backgroundColor", + QColor(Qt::yellow)); + + view.setSource(QUrl("main.qml")); + view.show(); + + return app.exec(); +} +//![0] + +static void alternative() +{ + // Alternatively, if we don't actually want to display main.qml: +//![1] + QDeclarativeEngine engine; + QDeclarativeContext *windowContext = new QDeclarativeContext(engine.rootContext()); + windowContext->setContextProperty("backgroundColor", QColor(Qt::yellow)); + + QDeclarativeComponent component(&engine, "main.qml"); + QObject *window = component.create(windowContext); +//![1] +} + + diff --git a/doc/src/declarative/snippets/qtbinding/contextproperties/main.qml b/doc/src/declarative/snippets/qtbinding/contextproperties/main.qml new file mode 100644 index 0000000..1053f73 --- /dev/null +++ b/doc/src/declarative/snippets/qtbinding/contextproperties/main.qml @@ -0,0 +1,15 @@ +//![0] +import Qt 4.7 + +Rectangle { + width: 300 + height: 300 + + color: backgroundColor + + Text { + anchors.centerIn: parent + text: "Hello Yellow World!" + } +} +//![0] diff --git a/doc/src/declarative/snippets/qtbinding/custompalette/custompalette.h b/doc/src/declarative/snippets/qtbinding/custompalette/custompalette.h new file mode 100644 index 0000000..d0d253a --- /dev/null +++ b/doc/src/declarative/snippets/qtbinding/custompalette/custompalette.h @@ -0,0 +1,80 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include <QObject> +#include <QColor> + +//![0] +class CustomPalette : public QObject +{ + Q_OBJECT + Q_PROPERTY(QColor background READ background WRITE setBackground NOTIFY backgroundChanged) + Q_PROPERTY(QColor text READ text WRITE setText NOTIFY textChanged) + +public: + CustomPalette() : m_background(Qt::white), m_text(Qt::black) {} + + QColor background() const { return m_background; } + void setBackground(const QColor &c) { + if (c != m_background) { + m_background = c; + emit backgroundChanged(); + } + } + + QColor text() const { return m_text; } + void setText(const QColor &c) { + if (c != m_text) { + m_text = c; + emit textChanged(); + } + } + +signals: + void textChanged(); + void backgroundChanged(); + +private: + QColor m_background; + QColor m_text; +}; + +//![0] diff --git a/doc/src/declarative/snippets/qtbinding/custompalette/custompalette.pro b/doc/src/declarative/snippets/qtbinding/custompalette/custompalette.pro new file mode 100644 index 0000000..e6af0d0 --- /dev/null +++ b/doc/src/declarative/snippets/qtbinding/custompalette/custompalette.pro @@ -0,0 +1,3 @@ +QT += declarative +HEADERS += custompalette.h +SOURCES += main.cpp diff --git a/doc/src/declarative/snippets/qtbinding/custompalette/main.cpp b/doc/src/declarative/snippets/qtbinding/custompalette/main.cpp new file mode 100644 index 0000000..c723688 --- /dev/null +++ b/doc/src/declarative/snippets/qtbinding/custompalette/main.cpp @@ -0,0 +1,62 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include <QApplication> +#include <QDeclarativeView> +#include <QDeclarativeContext> + +#include "custompalette.h" + +//![0] +int main(int argc, char *argv[]) +{ + QApplication app(argc, argv); + + QDeclarativeView view; + view.rootContext()->setContextProperty("palette", new CustomPalette); + + view.setSource(QUrl("main.qml")); + view.show(); + + return app.exec(); +} +//![0] + diff --git a/doc/src/declarative/snippets/qtbinding/custompalette/main.qml b/doc/src/declarative/snippets/qtbinding/custompalette/main.qml new file mode 100644 index 0000000..f1a3b4f --- /dev/null +++ b/doc/src/declarative/snippets/qtbinding/custompalette/main.qml @@ -0,0 +1,22 @@ +//![0] +import Qt 4.7 + +Rectangle { + width: 240 + height: 320 + color: palette.background + + Text { + anchors.centerIn: parent + color: palette.text + text: "Click me to change color!" + } + + MouseArea { + anchors.fill: parent + onClicked: { + palette.text = "blue"; + } + } +} +//![0] diff --git a/doc/src/declarative/snippets/qtbinding/resources/example.qrc b/doc/src/declarative/snippets/qtbinding/resources/example.qrc new file mode 100644 index 0000000..5e49415 --- /dev/null +++ b/doc/src/declarative/snippets/qtbinding/resources/example.qrc @@ -0,0 +1,10 @@ +<!DOCTYPE RCC> +<RCC version="1.0"> + +<qresource prefix="/"> + <file>main.qml</file> + <file>images/background.png</file> +</qresource> + +</RCC> + diff --git a/doc/src/declarative/snippets/qtbinding/resources/images/background.png b/doc/src/declarative/snippets/qtbinding/resources/images/background.png new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/doc/src/declarative/snippets/qtbinding/resources/images/background.png diff --git a/doc/src/declarative/snippets/qtbinding/resources/main.cpp b/doc/src/declarative/snippets/qtbinding/resources/main.cpp new file mode 100644 index 0000000..5459b9e --- /dev/null +++ b/doc/src/declarative/snippets/qtbinding/resources/main.cpp @@ -0,0 +1,58 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include <QApplication> +#include <QDeclarativeView> +#include <QDeclarativeContext> + +//![0] +int main(int argc, char *argv[]) +{ + QApplication app(argc, argv); + + QDeclarativeView view; + view.setSource(QUrl("qrc:/main.qml")); + view.show(); + + return app.exec(); +} +//![0] + diff --git a/doc/src/declarative/snippets/qtbinding/resources/main.qml b/doc/src/declarative/snippets/qtbinding/resources/main.qml new file mode 100644 index 0000000..dfe923f --- /dev/null +++ b/doc/src/declarative/snippets/qtbinding/resources/main.qml @@ -0,0 +1,7 @@ +//![0] +import Qt 4.7 + +Image { + source: "images/background.png" +} +//![0] diff --git a/doc/src/declarative/snippets/qtbinding/resources/resources.pro b/doc/src/declarative/snippets/qtbinding/resources/resources.pro new file mode 100644 index 0000000..cc01ee1 --- /dev/null +++ b/doc/src/declarative/snippets/qtbinding/resources/resources.pro @@ -0,0 +1,4 @@ +QT += declarative + +SOURCES += main.cpp +RESOURCES += example.qrc diff --git a/doc/src/declarative/snippets/qtbinding/stopwatch/main.cpp b/doc/src/declarative/snippets/qtbinding/stopwatch/main.cpp new file mode 100644 index 0000000..13e3b9f --- /dev/null +++ b/doc/src/declarative/snippets/qtbinding/stopwatch/main.cpp @@ -0,0 +1,63 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "stopwatch.h" + +#include <QDeclarativeView> +#include <QDeclarativeContext> +#include <QApplication> + +//![0] +int main(int argc, char *argv[]) +{ + QApplication app(argc, argv); + + QDeclarativeView view; + view.rootContext()->setContextProperty("stopwatch", + new Stopwatch); + + view.setSource(QUrl("main.qml")); + view.show(); + + return app.exec(); +} +//![0] + diff --git a/doc/src/declarative/snippets/qtbinding/stopwatch/main.qml b/doc/src/declarative/snippets/qtbinding/stopwatch/main.qml new file mode 100644 index 0000000..2efa542 --- /dev/null +++ b/doc/src/declarative/snippets/qtbinding/stopwatch/main.qml @@ -0,0 +1,18 @@ +//![0] +import Qt 4.7 + +Rectangle { + width: 300 + height: 300 + + MouseArea { + anchors.fill: parent + onClicked: { + if (stopwatch.isRunning()) + stopwatch.stop() + else + stopwatch.start(); + } + } +} +//![0] diff --git a/doc/src/declarative/snippets/qtbinding/stopwatch/stopwatch.cpp b/doc/src/declarative/snippets/qtbinding/stopwatch/stopwatch.cpp new file mode 100644 index 0000000..4954a5f --- /dev/null +++ b/doc/src/declarative/snippets/qtbinding/stopwatch/stopwatch.cpp @@ -0,0 +1,63 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "stopwatch.h" + +Stopwatch::Stopwatch() + : m_running(false) +{ +} + +bool Stopwatch::isRunning() const +{ + return m_running; +} + +void Stopwatch::start() +{ + m_running = true; +} + +void Stopwatch::stop() +{ + m_running = false; +} + diff --git a/doc/src/declarative/snippets/qtbinding/stopwatch/stopwatch.h b/doc/src/declarative/snippets/qtbinding/stopwatch/stopwatch.h new file mode 100644 index 0000000..8d17121 --- /dev/null +++ b/doc/src/declarative/snippets/qtbinding/stopwatch/stopwatch.h @@ -0,0 +1,62 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the documentation of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include <QObject> + +//![0] +class Stopwatch : public QObject +{ + Q_OBJECT +public: + Stopwatch(); + + Q_INVOKABLE bool isRunning() const; + +public slots: + void start(); + void stop(); + +private: + bool m_running; +}; + +//![0] + diff --git a/doc/src/declarative/snippets/qtbinding/stopwatch/stopwatch.pro b/doc/src/declarative/snippets/qtbinding/stopwatch/stopwatch.pro new file mode 100644 index 0000000..d803e6a --- /dev/null +++ b/doc/src/declarative/snippets/qtbinding/stopwatch/stopwatch.pro @@ -0,0 +1,3 @@ +QT += declarative +HEADERS += stopwatch.h +SOURCES += main.cpp stopwatch.cpp diff --git a/doc/src/platforms/platform-notes.qdoc b/doc/src/platforms/platform-notes.qdoc index 9c9b743..83f2833 100644 --- a/doc/src/platforms/platform-notes.qdoc +++ b/doc/src/platforms/platform-notes.qdoc @@ -494,6 +494,31 @@ For information about mixing exceptions with Symbian leaves, see \l{Exception Safety with Symbian}. + \section1 Required Capabilities + + Distributions of Qt are typically signed with \c{All -TCB}. What your + application needs to be signed with in order to function with Qt depends + on what functionality it uses: + + \table + \header \o Technology + \o Required Symbian Capability + \row \o QtCore + \o \c PowerMgmt if applications are terminated using QProcess. + \row \o QtNetwork + \o NetworkServices + \row \o QtMultiMedia + \o \c UserEnvironment if QAudioInput is used. + \endtable + + Depending on what file paths that are accessed and how AllFiles may be + required. Similarly, if the network is accessed indirectly through + components such as QtXmlPatterns, QtWebkit or QtScript, the capabilities + needs to match accordingly. + + See individual classes' documentation for specifics. If a class does not + mention Symbian capabilities, it requires none. + \section1 Multimedia and Phonon Support Qt provides a backend for Qt's Phonon module, which supports diff --git a/doc/src/template/scripts/functions.js b/doc/src/template/scripts/functions.js index 329b910..fa454e3 100755 --- a/doc/src/template/scripts/functions.js +++ b/doc/src/template/scripts/functions.js @@ -39,7 +39,7 @@ function doSearch(str){ if (str.length>3) { - alert('start search'); + alert('Search is not yet activated.'); // document.getElementById("refWrapper").innerHTML=""; return; } diff --git a/doc/src/template/style/style.css b/doc/src/template/style/style.css index c46e875..1c78118 100755 --- a/doc/src/template/style/style.css +++ b/doc/src/template/style/style.css @@ -786,10 +786,18 @@ font:600 12px/1.2 Arial; } - .toc ul + .wrap .content .toc ul { - float: left; - padding: 15px; + /* float: left;*/ + padding-left: 0px; + + } + + + .wrap .content .toc .level2 + { + /* float: left;*/ + padding-left: 15px; } diff --git a/examples/declarative/behaviors/SideRect.qml b/examples/declarative/behaviors/SideRect.qml index d06f73c..d32bd7b 100644 --- a/examples/declarative/behaviors/SideRect.qml +++ b/examples/declarative/behaviors/SideRect.qml @@ -5,12 +5,18 @@ Rectangle { property string text - width: 75; height: 50; radius: 6 - color: "#646464"; border.width: 4; border.color: "white" + width: 75; height: 50 + radius: 6 + color: "#646464" + border.width: 4; border.color: "white" MouseArea { anchors.fill: parent hoverEnabled: true - onEntered: { focusRect.x = myRect.x; focusRect.y = myRect.y; focusRect.text = myRect.text } + onEntered: { + focusRect.x = myRect.x; + focusRect.y = myRect.y; + focusRect.text = myRect.text; + } } } diff --git a/examples/declarative/behaviors/behavior-example.qml b/examples/declarative/behaviors/behavior-example.qml index b21f4f0..b7bae6c 100644 --- a/examples/declarative/behaviors/behavior-example.qml +++ b/examples/declarative/behaviors/behavior-example.qml @@ -1,40 +1,38 @@ import Qt 4.7 Rectangle { - color: "#343434" width: 600; height: 400 + color: "#343434" Rectangle { anchors.centerIn: parent - width: 200; height: 200; radius: 30 - color: "transparent"; border.width: 4; border.color: "white" + width: 200; height: 200 + radius: 30 + color: "transparent" + border.width: 4; border.color: "white" SideRect { id: leftRect - anchors.verticalCenter: parent.verticalCenter - anchors.horizontalCenter: parent.left + anchors { verticalCenter: parent.verticalCenter; horizontalCenter: parent.left } text: "Left" } SideRect { id: rightRect - anchors.verticalCenter: parent.verticalCenter - anchors.horizontalCenter: parent.right + anchors { verticalCenter: parent.verticalCenter; horizontalCenter: parent.right } text: "Right" } SideRect { id: topRect - anchors.verticalCenter: parent.top - anchors.horizontalCenter: parent.horizontalCenter + anchors { verticalCenter: parent.top; horizontalCenter: parent.horizontalCenter } text: "Top" } SideRect { id: bottomRect - anchors.verticalCenter: parent.bottom - anchors.horizontalCenter: parent.horizontalCenter + anchors { verticalCenter: parent.bottom; horizontalCenter: parent.horizontalCenter } text: "Bottom" } @@ -44,9 +42,10 @@ Rectangle { property string text - color: "firebrick" x: 62.5; y: 75; width: 75; height: 50 - radius: 6; border.width: 4; border.color: "white" + radius: 6 + border.width: 4; border.color: "white" + color: "firebrick" // Setting an 'elastic' behavior on the focusRect's x property. Behavior on x { @@ -62,7 +61,8 @@ Rectangle { id: focusText text: focusRect.text anchors.centerIn: parent - color: "white"; font.pixelSize: 16; font.bold: true + color: "white" + font.pixelSize: 16; font.bold: true // Setting a behavior on the focusText's x property: // Set the opacity to 0, set the new text value, then set the opacity back to 1. diff --git a/examples/declarative/border-image/animated.qml b/examples/declarative/border-image/animated.qml index 730aeca..c3ff9ef 100644 --- a/examples/declarative/border-image/animated.qml +++ b/examples/declarative/border-image/animated.qml @@ -3,7 +3,6 @@ import "content" Rectangle { id: page - color: "white" width: 1030; height: 540 MyBorderImage { diff --git a/examples/declarative/border-image/borders.qml b/examples/declarative/border-image/borders.qml index 8956128..3743f7e 100644 --- a/examples/declarative/border-image/borders.qml +++ b/examples/declarative/border-image/borders.qml @@ -2,7 +2,6 @@ import Qt 4.7 Rectangle { id: page - color: "white" width: 520; height: 280 BorderImage { diff --git a/examples/declarative/clocks/content/Clock.qml b/examples/declarative/clocks/content/Clock.qml index 036df46..3426e6a 100644 --- a/examples/declarative/clocks/content/Clock.qml +++ b/examples/declarative/clocks/content/Clock.qml @@ -14,7 +14,7 @@ Item { function timeChanged() { var date = new Date; hours = shift ? date.getUTCHours() + Math.floor(clock.shift) : date.getHours() - if ( hours < 7 || hours > 19 ) night = true; else night = false + night = ( hours < 7 || hours > 19 ) minutes = shift ? date.getUTCMinutes() + ((clock.shift % 1) * 60) : date.getMinutes() seconds = date.getUTCSeconds(); } @@ -74,7 +74,10 @@ Item { } Text { - id: cityLabel; font.bold: true; font.pixelSize: 14; y: 200; color: "white" - anchors.horizontalCenter: parent.horizontalCenter; style: Text.Raised; styleColor: "black" + id: cityLabel + y: 200; anchors.horizontalCenter: parent.horizontalCenter + color: "white" + font.bold: true; font.pixelSize: 14 + style: Text.Raised; styleColor: "black" } } diff --git a/examples/declarative/connections/connections-example.qml b/examples/declarative/connections/connections-example.qml index 0b4ca45..fbef968 100644 --- a/examples/declarative/connections/connections-example.qml +++ b/examples/declarative/connections/connections-example.qml @@ -2,23 +2,34 @@ import Qt 4.7 import "content" Rectangle { - id: window; color: "#646464" - width: 640; height: 480 + id: window property int angle: 0 + width: 640; height: 480 + color: "#646464" + Image { - id: image; source: "content/bg1.jpg"; anchors.centerIn: parent; transformOrigin: Item.Center - rotation: window.angle - Behavior on rotation { NumberAnimation { easing.type: "OutCubic"; duration: 300 } } + id: image + source: "content/bg1.jpg" + anchors.centerIn: parent + transformOrigin: Item.Center + rotation: window.angle + + Behavior on rotation { + NumberAnimation { easing.type: "OutCubic"; duration: 300 } + } } Button { - id: leftButton; image: "content/rotate-left.png" + id: leftButton + image: "content/rotate-left.png" anchors { left: parent.left; bottom: parent.bottom; leftMargin: 10; bottomMargin: 10 } } + Button { - id: rightButton; image: "content/rotate-right.png" + id: rightButton + image: "content/rotate-right.png" anchors { right: parent.right; bottom: parent.bottom; rightMargin: 10; bottomMargin: 10 } } diff --git a/examples/declarative/dial/dial-example.qml b/examples/declarative/dial/dial-example.qml index 1ca958a..fd899a5 100644 --- a/examples/declarative/dial/dial-example.qml +++ b/examples/declarative/dial/dial-example.qml @@ -6,26 +6,35 @@ Rectangle { width: 300; height: 300 // Dial with a slider to adjust it - Dial { id: dial; anchors.centerIn: parent; value: slider.x *100 / (container.width - 34) } + Dial { + id: dial + anchors.centerIn: parent + value: slider.x * 100 / (container.width - 34) + } Rectangle { id: container - anchors.bottom: parent.bottom; anchors.bottomMargin: 10 - anchors.left: parent.left; anchors.leftMargin: 20 - anchors.right: parent.right; anchors.rightMargin: 20; height: 16 + anchors { bottom: parent.bottom; left: parent.left; right: parent.right; leftMargin: 20; rightMargin: 20; bottomMargin: 10 } + height: 16 + + radius: 8 + opacity: 0.7 + smooth: true gradient: Gradient { GradientStop { position: 0.0; color: "gray" } GradientStop { position: 1.0; color: "white" } } - radius: 8; opacity: 0.7; smooth: true + Rectangle { id: slider x: 1; y: 1; width: 30; height: 14 - radius: 6; smooth: true + radius: 6 + smooth: true gradient: Gradient { GradientStop { position: 0.0; color: "#424242" } GradientStop { position: 1.0; color: "black" } } + MouseArea { anchors.fill: parent drag.target: parent; drag.axis: "XAxis"; drag.minimumX: 2; drag.maximumX: container.width - 32 diff --git a/examples/declarative/dynamic/dynamic.qml b/examples/declarative/dynamic/dynamic.qml index 7331b3f..eea528f 100644 --- a/examples/declarative/dynamic/dynamic.qml +++ b/examples/declarative/dynamic/dynamic.qml @@ -60,7 +60,7 @@ Item { width: 480 anchors { right: parent.right; top:parent.top; bottom: parent.bottom } Rectangle { //Not a child of any positioner - color: "white"; border.color: "black"; + border.color: "black"; width: toolRow.width + 4 height: toolRow.height + 4 x: toolboxPositioner.x + toolRow.x - 2 diff --git a/examples/declarative/effects/effects.qml b/examples/declarative/effects/effects.qml index d325e11..feb7c69 100644 --- a/examples/declarative/effects/effects.qml +++ b/examples/declarative/effects/effects.qml @@ -1,9 +1,7 @@ import Qt 4.7 Rectangle { - color: "white" - width: 400 - height: 200 + width: 400; height: 200 Image { id: blur @@ -33,7 +31,14 @@ Rectangle { effect: DropShadow { blurRadius: 3 offset.x: 3 - NumberAnimation on offset.y { id: dropShadowEffect; from: 0; to: 10; duration: 1000; running: false; loops: Animation.Infinite; } + + NumberAnimation on offset.y { + id: dropShadowEffect + from: 0; to: 10 + duration: 1000 + running: false + loops: Animation.Infinite + } } MouseArea { anchors.fill: parent; onClicked: dropShadowEffect.running = !dropShadowEffect.running } diff --git a/examples/declarative/fillmode/fillmode.qml b/examples/declarative/fillmode/fillmode.qml index 249674b..e47fc9b 100644 --- a/examples/declarative/fillmode/fillmode.qml +++ b/examples/declarative/fillmode/fillmode.qml @@ -4,6 +4,7 @@ Image { width: 400 height: 250 source: "face.png" + SequentialAnimation on fillMode { loops: Animation.Infinite PropertyAction { value: Image.Stretch } @@ -25,17 +26,19 @@ Image { PropertyAction { target: label; property: "text"; value: "TileVertically" } PauseAnimation { duration: 1000 } } + Text { id: label font.pointSize: 24 color: "blue" style: Text.Outline styleColor: "white" - anchors { centerIn: parent } + anchors.centerIn: parent } + Rectangle { border.color: "black" color: "transparent" - anchors { fill: parent; rightMargin: 1; bottomMargin: 1} + anchors { fill: parent; rightMargin: 1; bottomMargin: 1 } } } diff --git a/examples/declarative/flipable/flipable-example.qml b/examples/declarative/flipable/flipable-example.qml index 171353f..4e09569 100644 --- a/examples/declarative/flipable/flipable-example.qml +++ b/examples/declarative/flipable/flipable-example.qml @@ -2,7 +2,9 @@ import Qt 4.7 import "content" Rectangle { - id: window; width: 480; height: 320 + id: window + + width: 480; height: 320 color: "darkgreen" Row { diff --git a/examples/declarative/focus/Core/ContextMenu.qml b/examples/declarative/focus/Core/ContextMenu.qml index 56a1b3e..49a54bc 100644 --- a/examples/declarative/focus/Core/ContextMenu.qml +++ b/examples/declarative/focus/Core/ContextMenu.qml @@ -2,13 +2,16 @@ import Qt 4.7 FocusScope { id: container + property bool open: false Item { anchors.fill: parent Rectangle { - anchors.fill: parent; color: "#D1DBBD"; focus: true + anchors.fill: parent + color: "#D1DBBD" + focus: true Keys.onRightPressed: mainView.focus = true } } diff --git a/examples/declarative/focus/Core/GridMenu.qml b/examples/declarative/focus/Core/GridMenu.qml index 75f6be0..c37b17a 100644 --- a/examples/declarative/focus/Core/GridMenu.qml +++ b/examples/declarative/focus/Core/GridMenu.qml @@ -6,32 +6,41 @@ FocusScope { onWantsFocusChanged: if (wantsFocus) mainView.state = "" Rectangle { - clip: true; anchors.fill: parent + anchors.fill: parent + clip: true gradient: Gradient { GradientStop { position: 0.0; color: "#193441" } GradientStop { position: 1.0; color: Qt.darker("#193441") } } GridView { - id: gridView; cellWidth: 152; cellHeight: 152; focus: true + id: gridView x: 20; width: parent.width - 40; height: parent.height + cellWidth: 152; cellHeight: 152 + focus: true model: 12 KeyNavigation.down: listViews KeyNavigation.left: contextMenu delegate: Item { - id: container; width: GridView.view.cellWidth; height: GridView.view.cellHeight + id: container + width: GridView.view.cellWidth; height: GridView.view.cellHeight Rectangle { id: content - color: "transparent"; smooth: true + color: "transparent" + smooth: true anchors.centerIn: parent; width: container.width - 40; height: container.height - 40; radius: 10 + Rectangle { color: "#91AA9D"; x: 3; y: 3; width: parent.width - 6; height: parent.height - 6; radius: 8 } Image { source: "images/qt-logo.png"; anchors.centerIn: parent; smooth: true } } MouseArea { - id: mouseArea; anchors.fill: parent; hoverEnabled: true + id: mouseArea + anchors.fill: parent + hoverEnabled: true + onClicked: { GridView.view.currentIndex = index container.focus = true diff --git a/examples/declarative/focus/Core/ListViewDelegate.qml b/examples/declarative/focus/Core/ListViewDelegate.qml index 35c04cf..96324d7 100644 --- a/examples/declarative/focus/Core/ListViewDelegate.qml +++ b/examples/declarative/focus/Core/ListViewDelegate.qml @@ -7,8 +7,11 @@ Component { Rectangle { id: content - color: "transparent"; smooth: true - anchors.centerIn: parent; width: container.width - 40; height: container.height - 10; radius: 10 + anchors.centerIn: parent; width: container.width - 40; height: container.height - 10 + color: "transparent" + smooth: true + radius: 10 + Rectangle { color: "#91AA9D"; x: 3; y: 3; width: parent.width - 6; height: parent.height - 6; radius: 8 } Text { text: "List element " + (index + 1); color: "#193441"; font.bold: false; anchors.centerIn: parent @@ -17,7 +20,10 @@ Component { } MouseArea { - id: mouseArea; anchors.fill: parent; hoverEnabled: true + id: mouseArea + anchors.fill: parent + hoverEnabled: true + onClicked: { ListView.view.currentIndex = index container.focus = true diff --git a/examples/declarative/focus/Core/ListViews.qml b/examples/declarative/focus/Core/ListViews.qml index b28cc1c..f4384c8 100644 --- a/examples/declarative/focus/Core/ListViews.qml +++ b/examples/declarative/focus/Core/ListViews.qml @@ -7,29 +7,43 @@ FocusScope { ListView { id: list1 + y: wantsFocus ? 10 : 40; width: parent.width / 3; height: parent.height - 20 + focus: true + KeyNavigation.up: gridMenu; KeyNavigation.left: contextMenu; KeyNavigation.right: list2 + model: 10 delegate: ListViewDelegate {} - y: wantsFocus ? 10 : 40; focus: true; width: parent.width / 3; height: parent.height - 20 - model: 10; KeyNavigation.up: gridMenu; KeyNavigation.left: contextMenu; KeyNavigation.right: list2 - Behavior on y { NumberAnimation { duration: 600; easing.type: "OutQuint" } } + + Behavior on y { + NumberAnimation { duration: 600; easing.type: "OutQuint" } + } } ListView { id: list2 - delegate: ListViewDelegate {} y: wantsFocus ? 10 : 40; x: parent.width / 3; width: parent.width / 3; height: parent.height - 20 - model: 10; KeyNavigation.up: gridMenu; KeyNavigation.left: list1; KeyNavigation.right: list3 - Behavior on y { NumberAnimation { duration: 600; easing.type: "OutQuint" } } + KeyNavigation.up: gridMenu; KeyNavigation.left: list1; KeyNavigation.right: list3 + model: 10 + delegate: ListViewDelegate {} + + Behavior on y { + NumberAnimation { duration: 600; easing.type: "OutQuint" } + } } ListView { id: list3 - delegate: ListViewDelegate {} y: wantsFocus ? 10 : 40; x: 2 * parent.width / 3; width: parent.width / 3; height: parent.height - 20 - model: 10; KeyNavigation.up: gridMenu; KeyNavigation.left: list2 - Behavior on y { NumberAnimation { duration: 600; easing.type: "OutQuint" } } + KeyNavigation.up: gridMenu; KeyNavigation.left: list2 + model: 10 + delegate: ListViewDelegate {} + + Behavior on y { + NumberAnimation { duration: 600; easing.type: "OutQuint" } + } } Rectangle { width: parent.width; height: 1; color: "#D1DBBD" } + Rectangle { y: 1; width: parent.width; height: 10 gradient: Gradient { @@ -37,6 +51,7 @@ FocusScope { GradientStop { position: 1.0; color: "transparent" } } } + Rectangle { y: parent.height - 10; width: parent.width; height: 10 gradient: Gradient { diff --git a/examples/declarative/focus/focus.qml b/examples/declarative/focus/focus.qml index d9b6549..22b0e50 100644 --- a/examples/declarative/focus/focus.qml +++ b/examples/declarative/focus/focus.qml @@ -2,19 +2,34 @@ import Qt 4.7 import "Core" Rectangle { - id: window; width: 800; height: 480; color: "#3E606F" + id: window + + width: 800; height: 480 + color: "#3E606F" FocusScope { - id: mainView; focus: true; width: parent.width; height: parent.height + id: mainView + + width: parent.width; height: parent.height + focus: true GridMenu { - id: gridMenu; focus: true - width: parent.width; height: 320; interactive: parent.wantsFocus + id: gridMenu + + width: parent.width; height: 320 + focus: true + interactive: parent.wantsFocus } - ListViews { id: listViews; y: 320; width: parent.width; height: 320 } + ListViews { + id: listViews + y: 320; width: parent.width; height: 320 + } - Rectangle { id: shade; color: "black"; opacity: 0; anchors.fill: parent } + Rectangle { + id: shade + color: "black"; opacity: 0; anchors.fill: parent + } states: State { name: "showListViews" @@ -28,7 +43,10 @@ Rectangle { } Image { - source: "Core/images/arrow.png"; rotation: 90; anchors.verticalCenter: parent.verticalCenter + source: "Core/images/arrow.png" + rotation: 90 + anchors.verticalCenter: parent.verticalCenter + MouseArea { anchors { fill: parent; leftMargin: -10; topMargin: -10; rightMargin: -10; bottomMargin: -10 } onClicked: window.state = "contextMenuOpen" @@ -38,7 +56,8 @@ Rectangle { ContextMenu { id: contextMenu; x: -265; width: 260; height: parent.height } states: State { - name: "contextMenuOpen"; when: !mainView.wantsFocus + name: "contextMenuOpen" + when: !mainView.wantsFocus PropertyChanges { target: contextMenu; x: 0; open: true } PropertyChanges { target: mainView; x: 130 } PropertyChanges { target: shade; opacity: 0.25 } diff --git a/examples/declarative/fonts/banner.qml b/examples/declarative/fonts/banner.qml index b7f5344..353354a 100644 --- a/examples/declarative/fonts/banner.qml +++ b/examples/declarative/fonts/banner.qml @@ -2,14 +2,17 @@ import Qt 4.7 Rectangle { id: screen - width: 640; height: 320; color: "steelblue" property int pixelSize: screen.height * 1.25 property color textColor: "lightsteelblue" property string text: "Hello world! " + width: 640; height: 320 + color: "steelblue" + Row { y: -screen.height / 4.5 + NumberAnimation on x { from: 0; to: -text.width; duration: 6000; loops: Animation.Infinite } Text { id: text; font.pixelSize: screen.pixelSize; color: screen.textColor; text: screen.text } Text { font.pixelSize: screen.pixelSize; color: screen.textColor; text: screen.text } diff --git a/examples/declarative/fonts/fonts.qml b/examples/declarative/fonts/fonts.qml index 49c3d0a..97dd645 100644 --- a/examples/declarative/fonts/fonts.qml +++ b/examples/declarative/fonts/fonts.qml @@ -11,36 +11,43 @@ Rectangle { FontLoader { id: webFont; source: "http://www.princexml.com/fonts/steffmann/Starburst.ttf" } Column { - anchors.fill: parent; spacing: 15 - anchors.leftMargin: 10; anchors.rightMargin: 10 + anchors { fill: parent; leftMargin: 10; rightMargin: 10 } + spacing: 15 + Text { - text: myText; color: "lightsteelblue" - width: parent.width; elide: Text.ElideRight - font.family: "Times"; font.pointSize: 42 + text: myText + color: "lightsteelblue" + width: parent.width + elide: Text.ElideRight + font.family: "Times"; font.pointSize: 42 } Text { - text: myText; color: "lightsteelblue" - width: parent.width; elide: Text.ElideLeft - font.family: "Times"; font.pointSize: 42 - font.capitalization: Font.AllUppercase + text: myText + color: "lightsteelblue" + width: parent.width + elide: Text.ElideLeft + font { family: "Times"; pointSize: 42; capitalization: Font.AllUppercase } } Text { - text: myText; color: "lightsteelblue" - width: parent.width; elide: Text.ElideMiddle - font.family: fixedFont.name; font.pointSize: 42; font.weight: Font.Bold - font.capitalization: Font.AllLowercase + text: myText + color: "lightsteelblue" + width: parent.width + elide: Text.ElideMiddle + font { family: fixedFont.name; pointSize: 42; weight: Font.Bold; capitalization: Font.AllLowercase } } Text { - text: myText; color: "lightsteelblue" - width: parent.width; elide: Text.ElideRight - font.family: fixedFont.name; font.pointSize: 42; font.italic: true - font.capitalization: Font.SmallCaps + text: myText + color: "lightsteelblue" + width: parent.width + elide: Text.ElideRight + font { family: fixedFont.name; pointSize: 42; italic: true; capitalization: Font.SmallCaps } } Text { - text: myText; color: "lightsteelblue" - width: parent.width; elide: Text.ElideLeft - font.family: localFont.name; font.pointSize: 42 - font.capitalization: Font.Capitalize + text: myText + color: "lightsteelblue" + width: parent.width + elide: Text.ElideLeft + font { family: localFont.name; pointSize: 42; capitalization: Font.Capitalize } } Text { text: { @@ -49,7 +56,8 @@ Rectangle { else if (webFont.status == 3) "Error loading font" } color: "lightsteelblue" - width: parent.width; elide: Text.ElideMiddle + width: parent.width + elide: Text.ElideMiddle font.family: webFont.name; font.pointSize: 42 } } diff --git a/examples/declarative/fonts/hello.qml b/examples/declarative/fonts/hello.qml index 9d926fb..d4d0e4c 100644 --- a/examples/declarative/fonts/hello.qml +++ b/examples/declarative/fonts/hello.qml @@ -1,22 +1,33 @@ import Qt 4.7 Rectangle { - id: screen; width: 800; height: 480; color: "black" + id: screen + + width: 800; height: 480 + color: "black" Item { - id: container; x: screen.width / 2; y: screen.height / 2 + id: container + x: screen.width / 2; y: screen.height / 2 + Text { - id: text; color: "white"; anchors.centerIn: parent - text: "Hello world!"; font.pixelSize: 60 + id: text + anchors.centerIn: parent + color: "white" + text: "Hello world!" + font.pixelSize: 60 SequentialAnimation on font.letterSpacing { loops: Animation.Infinite; NumberAnimation { from: 100; to: 300; easing.type: "InQuad"; duration: 3000 } - ScriptAction { script: { - container.y = (screen.height / 4) + (Math.random() * screen.height / 2) - container.x = (screen.width / 4) + (Math.random() * screen.width / 2) - } } + ScriptAction { + script: { + container.y = (screen.height / 4) + (Math.random() * screen.height / 2) + container.x = (screen.width / 4) + (Math.random() * screen.width / 2) + } + } } + SequentialAnimation on opacity { loops: Animation.Infinite; NumberAnimation { from: 1; to: 0; duration: 2600 } diff --git a/examples/declarative/gridview/gridview-example.qml b/examples/declarative/gridview/gridview-example.qml index fd5f430..a5f41fb 100644 --- a/examples/declarative/gridview/gridview-example.qml +++ b/examples/declarative/gridview/gridview-example.qml @@ -1,7 +1,8 @@ import Qt 4.7 Rectangle { - width: 300; height: 400; color: "white" + width: 300; height: 400 + color: "white" ListModel { id: appModel @@ -16,10 +17,19 @@ Rectangle { Component { id: appDelegate + Item { width: 100; height: 100 - Image { id: myIcon; y: 20; anchors.horizontalCenter: parent.horizontalCenter; source: icon } - Text { anchors.top: myIcon.bottom; anchors.horizontalCenter: parent.horizontalCenter; text: name } + + Image { + id: myIcon + y: 20; anchors.horizontalCenter: parent.horizontalCenter + source: icon + } + Text { + anchors { top: myIcon.bottom; horizontalCenter: parent.horizontalCenter } + text: name + } } } @@ -31,8 +41,9 @@ Rectangle { GridView { anchors.fill: parent cellWidth: 100; cellHeight: 100 - model: appModel; delegate: appDelegate highlight: appHighlight focus: true + model: appModel + delegate: appDelegate } } diff --git a/examples/declarative/imageprovider/imageprovider-example.qml b/examples/declarative/imageprovider/imageprovider-example.qml index 9d22576..d774112 100644 --- a/examples/declarative/imageprovider/imageprovider-example.qml +++ b/examples/declarative/imageprovider/imageprovider-example.qml @@ -2,10 +2,11 @@ import Qt 4.7 import "ImageProviderCore" //![0] ListView { - width: 100 - height: 100 + width: 100; height: 100 anchors.fill: parent + model: myModel + delegate: Component { Item { width: 100 diff --git a/examples/declarative/images/images.qml b/examples/declarative/images/images.qml index 7980088..e48ad50 100644 --- a/examples/declarative/images/images.qml +++ b/examples/declarative/images/images.qml @@ -6,8 +6,8 @@ Rectangle { height: grid.height + 50 Grid { - x: 25; y: 25 id: grid + x: 25; y: 25 columns: 3 Image { @@ -48,19 +48,22 @@ Rectangle { } Image { - width: 50; height: 50; transform: Translate { x: 50 } + width: 50; height: 50 + transform: Translate { x: 50 } source: "content/lemonade.jpg" } Image { - width: 50; height: 50; transform: Translate { x: 50 } + width: 50; height: 50 + transform: Translate { x: 50 } sourceSize.width: 50 sourceSize.height: 50 source: "content/lemonade.jpg" } Image { - width: 50; height: 50; transform: Translate { x: 50 } + width: 50; height: 50 + transform: Translate { x: 50 } sourceSize: "50x50" // syntactic sugar smooth: true source: "content/lemonade.jpg" diff --git a/examples/declarative/layouts/layouts.qml b/examples/declarative/layouts/layouts.qml index 1d34afd..391eab7 100644 --- a/examples/declarative/layouts/layouts.qml +++ b/examples/declarative/layouts/layouts.qml @@ -1,12 +1,15 @@ import Qt 4.7 -import Qt.widgets 4.6 +import Qt.widgets 4.7 + Item { id: resizable - width:400 - height:400 + + width: 400 + height: 400 + QGraphicsWidget { - size.width:parent.width - size.height:parent.height + size.width: parent.width + size.height: parent.height layout: QGraphicsLinearLayout { LayoutItem { diff --git a/examples/declarative/layouts/positioners.qml b/examples/declarative/layouts/positioners.qml index ef225d0..3703b59 100644 --- a/examples/declarative/layouts/positioners.qml +++ b/examples/declarative/layouts/positioners.qml @@ -2,31 +2,40 @@ import Qt 4.7 Rectangle { id: page - width: 420 - height: 420 - color: "white" + width: 420; height: 420 Column { id: layout1 y: 0 move: Transition { - NumberAnimation { - properties: "y"; easing.type: "OutBounce" - } + NumberAnimation { properties: "y"; easing.type: "OutBounce" } } add: Transition { - NumberAnimation { - properties: "y"; easing.type: "OutQuad" - } + NumberAnimation { properties: "y"; easing.type: "OutQuad" } } + Rectangle { color: "red"; width: 100; height: 50; border.color: "black"; radius: 15 } - Rectangle { id: blueV1; color: "lightsteelblue"; width: 100; height: 50; border.color: "black"; radius: 15 - Behavior on opacity {NumberAnimation{}} + + Rectangle { + id: blueV1 + width: 100; height: 50 + color: "lightsteelblue" + border.color: "black" + radius: 15 + Behavior on opacity { NumberAnimation {} } } + Rectangle { color: "green"; width: 100; height: 50; border.color: "black"; radius: 15 } - Rectangle { id: blueV2; color: "lightsteelblue"; width: 100; height: 50; border.color: "black"; radius: 15 - Behavior on opacity {NumberAnimation{}} + + Rectangle { + id: blueV2 + width: 100; height: 50 + color: "lightsteelblue" + border.color: "black" + radius: 15 + Behavior on opacity { NumberAnimation {} } } + Rectangle { color: "orange"; width: 100; height: 50; border.color: "black"; radius: 15 } } @@ -34,31 +43,41 @@ Rectangle { id: layout2 y: 300 move: Transition { - NumberAnimation { - properties: "x"; easing.type: "OutBounce" - } + NumberAnimation { properties: "x"; easing.type: "OutBounce" } } add: Transition { - NumberAnimation { - properties: "x"; easing.type: "OutQuad" - } + NumberAnimation { properties: "x"; easing.type: "OutQuad" } } + Rectangle { color: "red"; width: 50; height: 100; border.color: "black"; radius: 15 } - Rectangle { id: blueH1; color: "lightsteelblue"; width: 50; height: 100; border.color: "black"; radius: 15 - Behavior on opacity {NumberAnimation{}} + + Rectangle { + id: blueH1 + width: 50; height: 100 + color: "lightsteelblue" + border.color: "black" + radius: 15 + Behavior on opacity { NumberAnimation {} } } + Rectangle { color: "green"; width: 50; height: 100; border.color: "black"; radius: 15 } - Rectangle { id: blueH2; color: "lightsteelblue"; width: 50; height: 100; border.color: "black"; radius: 15 - Behavior on opacity {NumberAnimation{}} + + Rectangle { + id: blueH2 + width: 50; height: 100 + color: "lightsteelblue" + border.color: "black" + radius: 15 + Behavior on opacity { NumberAnimation {} } } + Rectangle { color: "orange"; width: 50; height: 100; border.color: "black"; radius: 15 } } Button { + x: 135; y: 90 text: "Remove" icon: "del.png" - x: 135 - y: 90 onClicked: { blueH2.opacity = 0 @@ -75,10 +94,9 @@ Rectangle { } Button { + x: 145; y: 140 text: "Add" icon: "add.png" - x: 145 - y: 140 onClicked: { blueH2.opacity = 1 @@ -95,34 +113,50 @@ Rectangle { } Grid { - x: 260 - y: 0 + x: 260; y: 0 columns: 3 move: Transition { - NumberAnimation { - properties: "x,y"; easing.type: "OutBounce" - } + NumberAnimation { properties: "x,y"; easing.type: "OutBounce" } } add: Transition { - NumberAnimation { - properties: "x,y"; easing.type: "OutBounce" - } + NumberAnimation { properties: "x,y"; easing.type: "OutBounce" } } Rectangle { color: "red"; width: 50; height: 50; border.color: "black"; radius: 15 } - Rectangle { id: blueG1; color: "lightsteelblue"; width: 50; height: 50; border.color: "black"; radius: 15 - Behavior on opacity {NumberAnimation{}} + + Rectangle { + id: blueG1 + width: 50; height: 50 + color: "lightsteelblue" + border.color: "black" + radius: 15 + Behavior on opacity { NumberAnimation {} } } + Rectangle { color: "green"; width: 50; height: 50; border.color: "black"; radius: 15 } - Rectangle { id: blueG2; color: "lightsteelblue"; width: 50; height: 50; border.color: "black"; radius: 15 - Behavior on opacity {NumberAnimation{}} + + Rectangle { + id: blueG2 + width: 50; height: 50 + color: "lightsteelblue" + border.color: "black" + radius: 15 + Behavior on opacity { NumberAnimation {} } } + Rectangle { color: "orange"; width: 50; height: 50; border.color: "black"; radius: 15 } - Rectangle { id: blueG3; color: "lightsteelblue"; width: 50; height: 50; border.color: "black"; radius: 15 - Behavior on opacity {NumberAnimation{}} + + Rectangle { + id: blueG3 + width: 50; height: 50 + color: "lightsteelblue" + border.color: "black" + radius: 15 + Behavior on opacity { NumberAnimation {} } } + Rectangle { color: "red"; width: 50; height: 50; border.color: "black"; radius: 15 } Rectangle { color: "green"; width: 50; height: 50; border.color: "black"; radius: 15 } Rectangle { color: "orange"; width: 50; height: 50; border.color: "black"; radius: 15 } @@ -130,33 +164,49 @@ Rectangle { Flow { id: layout4 - x: 260 - y: 250 - width: 150 + x: 260; y: 250; width: 150 move: Transition { - NumberAnimation { - properties: "x,y"; easing.type: "OutBounce" - } + NumberAnimation { properties: "x,y"; easing.type: "OutBounce" } } add: Transition { - NumberAnimation { - properties: "x,y"; easing.type: "OutBounce" - } + NumberAnimation { properties: "x,y"; easing.type: "OutBounce" } } + Rectangle { color: "red"; width: 50; height: 50; border.color: "black"; radius: 15 } - Rectangle { id: blueF1; color: "lightsteelblue"; width: 60; height: 50; border.color: "black"; radius: 15 - Behavior on opacity {NumberAnimation{}} + + Rectangle { + id: blueF1 + width: 60; height: 50 + color: "lightsteelblue" + border.color: "black" + radius: 15 + Behavior on opacity { NumberAnimation {} } } + Rectangle { color: "green"; width: 30; height: 50; border.color: "black"; radius: 15 } - Rectangle { id: blueF2; color: "lightsteelblue"; width: 60; height: 50; border.color: "black"; radius: 15 - Behavior on opacity {NumberAnimation{}} + + Rectangle { + id: blueF2 + width: 60; height: 50 + color: "lightsteelblue" + border.color: "black" + radius: 15 + Behavior on opacity { NumberAnimation {} } } + Rectangle { color: "orange"; width: 50; height: 50; border.color: "black"; radius: 15 } - Rectangle { id: blueF3; color: "lightsteelblue"; width: 40; height: 50; border.color: "black"; radius: 15 - Behavior on opacity {NumberAnimation{}} + + Rectangle { + id: blueF3 + width: 40; height: 50 + color: "lightsteelblue" + border.color: "black" + radius: 15 + Behavior on opacity { NumberAnimation {} } } + Rectangle { color: "red"; width: 80; height: 50; border.color: "black"; radius: 15 } } diff --git a/examples/declarative/listmodel-threaded/timedisplay.qml b/examples/declarative/listmodel-threaded/timedisplay.qml index 848192e..80ac9fa 100644 --- a/examples/declarative/listmodel-threaded/timedisplay.qml +++ b/examples/declarative/listmodel-threaded/timedisplay.qml @@ -22,7 +22,9 @@ ListView { Timer { id: timer - interval: 2000; repeat: true; running: true; triggeredOnStart: true + interval: 2000; repeat: true + running: true + triggeredOnStart: true onTriggered: { var msg = {'action': 'appendCurrentTime', 'model': listModel}; diff --git a/examples/declarative/listview/dynamic.qml b/examples/declarative/listview/dynamic.qml index 32483fa..236a9c5 100644 --- a/examples/declarative/listview/dynamic.qml +++ b/examples/declarative/listview/dynamic.qml @@ -3,11 +3,13 @@ import "content" import "../scrollbar" Rectangle { + id: container width: 640; height: 480 color: "#343434" ListModel { id: fruitModel + ListElement { name: "Apple"; cost: 2.45 attributes: [ @@ -51,12 +53,16 @@ Rectangle { Component { id: fruitDelegate + Item { - width: parent.width; height: 55 + width: container.width; height: 55 Column { - id: moveButtons; x: 5; width: childrenRect.width; anchors.verticalCenter: parent.verticalCenter - Image { source: "content/pics/go-up.png" + id: moveButtons + x: 5; width: childrenRect.width; anchors.verticalCenter: parent.verticalCenter + + Image { + source: "content/pics/go-up.png" MouseArea { anchors.fill: parent; onClicked: fruitModel.move(index,index-1,1) } } Image { source: "content/pics/go-down.png" @@ -66,33 +72,63 @@ Rectangle { Column { anchors { right: itemButtons.left; verticalCenter: parent.verticalCenter; left: moveButtons.right; leftMargin: 10 } + Text { - id: label; font.bold: true; text: name; elide: Text.ElideRight; font.pixelSize: 15 - width: parent.width; color: "White" + id: label + width: parent.width + color: "White" + font.bold: true; font.pixelSize: 15 + text: name; elide: Text.ElideRight } Row { spacing: 5 - Repeater { model: attributes; Component { Text { text: description; color: "White" } } } + Repeater { + model: attributes + Component { + Text { text: description; color: "White" } + } + } } } Row { id: itemButtons - anchors.right: removeButton.left; anchors.rightMargin: 35; spacing: 10 - width: childrenRect.width; anchors.verticalCenter: parent.verticalCenter - Image { source: "content/pics/list-add.png" - ClickAutoRepeating { id: clickUp; anchors.fill: parent; onClicked: fruitModel.setProperty(index,"cost",cost+0.25) } - scale: clickUp.isPressed ? 0.9 : 1; transformOrigin: Item.Center + + anchors { right: removeButton.left; rightMargin: 35; verticalCenter: parent.verticalCenter } + width: childrenRect.width + spacing: 10 + + Image { + source: "content/pics/list-add.png" + scale: clickUp.isPressed ? 0.9 : 1 + transformOrigin: Item.Center + + ClickAutoRepeating { + id: clickUp + anchors.fill: parent + onClicked: fruitModel.setProperty(index, "cost", cost+0.25) + } } + Text { id: costText; text: '$'+Number(cost).toFixed(2); font.pixelSize: 15; color: "White"; font.bold: true; } - Image { source: "content/pics/list-remove.png" - ClickAutoRepeating { id: clickDown; anchors.fill: parent; onClicked: fruitModel.setProperty(index,"cost",Math.max(0,cost-0.25)) } - scale: clickDown.isPressed ? 0.9 : 1; transformOrigin: Item.Center + + Image { + source: "content/pics/list-remove.png" + scale: clickDown.isPressed ? 0.9 : 1 + transformOrigin: Item.Center + + ClickAutoRepeating { + id: clickDown + anchors.fill: parent + onClicked: fruitModel.setProperty(index, "cost", Math.max(0,cost-0.25)) + } } } Image { - id: removeButton; source: "content/pics/archive-remove.png" + id: removeButton anchors { verticalCenter: parent.verticalCenter; right: parent.right; rightMargin: 10 } + source: "content/pics/archive-remove.png" + MouseArea { anchors.fill:parent; onClicked: fruitModel.remove(index) } } } @@ -100,60 +136,75 @@ Rectangle { ListView { id: view - model: fruitModel; delegate: fruitDelegate anchors { top: parent.top; left: parent.left; right: parent.right; bottom: buttons.top } + model: fruitModel + delegate: fruitDelegate } // Attach scrollbar to the right edge of the view. ScrollBar { id: verticalScrollBar + + width: 8; height: view.height; anchors.right: view.right opacity: 0 orientation: "Vertical" position: view.visibleArea.yPosition pageSize: view.visibleArea.heightRatio - width: 8 - height: view.height - anchors.right: view.right + // Only show the scrollbar when the view is moving. - states: [ - State { - name: "ShowBars"; when: view.moving - PropertyChanges { target: verticalScrollBar; opacity: 1 } - } - ] - transitions: [ Transition { NumberAnimation { properties: "opacity"; duration: 400 } } ] + states: State { + name: "ShowBars"; when: view.moving + PropertyChanges { target: verticalScrollBar; opacity: 1 } + } + transitions: Transition { + NumberAnimation { properties: "opacity"; duration: 400 } + } } Row { - x: 8; width: childrenRect.width - height: childrenRect.height + id: buttons + + x: 8; width: childrenRect.width; height: childrenRect.height anchors { bottom: parent.bottom; bottomMargin: 8 } spacing: 8 - id: buttons - Image { source: "content/pics/archive-insert.png" - MouseArea { anchors.fill: parent; + + Image { + source: "content/pics/archive-insert.png" + + MouseArea { + anchors.fill: parent onClicked: { fruitModel.append({ - "name":"Pizza Margarita", - "cost":5.95, - "attributes":[{"description": "Cheese"},{"description": "Tomato"}] - }) + "name": "Pizza Margarita", + "cost": 5.95, + "attributes": [{"description": "Cheese"},{"description": "Tomato"}] + }) } } } - Image { source: "content/pics/archive-insert.png" - MouseArea { anchors.fill: parent; + + Image { + source: "content/pics/archive-insert.png" + + MouseArea { + anchors.fill: parent; onClicked: { - fruitModel.insert(0,{ - "name":"Pizza Supreme", - "cost":9.95, - "attributes":[{"description": "Cheese"},{"description": "Tomato"},{"description": "The Works"}] - }) + fruitModel.insert(0, { + "name": "Pizza Supreme", + "cost": 9.95, + "attributes": [{"description": "Cheese"},{"description": "Tomato"},{"description": "The Works"}] + }) } } } - Image { source: "content/pics/archive-remove.png" - MouseArea { anchors.fill: parent; onClicked: fruitModel.clear() } + + Image { + source: "content/pics/archive-remove.png" + + MouseArea { + anchors.fill: parent + onClicked: fruitModel.clear() + } } } } diff --git a/examples/declarative/listview/highlight.qml b/examples/declarative/listview/highlight.qml index 2b54dd8..50ba2f7 100644 --- a/examples/declarative/listview/highlight.qml +++ b/examples/declarative/listview/highlight.qml @@ -1,12 +1,13 @@ import Qt 4.7 Rectangle { - width: 400; height: 300; color: "white" + width: 400; height: 300 // MyPets model is defined in dummydata/MyPetsModel.qml // The viewer automatically loads files in dummydata/* to assist // development without a real data source. // This one contains my pets. + // Define a delegate component. A component will be // instantiated for each visible item in the list. Component { @@ -21,20 +22,14 @@ Rectangle { } // Use the ListView.isCurrentItem attached property to // indent the item if it is the current item. - states: [ - State { - name: "Current" - when: wrapper.ListView.isCurrentItem - PropertyChanges { target: wrapper; x: 10 } - } - ] - transitions: [ - Transition { - NumberAnimation { - properties: "x"; duration: 200 - } - } - ] + states: State { + name: "Current" + when: wrapper.ListView.isCurrentItem + PropertyChanges { target: wrapper; x: 10 } + } + transitions: Transition { + NumberAnimation { properties: "x"; duration: 200 } + } } } // Specify a highlight with custom movement. Note that highlightFollowsCurrentItem @@ -43,14 +38,17 @@ Rectangle { Component { id: petHighlight Rectangle { - width: 200; height: 50; color: "#FFFF88" + width: 200; height: 50 + color: "#FFFF88" SpringFollow on y { to: list1.currentItem.y; spring: 3; damping: 0.1 } } } + ListView { id: list1 width: 200; height: parent.height - model: MyPetsModel; delegate: petDelegate + model: MyPetsModel + delegate: petDelegate highlight: petHighlight; highlightFollowsCurrentItem: false focus: true } diff --git a/examples/declarative/listview/itemlist.qml b/examples/declarative/listview/itemlist.qml index 2f4aa31..e387f28 100644 --- a/examples/declarative/listview/itemlist.qml +++ b/examples/declarative/listview/itemlist.qml @@ -10,23 +10,27 @@ Rectangle { VisualItemModel { id: itemModel + Rectangle { - height: view.height; width: view.width; color: "#FFFEF0" + width: view.width; height: view.height + color: "#FFFEF0" Text { text: "Page 1"; font.bold: true; anchors.centerIn: parent } } Rectangle { - height: view.height; width: view.width; color: "#F0FFF7" + width: view.width; height: view.height + color: "#F0FFF7" Text { text: "Page 2"; font.bold: true; anchors.centerIn: parent } } Rectangle { - height: view.height; width: view.width; color: "#F4F0FF" + width: view.width; height: view.height + color: "#F4F0FF" Text { text: "Page 3"; font.bold: true; anchors.centerIn: parent } } } ListView { id: view - anchors.fill: parent; anchors.bottomMargin: 30 + anchors { fill: parent; bottomMargin: 30 } model: itemModel preferredHighlightBegin: 0; preferredHighlightEnd: 0 highlightRangeMode: "StrictlyEnforceRange" @@ -35,22 +39,27 @@ Rectangle { } Rectangle { + width: 240; height: 30 + anchors { top: view.bottom; bottom: parent.bottom } color: "gray" - anchors.top: view.bottom - anchors.bottom: parent.bottom - height: 30 - width: 240 Row { anchors.centerIn: parent spacing: 20 + Repeater { model: itemModel.count + Rectangle { width: 5; height: 5 radius: 3 - MouseArea { width: 20; height: 20; anchors.centerIn: parent; onClicked: view.currentIndex = index } color: view.currentIndex == index ? "blue" : "white" + + MouseArea { + width: 20; height: 20 + anchors.centerIn: parent + onClicked: view.currentIndex = index + } } } } diff --git a/examples/declarative/listview/listview-example.qml b/examples/declarative/listview/listview-example.qml index d648b60..6feedf6 100644 --- a/examples/declarative/listview/listview-example.qml +++ b/examples/declarative/listview/listview-example.qml @@ -1,12 +1,13 @@ import Qt 4.7 Rectangle { - width: 600; height: 300; color: "white" + width: 600; height: 300 // MyPets model is defined in dummydata/MyPetsModel.qml // The viewer automatically loads files in dummydata/* to assist // development without a real data source. // This one contains my pets. + // Define a delegate component. A component will be // instantiated for each visible item in the list. Component { @@ -31,46 +32,61 @@ Rectangle { // Show the model in three lists, with different highlight ranges. // preferredHighlightBegin and preferredHighlightEnd set the // range in which to attempt to maintain the highlight. + // // Note that the second and third ListView // set their currentIndex to be the same as the first, and that // the first ListView is given keyboard focus. + // // The default mode allows the currentItem to move freely // within the visible area. If it would move outside the visible // area, the view is scrolled to keep it visible. + // // The second list sets a highlight range which attempts to keep the // current item within the the bounds of the range, however // items will not scroll beyond the beginning or end of the view, // forcing the highlight to move outside the range at the ends. + // // The third list sets the highlightRangeMode to StrictlyEnforceRange // and sets a range smaller than the height of an item. This // forces the current item to change when the view is flicked, // since the highlight is unable to move. + // // Note that the first ListView sets its currentIndex to be equal to // the third ListView's currentIndex. By flicking List3 with // the mouse, the current index of List1 will be changed. + ListView { id: list1 width: 200; height: parent.height - model: MyPetsModel; delegate: petDelegate - highlight: petHighlight; currentIndex: list3.currentIndex + model: MyPetsModel + delegate: petDelegate + + highlight: petHighlight + currentIndex: list3.currentIndex focus: true } + ListView { id: list2 x: 200; width: 200; height: parent.height - model: MyPetsModel; delegate: petDelegate; highlight: petHighlight - preferredHighlightBegin: 80 - preferredHighlightEnd: 220 - highlightRangeMode: "ApplyRange" + model: MyPetsModel + delegate: petDelegate + + highlight: petHighlight currentIndex: list1.currentIndex + preferredHighlightBegin: 80; preferredHighlightEnd: 220 + highlightRangeMode: "ApplyRange" } + ListView { id: list3 x: 400; width: 200; height: parent.height - model: MyPetsModel; delegate: petDelegate; highlight: petHighlight + model: MyPetsModel + delegate: petDelegate + + highlight: Rectangle { color: "lightsteelblue" } currentIndex: list1.currentIndex - preferredHighlightBegin: 125 - preferredHighlightEnd: 125 + preferredHighlightBegin: 125; preferredHighlightEnd: 125 highlightRangeMode: "StrictlyEnforceRange" flickDeceleration: 1000 } diff --git a/examples/declarative/listview/recipes.qml b/examples/declarative/listview/recipes.qml index 66c4109..990e272 100644 --- a/examples/declarative/listview/recipes.qml +++ b/examples/declarative/listview/recipes.qml @@ -5,16 +5,17 @@ import "content" Rectangle { id: page - width: 400; height: 240; color: "black" + width: 400; height: 240 + color: "black" // Delegate for the recipes. This delegate has two modes: // 1. the list mode (default), which just shows the picture and title of the recipe. // 2. the details mode, which also shows the ingredients and method. Component { id: recipeDelegate + Item { id: wrapper - width: list.width // Create a property to contain the visibility of the details. // We can bind multiple element's opacity to this one property, @@ -22,11 +23,15 @@ Rectangle { // want to fade. property real detailsOpacity : 0 + width: list.width + // A simple rounded rectangle for the background Rectangle { id: background x: 1; y: 2; width: parent.width - 2; height: parent.height - 4 - color: "#FEFFEE"; border.color: "#FFBE4F"; radius: 5 + color: "#FEFFEE" + border.color: "#FFBE4F" + radius: 5 } // This mouse region covers the entire delegate. @@ -52,13 +57,17 @@ Rectangle { } Column { - height: recipePic.height; width: background.width-recipePic.width-20 + width: background.width-recipePic.width-20; height: recipePic.height; spacing: 5 + Text { id: name; text: title; font.bold: true; font.pointSize: 16 } + Text { - text: "Ingredients"; font.pointSize: 12; font.bold: true + text: "Ingredients" + font.pointSize: 12; font.bold: true opacity: wrapper.detailsOpacity } + Text { text: ingredients wrapMode: Text.WordWrap @@ -71,52 +80,61 @@ Rectangle { Item { id: details x: 10; width: parent.width-20 - anchors.top: topLayout.bottom; anchors.topMargin: 10 - anchors.bottom: parent.bottom; anchors.bottomMargin: 10 + anchors { top: topLayout.bottom; topMargin: 10; bottom: parent.bottom; bottomMargin: 10 } opacity: wrapper.detailsOpacity Text { id: methodTitle - text: "Method"; font.pointSize: 12; font.bold: true anchors.top: parent.top + text: "Method" + font.pointSize: 12; font.bold: true } + Flickable { id: flick - anchors.top: methodTitle.bottom; anchors.bottom: parent.bottom - width: parent.width; contentHeight: methodText.height; clip: true + width: parent.width + anchors { top: methodTitle.bottom; bottom: parent.bottom } + contentHeight: methodText.height; clip: true + Text { id: methodText; text: method; wrapMode: Text.WordWrap; width: details.width } } + Image { - anchors.right: flick.right; anchors.top: flick.top - source: "content/pics/moreUp.png"; opacity: flick.atYBeginning ? 0 : 1 + anchors { right: flick.right; top: flick.top } + source: "content/pics/moreUp.png" + opacity: flick.atYBeginning ? 0 : 1 } + Image { - anchors.right: flick.right; anchors.bottom: flick.bottom - source: "content/pics/moreDown.png"; opacity: flick.atYEnd ? 0 : 1 + anchors { right: flick.right; bottom: flick.bottom } + source: "content/pics/moreDown.png" + opacity: flick.atYEnd ? 0 : 1 } } // A button to close the detailed view, i.e. set the state back to default (''). MediaButton { - anchors.right: background.right; anchors.rightMargin: 5 - y: 10; opacity: wrapper.detailsOpacity - text: "Close"; onClicked: wrapper.state = ''; + y: 10; anchors { right: background.right; rightMargin: 5 } + opacity: wrapper.detailsOpacity + text: "Close" + + onClicked: wrapper.state = ''; } - // Make the default height equal the hight of the picture, plus margin. + // Set the default height to the height of the picture, plus margin. height: 68 states: State { name: "Details" + PropertyChanges { target: background; color: "white" } - // Make the picture bigger - PropertyChanges { target: recipePic; width: 128; height: 128 } - // Make details visible - PropertyChanges { target: wrapper; detailsOpacity: 1; x: 0 } - // Make the detailed view fill the entire list area - PropertyChanges { target: wrapper; height: list.height } + PropertyChanges { target: recipePic; width: 128; height: 128 } // Make picture bigger + PropertyChanges { target: wrapper; detailsOpacity: 1; x: 0 } // Make details visible + PropertyChanges { target: wrapper; height: list.height } // Fill the entire list area with the detailed view + // Move the list so that this item is at the top. PropertyChanges { target: wrapper.ListView.view; explicit: true; contentY: wrapper.y } + // Disallow flicking while we're in detailed view PropertyChanges { target: wrapper.ListView.view; interactive: false } } @@ -125,9 +143,7 @@ Rectangle { // Make the state changes smooth ParallelAnimation { ColorAnimation { property: "color"; duration: 500 } - NumberAnimation { - duration: 300; properties: "detailsOpacity,x,contentY,height,width" - } + NumberAnimation { duration: 300; properties: "detailsOpacity,x,contentY,height,width" } } } } @@ -136,7 +152,9 @@ Rectangle { // The actual list ListView { id: list - model: Recipes; delegate: recipeDelegate - anchors.fill: parent; clip: true + anchors.fill: parent + clip: true + model: Recipes + delegate: recipeDelegate } } diff --git a/examples/declarative/listview/sections.qml b/examples/declarative/listview/sections.qml index 7c132a4..0a81f63 100644 --- a/examples/declarative/listview/sections.qml +++ b/examples/declarative/listview/sections.qml @@ -4,7 +4,7 @@ import Qt 4.7 Rectangle { width: 200 height: 240 - color: "white" + // MyPets model is defined in dummydata/MyPetsModel.qml // The viewer automatically loads files in dummydata/* to assist // development without a real data source. @@ -13,15 +13,16 @@ Rectangle { // Define a delegate component that includes a separator for sections. Component { id: petDelegate + Item { id: wrapper width: 200 - // My height is the combined height of the description and the section separator - height: desc.height + height: desc.height // height is the combined height of the description and the section separator + Item { id: desc - x: 5 - height: layout.height + 4 + x: 5; height: layout.height + 4 + Column { id: layout y: 2 @@ -32,22 +33,24 @@ Rectangle { } } } + // Define a highlight component. Just one of these will be instantiated // by each ListView and placed behind the current item. Component { id: petHighlight - Rectangle { - color: "#FFFF88" - } + Rectangle { color: "#FFFF88" } } + // The list ListView { id: myList - width: 200 - height: parent.height + + width: 200; height: parent.height model: MyPetsModel delegate: petDelegate highlight: petHighlight + focus: true + // The sectionExpression is simply the size of the pet. // We use this to determine which section we are in above. section.property: "size" @@ -57,11 +60,12 @@ Rectangle { width: 200 height: 20 Text { - text: section; font.bold: true - x: 2; height: parent.height; verticalAlignment: 'AlignVCenter' + x: 2; height: parent.height + verticalAlignment: 'AlignVCenter' + text: section + font.bold: true } } - focus: true } } //! [0] diff --git a/examples/declarative/mousearea/mouse.qml b/examples/declarative/mousearea/mouse.qml index efbfb53..67302a8 100644 --- a/examples/declarative/mousearea/mouse.qml +++ b/examples/declarative/mousearea/mouse.qml @@ -1,40 +1,47 @@ import Qt 4.7 Rectangle { - color: "white" width: 200; height: 200 + Rectangle { width: 50; height: 50 color: "red" + Text { text: "Click"; anchors.centerIn: parent } + MouseArea { + anchors.fill: parent hoverEnabled: true acceptedButtons: Qt.LeftButton | Qt.RightButton - onPressed: { console.log('press (x: ' + mouse.x + ' y: ' + mouse.y + ' button: ' + (mouse.button == Qt.RightButton ? 'right' : 'left') + ' Shift: ' + (mouse.modifiers & Qt.ShiftModifier ? 'true' : 'false') + ')') } - onReleased: { console.log('release (x: ' + mouse.x + ' y: ' + mouse.y + ' isClick: ' + mouse.isClick + ' wasHeld: ' + mouse.wasHeld + ')') } - onClicked: { console.log('click (x: ' + mouse.x + ' y: ' + mouse.y + ' wasHeld: ' + mouse.wasHeld + ')') } - onDoubleClicked: { console.log('double click (x: ' + mouse.x + ' y: ' + mouse.y + ')') } - onPressAndHold: { console.log('press and hold') } - onEntered: { console.log('entered ' + pressed) } - onExited: { console.log('exited ' + pressed) } - anchors.fill: parent + + onPressed: console.log('press (x: ' + mouse.x + ' y: ' + mouse.y + ' button: ' + (mouse.button == Qt.RightButton ? 'right' : 'left') + ' Shift: ' + (mouse.modifiers & Qt.ShiftModifier ? 'true' : 'false') + ')') + onReleased: console.log('release (x: ' + mouse.x + ' y: ' + mouse.y + ' isClick: ' + mouse.isClick + ' wasHeld: ' + mouse.wasHeld + ')') + onClicked: console.log('click (x: ' + mouse.x + ' y: ' + mouse.y + ' wasHeld: ' + mouse.wasHeld + ')') + onDoubleClicked: console.log('double click (x: ' + mouse.x + ' y: ' + mouse.y + ')') + onPressAndHold: console.log('press and hold') + onEntered: console.log('entered ' + pressed) + onExited: console.log('exited ' + pressed) } } + Rectangle { y: 100; width: 50; height: 50 color: "blue" + Text { text: "Drag"; anchors.centerIn: parent } + MouseArea { + anchors.fill: parent drag.target: parent drag.axis: "XAxis" drag.minimumX: 0 drag.maximumX: 150 - onPressed: { console.log('press') } - onReleased: { console.log('release (isClick: ' + mouse.isClick + ') (wasHeld: ' + mouse.wasHeld + ')') } - onClicked: { console.log('click' + '(wasHeld: ' + mouse.wasHeld + ')') } - onDoubleClicked: { console.log('double click') } - onPressAndHold: { console.log('press and hold') } - anchors.fill: parent + + onPressed: console.log('press') + onReleased: console.log('release (isClick: ' + mouse.isClick + ') (wasHeld: ' + mouse.wasHeld + ')') + onClicked: console.log('click' + '(wasHeld: ' + mouse.wasHeld + ')') + onDoubleClicked: console.log('double click') + onPressAndHold: console.log('press and hold') } } } diff --git a/examples/declarative/progressbar/content/ProgressBar.qml b/examples/declarative/progressbar/content/ProgressBar.qml index d82d89d..bc36df5 100644 --- a/examples/declarative/progressbar/content/ProgressBar.qml +++ b/examples/declarative/progressbar/content/ProgressBar.qml @@ -2,36 +2,42 @@ import Qt 4.7 Item { id: progressbar - width: 250; height: 23; clip: true property int minimum: 0 property int maximum: 100 property int value: 0 - property alias color: g1.color - property alias secondColor: g2.color + property alias color: gradient1.color + property alias secondColor: gradient2.color + + width: 250; height: 23 + clip: true BorderImage { source: "background.png" width: parent.width; height: parent.height - border.left: 4; border.top: 4; border.right: 4; border.bottom: 4 + border { left: 4; top: 4; right: 4; bottom: 4 } } Rectangle { + id: highlight + property int widthDest: ((progressbar.width * (value - minimum)) / (maximum - minimum) - 6) - id: highlight; radius: 1 - anchors.left: parent.left; anchors.top: parent.top; anchors.bottom: parent.bottom - anchors.leftMargin: 3; anchors.topMargin: 3; anchors.bottomMargin: 3 + width: highlight.widthDest Behavior on width { SmoothedAnimation { velocity: 1200 } } + + anchors { left: parent.left; top: parent.top; bottom: parent.bottom; leftMargin: 3; topMargin: 3; bottomMargin: 3 } + radius: 1 gradient: Gradient { - GradientStop { id: g1; position: 0.0 } - GradientStop { id: g2; position: 1.0 } + GradientStop { id: gradient1; position: 0.0 } + GradientStop { id: gradient2; position: 1.0 } } + } Text { - anchors.right: highlight.right; anchors.rightMargin: 6 - color: "white"; font.bold: true - anchors.verticalCenter: parent.verticalCenter + anchors { right: highlight.right; rightMargin: 6; verticalCenter: parent.verticalCenter } + color: "white" + font.bold: true text: Math.floor((value - minimum) / (maximum - minimum) * 100) + '%' } } diff --git a/examples/declarative/progressbar/progressbars.qml b/examples/declarative/progressbar/progressbars.qml index e10c9f0..55fd682 100644 --- a/examples/declarative/progressbar/progressbars.qml +++ b/examples/declarative/progressbar/progressbars.qml @@ -3,17 +3,26 @@ import "content" Rectangle { id: main - width: 600; height: 405; color: "#edecec" + + width: 600; height: 405 + color: "#edecec" Flickable { - anchors.fill: parent; contentHeight: column.height + 20 + anchors.fill: parent + contentHeight: column.height + 20 + Column { - id: column; x: 10; y: 10; spacing: 10 + id: column + x: 10; y: 10 + spacing: 10 + Repeater { model: 25 + ProgressBar { property int r: Math.floor(Math.random() * 5000 + 1000) width: main.width - 20 + NumberAnimation on value { duration: r; from: 0; to: 100; loops: Animation.Infinite } ColorAnimation on color { duration: r; from: "lightsteelblue"; to: "thistle"; loops: Animation.Infinite } ColorAnimation on secondColor { duration: r; from: "steelblue"; to: "#CD96CD"; loops: Animation.Infinite } diff --git a/examples/declarative/proxywidgets/proxywidgets.qml b/examples/declarative/proxywidgets/proxywidgets.qml index 6fa0c40..46dcf99 100644 --- a/examples/declarative/proxywidgets/proxywidgets.qml +++ b/examples/declarative/proxywidgets/proxywidgets.qml @@ -3,45 +3,62 @@ import "ProxyWidgets" 1.0 Rectangle { id: window - width: 640; height: 480; color: palette.window property int margin: 30 + width: 640; height: 480 + color: palette.window + SystemPalette { id: palette } MyPushButton { - id: button1; x: margin; y: margin; text: "Right"; onClicked: window.state = "right" + id: button1 + x: margin; y: margin + text: "Right" transformOriginPoint: Qt.point(width / 2, height / 2) + + onClicked: window.state = "right" } MyPushButton { - id: button2; x: margin; y: margin + 30; text: "Bottom"; onClicked: window.state = "bottom" + id: button2 + x: margin; y: margin + 30 + text: "Bottom" transformOriginPoint: Qt.point(width / 2, height / 2) + + onClicked: window.state = "bottom" } MyPushButton { - id: button3; x: margin; y: margin + 60; text: "Quit"; onClicked: Qt.quit() + id: button3 + x: margin; y: margin + 60 + text: "Quit" transformOriginPoint: Qt.point(width / 2, height / 2) + + onClicked: Qt.quit() } states: [ - State { - name: "right" - PropertyChanges { target: button1; x: window.width - width - margin; text: "Left"; onClicked: window.state = "" } - PropertyChanges { target: button2; x: window.width - width - margin } - PropertyChanges { target: button3; x: window.width - width - margin } - PropertyChanges { target: window; color: Qt.darker(palette.window) } - }, - State { - name: "bottom" - PropertyChanges { target: button1; y: window.height - height - margin; rotation: 180 } - PropertyChanges { - target: button2; x: button1.x + button1.width + 10; y: window.height - height - margin; rotation: 180 - text: "Top"; onClicked: window.state = "" + State { + name: "right" + PropertyChanges { target: button1; x: window.width - width - margin; text: "Left"; onClicked: window.state = "" } + PropertyChanges { target: button2; x: window.width - width - margin } + PropertyChanges { target: button3; x: window.width - width - margin } + PropertyChanges { target: window; color: Qt.darker(palette.window) } + }, + State { + name: "bottom" + PropertyChanges { target: button1; y: window.height - height - margin; rotation: 180 } + PropertyChanges { + target: button2 + x: button1.x + button1.width + 10; y: window.height - height - margin + rotation: 180 + text: "Top" + onClicked: window.state = "" + } + PropertyChanges { target: button3; x: button2.x + button2.width + 10; y: window.height - height - margin; rotation: 180 } + PropertyChanges { target: window; color: Qt.lighter(palette.window) } } - PropertyChanges { target: button3; x: button2.x + button2.width + 10; y: window.height - height - margin; rotation: 180 } - PropertyChanges { target: window; color: Qt.lighter(palette.window) } - } ] transitions: Transition { diff --git a/examples/declarative/scrollbar/ScrollBar.qml b/examples/declarative/scrollbar/ScrollBar.qml index 2186b35..5433156 100644 --- a/examples/declarative/scrollbar/ScrollBar.qml +++ b/examples/declarative/scrollbar/ScrollBar.qml @@ -2,6 +2,7 @@ import Qt 4.7 Item { id: scrollBar + // The properties that define the scrollbar's state. // position and pageSize are in the range 0.0 - 1.0. They are relative to the // height of the page, i.e. a pageSize of 0.5 means that you can see 50% @@ -14,18 +15,19 @@ Item { // A light, semi-transparent background Rectangle { id: background - radius: orientation == 'Vertical' ? (width/2 - 1) : (height/2 - 1) - color: "white"; opacity: 0.3 anchors.fill: parent + radius: orientation == 'Vertical' ? (width/2 - 1) : (height/2 - 1) + color: "white" + opacity: 0.3 } // Size the bar to the required size, depending upon the orientation. Rectangle { - opacity: 0.7 - color: "black" - radius: orientation == 'Vertical' ? (width/2 - 1) : (height/2 - 1) x: orientation == 'Vertical' ? 1 : (scrollBar.position * (scrollBar.width-2) + 1) y: orientation == 'Vertical' ? (scrollBar.position * (scrollBar.height-2) + 1) : 1 width: orientation == 'Vertical' ? (parent.width-2) : (scrollBar.pageSize * (scrollBar.width-2)) height: orientation == 'Vertical' ? (scrollBar.pageSize * (scrollBar.height-2)) : (parent.height-2) + radius: orientation == 'Vertical' ? (width/2 - 1) : (height/2 - 1) + color: "black" + opacity: 0.7 } } diff --git a/examples/declarative/scrollbar/display.qml b/examples/declarative/scrollbar/display.qml index 421cb7f..cb1da16 100644 --- a/examples/declarative/scrollbar/display.qml +++ b/examples/declarative/scrollbar/display.qml @@ -3,56 +3,52 @@ import Qt 4.7 Rectangle { width: 640 height: 480 + // Create a flickable to view a large image. Flickable { id: view anchors.fill: parent + contentWidth: picture.width + contentHeight: picture.height + Image { id: picture source: "pics/niagara_falls.jpg" asynchronous: true } - contentWidth: picture.width - contentHeight: picture.height + // Only show the scrollbars when the view is moving. - states: [ - State { - name: "ShowBars" - when: view.moving - PropertyChanges { target: verticalScrollBar; opacity: 1 } - PropertyChanges { target: horizontalScrollBar; opacity: 1 } - } - ] - transitions: [ - Transition { - from: "*" - to: "*" - NumberAnimation { - properties: "opacity" - duration: 400 - } - } - ] + states: State { + name: "ShowBars" + when: view.moving + PropertyChanges { target: verticalScrollBar; opacity: 1 } + PropertyChanges { target: horizontalScrollBar; opacity: 1 } + } + + transitions: Transition { + from: "*"; to: "*" + NumberAnimation { properties: "opacity"; duration: 400 } + } } + // Attach scrollbars to the right and bottom edges of the view. ScrollBar { id: verticalScrollBar + width: 12; height: view.height-12 + anchors.right: view.right opacity: 0 orientation: "Vertical" position: view.visibleArea.yPosition pageSize: view.visibleArea.heightRatio - width: 12 - height: view.height-12 - anchors.right: view.right } + ScrollBar { id: horizontalScrollBar + width: view.width-12; height: 12 + anchors.bottom: view.bottom opacity: 0 orientation: "Horizontal" position: view.visibleArea.xPosition pageSize: view.visibleArea.widthRatio - height: 12 - width: view.width-12 - anchors.bottom: view.bottom } } diff --git a/examples/declarative/searchbox/SearchBox.qml b/examples/declarative/searchbox/SearchBox.qml index be85023..aae7ee9 100644 --- a/examples/declarative/searchbox/SearchBox.qml +++ b/examples/declarative/searchbox/SearchBox.qml @@ -18,27 +18,32 @@ FocusScope { } Text { - id: typeSomething; anchors.fill: parent; anchors.leftMargin: 8 + id: typeSomething + anchors.fill: parent; anchors.leftMargin: 8 verticalAlignment: Text.AlignVCenter - text: "Type something..."; color: "gray"; font.italic: true + text: "Type something..." + color: "gray" + font.italic: true } MouseArea { anchors.fill: parent; onClicked: focusScope.focus = true } TextInput { id: textInput - anchors.left: parent.left; anchors.leftMargin: 8 - anchors.verticalCenter: parent.verticalCenter - focus: if (1) true + anchors { left: parent.left; leftMargin: 8; verticalCenter: parent.verticalCenter } + focus: true } Image { id: clear - anchors.right: parent.right; anchors.rightMargin: 8 - anchors.verticalCenter: parent.verticalCenter - source: "images/edit-clear-locationbar-rtl.png"; opacity: 0 + anchors { right: parent.right; rightMargin: 8; verticalCenter: parent.verticalCenter } + source: "images/edit-clear-locationbar-rtl.png" + opacity: 0 - MouseArea { anchors.fill: parent; onClicked: { textInput.text = ''; focusScope.focus = true } } + MouseArea { + anchors.fill: parent + onClicked: { textInput.text = ''; focusScope.focus = true } + } } states: State { diff --git a/examples/declarative/searchbox/main.qml b/examples/declarative/searchbox/main.qml index eb95a23..9f73473 100644 --- a/examples/declarative/searchbox/main.qml +++ b/examples/declarative/searchbox/main.qml @@ -1,10 +1,12 @@ import Qt 4.7 Rectangle { - width: 500; height: 250; color: "#edecec" + width: 500; height: 250 + color: "#edecec" Column { - anchors.horizontalCenter: parent.horizontalCenter; anchors.verticalCenter: parent.verticalCenter; spacing: 10 + anchors { horizontalCenter: parent.horizontalCenter; verticalCenter: parent.verticalCenter } + spacing: 10 SearchBox { id: search1; KeyNavigation.tab: search2; KeyNavigation.backtab: search3; focus: true } SearchBox { id: search2; KeyNavigation.tab: search3; KeyNavigation.backtab: search1 } diff --git a/examples/declarative/slideswitch/content/Switch.qml b/examples/declarative/slideswitch/content/Switch.qml index e16198d..a8fa6ef 100644 --- a/examples/declarative/slideswitch/content/Switch.qml +++ b/examples/declarative/slideswitch/content/Switch.qml @@ -31,14 +31,17 @@ Item { //![4] Image { - id: background; source: "background.svg" + id: background + source: "background.svg" MouseArea { anchors.fill: parent; onClicked: toggle() } } //![4] //![5] Image { - id: knob; source: "knob.svg"; x: 1; y: 2 + id: knob + x: 1; y: 2 + source: "knob.svg" MouseArea { anchors.fill: parent diff --git a/examples/declarative/sql/hello.qml b/examples/declarative/sql/hello.qml index a9f77ca..8b021b7 100644 --- a/examples/declarative/sql/hello.qml +++ b/examples/declarative/sql/hello.qml @@ -1,6 +1,8 @@ import Qt 4.7 Text { + text: "?" + function findGreetings() { var db = openDatabaseSync("QDeclarativeExampleDB", "1.0", "The Example QML SQL!", 1000000); @@ -24,7 +26,6 @@ Text { ) } - text: "?" Component.onCompleted: findGreetings() } diff --git a/examples/declarative/states/states.qml b/examples/declarative/states/states.qml index c35cd63..4429e78 100644 --- a/examples/declarative/states/states.qml +++ b/examples/declarative/states/states.qml @@ -2,49 +2,60 @@ import Qt 4.7 Rectangle { id: page - width: 640; height: 480; color: "#343434" + width: 640; height: 480 + color: "#343434" + + Image { + id: userIcon + x: topLeftRect.x; y: topLeftRect.y + source: "user.png" + } - // A target region. Clicking in here sets the state to the default state Rectangle { - id: initialPosition + id: topLeftRect + anchors { left: parent.left; top: parent.top; leftMargin: 10; topMargin: 20 } - width: 64; height: 64; radius: 6 - color: "Transparent"; border.color: "Gray" + width: 64; height: 64 + color: "Transparent"; border.color: "Gray"; radius: 6 + + // Clicking in here sets the state to the default state, returning the image to + // its initial position MouseArea { anchors.fill: parent; onClicked: page.state = '' } } - // Another target region. Clicking in here sets the state to 'Position1' Rectangle { - id: position1 + id: middleRightRect + anchors { right: parent.right; verticalCenter: parent.verticalCenter; rightMargin: 20 } - width: 64; height: 64; radius: 6 - color: "Transparent"; border.color: "Gray" - MouseArea { anchors.fill: parent; onClicked: page.state = 'Position1' } + width: 64; height: 64 + color: "Transparent"; border.color: "Gray"; radius: 6 + + // Clicking in here sets the state to 'middleRight' + MouseArea { anchors.fill: parent; onClicked: page.state = 'middleRight' } } - // Another target region. Clicking in here sets the state to 'Position2' Rectangle { - id: position2 + id: bottomLeftRect + anchors { left: parent.left; bottom: parent.bottom; leftMargin: 10; bottomMargin: 20 } - width: 64; height: 64; radius: 6 - color: "Transparent"; border.color: "Gray" - MouseArea { anchors.fill: parent; onClicked: page.state = 'Position2' } - } + width: 64; height: 64 + color: "Transparent"; border.color: "Gray"; radius: 6 - // The image which will be moved when my state changes - Image { id: user; source: "user.png"; x: initialPosition.x; y: initialPosition.y } + // Clicking in here sets the state to 'bottomLeft' + MouseArea { anchors.fill: parent; onClicked: page.state = 'bottomLeft' } + } states: [ - // In state 'Position1', change the 'user' item position to rect2's position. + // In state 'middleRight', move the image to middleRightRect State { - name: "Position1" - PropertyChanges { target: user; x: position1.x; y: position1.y } + name: "middleRight" + PropertyChanges { target: userIcon; x: middleRightRect.x; y: middleRightRect.y } }, - // In state 'Position2', change the 'user' item position to rect3's position. + // In state 'bottomLeft', move the image to bottomLeftRect State { - name: "Position2" - PropertyChanges { target: user; x: position2.x; y: position2.y } + name: "bottomLeft" + PropertyChanges { target: userIcon; x: bottomLeftRect.x; y: bottomLeftRect.y } } ] } diff --git a/examples/declarative/states/transitions.qml b/examples/declarative/states/transitions.qml index 3cb5543..d1b1dd6 100644 --- a/examples/declarative/states/transitions.qml +++ b/examples/declarative/states/transitions.qml @@ -1,67 +1,87 @@ import Qt 4.7 +/* + This is exactly the same as states.qml, except that we have appended + a set of transitions to apply animations when the item changes + between each state. +*/ + Rectangle { id: page - width: 640; height: 480; color: "#343434" + width: 640; height: 480 + color: "#343434" + + Image { + id: userIcon + x: topLeftRect.x; y: topLeftRect.y + source: "user.png" + } - // A target region. Clicking in here sets the state to the default state Rectangle { - id: initialPosition + id: topLeftRect + anchors { left: parent.left; top: parent.top; leftMargin: 10; topMargin: 20 } - width: 64; height: 64; radius: 6 - color: "Transparent"; border.color: "Gray" + width: 64; height: 64 + color: "Transparent"; border.color: "Gray"; radius: 6 + + // Clicking in here sets the state to the default state, returning the image to + // its initial position MouseArea { anchors.fill: parent; onClicked: page.state = '' } } - // Another target region. Clicking in here sets the state to 'Position1' Rectangle { - id: position1 + id: middleRightRect + anchors { right: parent.right; verticalCenter: parent.verticalCenter; rightMargin: 20 } - width: 64; height: 64; radius: 6 - color: "Transparent"; border.color: "Gray" - MouseArea { anchors.fill: parent; onClicked: page.state = 'Position1' } + width: 64; height: 64 + color: "Transparent"; border.color: "Gray"; radius: 6 + + // Clicking in here sets the state to 'middleRight' + MouseArea { anchors.fill: parent; onClicked: page.state = 'middleRight' } } - // Another target region. Clicking in here sets the state to 'Position2' Rectangle { - id: position2 + id: bottomLeftRect + anchors { left: parent.left; bottom: parent.bottom; leftMargin: 10; bottomMargin: 20 } - width: 64; height: 64; radius: 6 - color: "Transparent"; border.color: "Gray" - MouseArea { anchors.fill: parent; onClicked: page.state = 'Position2' } - } + width: 64; height: 64 + color: "Transparent"; border.color: "Gray"; radius: 6 - // The image which will be moved when my state changes - Image { id: user; source: "user.png"; x: initialPosition.x; y: initialPosition.y } + // Clicking in here sets the state to 'bottomLeft' + MouseArea { anchors.fill: parent; onClicked: page.state = 'bottomLeft' } + } states: [ - // In state 'Position1', change the 'user' item position to rect2's position. + // In state 'middleRight', move the image to middleRightRect State { - name: "Position1" - PropertyChanges { target: user; x: position1.x; y: position1.y } + name: "middleRight" + PropertyChanges { target: userIcon; x: middleRightRect.x; y: middleRightRect.y } }, - // In state 'Position2', change the 'user' item position to rect3's position. + // In state 'bottomLeft', move the image to bottomLeftRect State { - name: "Position2" - PropertyChanges { target: user; x: position2.x; y: position2.y } + name: "bottomLeft" + PropertyChanges { target: userIcon; x: bottomLeftRect.x; y: bottomLeftRect.y } } ] - // transitions define how the properties change. + // Transitions define how the properties change when the item moves between each state transitions: [ - // When transitioning to 'Position1' move x,y over a duration of 1 second, + + // When transitioning to 'middleRight' move x,y over a duration of 1 second, // with OutBounce easing function. Transition { - from: "*"; to: "Position1" + from: "*"; to: "middleRight" NumberAnimation { properties: "x,y"; easing.type: "OutBounce"; duration: 1000 } }, - // When transitioning to 'Position2' move x,y over a duration of 2 seconds, + + // When transitioning to 'bottomLeft' move x,y over a duration of 2 seconds, // with InOutQuad easing function. Transition { - from: "*"; to: "Position2" + from: "*"; to: "bottomLeft" NumberAnimation { properties: "x,y"; easing.type: "InOutQuad"; duration: 2000 } }, + // For any other state changes move x,y linearly over duration of 200ms. Transition { NumberAnimation { properties: "x,y"; duration: 200 } diff --git a/examples/declarative/tabwidget/TabWidget.qml b/examples/declarative/tabwidget/TabWidget.qml index e6b40fd..26d25b4 100644 --- a/examples/declarative/tabwidget/TabWidget.qml +++ b/examples/declarative/tabwidget/TabWidget.qml @@ -2,6 +2,7 @@ import Qt 4.7 Item { id: tabWidget + property int current: 0 default property alias content: stack.children @@ -18,21 +19,26 @@ Item { Row { id: header Repeater { - delegate: - Rectangle { + delegate: Rectangle { width: tabWidget.width / stack.children.length; height: 36 + Rectangle { - color: "#acb2c2"; width: parent.width; height: 1 + width: parent.width; height: 1 anchors { bottom: parent.bottom; bottomMargin: 1 } + color: "#acb2c2" } BorderImage { - source: "tab.png"; visible: tabWidget.current == index; border.left: 7; border.right: 7 anchors { fill: parent; leftMargin: 2; topMargin: 5; rightMargin: 1 } + border { left: 7; right: 7 } + source: "tab.png" + visible: tabWidget.current == index } Text { horizontalAlignment: Qt.AlignHCenter; verticalAlignment: Qt.AlignVCenter - anchors.fill: parent; text: stack.children[index].title - elide: Text.ElideRight; font.bold: tabWidget.current == index + anchors.fill: parent + text: stack.children[index].title + elide: Text.ElideRight + font.bold: tabWidget.current == index } MouseArea { anchors.fill: parent @@ -45,6 +51,7 @@ Item { Item { id: stack - anchors.top: header.bottom; anchors.bottom: tabWidget.bottom; width: tabWidget.width + width: tabWidget.width + anchors.top: header.bottom; anchors.bottom: tabWidget.bottom } } diff --git a/examples/declarative/tabwidget/tabs.qml b/examples/declarative/tabwidget/tabs.qml index e1bbdef..fba203c 100644 --- a/examples/declarative/tabwidget/tabs.qml +++ b/examples/declarative/tabwidget/tabs.qml @@ -6,28 +6,36 @@ TabWidget { Rectangle { property string title: "Red" - anchors.fill: parent; color: "#e3e3e3" + anchors.fill: parent + color: "#e3e3e3" + Rectangle { anchors { fill: parent; topMargin: 20; leftMargin: 20; rightMargin: 20; bottomMargin: 20 } color: "#ff7f7f" Text { + width: parent.width - 20 anchors.centerIn: parent; horizontalAlignment: Qt.AlignHCenter - text: "Roses are red"; font.pixelSize: 20 - wrapMode: Text.WordWrap; width: parent.width - 20 + text: "Roses are red" + font.pixelSize: 20 + wrapMode: Text.WordWrap } } } Rectangle { property string title: "Green" - anchors.fill: parent; color: "#e3e3e3" + anchors.fill: parent + color: "#e3e3e3" + Rectangle { anchors { fill: parent; topMargin: 20; leftMargin: 20; rightMargin: 20; bottomMargin: 20 } color: "#7fff7f" Text { + width: parent.width - 20 anchors.centerIn: parent; horizontalAlignment: Qt.AlignHCenter - text: "Flower stems are green"; font.pixelSize: 20 - wrapMode: Text.WordWrap; width: parent.width - 20 + text: "Flower stems are green" + font.pixelSize: 20 + wrapMode: Text.WordWrap } } } @@ -35,13 +43,16 @@ TabWidget { Rectangle { property string title: "Blue" anchors.fill: parent; color: "#e3e3e3" + Rectangle { anchors { fill: parent; topMargin: 20; leftMargin: 20; rightMargin: 20; bottomMargin: 20 } color: "#7f7fff" Text { + width: parent.width - 20 anchors.centerIn: parent; horizontalAlignment: Qt.AlignHCenter - text: "Violets are blue"; font.pixelSize: 20 - wrapMode: Text.WordWrap; width: parent.width - 20 + text: "Violets are blue" + font.pixelSize: 20 + wrapMode: Text.WordWrap } } } diff --git a/examples/declarative/tic-tac-toe/content/Button.qml b/examples/declarative/tic-tac-toe/content/Button.qml index 05d3f8d..ecf18cd 100644 --- a/examples/declarative/tic-tac-toe/content/Button.qml +++ b/examples/declarative/tic-tac-toe/content/Button.qml @@ -3,33 +3,35 @@ import Qt 4.7 Rectangle { id: container - signal clicked property string text: "Button" property bool down: false property string mainCol: "lightgray" property string darkCol: "darkgray" property string lightCol: "white" - color: mainCol; smooth: true - width: txtItem.width + 20; height: txtItem.height + 6 - border.width: 1; border.color: Qt.darker(mainCol); radius: 8; + width: buttonLabel.width + 20; height: buttonLabel.height + 6 + border { width: 1; color: Qt.darker(mainCol) } + radius: 8; + color: mainCol + smooth: true gradient: Gradient { GradientStop { id: topGrad; position: 0.0 - color: if (container.down) { darkCol } else { lightCol } } + color: if (container.down) { darkCol } else { lightCol } + } GradientStop { position: 1.0; color: mainCol } } + signal clicked + MouseArea { id: mr; anchors.fill: parent; onClicked: container.clicked() } Text { - id: txtItem; text: container.text; + id: buttonLabel + anchors.centerIn: container - color: "blue" - styleColor: "white" - style: Text.Outline + text: container.text; font.pixelSize: 14 - font.bold: true } } diff --git a/examples/declarative/tic-tac-toe/tic-tac-toe.qml b/examples/declarative/tic-tac-toe/tic-tac-toe.qml index ca66a46..dd13052 100644 --- a/examples/declarative/tic-tac-toe/tic-tac-toe.qml +++ b/examples/declarative/tic-tac-toe/tic-tac-toe.qml @@ -4,23 +4,23 @@ import "content/tic-tac-toe.js" as Logic Item { id: game - property bool show: false; + + property bool show: false + property real difficulty: 1.0 //chance it will actually think + width: 440 height: 480 anchors.fill: parent - property real difficulty: 1.0; //chance it will actually think Image { id: boardimage - anchors.verticalCenter: parent.verticalCenter - anchors.horizontalCenter: parent.horizontalCenter + anchors { verticalCenter: parent.verticalCenter; horizontalCenter: parent.horizontalCenter } source: "content/pics/board.png" } Grid { id: board anchors.fill: boardimage - columns: 3 Repeater { @@ -46,33 +46,32 @@ Item { Row { spacing: 4 - anchors.top: board.bottom - anchors.horizontalCenter: board.horizontalCenter + anchors { top: board.bottom; horizontalCenter: board.horizontalCenter } + Button { text: "Hard" - onClicked: game.difficulty=1.0; + onClicked: game.difficulty = 1.0; down: game.difficulty == 1.0 } Button { text: "Moderate" - onClicked: game.difficulty=0.8; + onClicked: game.difficulty = 0.8; down: game.difficulty == 0.8 } Button { text: "Easy" - onClicked: game.difficulty=0.2; + onClicked: game.difficulty = 0.2; down: game.difficulty == 0.2 } } Text { id: msg - opacity: 0 + anchors.centerIn: parent + opacity: 0 color: "blue" - styleColor: "white" - style: Text.Outline - font.pixelSize: 50 - font.bold: true + style: Text.Outline; styleColor: "white" + font.pixelSize: 50; font.bold: true } } diff --git a/examples/declarative/tutorials/samegame/samegame1/Block.qml b/examples/declarative/tutorials/samegame/samegame1/Block.qml index 7cf819b..a535235 100644 --- a/examples/declarative/tutorials/samegame/samegame1/Block.qml +++ b/examples/declarative/tutorials/samegame/samegame1/Block.qml @@ -2,11 +2,12 @@ import Qt 4.7 Item { - id:block + id: block - Image { id: img - source: "../shared/pics/redStone.png"; + Image { + id: img anchors.fill: parent + source: "../shared/pics/redStone.png"; } } //![0] diff --git a/examples/declarative/tutorials/samegame/samegame1/Button.qml b/examples/declarative/tutorials/samegame/samegame1/Button.qml index 8ad7c0f..e8034ac 100644 --- a/examples/declarative/tutorials/samegame/samegame1/Button.qml +++ b/examples/declarative/tutorials/samegame/samegame1/Button.qml @@ -4,25 +4,31 @@ import Qt 4.7 Rectangle { id: container - signal clicked property string text: "Button" - color: activePalette.button; smooth: true + signal clicked + width: buttonLabel.width + 20; height: buttonLabel.height + 6 - border.width: 1; border.color: Qt.darker(activePalette.button); radius: 8; + smooth: true + border { width: 1; color: Qt.darker(activePalette.button) } + radius: 8 + // color the button with a gradient gradient: Gradient { GradientStop { position: 0.0 - color: if (mouseArea.pressed) { activePalette.dark } else { activePalette.light } + color: { + if (mouseArea.pressed) + return activePalette.dark + else + return activePalette.light + } } GradientStop { position: 1.0; color: activePalette.button } } MouseArea { id: mouseArea; anchors.fill: parent; onClicked: container.clicked() } - Text { - id: buttonLabel; text: container.text; anchors.centerIn: container; color: activePalette.buttonText - } + Text { id: buttonLabel; text: container.text; anchors.centerIn: container; color: activePalette.buttonText } } //![0] diff --git a/examples/declarative/tutorials/samegame/samegame1/samegame.qml b/examples/declarative/tutorials/samegame/samegame1/samegame.qml index ae881ba..b6e01fd 100644 --- a/examples/declarative/tutorials/samegame/samegame1/samegame.qml +++ b/examples/declarative/tutorials/samegame/samegame1/samegame.qml @@ -3,37 +3,40 @@ import Qt 4.7 Rectangle { id: screen + width: 490; height: 720 SystemPalette { id: activePalette } Item { - width: parent.width; anchors.top: parent.top; anchors.bottom: toolbar.top + width: parent.width + anchors { top: parent.top; bottom: toolBar.top } Image { id: background - anchors.fill: parent; source: "../shared/pics/background.jpg" + anchors.fill: parent + source: "../shared/pics/background.jpg" fillMode: Image.PreserveAspectCrop } } Rectangle { - id: toolbar + id: toolBar + width: parent.width; height: 32 color: activePalette.window - height: 32; width: parent.width anchors.bottom: screen.bottom Button { - text: "New Game"; onClicked: console.log("Starting a new game..."); - anchors.left: parent.left; anchors.leftMargin: 3 - anchors.verticalCenter: parent.verticalCenter + anchors { left: parent.left; leftMargin: 3; verticalCenter: parent.verticalCenter } + text: "New Game" + onClicked: console.log("This doesn't do anything yet...") } Text { id: score - text: "Score: Who knows?"; font.bold: true - anchors.right: parent.right; anchors.rightMargin: 3 - anchors.verticalCenter: parent.verticalCenter + anchors { right: parent.right; rightMargin: 3; verticalCenter: parent.verticalCenter } + text: "Score: Who knows?" + font.bold: true } } } diff --git a/examples/declarative/tutorials/samegame/samegame2/Block.qml b/examples/declarative/tutorials/samegame/samegame2/Block.qml index 44ff5d7..88b3d79 100644 --- a/examples/declarative/tutorials/samegame/samegame2/Block.qml +++ b/examples/declarative/tutorials/samegame/samegame2/Block.qml @@ -1,10 +1,11 @@ import Qt 4.7 Item { - id:block + id: block - Image { id: img - source: "../shared/pics/redStone.png"; + Image { + id: img anchors.fill: parent + source: "../shared/pics/redStone.png"; } } diff --git a/examples/declarative/tutorials/samegame/samegame2/Button.qml b/examples/declarative/tutorials/samegame/samegame2/Button.qml index cf4c61b..8d322de5 100644 --- a/examples/declarative/tutorials/samegame/samegame2/Button.qml +++ b/examples/declarative/tutorials/samegame/samegame2/Button.qml @@ -3,24 +3,30 @@ import Qt 4.7 Rectangle { id: container - signal clicked property string text: "Button" - color: activePalette.button; smooth: true + signal clicked + width: buttonLabel.width + 20; height: buttonLabel.height + 6 - border.width: 1; border.color: Qt.darker(activePalette.button); radius: 8; + smooth: true + border { width: 1; color: Qt.darker(activePalette.button) } + radius: 8 + // color the button with a gradient gradient: Gradient { GradientStop { position: 0.0 - color: if (mouseArea.pressed) { activePalette.dark } else { activePalette.light } + color: { + if (mouseArea.pressed) + return activePalette.dark + else + return activePalette.light + } } GradientStop { position: 1.0; color: activePalette.button } } MouseArea { id: mouseArea; anchors.fill: parent; onClicked: container.clicked() } - Text { - id: buttonLabel; text: container.text; anchors.centerIn: container; color: activePalette.buttonText - } + Text { id: buttonLabel; text: container.text; anchors.centerIn: container; color: activePalette.buttonText } } diff --git a/examples/declarative/tutorials/samegame/samegame2/samegame.qml b/examples/declarative/tutorials/samegame/samegame2/samegame.qml index e0706c2..7a17d16 100644 --- a/examples/declarative/tutorials/samegame/samegame2/samegame.qml +++ b/examples/declarative/tutorials/samegame/samegame2/samegame.qml @@ -5,39 +5,42 @@ import "samegame.js" as SameGame Rectangle { id: screen + width: 490; height: 720 SystemPalette { id: activePalette } Item { - width: parent.width; anchors.top: parent.top; anchors.bottom: toolbar.top + width: parent.width + anchors { top: parent.top; bottom: toolBar.top } Image { id: background - anchors.fill: parent; source: "../shared/pics/background.jpg" + anchors.fill: parent + source: "../shared/pics/background.jpg" fillMode: Image.PreserveAspectCrop } } Rectangle { - id: toolbar + id: toolBar + width: parent.width; height: 32 color: activePalette.window - height: 32; width: parent.width anchors.bottom: screen.bottom //![1] Button { - text: "New Game"; onClicked: SameGame.startNewGame(); - anchors.left: parent.left; anchors.leftMargin: 3 - anchors.verticalCenter: parent.verticalCenter + anchors { left: parent.left; leftMargin: 3; verticalCenter: parent.verticalCenter } + text: "New Game" + onClicked: SameGame.startNewGame() } //![1] Text { id: score - text: "Score: Who knows?"; font.bold: true - anchors.right: parent.right; anchors.rightMargin: 3 - anchors.verticalCenter: parent.verticalCenter + anchors { right: parent.right; rightMargin: 3; verticalCenter: parent.verticalCenter } + text: "Score: Who knows?" + font.bold: true } } } diff --git a/examples/declarative/tutorials/samegame/samegame3/Block.qml b/examples/declarative/tutorials/samegame/samegame3/Block.qml index bb48ac8..dd0fb48 100644 --- a/examples/declarative/tutorials/samegame/samegame3/Block.qml +++ b/examples/declarative/tutorials/samegame/samegame3/Block.qml @@ -2,20 +2,22 @@ import Qt 4.7 Item { - id:block + id: block + property int type: 0 - Image { id: img + Image { + id: img + + anchors.fill: parent source: { - if(type == 0){ - "../shared/pics/redStone.png"; - } else if(type == 1) { - "../shared/pics/blueStone.png"; - } else { - "../shared/pics/greenStone.png"; - } + if (type == 0) + return "../shared/pics/redStone.png"; + else if (type == 1) + return "../shared/pics/blueStone.png"; + else + return "../shared/pics/greenStone.png"; } - anchors.fill: parent } } //![0] diff --git a/examples/declarative/tutorials/samegame/samegame3/Button.qml b/examples/declarative/tutorials/samegame/samegame3/Button.qml index cf4c61b..8d322de5 100644 --- a/examples/declarative/tutorials/samegame/samegame3/Button.qml +++ b/examples/declarative/tutorials/samegame/samegame3/Button.qml @@ -3,24 +3,30 @@ import Qt 4.7 Rectangle { id: container - signal clicked property string text: "Button" - color: activePalette.button; smooth: true + signal clicked + width: buttonLabel.width + 20; height: buttonLabel.height + 6 - border.width: 1; border.color: Qt.darker(activePalette.button); radius: 8; + smooth: true + border { width: 1; color: Qt.darker(activePalette.button) } + radius: 8 + // color the button with a gradient gradient: Gradient { GradientStop { position: 0.0 - color: if (mouseArea.pressed) { activePalette.dark } else { activePalette.light } + color: { + if (mouseArea.pressed) + return activePalette.dark + else + return activePalette.light + } } GradientStop { position: 1.0; color: activePalette.button } } MouseArea { id: mouseArea; anchors.fill: parent; onClicked: container.clicked() } - Text { - id: buttonLabel; text: container.text; anchors.centerIn: container; color: activePalette.buttonText - } + Text { id: buttonLabel; text: container.text; anchors.centerIn: container; color: activePalette.buttonText } } diff --git a/examples/declarative/tutorials/samegame/samegame3/Dialog.qml b/examples/declarative/tutorials/samegame/samegame3/Dialog.qml index a76b517..be3a7b7 100644 --- a/examples/declarative/tutorials/samegame/samegame3/Dialog.qml +++ b/examples/declarative/tutorials/samegame/samegame3/Dialog.qml @@ -3,21 +3,30 @@ import Qt 4.7 Rectangle { id: page + + signal closed + function forceClose() { page.closed(); page.opacity = 0; } + function show(txt) { dialogText.text = txt; page.opacity = 1; } - signal closed(); - color: "white"; border.width: 1; width: dialogText.width + 20; height: dialogText.height + 20; + + width: dialogText.width + 20; height: dialogText.height + 20 + color: "white" + border.width: 1 opacity: 0 + Behavior on opacity { NumberAnimation { duration: 1000 } } + Text { id: dialogText; anchors.centerIn: parent; text: "Hello World!" } + MouseArea { anchors.fill: parent; onClicked: forceClose(); } } //![0] diff --git a/examples/declarative/tutorials/samegame/samegame3/samegame.qml b/examples/declarative/tutorials/samegame/samegame3/samegame.qml index cdf99d7..bc5f2f8 100644 --- a/examples/declarative/tutorials/samegame/samegame3/samegame.qml +++ b/examples/declarative/tutorials/samegame/samegame3/samegame.qml @@ -4,31 +4,37 @@ import "samegame.js" as SameGame Rectangle { id: screen + width: 490; height: 720 SystemPalette { id: activePalette } Item { - width: parent.width; anchors.top: parent.top; anchors.bottom: toolbar.top + width: parent.width + anchors { top: parent.top; bottom: toolBar.top } Image { id: background - anchors.fill: parent; source: "../shared/pics/background.jpg" + anchors.fill: parent + source: "../shared/pics/background.jpg" fillMode: Image.PreserveAspectCrop } //![1] Item { id: gameCanvas + property int score: 0 property int blockSize: 40 - z: 20; anchors.centerIn: parent - width: parent.width - (parent.width % blockSize); - height: parent.height - (parent.height % blockSize); + width: parent.width - (parent.width % blockSize) + height: parent.height - (parent.height % blockSize) + anchors.centerIn: parent + z: 20 MouseArea { - anchors.fill: parent; onClicked: SameGame.handleClick(mouse.x,mouse.y); + anchors.fill: parent + onClicked: SameGame.handleClick(mouse.x, mouse.y) } } //![1] @@ -39,22 +45,22 @@ Rectangle { //![2] Rectangle { - id: toolbar + id: toolBar + width: parent.width; height: 32 color: activePalette.window - height: 32; width: parent.width anchors.bottom: screen.bottom Button { - text: "New Game"; onClicked: SameGame.startNewGame(); - anchors.left: parent.left; anchors.leftMargin: 3 - anchors.verticalCenter: parent.verticalCenter + anchors { left: parent.left; leftMargin: 3; verticalCenter: parent.verticalCenter } + text: "New Game" + onClicked: SameGame.startNewGame() } Text { id: score - text: "Score: " + gameCanvas.score; font.bold: true - anchors.right: parent.right; anchors.rightMargin: 3 - anchors.verticalCenter: parent.verticalCenter + anchors { right: parent.right; rightMargin: 3; verticalCenter: parent.verticalCenter } + text: "Score: Who knows?" + font.bold: true } } } diff --git a/examples/declarative/tutorials/samegame/samegame4/content/BoomBlock.qml b/examples/declarative/tutorials/samegame/samegame4/content/BoomBlock.qml index 243df75..d3a9df7 100644 --- a/examples/declarative/tutorials/samegame/samegame4/content/BoomBlock.qml +++ b/examples/declarative/tutorials/samegame/samegame4/content/BoomBlock.qml @@ -1,9 +1,12 @@ import Qt 4.7 import Qt.labs.particles 1.0 -Item { id:block +Item { + id: block + property int type: 0 property bool dying: false + //![1] property bool spawned: false property int targetX: 0 @@ -14,47 +17,59 @@ Item { id:block //![1] //![2] - Image { id: img + Image { + id: img + + anchors.fill: parent source: { - if(type == 0){ - "../../shared/pics/redStone.png"; - } else if(type == 1) { - "../../shared/pics/blueStone.png"; - } else { - "../../shared/pics/greenStone.png"; - } + if (type == 0) + return "../../shared/pics/redStone.png"; + else if (type == 1) + return "../../shared/pics/blueStone.png"; + else + return "../../shared/pics/greenStone.png"; } opacity: 0 - Behavior on opacity { NumberAnimation { properties:"opacity"; duration: 200 } } - anchors.fill: parent + + Behavior on opacity { + NumberAnimation { properties:"opacity"; duration: 200 } + } } //![2] //![3] - Particles { id: particles - width:1; height:1; anchors.centerIn: parent; - emissionRate: 0; - lifeSpan: 700; lifeSpanDeviation: 600; + Particles { + id: particles + + width: 1; height: 1 + anchors.centerIn: parent + + emissionRate: 0 + lifeSpan: 700; lifeSpanDeviation: 600 angle: 0; angleDeviation: 360; - velocity: 100; velocityDeviation:30; + velocity: 100; velocityDeviation: 30 source: { - if(type == 0){ - "../../shared/pics/redStar.png"; - } else if (type == 1) { - "../../shared/pics/blueStar.png"; - } else { - "../../shared/pics/greenStar.png"; - } + if (type == 0) + return "../../shared/pics/redStar.png"; + else if (type == 1) + return "../../shared/pics/blueStar.png"; + else + return "../../shared/pics/greenStar.png"; } } //![3] //![4] states: [ - State{ name: "AliveState"; when: spawned == true && dying == false + State { + name: "AliveState" + when: spawned == true && dying == false PropertyChanges { target: img; opacity: 1 } }, - State{ name: "DeathState"; when: dying == true + + State { + name: "DeathState" + when: dying == true StateChangeScript { script: particles.burst(50); } PropertyChanges { target: img; opacity: 0 } StateChangeScript { script: block.destroy(1000); } diff --git a/examples/declarative/tutorials/samegame/samegame4/content/Button.qml b/examples/declarative/tutorials/samegame/samegame4/content/Button.qml index cf4c61b..8d322de5 100644 --- a/examples/declarative/tutorials/samegame/samegame4/content/Button.qml +++ b/examples/declarative/tutorials/samegame/samegame4/content/Button.qml @@ -3,24 +3,30 @@ import Qt 4.7 Rectangle { id: container - signal clicked property string text: "Button" - color: activePalette.button; smooth: true + signal clicked + width: buttonLabel.width + 20; height: buttonLabel.height + 6 - border.width: 1; border.color: Qt.darker(activePalette.button); radius: 8; + smooth: true + border { width: 1; color: Qt.darker(activePalette.button) } + radius: 8 + // color the button with a gradient gradient: Gradient { GradientStop { position: 0.0 - color: if (mouseArea.pressed) { activePalette.dark } else { activePalette.light } + color: { + if (mouseArea.pressed) + return activePalette.dark + else + return activePalette.light + } } GradientStop { position: 1.0; color: activePalette.button } } MouseArea { id: mouseArea; anchors.fill: parent; onClicked: container.clicked() } - Text { - id: buttonLabel; text: container.text; anchors.centerIn: container; color: activePalette.buttonText - } + Text { id: buttonLabel; text: container.text; anchors.centerIn: container; color: activePalette.buttonText } } diff --git a/examples/declarative/tutorials/samegame/samegame4/content/Dialog.qml b/examples/declarative/tutorials/samegame/samegame4/content/Dialog.qml index 15f5b19..adb3f9e 100644 --- a/examples/declarative/tutorials/samegame/samegame4/content/Dialog.qml +++ b/examples/declarative/tutorials/samegame/samegame4/content/Dialog.qml @@ -2,20 +2,29 @@ import Qt 4.7 Rectangle { id: page + + signal closed + function forceClose() { page.closed(); page.opacity = 0; } + function show(txt) { dialogText.text = txt; page.opacity = 1; } - signal closed(); - color: "white"; border.width: 1; width: dialogText.width + 20; height: dialogText.height + 20; + + width: dialogText.width + 20; height: dialogText.height + 20 + color: "white" + border.width: 1 opacity: 0 + Behavior on opacity { NumberAnimation { duration: 1000 } } + Text { id: dialogText; anchors.centerIn: parent; text: "Hello World!" } + MouseArea { anchors.fill: parent; onClicked: forceClose(); } } diff --git a/examples/declarative/tutorials/samegame/samegame4/content/samegame.js b/examples/declarative/tutorials/samegame/samegame4/content/samegame.js index 47985de..7800b6e 100755 --- a/examples/declarative/tutorials/samegame/samegame4/content/samegame.js +++ b/examples/declarative/tutorials/samegame/samegame4/content/samegame.js @@ -13,8 +13,8 @@ function index(column, row) { } function startNewGame() { + //Delete blocks from previous game for (var i = 0; i < maxIndex; i++) { - //Delete blocks from previous game if (board[i] != null) board[i].destroy(); } diff --git a/examples/declarative/tutorials/samegame/samegame4/samegame.qml b/examples/declarative/tutorials/samegame/samegame4/samegame.qml index 5d5c81f..b2a490d 100644 --- a/examples/declarative/tutorials/samegame/samegame4/samegame.qml +++ b/examples/declarative/tutorials/samegame/samegame4/samegame.qml @@ -4,16 +4,19 @@ import "content/samegame.js" as SameGame Rectangle { id: screen + width: 490; height: 720 SystemPalette { id: activePalette } Item { - width: parent.width; anchors.top: parent.top; anchors.bottom: toolBar.top + width: parent.width + anchors { top: parent.top; bottom: toolBar.top } Image { id: background - anchors.fill: parent; source: "../shared/pics/background.jpg" + anchors.fill: parent + source: "../shared/pics/background.jpg" fillMode: Image.PreserveAspectCrop } @@ -36,43 +39,49 @@ Rectangle { //![0] Dialog { - id: nameInputDialog; anchors.centerIn: parent; z: 22; + id: nameInputDialog + + anchors.centerIn: parent + z: 22 + Text { - id: spacer + id: dialogText opacity: 0 text: " You won! Please enter your name:" } + TextInput { - id: editor + id: nameInput + width: 72 + anchors { verticalCenter: parent.verticalCenter; left: dialogText.right } + focus: true + onAccepted: { - if(nameInputDialog.opacity==1&&editor.text!="") - SameGame.saveHighScore(editor.text); + if (nameInputDialog.opacity == 1 && nameInput.text != "") + SameGame.saveHighScore(nameInput.text); nameInputDialog.forceClose(); } - anchors.verticalCenter: parent.verticalCenter - width: 72; focus: true - anchors.left: spacer.right } } //![0] Rectangle { id: toolBar + width: parent.width; height: 32 color: activePalette.window - height: 32; width: parent.width anchors.bottom: screen.bottom Button { - text: "New Game"; onClicked: SameGame.startNewGame(); - anchors.left: parent.left; anchors.leftMargin: 3 - anchors.verticalCenter: parent.verticalCenter + anchors { left: parent.left; leftMargin: 3; verticalCenter: parent.verticalCenter } + text: "New Game" + onClicked: SameGame.startNewGame() } Text { id: score - text: "Score: " + gameCanvas.score; font.bold: true - anchors.right: parent.right; anchors.rightMargin: 3 - anchors.verticalCenter: parent.verticalCenter + anchors { right: parent.right; rightMargin: 3; verticalCenter: parent.verticalCenter } + text: "Score: " + gameCanvas.score + font.bold: true } } } diff --git a/examples/declarative/tvtennis/tvtennis.qml b/examples/declarative/tvtennis/tvtennis.qml index 9d107ad..354a16f 100644 --- a/examples/declarative/tvtennis/tvtennis.qml +++ b/examples/declarative/tvtennis/tvtennis.qml @@ -8,13 +8,14 @@ Rectangle { // Make a ball to bounce Rectangle { + id: ball + // Add a property for the target y coordinate property int targetY : page.height - 10 property variant direction : "right" - id: ball - color: "Lime" x: 20; width: 20; height: 20; z: 1 + color: "Lime" SoundEffect { id: paddle; source: "paddle.wav" } SoundEffect { id: wall; source: "click.wav" } diff --git a/examples/declarative/velocity/Day.qml b/examples/declarative/velocity/Day.qml index a39ec94..433295b 100644 --- a/examples/declarative/velocity/Day.qml +++ b/examples/declarative/velocity/Day.qml @@ -18,10 +18,11 @@ Component { Repeater { model: notes Item { + id: stickyPage + property int randomX: Math.random() * 500 + 100 property int randomY: Math.random() * 200 + 50 - id: stickyPage x: randomX; y: randomY SpringFollow on rotation { @@ -32,26 +33,32 @@ Component { Item { id: sticky scale: 0.7 + Image { id: stickyImage - source: "note-yellow.png"; transformOrigin: Item.TopLeft - smooth: true; y: -20; x: 8 + -width * 0.6 / 2; scale: 0.6 + x: 8 + -width * 0.6 / 2; y: -20 + source: "note-yellow.png" + scale: 0.6; transformOrigin: Item.TopLeft + smooth: true } TextEdit { - id: myText; smooth: true; font.pixelSize: 24 - readOnly: false; x: -104; y: 36 - rotation: -8; text: noteText; width: 215; height: 200 + id: myText + x: -104; y: 36; width: 215; height: 200 + smooth: true + font.pixelSize: 24 + readOnly: false + rotation: -8 + text: noteText } Item { - y: -20 - x: stickyImage.x + x: stickyImage.x; y: -20 width: stickyImage.width * stickyImage.scale height: stickyImage.height * stickyImage.scale + MouseArea { id: mouse - onClicked: { myText.focus = true } anchors.fill: parent drag.target: stickyPage drag.axis: "XandYAxis" @@ -59,13 +66,15 @@ Component { drag.maximumY: page.height - 80 drag.minimumX: 100 drag.maximumX: page.width - 140 + onClicked: { myText.focus = true } } } } Image { - source: "tack.png"; transformOrigin: Item.TopLeft - x: -width / 2; y: -height * 0.5 / 2; scale: 0.7 + x: -width / 2; y: -height * 0.5 / 2 + source: "tack.png" + scale: 0.7; transformOrigin: Item.TopLeft } states: State { diff --git a/examples/declarative/velocity/velocity.qml b/examples/declarative/velocity/velocity.qml index 20821d6..871bafc 100644 --- a/examples/declarative/velocity/velocity.qml +++ b/examples/declarative/velocity/velocity.qml @@ -1,46 +1,75 @@ import Qt 4.7 Rectangle { - width: 800; height: 480; color: "#464646" + width: 800; height: 480 + color: "#464646" ListModel { id: list + ListElement { name: "Sunday" - notes: [ ListElement { noteText: "Lunch" }, ListElement { noteText: "Birthday Party" } ] + notes: [ + ListElement { noteText: "Lunch" }, + ListElement { noteText: "Birthday Party" } + ] } + ListElement { name: "Monday" - notes: [ ListElement { noteText: "Pickup kids from\nschool\n4.30pm" }, - ListElement { noteText: "Checkout Qt" }, ListElement { noteText: "Read email" } ] + notes: [ + ListElement { noteText: "Pickup kids from\nschool\n4.30pm" }, + ListElement { noteText: "Checkout Qt" }, ListElement { noteText: "Read email" } + ] } + ListElement { name: "Tuesday" - notes: [ ListElement { noteText: "Walk dog" }, ListElement { noteText: "Buy newspaper" } ] + notes: [ + ListElement { noteText: "Walk dog" }, + ListElement { noteText: "Buy newspaper" } + ] } + ListElement { - name: "Wednesday"; notes: [ ListElement { noteText: "Cook dinner" } ] + name: "Wednesday" + notes: [ ListElement { noteText: "Cook dinner" } ] } + ListElement { name: "Thursday" - notes: [ ListElement { noteText: "Meeting\n5.30pm" }, ListElement { noteText: "Weed garden" } ] + notes: [ + ListElement { noteText: "Meeting\n5.30pm" }, + ListElement { noteText: "Weed garden" } + ] } + ListElement { name: "Friday" - notes: [ ListElement { noteText: "More work" }, ListElement { noteText: "Grocery shopping" } ] + notes: [ + ListElement { noteText: "More work" }, + ListElement { noteText: "Grocery shopping" } + ] } + ListElement { name: "Saturday" - notes: [ ListElement { noteText: "Drink" }, ListElement { noteText: "Download Qt\nPlay with QML" } ] + notes: [ + ListElement { noteText: "Drink" }, + ListElement { noteText: "Download Qt\nPlay with QML" } + ] } } ListView { id: flickable - anchors.fill: parent; focus: true - model: list; delegate: Day { } + + anchors.fill: parent + focus: true highlightRangeMode: ListView.StrictlyEnforceRange orientation: ListView.Horizontal snapMode: ListView.SnapOneItem + model: list + delegate: Day { } } } diff --git a/examples/declarative/webview/alerts.qml b/examples/declarative/webview/alerts.qml index 2ba4300..6a5a0d2 100644 --- a/examples/declarative/webview/alerts.qml +++ b/examples/declarative/webview/alerts.qml @@ -3,17 +3,17 @@ import org.webkit 1.0 WebView { id: webView - onAlert: popup.show(message) width: 120 height: 150 url: "alerts.html" + onAlert: popup.show(message) + Rectangle { id: popup color: "red" - border.color: "black" - border.width: 2 + border.color: "black"; border.width: 2 radius: 4 y: parent.height // off "screen" diff --git a/examples/declarative/webview/autosize.qml b/examples/declarative/webview/autosize.qml index c4a502e..9632883 100644 --- a/examples/declarative/webview/autosize.qml +++ b/examples/declarative/webview/autosize.qml @@ -5,15 +5,16 @@ import org.webkit 1.0 // preferredWidth, and preferredHeight properties. Rectangle { id: rect - color: "white" width: 200 height: layout.height + Column { id: layout spacing: 2 WebView { html: "No width defined." - Rectangle { color: "#10000000" + Rectangle { + color: "#10000000" anchors.fill: parent } } diff --git a/examples/declarative/webview/googleMaps.qml b/examples/declarative/webview/googleMaps.qml index 4702dea..5506012 100644 --- a/examples/declarative/webview/googleMaps.qml +++ b/examples/declarative/webview/googleMaps.qml @@ -14,15 +14,15 @@ Map { width: 300 height: 300 address: "Paris" + Rectangle { - color: "white" + x: 70 width: input.width + 20 height: input.height + 4 + anchors.bottom: parent.bottom; anchors.bottomMargin: 5 radius: 5 - anchors.bottom: parent.bottom - anchors.bottomMargin: 5 opacity: map.status == "Ready" ? 1 : 0 - x: 70 + TextInput { id: input text: map.address @@ -30,12 +30,14 @@ Map { Keys.onReturnPressed: map.address = input.text } } + Text { id: loading anchors.centerIn: parent text: map.status == "Error" ? "Error" : "Loading" opacity: map.status == "Ready" ? 0 : 1 font.pixelSize: 30 - Behavior on opacity {NumberAnimation{}} + + Behavior on opacity { NumberAnimation{} } } } diff --git a/examples/declarative/webview/transparent.qml b/examples/declarative/webview/transparent.qml index a0676f4..e4efc31 100644 --- a/examples/declarative/webview/transparent.qml +++ b/examples/declarative/webview/transparent.qml @@ -7,6 +7,7 @@ Rectangle { color: "green" width: web.width height: web.height + WebView { id: web html: "Hello <b>World!</b>" diff --git a/examples/declarative/workerscript/workerscript.qml b/examples/declarative/workerscript/workerscript.qml index 1c7a920..6c6253b 100644 --- a/examples/declarative/workerscript/workerscript.qml +++ b/examples/declarative/workerscript/workerscript.qml @@ -1,7 +1,7 @@ import Qt 4.7 Rectangle { - width: 480; height: 320; + width: 480; height: 320 WorkerScript { id: myWorker @@ -16,8 +16,7 @@ Rectangle { Rectangle { width: 200; height: 200 - anchors.left: parent.left - anchors.leftMargin: 20 + anchors.left: parent.left; anchors.leftMargin: 20 color: "red" MouseArea { @@ -28,8 +27,7 @@ Rectangle { Rectangle { width: 200; height: 200 - anchors.right: parent.right - anchors.rightMargin: 20 + anchors.right: parent.right; anchors.rightMargin: 20 color: "blue" MouseArea { @@ -40,8 +38,6 @@ Rectangle { Text { text: "Click a Rectangle!" - anchors.horizontalCenter: parent.horizontalCenter - anchors.bottom: parent.bottom - anchors.bottomMargin: 50 + anchors { horizontalCenter: parent.horizontalCenter; bottom: parent.bottom; bottomMargin: 50 } } } diff --git a/examples/declarative/xmldata/daringfireball.qml b/examples/declarative/xmldata/daringfireball.qml index c5732c0..a1df809 100644 --- a/examples/declarative/xmldata/daringfireball.qml +++ b/examples/declarative/xmldata/daringfireball.qml @@ -24,15 +24,17 @@ Rectangle { text: title; font.bold: true } Text { + anchors { left: titleText.right; leftMargin: 10 } text: 'by ' + tagline - anchors.left: titleText.right; anchors.leftMargin: 10 font.italic: true } Text { x: 10 - text: content + width: 580 anchors.top: titleText.bottom - width: 580; wrapMode: Text.WordWrap + text: content + wrapMode: Text.WordWrap + onLinkActivated: { console.log('link clicked: ' + link) } } } @@ -40,6 +42,7 @@ Rectangle { ListView { anchors.fill: parent - model: feedModel; delegate: feedDelegate + model: feedModel + delegate: feedDelegate } } diff --git a/examples/declarative/xmldata/yahoonews.qml b/examples/declarative/xmldata/yahoonews.qml index e6cb373..668778e 100644 --- a/examples/declarative/xmldata/yahoonews.qml +++ b/examples/declarative/xmldata/yahoonews.qml @@ -1,11 +1,12 @@ import Qt 4.7 Rectangle { + width: 600; height: 600 + gradient: Gradient { GradientStop { position: 0; color: "black" } GradientStop { position: 1.0; color: "#AAAAAA" } } - width: 600; height: 600 XmlListModel { id: feedModel @@ -18,6 +19,7 @@ Rectangle { Component { id: feedDelegate + Item { id: delegate height: wrapper.height + 10 @@ -30,25 +32,27 @@ Rectangle { Rectangle { id: wrapper - y: 5; height: titleText.height + 10; width: 580 - color: "#F0F0F0"; radius: 5 + + width: 580; y: 5; height: titleText.height + 10 + color: "#F0F0F0" + radius: 5 + Text { id: titleText x: 10; y: 5 text: '<a href=\'' + link + '\'>' + title + '</a>' - font.bold: true; font.family: "Helvetica"; font.pointSize: 14 + font { bold: true; family: "Helvetica"; pointSize: 14 } + onLinkActivated: { console.log('link clicked: ' + link) } } Text { - x: 10 id: descriptionText + x: 10; width: 560 + anchors.top: titleText.bottom; anchors.topMargin: 5 text: description - width: 560 wrapMode: Text.WordWrap font.family: "Helvetica" - anchors.top: titleText.bottom - anchors.topMargin: 5 opacity: 0 } diff --git a/examples/declarative/xmlhttprequest/test.qml b/examples/declarative/xmlhttprequest/test.qml index ef9d5f3..c7e7e6d 100644 --- a/examples/declarative/xmlhttprequest/test.qml +++ b/examples/declarative/xmlhttprequest/test.qml @@ -5,32 +5,32 @@ Rectangle { MouseArea { anchors.fill: parent + onClicked: { + var doc = new XMLHttpRequest(); + doc.onreadystatechange = function() { + if (doc.readyState == XMLHttpRequest.HEADERS_RECEIVED) { + console.log("Headers -->"); + console.log(doc.getAllResponseHeaders ()); + console.log("Last modified -->"); + console.log(doc.getResponseHeader ("Last-Modified")); + } + else if (doc.readyState == XMLHttpRequest.DONE) { - var doc = new XMLHttpRequest(); - doc.onreadystatechange = function() { - if (doc.readyState == XMLHttpRequest.HEADERS_RECEIVED) { - console.log("Headers -->"); - console.log(doc.getAllResponseHeaders ()); - console.log("Last modified -->"); - console.log(doc.getResponseHeader ("Last-Modified")); + var a = doc.responseXML.documentElement; + for (var ii = 0; ii < a.childNodes.length; ++ii) { + console.log(a.childNodes[ii].nodeName); } - else if (doc.readyState == XMLHttpRequest.DONE) { - - var a = doc.responseXML.documentElement; - for (var ii = 0; ii < a.childNodes.length; ++ii) { - console.log(a.childNodes[ii].nodeName); - } - console.log("Headers -->"); - console.log(doc.getAllResponseHeaders ()); - console.log("Last modified -->"); - console.log(doc.getResponseHeader ("Last-Modified")); + console.log("Headers -->"); + console.log(doc.getAllResponseHeaders ()); + console.log("Last modified -->"); + console.log(doc.getResponseHeader ("Last-Modified")); - } } + } - doc.open("GET", "test.xml"); - doc.send(); + doc.open("GET", "test.xml"); + doc.send(); } } } diff --git a/mkspecs/features/resources.prf b/mkspecs/features/resources.prf index 8ccd576..eb33aab 100644 --- a/mkspecs/features/resources.prf +++ b/mkspecs/features/resources.prf @@ -1,6 +1,6 @@ isEmpty(QMAKE_RCC) { - win32:QMAKE_RCC = $$[QT_INSTALL_BINS]\rcc.exe - else:QMAKE_RCC = $$[QT_INSTALL_BINS]/rcc + win32:QMAKE_RCC = $$[QT_INSTALL_BINS]$${DIR_SEPARATOR}rcc.exe + else:QMAKE_RCC = $$[QT_INSTALL_BINS]$${DIR_SEPARATOR}rcc } isEmpty(RCC_DIR):RCC_DIR = . diff --git a/mkspecs/features/uic.prf b/mkspecs/features/uic.prf index eaf373a..8ebe0ea 100644 --- a/mkspecs/features/uic.prf +++ b/mkspecs/features/uic.prf @@ -1,11 +1,11 @@ isEmpty(QMAKE_UIC3) { - contains(QMAKE_HOST.os,Windows):QMAKE_UIC3 = $$[QT_INSTALL_BINS]\uic3.exe + contains(QMAKE_HOST.os,Windows):QMAKE_UIC3 = $$[QT_INSTALL_BINS]$${DIR_SEPARATOR}uic3.exe else:QMAKE_UIC3 = $$[QT_INSTALL_BINS]/uic3 } isEmpty(QMAKE_UIC) { - contains(QMAKE_HOST.os,Windows):QMAKE_UIC = $$[QT_INSTALL_BINS]\uic.exe + contains(QMAKE_HOST.os,Windows):QMAKE_UIC = $$[QT_INSTALL_BINS]$${DIR_SEPARATOR}uic.exe else:QMAKE_UIC = $$[QT_INSTALL_BINS]/uic } diff --git a/qmake/generators/metamakefile.cpp b/qmake/generators/metamakefile.cpp index e76e596..c42a837 100644 --- a/qmake/generators/metamakefile.cpp +++ b/qmake/generators/metamakefile.cpp @@ -58,6 +58,8 @@ MetaMakefileGenerator::~MetaMakefileGenerator() delete project; } +#ifndef QT_QMAKE_PARSER_ONLY + class BuildsMetaMakefileGenerator : public MetaMakefileGenerator { private: @@ -489,6 +491,25 @@ MetaMakefileGenerator::createMakefileGenerator(QMakeProject *proj, bool noIO) return mkfile; } +MetaMakefileGenerator * +MetaMakefileGenerator::createMetaGenerator(QMakeProject *proj, const QString &name, bool op, bool *success) +{ + MetaMakefileGenerator *ret = 0; + if ((Option::qmake_mode == Option::QMAKE_GENERATE_MAKEFILE || + Option::qmake_mode == Option::QMAKE_GENERATE_PRL)) { + if (proj->first("TEMPLATE").endsWith("subdirs")) + ret = new SubdirsMetaMakefileGenerator(proj, name, op); + } + if (!ret) + ret = new BuildsMetaMakefileGenerator(proj, name, op); + bool res = ret->init(); + if (success) + *success = res; + return ret; +} + +#endif // QT_QMAKE_PARSER_ONLY + bool MetaMakefileGenerator::modesForGenerator(const QString &gen, Option::HOST_MODE *host_mode, Option::TARG_MODE *target_mode) @@ -523,21 +544,4 @@ MetaMakefileGenerator::modesForGenerator(const QString &gen, return true; } -MetaMakefileGenerator * -MetaMakefileGenerator::createMetaGenerator(QMakeProject *proj, const QString &name, bool op, bool *success) -{ - MetaMakefileGenerator *ret = 0; - if ((Option::qmake_mode == Option::QMAKE_GENERATE_MAKEFILE || - Option::qmake_mode == Option::QMAKE_GENERATE_PRL)) { - if (proj->first("TEMPLATE").endsWith("subdirs")) - ret = new SubdirsMetaMakefileGenerator(proj, name, op); - } - if (!ret) - ret = new BuildsMetaMakefileGenerator(proj, name, op); - bool res = ret->init(); - if (success) - *success = res; - return ret; -} - QT_END_NAMESPACE diff --git a/qmake/generators/symbian/symbiancommon.cpp b/qmake/generators/symbian/symbiancommon.cpp index 10889c4..0df2d15 100644 --- a/qmake/generators/symbian/symbiancommon.cpp +++ b/qmake/generators/symbian/symbiancommon.cpp @@ -164,6 +164,9 @@ void SymbianCommonGenerator::generatePkgFile(const QString &iconFile, bool epocB QTextStream t(&pkgFile); QString installerSisHeader = project->values("DEPLOYMENT.installer_header").join("\n"); + if (installerSisHeader.isEmpty()) + installerSisHeader = "0xA000D7CE"; // Use default self-signable UID if not defined + QString wrapperStreamBuffer; QTextStream tw(&wrapperStreamBuffer); @@ -360,15 +363,32 @@ void SymbianCommonGenerator::generatePkgFile(const QString &iconFile, bool epocB // deploy any additional DEPLOYMENT files QString remoteTestPath; remoteTestPath = QString("!:\\private\\%1").arg(privateDirUid); + QString zDir = epocRoot() + QLatin1String("epoc32/data/z"); DeploymentList depList; initProjectDeploySymbian(project, depList, remoteTestPath, true, epocBuild, "$(PLATFORM)", "$(TARGET)", generatedDirs, generatedFiles); if (depList.size()) t << "; DEPLOYMENT" << endl; for (int i = 0; i < depList.size(); ++i) { - t << QString("\"%1\" - \"%2\"") - .arg(depList.at(i).from) - .arg(depList.at(i).to) << endl; + QString from = depList.at(i).from; + QString to = depList.at(i).to; + + if (epocBuild) { + // Deploy anything not already deployed from under epoc32 instead from under + // \epoc32\data\z\ to enable using pkg file without rebuilding + // the project, which can be useful for some binary only distributions. + if (!from.contains(QLatin1String("epoc32"), Qt::CaseInsensitive)) { + from = to; + if (from.size() > 1 && from.at(1) == QLatin1Char(':')) + from = from.mid(2); + from.prepend(zDir); + } else { + if (from.size() > 1 && from.at(1) == QLatin1Char(':')) + from = from.mid(2); + } + } + + t << QString("\"%1\" - \"%2\"").arg(from.replace('\\','/')).arg(to) << endl; } t << endl; @@ -433,7 +453,7 @@ void SymbianCommonGenerator::generatePkgFile(const QString &iconFile, bool epocB twf << "\"" << currentPath << "/" << sisName << "\" - \"c:\\adm\\" << sisName << "\"" << endl; QString bootStrapPath = QLibraryInfo::location(QLibraryInfo::PrefixPath); - bootStrapPath.append("/bootstrap.sis"); + bootStrapPath.append("/smartinstaller.sis"); QFileInfo fi(generator->fileInfo(bootStrapPath)); twf << "@\"" << fi.absoluteFilePath() << "\",(0x2002CCCD)" << endl; } diff --git a/qmake/generators/symbian/symmake_sbsv2.cpp b/qmake/generators/symbian/symmake_sbsv2.cpp index c817056..3a6706a 100644 --- a/qmake/generators/symbian/symmake_sbsv2.cpp +++ b/qmake/generators/symbian/symmake_sbsv2.cpp @@ -75,7 +75,7 @@ void SymbianSbsv2MakefileGenerator::exportFlm() foreach(QFileInfo item, sourceInfos) { QFileInfo destInfo = QFileInfo(destDir.absolutePath() + "/" + item.fileName()); - if (!destInfo.exists() || destInfo.lastModified() < item.lastModified()) { + if (!destInfo.exists() || destInfo.lastModified() != item.lastModified()) { if (destInfo.exists()) QFile::remove(destInfo.absoluteFilePath()); if (QFile::copy(item.absoluteFilePath(), destInfo.absoluteFilePath())) diff --git a/qmake/project.cpp b/qmake/project.cpp index 56707cf..764264f 100644 --- a/qmake/project.cpp +++ b/qmake/project.cpp @@ -1507,7 +1507,6 @@ QMakeProject::read(uchar cmd) void QMakeProject::validateModes() { -#if !defined(QT_BUILD_QMAKE_NO_GENERATORS) if (Option::host_mode == Option::HOST_UNKNOWN_MODE || Option::target_mode == Option::TARG_UNKNOWN_MODE) { Option::HOST_MODE host_mode; @@ -1544,7 +1543,6 @@ void QMakeProject::validateModes() } } } -#endif // !defined(QT_BUILD_QMAKE_NO_GENERATORS) } bool diff --git a/qmake/qmake.pri b/qmake/qmake.pri index 281417c..0163839 100644 --- a/qmake/qmake.pri +++ b/qmake/qmake.pri @@ -132,6 +132,7 @@ bootstrap { #Qt code } else:win32 { SOURCES += qfsfileengine_win.cpp qfsfileengine_iterator_win.cpp qsettings_win.cpp win32-msvc*:LIBS += ole32.lib advapi32.lib + win32-g++:LIBS += -lole32 -luuid } qnx { diff --git a/src/3rdparty/phonon/ds9/abstractvideorenderer.cpp b/src/3rdparty/phonon/ds9/abstractvideorenderer.cpp index e932e70..a9d0694 100644 --- a/src/3rdparty/phonon/ds9/abstractvideorenderer.cpp +++ b/src/3rdparty/phonon/ds9/abstractvideorenderer.cpp @@ -99,8 +99,8 @@ namespace Phonon m_dstX = m_dstY = 0; if (ratio > 0) { - if (realWidth / realHeight > ratio && scaleMode == Phonon::VideoWidget::FitInView - || realWidth / realHeight < ratio && scaleMode == Phonon::VideoWidget::ScaleAndCrop) { + if ((realWidth / realHeight > ratio && scaleMode == Phonon::VideoWidget::FitInView) + || (realWidth / realHeight < ratio && scaleMode == Phonon::VideoWidget::ScaleAndCrop)) { //the height is correct, let's change the width m_dstWidth = qRound(realHeight * ratio); m_dstX = qRound((realWidth - realHeight * ratio) / 2.); diff --git a/src/3rdparty/phonon/ds9/backend.cpp b/src/3rdparty/phonon/ds9/backend.cpp index 2c56af7..fbc4bdc 100644 --- a/src/3rdparty/phonon/ds9/backend.cpp +++ b/src/3rdparty/phonon/ds9/backend.cpp @@ -41,6 +41,8 @@ namespace Phonon { namespace DS9 { + QMutex *Backend::directShowMutex = 0; + bool Backend::AudioMoniker::operator==(const AudioMoniker &other) { return other->IsEqual(*this) == S_OK; @@ -50,6 +52,8 @@ namespace Phonon Backend::Backend(QObject *parent, const QVariantList &) : QObject(parent) { + directShowMutex = &m_directShowMutex; + ::CoInitialize(0); //registering meta types @@ -62,6 +66,8 @@ namespace Phonon m_audioOutputs.clear(); m_audioEffects.clear(); ::CoUninitialize(); + + directShowMutex = 0; } QObject *Backend::createObject(BackendInterface::Class c, QObject *parent, const QList<QVariant> &args) @@ -131,6 +137,7 @@ namespace Phonon QList<int> Backend::objectDescriptionIndexes(Phonon::ObjectDescriptionType type) const { + QMutexLocker locker(&m_directShowMutex); QList<int> ret; switch(type) @@ -157,7 +164,7 @@ namespace Phonon while (S_OK == enumMon->Next(1, mon.pparam(), 0)) { LPOLESTR str = 0; mon->GetDisplayName(0,0,&str); - const QString name = QString::fromUtf16((unsigned short*)str); + const QString name = QString::fromWCharArray(str); ComPointer<IMalloc> alloc; ::CoGetMalloc(1, alloc.pparam()); alloc->Free(str); @@ -204,6 +211,7 @@ namespace Phonon QHash<QByteArray, QVariant> Backend::objectDescriptionProperties(Phonon::ObjectDescriptionType type, int index) const { + QMutexLocker locker(&m_directShowMutex); QHash<QByteArray, QVariant> ret; switch (type) { @@ -216,7 +224,7 @@ namespace Phonon LPOLESTR str = 0; HRESULT hr = mon->GetDisplayName(0,0, &str); if (SUCCEEDED(hr)) { - QString name = QString::fromUtf16((unsigned short*)str); + QString name = QString::fromWCharArray(str); ComPointer<IMalloc> alloc; ::CoGetMalloc(1, alloc.pparam()); alloc->Free(str); @@ -231,7 +239,7 @@ namespace Phonon WCHAR name[80]; // 80 is clearly stated in the MSDN doc HRESULT hr = ::DMOGetName(m_audioEffects[index], name); if (SUCCEEDED(hr)) { - ret["name"] = QString::fromUtf16((unsigned short*)name); + ret["name"] = QString::fromWCharArray(name); } } break; diff --git a/src/3rdparty/phonon/ds9/backend.h b/src/3rdparty/phonon/ds9/backend.h index ad638f2..7c3c109 100644 --- a/src/3rdparty/phonon/ds9/backend.h +++ b/src/3rdparty/phonon/ds9/backend.h @@ -23,6 +23,7 @@ along with this library. If not, see <http://www.gnu.org/licenses/>. #include <phonon/phononnamespace.h> #include <QtCore/QList> +#include <QtCore/QMutex> #include "compointer.h" #include "backendnode.h" @@ -63,6 +64,8 @@ namespace Phonon Filter getAudioOutputFilter(int index) const; + static QMutex *directShowMutex; + Q_SIGNALS: void objectDescriptionChanged(ObjectDescriptionType); @@ -74,6 +77,7 @@ namespace Phonon }; mutable QVector<AudioMoniker> m_audioOutputs; mutable QVector<CLSID> m_audioEffects; + mutable QMutex m_directShowMutex; }; } } diff --git a/src/3rdparty/phonon/ds9/backendnode.cpp b/src/3rdparty/phonon/ds9/backendnode.cpp index 7e0b3cd..737ab7b 100644 --- a/src/3rdparty/phonon/ds9/backendnode.cpp +++ b/src/3rdparty/phonon/ds9/backendnode.cpp @@ -57,6 +57,25 @@ namespace Phonon BackendNode::~BackendNode() { + //this will remove the filter from the graph + FILTER_INFO info; + for(int i = 0; i < FILTER_COUNT; ++i) { + const Filter &filter = m_filters[i]; + if (!filter) + continue; + filter->QueryFilterInfo(&info); + if (info.pGraph) { + HRESULT hr = info.pGraph->RemoveFilter(filter); + + if (FAILED(hr) && m_mediaObject) { + m_mediaObject->ensureStopped(); + + hr = info.pGraph->RemoveFilter(filter); + } + Q_ASSERT(SUCCEEDED(hr)); + info.pGraph->Release(); + } + } } void BackendNode::setMediaObject(MediaObject *mo) diff --git a/src/3rdparty/phonon/ds9/ds9.desktop b/src/3rdparty/phonon/ds9/ds9.desktop index 1bc3451..764390e 100644 --- a/src/3rdparty/phonon/ds9/ds9.desktop +++ b/src/3rdparty/phonon/ds9/ds9.desktop @@ -5,13 +5,12 @@ MimeType=application/x-annodex;video/quicktime;video/x-quicktime;audio/x-m4a;app X-KDE-Library=phonon_ds9 X-KDE-PhononBackendInfo-InterfaceVersion=1 X-KDE-PhononBackendInfo-Version=0.1 -X-KDE-PhononBackendInfo-Website=http://www.trolltech.com/ +X-KDE-PhononBackendInfo-Website=http://qt.nokia.com/ InitialPreference=15 Name=DirectShow9 Name[bg]=DirectShow9 Name[ca]=DirectShow9 -Name[ca@valencia]=DirectShow9 Name[cs]=DirectShow9 Name[da]=DirectShow9 Name[de]=DirectShow9 @@ -20,14 +19,11 @@ Name[en_GB]=DirectShow9 Name[es]=DirectShow9 Name[et]=DirectShow9 Name[eu]=DirectShow9 -Name[fi]=DirectShow9 Name[fr]=DirectShow9 Name[ga]=DirectShow9 Name[gl]=DirectShow9 -Name[hr]=DirectShow9 Name[hsb]=DirectShow9 Name[hu]=DirectShow9 -Name[id]=DirectShow9 Name[is]=DirectShow9 Name[it]=DirectShow9 Name[ja]=DirectShow9 @@ -35,7 +31,6 @@ Name[ko]=DirectShow9 Name[ku]=DirectShow9 Name[lt]=DirectShow9 Name[lv]=DirectShow9 -Name[nb]=DirectShow9 Name[nds]=DirectShow9 Name[nl]=DirectShow9 Name[nn]=DirectShow9 @@ -43,13 +38,10 @@ Name[pa]=ਡਾਇਰੈਕਸ਼ੋ9 Name[pl]=DirectShow9 Name[pt]=DirectShow9 Name[pt_BR]=DirectShow9 -Name[ru]=DirectShow9 Name[se]=DirectShow9 Name[sk]=DirectShow 9 Name[sl]=DirectShow 9 Name[sr]=Директшоу‑9 -Name[sr@ijekavian]=Директшоу‑9 -Name[sr@ijekavianlatin]=DirectShow‑9 Name[sr@latin]=DirectShow‑9 Name[sv]=Directshow 9 Name[tr]=DirectShow9 @@ -61,7 +53,6 @@ Name[zh_TW]=DirectShow9 Comment=Phonon DirectShow9 backend Comment[bg]=Phonon DirectShow9 Comment[ca]=Dorsal DirectShow9 del Phonon -Comment[ca@valencia]=Dorsal DirectShow9 del Phonon Comment[cs]=Phonon DirectShow9 backend Comment[da]=DirectShow9-backend til Phonon Comment[de]=Phonon-Treiber für DirectShow9 @@ -70,13 +61,11 @@ Comment[en_GB]=Phonon DirectShow9 backend Comment[es]=Motor DirectShow9 para Phonon Comment[et]=Phononi DirectShow9 taustaprogramm Comment[eu]=Phonon DirectShow9 backend -Comment[fi]=Phonon DirectShow9-taustaohjelma Comment[fr]=Système de gestion DirectShow9 pour Phonon Comment[ga]=Inneall DirectShow9 le haghaidh Phonon Comment[gl]=Infraestrutura de DirectShow9 para Phonon Comment[hsb]=Phonon DirectShow9 backend Comment[hu]=Phonon DirectShow9 modul -Comment[id]=Phonon DirectShow9 backend Comment[is]=Phonon DirectShow9 bakendi Comment[it]=Motore DirectShow9 di Phonon Comment[ja]=Phonon DirectShow9 バックエンド @@ -84,7 +73,6 @@ Comment[ko]=Phonon DirectShow9 백엔드 Comment[ku]=Binesaza Phonon DirectShow9 Comment[lt]=Phonon DirectShow9 galinė sąsaja Comment[lv]=Phonon DirectShow9 aizmugure -Comment[nb]=Phonon-motor for DirectShow9 Comment[nds]=Phonon-Hülpprogrmm DirectShow9 Comment[nl]=DirectShow9-backend (Phonon) Comment[nn]=Phonon-motor for DirectShow9 @@ -92,13 +80,10 @@ Comment[pa]=ਫੋਨੋਨ ਡਾਇਰੈਕਟਸ਼ੋ9 ਬੈਕਐਂਡ Comment[pl]=Obsługa DirectShow9 przez Phonon Comment[pt]=Infra-estrutura do DirectShow9 para o Phonon Comment[pt_BR]=Infraestrutura Phonon DirectShow9 -Comment[ru]=Механизм DirectShow9 для Phonon Comment[se]=Phonon DirectShow9 duogášmohtor Comment[sk]=Phonon DirectShow 9 podsystém Comment[sl]=Phononova Hrbtenica DirectShow 9 Comment[sr]=Директшоу‑9 као позадина Фонона -Comment[sr@ijekavian]=Директшоу‑9 као позадина Фонона -Comment[sr@ijekavianlatin]=DirectShow‑9 kao pozadina Phonona Comment[sr@latin]=DirectShow‑9 kao pozadina Phonona Comment[sv]=Phonon Directshow 9-gränssnitt Comment[tr]=Phonon DirectShow9 arka ucu diff --git a/src/3rdparty/phonon/ds9/effect.cpp b/src/3rdparty/phonon/ds9/effect.cpp index 104a3c1..ebe976b 100644 --- a/src/3rdparty/phonon/ds9/effect.cpp +++ b/src/3rdparty/phonon/ds9/effect.cpp @@ -82,7 +82,7 @@ namespace Phonon current += wcslen(current) + 1; //skip the name current += wcslen(current) + 1; //skip the unit for(; *current; current += wcslen(current) + 1) { - values.append( QString::fromUtf16((unsigned short*)current) ); + values.append( QString::fromWCharArray(current) ); } } //FALLTHROUGH @@ -107,7 +107,7 @@ namespace Phonon Phonon::EffectParameter::Hints hint = info.mopCaps == MP_CAPS_CURVE_INVSQUARE ? Phonon::EffectParameter::LogarithmicHint : Phonon::EffectParameter::Hints(0); - const QString n = QString::fromUtf16((unsigned short*)name); + const QString n = QString::fromWCharArray(name); ret.append(Phonon::EffectParameter(i, n, hint, def, min, max, values)); ::CoTaskMemFree(name); //let's free the memory } diff --git a/src/3rdparty/phonon/ds9/fakesource.cpp b/src/3rdparty/phonon/ds9/fakesource.cpp index 9a61a2e..4dce138 100644 --- a/src/3rdparty/phonon/ds9/fakesource.cpp +++ b/src/3rdparty/phonon/ds9/fakesource.cpp @@ -29,8 +29,10 @@ namespace Phonon namespace DS9 { static WAVEFORMATEX g_defaultWaveFormat = {WAVE_FORMAT_PCM, 2, 44100, 176400, 4, 16, 0}; - static BITMAPINFOHEADER g_defautBitmapHeader = { sizeof(BITMAPINFOHEADER), 1, 1, 1, 0, 0, 0, 0, 0, 0, 0}; - static VIDEOINFOHEADER2 g_defaultVideoInfo = { { 0, 0, 0, 0 }, { 0, 0, 0, 0 }, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; + static VIDEOINFOHEADER2 g_defaultVideoInfo = { { 0, 0, 0, 0 }, { 0, 0, 0, 0 }, 0, 0, 0, 0, 0, 0, 0, {0}, 0, {sizeof(BITMAPINFOHEADER), 1, 1, 1, 0, 0, 0, 0, 0, 0, 0} }; + + static const AM_MEDIA_TYPE g_fakeAudioType = {MEDIATYPE_Audio, MEDIASUBTYPE_PCM, 0, 0, 2, FORMAT_WaveFormatEx, 0, sizeof(WAVEFORMATEX), reinterpret_cast<BYTE*>(&g_defaultWaveFormat)}; + static const AM_MEDIA_TYPE g_fakeVideoType = {MEDIATYPE_Video, MEDIASUBTYPE_RGB32, TRUE, FALSE, 0, FORMAT_VideoInfo2, 0, sizeof(VIDEOINFOHEADER2), reinterpret_cast<BYTE*>(&g_defaultVideoInfo)}; class FakePin : public QPin { @@ -128,36 +130,12 @@ namespace Phonon void FakeSource::createFakeAudioPin() { - AM_MEDIA_TYPE mt; - qMemSet(&mt, 0, sizeof(AM_MEDIA_TYPE)); - mt.majortype = MEDIATYPE_Audio; - mt.subtype = MEDIASUBTYPE_PCM; - mt.formattype = FORMAT_WaveFormatEx; - mt.lSampleSize = 2; - - //fake the format (stereo 44.1 khz stereo 16 bits) - mt.cbFormat = sizeof(WAVEFORMATEX); - mt.pbFormat = reinterpret_cast<BYTE*>(&g_defaultWaveFormat); - - new FakePin(this, mt); + new FakePin(this, g_fakeAudioType); } void FakeSource::createFakeVideoPin() { - AM_MEDIA_TYPE mt; - qMemSet(&mt, 0, sizeof(AM_MEDIA_TYPE)); - mt.majortype = MEDIATYPE_Video; - mt.subtype = MEDIASUBTYPE_RGB32; - mt.formattype = FORMAT_VideoInfo2; - mt.bFixedSizeSamples = 1; - - g_defaultVideoInfo.bmiHeader = g_defautBitmapHeader; - - //fake the format - mt.cbFormat = sizeof(VIDEOINFOHEADER2); - mt.pbFormat = reinterpret_cast<BYTE*>(&g_defaultVideoInfo); - - new FakePin(this, mt); + new FakePin(this, g_fakeVideoType); } } diff --git a/src/3rdparty/phonon/ds9/iodevicereader.cpp b/src/3rdparty/phonon/ds9/iodevicereader.cpp index 9152712..ba4ae5c 100644 --- a/src/3rdparty/phonon/ds9/iodevicereader.cpp +++ b/src/3rdparty/phonon/ds9/iodevicereader.cpp @@ -36,18 +36,20 @@ namespace Phonon //these mediatypes define a stream, its type will be autodetected by DirectShow static QVector<AM_MEDIA_TYPE> getMediaTypes() { - AM_MEDIA_TYPE mt = { MEDIATYPE_Stream, MEDIASUBTYPE_NULL, TRUE, FALSE, 1, GUID_NULL, 0, 0, 0}; + //the order here is important because otherwise, + //directshow might not be able to detect the stream type correctly + + AM_MEDIA_TYPE mt = { MEDIATYPE_Stream, MEDIASUBTYPE_Avi, TRUE, FALSE, 1, GUID_NULL, 0, 0, 0}; QVector<AM_MEDIA_TYPE> ret; - //normal auto-detect stream - mt.subtype = MEDIASUBTYPE_NULL; - ret << mt; //AVI stream - mt.subtype = MEDIASUBTYPE_Avi; ret << mt; //WAVE stream mt.subtype = MEDIASUBTYPE_WAVE; ret << mt; + //normal auto-detect stream (must be at the end!) + mt.subtype = MEDIASUBTYPE_NULL; + ret << mt; return ret; } @@ -64,7 +66,6 @@ namespace Phonon //for Phonon::StreamInterface void writeData(const QByteArray &data) { - QWriteLocker locker(&m_lock); m_pos += data.size(); m_buffer += data; } @@ -75,54 +76,22 @@ namespace Phonon void setStreamSize(qint64 newSize) { - QWriteLocker locker(&m_lock); + QMutexLocker locker(&m_mutex); m_size = newSize; } - qint64 streamSize() const - { - QReadLocker locker(&m_lock); - return m_size; - } - void setStreamSeekable(bool s) { - QWriteLocker locker(&m_lock); + QMutexLocker locker(&m_mutex); m_seekable = s; } - bool streamSeekable() const - { - QReadLocker locker(&m_lock); - return m_seekable; - } - - void setCurrentPos(qint64 pos) - { - QWriteLocker locker(&m_lock); - m_pos = pos; - seekStream(pos); - m_buffer.clear(); - } - - qint64 currentPos() const - { - QReadLocker locker(&m_lock); - return m_pos; - } - - int currentBufferSize() const - { - QReadLocker locker(&m_lock); - return m_buffer.size(); - } - //virtual pure members //implementation from IAsyncReader STDMETHODIMP Length(LONGLONG *total, LONGLONG *available) { - QReadLocker locker(&m_lock); + QMutexLocker locker(&m_mutex); if (total) { *total = m_size; } @@ -137,37 +106,39 @@ namespace Phonon HRESULT read(LONGLONG pos, LONG length, BYTE *buffer, LONG *actual) { - QMutexLocker locker(&m_mutexRead); + Q_ASSERT(!m_mutex.tryLock()); + if (m_mediaGraph->isStopping()) { + return VFW_E_WRONG_STATE; + } - if(streamSize() != 1 && pos + length > streamSize()) { + if(m_size != 1 && pos + length > m_size) { //it tries to read outside of the boundaries return E_FAIL; } - if (currentPos() - currentBufferSize() != pos) { - if (!streamSeekable()) { + if (m_pos - m_buffer.size() != pos) { + if (!m_seekable) { return S_FALSE; } - setCurrentPos(pos); + m_pos = pos; + seekStream(pos); + m_buffer.clear(); } - int oldSize = currentBufferSize(); - while (currentBufferSize() < int(length)) { + int oldSize = m_buffer.size(); + while (m_buffer.size() < int(length)) { needData(); - if (oldSize == currentBufferSize()) { + if (oldSize == m_buffer.size()) { break; //we didn't get any data } - oldSize = currentBufferSize(); + oldSize = m_buffer.size(); } - DWORD bytesRead = qMin(currentBufferSize(), int(length)); - { - QWriteLocker locker(&m_lock); - qMemCopy(buffer, m_buffer.data(), bytesRead); - //truncate the buffer - m_buffer = m_buffer.mid(bytesRead); - } + int bytesRead = qMin(m_buffer.size(), int(length)); + qMemCopy(buffer, m_buffer.data(), bytesRead); + //truncate the buffer + m_buffer = m_buffer.mid(bytesRead); if (actual) { *actual = bytesRead; //initialization @@ -183,7 +154,6 @@ namespace Phonon qint64 m_pos; qint64 m_size; - QMutex m_mutexRead; const MediaGraph *m_mediaGraph; }; @@ -197,14 +167,6 @@ namespace Phonon IODeviceReader::~IODeviceReader() { } - - STDMETHODIMP IODeviceReader::Stop() - { - HRESULT hr = QBaseFilter::Stop(); - m_streamReader->enoughData(); //this asks to cancel any blocked call to needData - return hr; - } - } } diff --git a/src/3rdparty/phonon/ds9/iodevicereader.h b/src/3rdparty/phonon/ds9/iodevicereader.h index af4b271..c8b91c3 100644 --- a/src/3rdparty/phonon/ds9/iodevicereader.h +++ b/src/3rdparty/phonon/ds9/iodevicereader.h @@ -41,7 +41,6 @@ namespace Phonon public: IODeviceReader(const MediaSource &source, const MediaGraph *); ~IODeviceReader(); - STDMETHODIMP Stop(); private: StreamReader *m_streamReader; diff --git a/src/3rdparty/phonon/ds9/mediagraph.cpp b/src/3rdparty/phonon/ds9/mediagraph.cpp index db0ec84..3e7a68b 100644 --- a/src/3rdparty/phonon/ds9/mediagraph.cpp +++ b/src/3rdparty/phonon/ds9/mediagraph.cpp @@ -68,6 +68,8 @@ namespace Phonon return ret; } + +/* static HRESULT saveToFile(Graph graph, const QString &filepath) { const WCHAR wszStreamName[] = L"ActiveMovieGraph"; @@ -103,7 +105,7 @@ namespace Phonon return hr; } - +*/ MediaGraph::MediaGraph(MediaObject *mo, short index) : m_graph(CLSID_FilterGraph, IID_IGraphBuilder), @@ -377,11 +379,12 @@ namespace Phonon FILTER_INFO info; filter->QueryFilterInfo(&info); #ifdef GRAPH_DEBUG - qDebug() << "removeFilter" << QString::fromUtf16(info.achName); + qDebug() << "removeFilter" << QString((const QChar *)info.achName); #endif if (info.pGraph) { info.pGraph->Release(); - return m_graph->RemoveFilter(filter); + if (info.pGraph == m_graph) + return m_graph->RemoveFilter(filter); } //already removed @@ -537,11 +540,11 @@ namespace Phonon const QList<OutputPin> outputs = BackendNode::pins(filter, PINDIR_OUTPUT); for(int i = 0; i < outputs.count(); ++i) { const OutputPin &pin = outputs.at(i); - if (VFW_E_NOT_CONNECTED == pin->ConnectedTo(inPin.pparam())) { + if (HRESULT(VFW_E_NOT_CONNECTED) == pin->ConnectedTo(inPin.pparam())) { return SUCCEEDED(pin->Connect(newIn, 0)); } } - //we should never go here + //we shoud never go here return false; } else { QAMMediaType type; @@ -679,7 +682,6 @@ namespace Phonon #ifndef QT_NO_PHONON_MEDIACONTROLLER } else if (source.discType() == Phonon::Cd) { m_realSource = Filter(new QAudioCDPlayer); - m_result = m_graph->AddFilter(m_realSource, 0); #endif //QT_NO_PHONON_MEDIACONTROLLER } else { @@ -809,7 +811,7 @@ namespace Phonon for (int i = 0; i < outputs.count(); ++i) { const OutputPin &out = outputs.at(i); InputPin pin; - if (out->ConnectedTo(pin.pparam()) == VFW_E_NOT_CONNECTED) { + if (out->ConnectedTo(pin.pparam()) == HRESULT(VFW_E_NOT_CONNECTED)) { m_decoderPins += out; //unconnected outputs can be decoded outputs } } @@ -820,7 +822,7 @@ namespace Phonon //let's reestablish the connections for (int i = 0; i < connections.count(); ++i) { const GraphConnection &connection = connections.at(i); - //check if we should transfer the sink node + //check if we shoud transfer the sink node grabFilter(connection.input); grabFilter(connection.output); @@ -873,7 +875,7 @@ namespace Phonon { FILTER_INFO info; filter->QueryFilterInfo(&info); - qDebug() << Q_FUNC_INFO << QString::fromUtf16(info.achName); + qDebug() << Q_FUNC_INFO << QString((const QChar *)info.achName); if (info.pGraph) { info.pGraph->Release(); } @@ -919,7 +921,7 @@ namespace Phonon { FILTER_INFO info; filter->QueryFilterInfo(&info); - qDebug() << "found a decoder filter" << QString::fromUtf16(info.achName); + qDebug() << "found a decoder filter" << QString((const QChar *)info.achName); if (info.pGraph) { info.pGraph->Release(); } @@ -935,7 +937,7 @@ namespace Phonon { FILTER_INFO info; filter->QueryFilterInfo(&info); - qDebug() << Q_FUNC_INFO << QString::fromUtf16(info.achName); + qDebug() << Q_FUNC_INFO << QString((const QChar *)info.achName); if (info.pGraph) { info.pGraph->Release(); } @@ -954,7 +956,7 @@ namespace Phonon { FILTER_INFO info; filter->QueryFilterInfo(&info); - qDebug() << Q_FUNC_INFO << QString::fromUtf16(info.achName); + qDebug() << Q_FUNC_INFO << QString((const QChar *)info.achName); if (info.pGraph) { info.pGraph->Release(); } @@ -988,7 +990,7 @@ namespace Phonon { FILTER_INFO info; filter->QueryFilterInfo(&info); - qDebug() << "found a demuxer filter" << QString::fromUtf16(info.achName); + qDebug() << "found a demuxer filter" << QString((const QChar *)info.achName); if (info.pGraph) { info.pGraph->Release(); } @@ -1006,27 +1008,27 @@ namespace Phonon BSTR str; HRESULT hr = mediaContent->get_AuthorName(&str); if (SUCCEEDED(hr)) { - ret.insert(QLatin1String("ARTIST"), QString::fromUtf16((const unsigned short*)str)); + ret.insert(QLatin1String("ARTIST"), QString::fromWCharArray(str)); SysFreeString(str); } hr = mediaContent->get_Title(&str); if (SUCCEEDED(hr)) { - ret.insert(QLatin1String("TITLE"), QString::fromUtf16((const unsigned short*)str)); + ret.insert(QLatin1String("TITLE"), QString::fromWCharArray(str)); SysFreeString(str); } hr = mediaContent->get_Description(&str); if (SUCCEEDED(hr)) { - ret.insert(QLatin1String("DESCRIPTION"), QString::fromUtf16((const unsigned short*)str)); + ret.insert(QLatin1String("DESCRIPTION"), QString::fromWCharArray(str)); SysFreeString(str); } hr = mediaContent->get_Copyright(&str); if (SUCCEEDED(hr)) { - ret.insert(QLatin1String("COPYRIGHT"), QString::fromUtf16((const unsigned short*)str)); + ret.insert(QLatin1String("COPYRIGHT"), QString::fromWCharArray(str)); SysFreeString(str); } hr = mediaContent->get_MoreInfoText(&str); if (SUCCEEDED(hr)) { - ret.insert(QLatin1String("MOREINFO"), QString::fromUtf16((const unsigned short*)str)); + ret.insert(QLatin1String("MOREINFO"), QString::fromWCharArray(str)); SysFreeString(str); } } diff --git a/src/3rdparty/phonon/ds9/mediaobject.cpp b/src/3rdparty/phonon/ds9/mediaobject.cpp index b9a8713..d640956 100644 --- a/src/3rdparty/phonon/ds9/mediaobject.cpp +++ b/src/3rdparty/phonon/ds9/mediaobject.cpp @@ -23,7 +23,7 @@ along with this library. If not, see <http://www.gnu.org/licenses/>. #ifndef Q_CC_MSVC #include <dshow.h> -#endif //Q_CC_MSVC +#endif #include <objbase.h> #include <initguid.h> #include <qnetwork.h> @@ -52,7 +52,7 @@ namespace Phonon //first the definition of the WorkerThread class WorkerThread::WorkerThread() - : QThread(), m_currentRenderId(0), m_finished(false), m_currentWorkId(1) + : QThread(), m_finished(false), m_currentWorkId(1) { } @@ -60,24 +60,6 @@ namespace Phonon { } - WorkerThread::Work WorkerThread::dequeueWork() - { - QMutexLocker locker(&m_mutex); - if (m_finished) { - return Work(); - } - Work ret = m_queue.dequeue(); - - //we ensure to have the wait condition in the right state - if (m_queue.isEmpty()) { - m_waitCondition.reset(); - } else { - m_waitCondition.set(); - } - - return ret; - } - void WorkerThread::run() { while (m_finished == false) { @@ -91,11 +73,6 @@ namespace Phonon } DWORD result = ::WaitForMultipleObjects(count, handles, FALSE, INFINITE); if (result == WAIT_OBJECT_0) { - if (m_finished) { - //that's the end of the thread execution - return; - } - handleTask(); } else { //this is the event management @@ -183,6 +160,7 @@ namespace Phonon //we create a new graph w.graph = Graph(CLSID_FilterGraph, IID_IGraphBuilder); w.filter = filter; + w.graph->AddFilter(filter, 0); w.id = m_currentWorkId++; m_queue.enqueue(w); m_waitCondition.set(); @@ -202,23 +180,29 @@ namespace Phonon void WorkerThread::handleTask() { - const Work w = dequeueWork(); + QMutexLocker locker(Backend::directShowMutex); + { + QMutexLocker locker(&m_mutex); + if (m_finished || m_queue.isEmpty()) { + return; + } - if (m_finished) { - return; + m_currentWork = m_queue.dequeue(); + + //we ensure to have the wait condition in the right state + if (m_queue.isEmpty()) { + m_waitCondition.reset(); + } else { + m_waitCondition.set(); + } } HRESULT hr = S_OK; - m_currentRender = w.graph; - m_currentRenderId = w.id; - if (w.task == ReplaceGraph) { - QMutexLocker locker(&m_mutex); - HANDLE h; - + if (m_currentWork.task == ReplaceGraph) { int index = -1; for(int i = 0; i < FILTER_COUNT; ++i) { - if (m_graphHandle[i].graph == w.oldGraph) { + if (m_graphHandle[i].graph == m_currentWork.oldGraph) { m_graphHandle[i].graph = Graph(); index = i; break; @@ -231,51 +215,40 @@ namespace Phonon Q_ASSERT(index != -1); //add the new graph - if (SUCCEEDED(ComPointer<IMediaEvent>(w.graph, IID_IMediaEvent) + HANDLE h; + if (SUCCEEDED(ComPointer<IMediaEvent>(m_currentWork.graph, IID_IMediaEvent) ->GetEventHandle(reinterpret_cast<OAEVENT*>(&h)))) { - m_graphHandle[index].graph = w.graph; + m_graphHandle[index].graph = m_currentWork.graph; m_graphHandle[index].handle = h; } - } else if (w.task == Render) { - if (w.filter) { + } else if (m_currentWork.task == Render) { + if (m_currentWork.filter) { //let's render pins - w.graph->AddFilter(w.filter, 0); - const QList<OutputPin> outputs = BackendNode::pins(w.filter, PINDIR_OUTPUT); - for (int i = 0; i < outputs.count(); ++i) { - //blocking call - hr = w.graph->Render(outputs.at(i)); - if (FAILED(hr)) { - break; - } + const QList<OutputPin> outputs = BackendNode::pins(m_currentWork.filter, PINDIR_OUTPUT); + for (int i = 0; SUCCEEDED(hr) && i < outputs.count(); ++i) { + hr = m_currentWork.graph->Render(outputs.at(i)); } - } else if (!w.url.isEmpty()) { + } else if (!m_currentWork.url.isEmpty()) { //let's render a url (blocking call) - hr = w.graph->RenderFile(reinterpret_cast<const wchar_t *>(w.url.utf16()), 0); + hr = m_currentWork.graph->RenderFile(reinterpret_cast<const wchar_t *>(m_currentWork.url.utf16()), 0); } if (hr != E_ABORT) { - emit asyncRenderFinished(w.id, hr, w.graph); + emit asyncRenderFinished(m_currentWork.id, hr, m_currentWork.graph); } - } else if (w.task == Seek) { + } else if (m_currentWork.task == Seek) { //that's a seekrequest - ComPointer<IMediaSeeking> mediaSeeking(w.graph, IID_IMediaSeeking); - qint64 newtime = w.time * 10000; + ComPointer<IMediaSeeking> mediaSeeking(m_currentWork.graph, IID_IMediaSeeking); + qint64 newtime = m_currentWork.time * 10000; hr = mediaSeeking->SetPositions(&newtime, AM_SEEKING_AbsolutePositioning, 0, AM_SEEKING_NoPositioning); - qint64 currentTime = -1; - if (SUCCEEDED(hr)) { - hr = mediaSeeking->GetCurrentPosition(¤tTime); - if (SUCCEEDED(hr)) { - currentTime /= 10000; //convert to ms - } - } - emit asyncSeekingFinished(w.id, currentTime); + emit asyncSeekingFinished(m_currentWork.id, newtime / 10000); hr = E_ABORT; //to avoid emitting asyncRenderFinished - } else if (w.task == ChangeState) { + } else if (m_currentWork.task == ChangeState) { //remove useless decoders QList<Filter> unused; - for (int i = 0; i < w.decoders.count(); ++i) { - const Filter &filter = w.decoders.at(i); + for (int i = 0; i < m_currentWork.decoders.count(); ++i) { + const Filter &filter = m_currentWork.decoders.at(i); bool used = false; const QList<OutputPin> pins = BackendNode::pins(filter, PINDIR_OUTPUT); for( int i = 0; i < pins.count(); ++i) { @@ -292,15 +265,15 @@ namespace Phonon //we can get the state for (int i = 0; i < unused.count(); ++i) { //we should remove this filter from the graph - w.graph->RemoveFilter(unused.at(i)); + m_currentWork.graph->RemoveFilter(unused.at(i)); } //we can get the state - ComPointer<IMediaControl> mc(w.graph, IID_IMediaControl); + ComPointer<IMediaControl> mc(m_currentWork.graph, IID_IMediaControl); //we change the state here - switch(w.state) + switch(m_currentWork.state) { case State_Stopped: mc->Stop(); @@ -318,36 +291,38 @@ namespace Phonon if (SUCCEEDED(hr)) { if (s == State_Stopped) { - emit stateReady(w.graph, Phonon::StoppedState); + emit stateReady(m_currentWork.graph, Phonon::StoppedState); } else if (s == State_Paused) { - emit stateReady(w.graph, Phonon::PausedState); + emit stateReady(m_currentWork.graph, Phonon::PausedState); } else /*if (s == State_Running)*/ { - emit stateReady(w.graph, Phonon::PlayingState); + emit stateReady(m_currentWork.graph, Phonon::PlayingState); } } } - m_currentRender = Graph(); - m_currentRenderId = 0; - + { + QMutexLocker locker(&m_mutex); + m_currentWork = Work(); //reinitialize + } } - void WorkerThread::abortCurrentRender(qint16 renderId) - { + void WorkerThread::abortCurrentRender(qint16 renderId) + { QMutexLocker locker(&m_mutex); + if (m_currentWork.id == renderId) { + m_currentWork.graph->Abort(); + } bool found = false; - //we try to see if there is already an attempt to seek and we remove it for(int i = 0; !found && i < m_queue.size(); ++i) { const Work &w = m_queue.at(i); if (w.id == renderId) { found = true; m_queue.removeAt(i); + if (m_queue.isEmpty()) { + m_waitCondition.reset(); + } } } - - if (m_currentRender && m_currentRenderId == renderId) { - m_currentRender->Abort(); - } } //tells the thread to stop processing @@ -355,9 +330,9 @@ namespace Phonon { QMutexLocker locker(&m_mutex); m_queue.clear(); - if (m_currentRender) { + if (m_currentWork.graph) { //in case we're currently rendering something - m_currentRender->Abort(); + m_currentWork.graph->Abort(); } @@ -389,17 +364,17 @@ namespace Phonon m_graphs[i] = new MediaGraph(this, i); } - connect(&m_thread, SIGNAL(stateReady(Graph, Phonon::State)), - SLOT(slotStateReady(Graph, Phonon::State))); + connect(&m_thread, SIGNAL(stateReady(Graph,Phonon::State)), + SLOT(slotStateReady(Graph,Phonon::State))); - connect(&m_thread, SIGNAL(eventReady(Graph, long, long)), - SLOT(handleEvents(Graph, long, long))); + connect(&m_thread, SIGNAL(eventReady(Graph,long,long)), + SLOT(handleEvents(Graph,long,long))); - connect(&m_thread, SIGNAL(asyncRenderFinished(quint16, HRESULT, Graph)), - SLOT(finishLoading(quint16, HRESULT, Graph))); + connect(&m_thread, SIGNAL(asyncRenderFinished(quint16,HRESULT,Graph)), + SLOT(finishLoading(quint16,HRESULT,Graph))); - connect(&m_thread, SIGNAL(asyncSeekingFinished(quint16, qint64)), - SLOT(finishSeeking(quint16, qint64))); + connect(&m_thread, SIGNAL(asyncSeekingFinished(quint16,qint64)), + SLOT(finishSeeking(quint16,qint64))); //really special case m_mediaObject = this; m_thread.start(); @@ -522,6 +497,18 @@ namespace Phonon qSwap(m_graphs[0], m_graphs[1]); //swap the graphs + if (m_transitionTime >= 0) + m_graphs[1]->stop(); //make sure we stop the previous graph + + if (currentGraph()->mediaSource().type() != Phonon::MediaSource::Invalid && + catchComError(currentGraph()->renderResult())) { + setState(Phonon::ErrorState); + return; + } + + //we need to play the next media + play(); + //we tell the video widgets to switch now to the new source #ifndef QT_NO_PHONON_VIDEO for (int i = 0; i < m_videoWidgets.count(); ++i) { @@ -530,15 +517,6 @@ namespace Phonon #endif //QT_NO_PHONON_VIDEO emit currentSourceChanged(currentGraph()->mediaSource()); - - if (currentGraph()->isLoading()) { - //will simply tell that when loading is finished - //it should start the playback - play(); - } - - - emit metaDataChanged(currentGraph()->metadata()); if (nextGraph()->hasVideo() != currentGraph()->hasVideo()) { @@ -551,15 +529,6 @@ namespace Phonon #ifndef QT_NO_PHONON_MEDIACONTROLLER setTitles(currentGraph()->titles()); #endif //QT_NO_PHONON_MEDIACONTROLLER - - //this manages only gapless transitions - if (currentGraph()->mediaSource().type() != Phonon::MediaSource::Invalid) { - if (catchComError(currentGraph()->renderResult())) { - setState(Phonon::ErrorState); - } else { - play(); - } - } } Phonon::State MediaObject::state() const @@ -794,15 +763,16 @@ namespace Phonon case Phonon::PausedState: pause(); break; - case Phonon::StoppedState: - stop(); - break; case Phonon::PlayingState: play(); break; case Phonon::ErrorState: setState(Phonon::ErrorState); break; + case Phonon::StoppedState: + default: + stop(); + break; } } } @@ -850,13 +820,11 @@ namespace Phonon #endif LPAMGETERRORTEXT getErrorText = (LPAMGETERRORTEXT)QLibrary::resolve(QLatin1String("quartz"), "AMGetErrorTextW"); - ushort buffer[MAX_ERROR_TEXT_LEN]; - if (getErrorText && getErrorText(hr, (WCHAR*)buffer, MAX_ERROR_TEXT_LEN)) { - m_errorString = QString::fromUtf16(buffer); -#ifdef Q_CC_MSVC + WCHAR buffer[MAX_ERROR_TEXT_LEN]; + if (getErrorText && getErrorText(hr, buffer, MAX_ERROR_TEXT_LEN)) { + m_errorString = QString::fromWCharArray(buffer); } else { - m_errorString = QString::fromUtf16((ushort*)_com_error(hr).ErrorMessage()); -#endif + m_errorString = QString::fromLatin1("Unknown error"); } const QString comError = QString::number(uint(hr), 16); if (!m_errorString.toLower().contains(comError.toLower())) { diff --git a/src/3rdparty/phonon/ds9/mediaobject.h b/src/3rdparty/phonon/ds9/mediaobject.h index 2c34ffc..34aa666 100644 --- a/src/3rdparty/phonon/ds9/mediaobject.h +++ b/src/3rdparty/phonon/ds9/mediaobject.h @@ -114,6 +114,7 @@ namespace Phonon enum Task { + None, Render, Seek, ChangeState, @@ -122,6 +123,7 @@ namespace Phonon struct Work { + Work() : task(None), id(0), time(0) { } Task task; quint16 id; Graph graph; @@ -135,16 +137,14 @@ namespace Phonon }; QList<Filter> decoders; //for the state change requests }; - Work dequeueWork(); void handleTask(); - Graph m_currentRender; - qint16 m_currentRenderId; + Work m_currentWork; QQueue<Work> m_queue; bool m_finished; quint16 m_currentWorkId; QWinWaitCondition m_waitCondition; - QMutex m_mutex; + QMutex m_mutex; // mutex for the m_queue, m_finished and m_currentWorkId //this is for WaitForMultipleObjects struct diff --git a/src/3rdparty/phonon/ds9/qasyncreader.cpp b/src/3rdparty/phonon/ds9/qasyncreader.cpp index 68ec1f8..a3f9cda 100644 --- a/src/3rdparty/phonon/ds9/qasyncreader.cpp +++ b/src/3rdparty/phonon/ds9/qasyncreader.cpp @@ -15,8 +15,6 @@ You should have received a copy of the GNU Lesser General Public License along with this library. If not, see <http://www.gnu.org/licenses/>. */ -#include <QtCore/QFile> - #include "qasyncreader.h" #include "qbasefilter.h" @@ -80,8 +78,7 @@ namespace Phonon STDMETHODIMP QAsyncReader::Request(IMediaSample *sample,DWORD_PTR user) { - QMutexLocker mutexLocker(&m_mutexWait); - QWriteLocker locker(&m_lock); + QMutexLocker locker(&m_mutex); if (m_flushing) { return VFW_E_WRONG_STATE; } @@ -93,33 +90,28 @@ namespace Phonon STDMETHODIMP QAsyncReader::WaitForNext(DWORD timeout, IMediaSample **sample, DWORD_PTR *user) { - QMutexLocker locker(&m_mutexWait); + QMutexLocker locker(&m_mutex); if (!sample ||!user) { return E_POINTER; } + //msdn says to return immediately if we're flushing but that doesn't seem to be true + //since it triggers a dead-lock somewhere inside directshow (see task 258830) + *sample = 0; *user = 0; - AsyncRequest r = getNextRequest(); - - if (r.sample == 0) { - //there is no request in the queue - if (isFlushing()) { + if (m_requestQueue.isEmpty()) { + if (m_requestWait.wait(&m_mutex, timeout) == false) { + return VFW_E_TIMEOUT; + } + if (m_requestQueue.isEmpty()) { return VFW_E_WRONG_STATE; - } else { - //First we need to lock the mutex - if (m_requestWait.wait(&m_mutexWait, timeout) == false) { - return VFW_E_TIMEOUT; - } - if (isFlushing()) { - return VFW_E_WRONG_STATE; - } - - r = getNextRequest(); } } + AsyncRequest r = m_requestQueue.dequeue(); + //at this point we're sure to have a request to proceed if (r.sample == 0) { return E_FAIL; @@ -127,14 +119,12 @@ namespace Phonon *sample = r.sample; *user = r.user; - - return SyncReadAligned(r.sample); + return syncReadAlignedUnlocked(r.sample); } STDMETHODIMP QAsyncReader::BeginFlush() { - QMutexLocker mutexLocker(&m_mutexWait); - QWriteLocker locker(&m_lock); + QMutexLocker locker(&m_mutex); m_flushing = true; m_requestWait.wakeOne(); return S_OK; @@ -142,13 +132,28 @@ namespace Phonon STDMETHODIMP QAsyncReader::EndFlush() { - QWriteLocker locker(&m_lock); + QMutexLocker locker(&m_mutex); m_flushing = false; return S_OK; } STDMETHODIMP QAsyncReader::SyncReadAligned(IMediaSample *sample) { + QMutexLocker locker(&m_mutex); + return syncReadAlignedUnlocked(sample); + } + + STDMETHODIMP QAsyncReader::SyncRead(LONGLONG pos, LONG length, BYTE *buffer) + { + QMutexLocker locker(&m_mutex); + return read(pos, length, buffer, 0); + } + + + STDMETHODIMP QAsyncReader::syncReadAlignedUnlocked(IMediaSample *sample) + { + Q_ASSERT(!m_mutex.tryLock()); + if (!sample) { return E_POINTER; } @@ -175,23 +180,6 @@ namespace Phonon return sample->SetActualDataLength(actual); } - STDMETHODIMP QAsyncReader::SyncRead(LONGLONG pos, LONG length, BYTE *buffer) - { - return read(pos, length, buffer, 0); - } - - - //addition - QAsyncReader::AsyncRequest QAsyncReader::getNextRequest() - { - QWriteLocker locker(&m_lock); - AsyncRequest ret; - if (!m_requestQueue.isEmpty()) { - ret = m_requestQueue.dequeue(); - } - - return ret; - } } } diff --git a/src/3rdparty/phonon/ds9/qasyncreader.h b/src/3rdparty/phonon/ds9/qasyncreader.h index cb789ee..95872f9 100644 --- a/src/3rdparty/phonon/ds9/qasyncreader.h +++ b/src/3rdparty/phonon/ds9/qasyncreader.h @@ -48,11 +48,12 @@ namespace Phonon STDMETHODIMP WaitForNext(DWORD,IMediaSample **,DWORD_PTR *); STDMETHODIMP SyncReadAligned(IMediaSample *); STDMETHODIMP SyncRead(LONGLONG,LONG,BYTE *); - virtual STDMETHODIMP Length(LONGLONG *,LONGLONG *) = 0; + STDMETHODIMP Length(LONGLONG *,LONGLONG *) = 0; STDMETHODIMP BeginFlush(); STDMETHODIMP EndFlush(); protected: + STDMETHODIMP syncReadAlignedUnlocked(IMediaSample *); virtual HRESULT read(LONGLONG pos, LONG length, BYTE *buffer, LONG *actual) = 0; private: @@ -62,9 +63,6 @@ namespace Phonon IMediaSample *sample; DWORD_PTR user; }; - AsyncRequest getNextRequest(); - - QMutex m_mutexWait; QQueue<AsyncRequest> m_requestQueue; QWaitCondition m_requestWait; diff --git a/src/3rdparty/phonon/ds9/qaudiocdreader.cpp b/src/3rdparty/phonon/ds9/qaudiocdreader.cpp index b9f9fd6..6d0f335 100644 --- a/src/3rdparty/phonon/ds9/qaudiocdreader.cpp +++ b/src/3rdparty/phonon/ds9/qaudiocdreader.cpp @@ -103,8 +103,8 @@ namespace Phonon private: HANDLE m_cddrive; - CDROM_TOC *m_toc; - WaveStructure *m_waveHeader; + CDROM_TOC m_toc; + WaveStructure m_waveHeader; qint64 m_trackAddress; }; @@ -112,19 +112,8 @@ namespace Phonon #define SECTOR_SIZE 2352 #define NB_SECTORS_READ 20 - static AM_MEDIA_TYPE getAudioCDMediaType() - { - AM_MEDIA_TYPE mt; - qMemSet(&mt, 0, sizeof(AM_MEDIA_TYPE)); - mt.majortype = MEDIATYPE_Stream; - mt.subtype = MEDIASUBTYPE_WAVE; - mt.bFixedSizeSamples = TRUE; - mt.bTemporalCompression = FALSE; - mt.lSampleSize = 1; - mt.formattype = GUID_NULL; - return mt; - } - + static const AM_MEDIA_TYPE audioCDMediaType = { MEDIATYPE_Stream, MEDIASUBTYPE_WAVE, TRUE, FALSE, 1, GUID_NULL, 0, 0, 0}; + int addressToSectors(UCHAR address[4]) { return ((address[0] * 60 + address[1]) * 60 + address[2]) * 75 + address[3] - 150; @@ -141,11 +130,8 @@ namespace Phonon } - QAudioCDReader::QAudioCDReader(QBaseFilter *parent, QChar drive) : QAsyncReader(parent, QVector<AM_MEDIA_TYPE>() << getAudioCDMediaType()) + QAudioCDReader::QAudioCDReader(QBaseFilter *parent, QChar drive) : QAsyncReader(parent, QVector<AM_MEDIA_TYPE>() << audioCDMediaType) { - m_toc = new CDROM_TOC; - m_waveHeader = new WaveStructure; - //now open the cd-drive QString path; if (drive.isNull()) { @@ -154,36 +140,30 @@ namespace Phonon path = QString::fromLatin1("\\\\.\\%1:").arg(drive); } - m_cddrive = QT_WA_INLINE ( - ::CreateFile( (TCHAR*)path.utf16(), GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL ), - ::CreateFileA( path.toLocal8Bit().constData(), GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL ) - ); + m_cddrive = ::CreateFile((const wchar_t *)path.utf16(), GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL); - qMemSet(m_toc, 0, sizeof(CDROM_TOC)); + qMemSet(&m_toc, 0, sizeof(CDROM_TOC)); //read the TOC DWORD bytesRead = 0; - bool tocRead = ::DeviceIoControl(m_cddrive, IOCTL_CDROM_READ_TOC, 0, 0, m_toc, sizeof(CDROM_TOC), &bytesRead, 0); + bool tocRead = ::DeviceIoControl(m_cddrive, IOCTL_CDROM_READ_TOC, 0, 0, &m_toc, sizeof(CDROM_TOC), &bytesRead, 0); if (!tocRead) { qWarning("unable to load the TOC from the CD"); return; } - m_trackAddress = addressToSectors(m_toc->TrackData[0].Address); - const qint32 nbSectorsToRead = (addressToSectors(m_toc->TrackData[m_toc->LastTrack + 1 - m_toc->FirstTrack].Address) + m_trackAddress = addressToSectors(m_toc.TrackData[0].Address); + const qint32 nbSectorsToRead = (addressToSectors(m_toc.TrackData[m_toc.LastTrack + 1 - m_toc.FirstTrack].Address) - m_trackAddress); const qint32 dataLength = nbSectorsToRead * SECTOR_SIZE; - m_waveHeader->chunksize = 4 + (8 + m_waveHeader->chunksize2) + (8 + dataLength); - m_waveHeader->dataLength = dataLength; + m_waveHeader.chunksize = 4 + (8 + m_waveHeader.chunksize2) + (8 + dataLength); + m_waveHeader.dataLength = dataLength; } QAudioCDReader::~QAudioCDReader() { ::CloseHandle(m_cddrive); - delete m_toc; - delete m_waveHeader; - } STDMETHODIMP_(ULONG) QAudioCDReader::AddRef() @@ -199,7 +179,7 @@ namespace Phonon STDMETHODIMP QAudioCDReader::Length(LONGLONG *total,LONGLONG *available) { - const LONGLONG length = sizeof(WaveStructure) + m_waveHeader->dataLength; + const LONGLONG length = sizeof(WaveStructure) + m_waveHeader.dataLength; if (total) { *total = length; } @@ -238,11 +218,11 @@ namespace Phonon if (pos < sizeof(WaveStructure)) { //we first copy the content of the structure nbRead = qMin(LONG(sizeof(WaveStructure) - pos), length); - qMemCopy(buffer, reinterpret_cast<char*>(m_waveHeader) + pos, nbRead); + qMemCopy(buffer, reinterpret_cast<char*>(&m_waveHeader) + pos, nbRead); } const LONGLONG posInTrack = pos - sizeof(WaveStructure) + nbRead; - const int bytesLeft = qMin(m_waveHeader->dataLength - posInTrack, LONGLONG(length - nbRead)); + const int bytesLeft = qMin(m_waveHeader.dataLength - posInTrack, LONGLONG(length - nbRead)); if (bytesLeft > 0) { @@ -297,8 +277,8 @@ namespace Phonon { QList<qint64> ret; ret << 0; - for(int i = m_toc->FirstTrack; i <= m_toc->LastTrack ; ++i) { - const uchar *address = m_toc->TrackData[i].Address; + for(int i = m_toc.FirstTrack; i <= m_toc.LastTrack ; ++i) { + const uchar *address = m_toc.TrackData[i].Address; ret << ((address[0] * 60 + address[1]) * 60 + address[2]) * 1000 + address[3]*1000/75 - 2000; } diff --git a/src/3rdparty/phonon/ds9/qaudiocdreader.h b/src/3rdparty/phonon/ds9/qaudiocdreader.h index 9049b66..eff845d 100644 --- a/src/3rdparty/phonon/ds9/qaudiocdreader.h +++ b/src/3rdparty/phonon/ds9/qaudiocdreader.h @@ -31,7 +31,7 @@ namespace Phonon { struct CDROM_TOC; struct WaveStructure; - extern const IID IID_ITitleInterface; + EXTERN_C const IID IID_ITitleInterface; //interface for the Titles struct ITitleInterface : public IUnknown diff --git a/src/3rdparty/phonon/ds9/qbasefilter.cpp b/src/3rdparty/phonon/ds9/qbasefilter.cpp index 95cab92..78b8b8f 100644 --- a/src/3rdparty/phonon/ds9/qbasefilter.cpp +++ b/src/3rdparty/phonon/ds9/qbasefilter.cpp @@ -92,8 +92,8 @@ namespace Phonon return E_POINTER; } - int nbfetched = 0; - while (nbfetched < int(count) && m_index < m_pins.count()) { + uint nbfetched = 0; + while (nbfetched < count && m_index < m_pins.count()) { IPin *current = m_pins[m_index]; current->AddRef(); ret[nbfetched] = current; @@ -166,19 +166,19 @@ namespace Phonon const QList<QPin *> QBaseFilter::pins() const { - QReadLocker locker(&m_lock); + QMutexLocker locker(&m_mutex); return m_pins; } void QBaseFilter::addPin(QPin *pin) { - QWriteLocker locker(&m_lock); + QMutexLocker locker(&m_mutex); m_pins.append(pin); } void QBaseFilter::removePin(QPin *pin) { - QWriteLocker locker(&m_lock); + QMutexLocker locker(&m_mutex); m_pins.removeAll(pin); } @@ -211,7 +211,8 @@ namespace Phonon } else if (iid == IID_IMediaPosition || iid == IID_IMediaSeeking) { if (inputPins().isEmpty()) { - if (*out = getUpStreamInterface(iid)) { + *out = getUpStreamInterface(iid); + if (*out) { return S_OK; //we return here to avoid adding a reference } else { hr = E_NOINTERFACE; @@ -250,35 +251,35 @@ namespace Phonon STDMETHODIMP QBaseFilter::GetClassID(CLSID *clsid) { - QReadLocker locker(&m_lock); + QMutexLocker locker(&m_mutex); *clsid = m_clsid; return S_OK; } STDMETHODIMP QBaseFilter::Stop() { - QWriteLocker locker(&m_lock); + QMutexLocker locker(&m_mutex); m_state = State_Stopped; return S_OK; } STDMETHODIMP QBaseFilter::Pause() { - QWriteLocker locker(&m_lock); + QMutexLocker locker(&m_mutex); m_state = State_Paused; return S_OK; } STDMETHODIMP QBaseFilter::Run(REFERENCE_TIME) { - QWriteLocker locker(&m_lock); + QMutexLocker locker(&m_mutex); m_state = State_Running; return S_OK; } STDMETHODIMP QBaseFilter::GetState(DWORD, FILTER_STATE *state) { - QReadLocker locker(&m_lock); + QMutexLocker locker(&m_mutex); if (!state) { return E_POINTER; } @@ -289,7 +290,7 @@ namespace Phonon STDMETHODIMP QBaseFilter::SetSyncSource(IReferenceClock *clock) { - QWriteLocker locker(&m_lock); + QMutexLocker locker(&m_mutex); if (clock) { clock->AddRef(); } @@ -302,7 +303,7 @@ namespace Phonon STDMETHODIMP QBaseFilter::GetSyncSource(IReferenceClock **clock) { - QReadLocker locker(&m_lock); + QMutexLocker locker(&m_mutex); if (!clock) { return E_POINTER; } @@ -341,7 +342,7 @@ namespace Phonon STDMETHODIMP QBaseFilter::QueryFilterInfo(FILTER_INFO *info ) { - QReadLocker locker(&m_lock); + QMutexLocker locker(&m_mutex); if (!info) { return E_POINTER; } @@ -355,9 +356,9 @@ namespace Phonon STDMETHODIMP QBaseFilter::JoinFilterGraph(IFilterGraph *graph, LPCWSTR name) { - QWriteLocker locker(&m_lock); + QMutexLocker locker(&m_mutex); m_graph = graph; - m_name = QString::fromUtf16((const unsigned short*)name); + m_name = QString::fromWCharArray(name); return S_OK; } diff --git a/src/3rdparty/phonon/ds9/qbasefilter.h b/src/3rdparty/phonon/ds9/qbasefilter.h index 85f1431..a72d6fe 100644 --- a/src/3rdparty/phonon/ds9/qbasefilter.h +++ b/src/3rdparty/phonon/ds9/qbasefilter.h @@ -22,7 +22,7 @@ along with this library. If not, see <http://www.gnu.org/licenses/>. #include <QtCore/QString> #include <QtCore/QList> -#include <QtCore/QReadWriteLock> +#include <QtCore/QMutex> #include <dshow.h> @@ -127,7 +127,7 @@ namespace Phonon IFilterGraph *m_graph; FILTER_STATE m_state; QList<QPin *> m_pins; - mutable QReadWriteLock m_lock; + mutable QMutex m_mutex; }; } } diff --git a/src/3rdparty/phonon/ds9/qevr9.h b/src/3rdparty/phonon/ds9/qevr9.h new file mode 100644 index 0000000..8599fce --- /dev/null +++ b/src/3rdparty/phonon/ds9/qevr9.h @@ -0,0 +1,143 @@ +/* This file is part of the KDE project. + +Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). + +This library is free software: you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation, either version 2.1 or 3 of the License. + +This library is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU Lesser General Public License for more details. + +You should have received a copy of the GNU Lesser General Public License +along with this library. If not, see <http://www.gnu.org/licenses/>. +*/ + +#include <d3d9.h> + +#define DXVA2_ProcAmp_Brightness 1 +#define DXVA2_ProcAmp_Contrast 2 +#define DXVA2_ProcAmp_Hue 4 +#define DXVA2_ProcAmp_Saturation 8 + +typedef enum { + MFVideoARMode_None = 0x00000000, + MFVideoARMode_PreservePicture = 0x00000001, + MFVideoARMode_PreservePixel = 0x00000002, + MFVideoARMode_NonLinearStretch = 0x00000004, + MFVideoARMode_Mask = 0x00000007 +} MFVideoAspectRatioMode; + +typedef struct { + float left; + float top; + float right; + float bottom; +} MFVideoNormalizedRect; + +typedef struct { + UINT DeviceCaps; + D3DPOOL InputPool; + UINT NumForwardRefSamples; + UINT NumBackwardRefSamples; + UINT Reserved; + UINT DeinterlaceTechnology; + UINT ProcAmpControlCaps; + UINT VideoProcessorOperations; + UINT NoiseFilterTechnology; + UINT DetailFilterTechnology; +} DXVA2_VideoProcessorCaps; + +typedef struct { + union { + struct { + USHORT Fraction; + SHORT Value; + }; + LONG ll; + }; +} DXVA2_Fixed32; + +typedef struct { + DXVA2_Fixed32 MinValue; + DXVA2_Fixed32 MaxValue; + DXVA2_Fixed32 DefaultValue; + DXVA2_Fixed32 StepSize; +} DXVA2_ValueRange; + +typedef struct { + DXVA2_Fixed32 Brightness; + DXVA2_Fixed32 Contrast; + DXVA2_Fixed32 Hue; + DXVA2_Fixed32 Saturation; +} DXVA2_ProcAmpValues; + +DXVA2_Fixed32 DXVA2FloatToFixed(const float _float_) +{ + DXVA2_Fixed32 _fixed_; + _fixed_.Fraction = LOWORD(_float_ * 0x10000); + _fixed_.Value = HIWORD(_float_ * 0x10000); + return _fixed_; +} + +float DXVA2FixedToFloat(const DXVA2_Fixed32 _fixed_) +{ + return (FLOAT)_fixed_.Value + (FLOAT)_fixed_.Fraction / 0x10000; +} + +#undef INTERFACE +#define INTERFACE IMFVideoDisplayControl +DECLARE_INTERFACE_(IMFVideoDisplayControl, IUnknown) +{ + STDMETHOD(GetNativeVideoSize)(THIS_ SIZE* pszVideo, SIZE* pszARVideo) PURE; + STDMETHOD(GetIdealVideoSize)(THIS_ SIZE* pszMin, SIZE* pszMax) PURE; + STDMETHOD(SetVideoPosition)(THIS_ const MFVideoNormalizedRect* pnrcSource, const LPRECT prcDest) PURE; + STDMETHOD(GetVideoPosition)(THIS_ MFVideoNormalizedRect* pnrcSource, LPRECT prcDest) PURE; + STDMETHOD(SetAspectRatioMode)(THIS_ DWORD dwAspectRatioMode) PURE; + STDMETHOD(GetAspectRatioMode)(THIS_ DWORD* pdwAspectRatioMode) PURE; + STDMETHOD(SetVideoWindow)(THIS_ HWND hwndVideo) PURE; + STDMETHOD(GetVideoWindow)(THIS_ HWND* phwndVideo) PURE; + STDMETHOD(RepaintVideo)(THIS_) PURE; + STDMETHOD(GetCurrentImage)(THIS_ BITMAPINFOHEADER* pBih, BYTE** pDib, DWORD* pcbDib, LONGLONG* pTimeStamp) PURE; + STDMETHOD(SetBorderColor)(THIS_ COLORREF Clr) PURE; + STDMETHOD(GetBorderColor)(THIS_ COLORREF* pClr) PURE; + STDMETHOD(SetRenderingPrefs)(THIS_ DWORD dwRenderFlags) PURE; + STDMETHOD(GetRenderingPrefs)(THIS_ DWORD* pdwRenderFlags) PURE; + STDMETHOD(SetFullScreen)(THIS_ BOOL fFullscreen) PURE; + STDMETHOD(GetFullScreen)(THIS_ BOOL* pfFullscreen) PURE; +}; +#undef INTERFACE +#define INTERFACE IMFVideoMixerControl +DECLARE_INTERFACE_(IMFVideoMixerControl, IUnknown) +{ + STDMETHOD(SetStreamZOrder)(THIS_ DWORD dwStreamID, DWORD dwZ) PURE; + STDMETHOD(GetStreamZOrder)(THIS_ DWORD dwStreamID, DWORD* pdwZ) PURE; + STDMETHOD(SetStreamOutputRect)(THIS_ DWORD dwStreamID, const MFVideoNormalizedRect* pnrcOutput) PURE; + STDMETHOD(GetStreamOutputRect)(THIS_ DWORD dwStreamID, MFVideoNormalizedRect* pnrcOutput) PURE; +}; +#undef INTERFACE +#define INTERFACE IMFVideoProcessor +DECLARE_INTERFACE_(IMFVideoProcessor, IUnknown) +{ + STDMETHOD(GetAvailableVideoProcessorModes)(THIS_ UINT* lpdwNumProcessingModes, GUID** ppVideoProcessingModes) PURE; + STDMETHOD(GetVideoProcessorCaps)(THIS_ LPGUID lpVideoProcessorMode, DXVA2_VideoProcessorCaps* lpVideoProcessorCaps) PURE; + STDMETHOD(GetVideoProcessorMode)(THIS_ LPGUID lpMode) PURE; + STDMETHOD(SetVideoProcessorMode)(THIS_ LPGUID lpMode) PURE; + STDMETHOD(GetProcAmpRange)(THIS_ DWORD dwProperty, DXVA2_ValueRange* pPropRange) PURE; + STDMETHOD(GetProcAmpValues)(THIS_ DWORD dwFlags, DXVA2_ProcAmpValues* Values) PURE; + STDMETHOD(SetProcAmpValues)(THIS_ DWORD dwFlags, DXVA2_ProcAmpValues* pValues) PURE; + STDMETHOD(GetFilteringRange)(THIS_ DWORD dwProperty, DXVA2_ValueRange* pPropRange) PURE; + STDMETHOD(GetFilteringValue)(THIS_ DWORD dwProperty, DXVA2_Fixed32* pValue) PURE; + STDMETHOD(SetFilteringValue)(THIS_ DWORD dwProperty, DXVA2_Fixed32* pValue) PURE; + STDMETHOD(GetBackgroundColor)(THIS_ COLORREF* lpClrBkg) PURE; + STDMETHOD(SetBackgroundColor)(THIS_ COLORREF ClrBkg) PURE; +}; +#undef INTERFACE +#define INTERFACE IMFGetService +DECLARE_INTERFACE_(IMFGetService, IUnknown) +{ + STDMETHOD(GetService)(THIS_ REFGUID guidService, REFIID riid, LPVOID* ppvObject) PURE; +}; +#undef INTERFACE diff --git a/src/3rdparty/phonon/ds9/qmeminputpin.cpp b/src/3rdparty/phonon/ds9/qmeminputpin.cpp index dca99db..a21fbe7 100644 --- a/src/3rdparty/phonon/ds9/qmeminputpin.cpp +++ b/src/3rdparty/phonon/ds9/qmeminputpin.cpp @@ -28,8 +28,8 @@ namespace Phonon namespace DS9 { - QMemInputPin::QMemInputPin(QBaseFilter *parent, const QVector<AM_MEDIA_TYPE> &mt, bool transform) : - QPin(parent, PINDIR_INPUT, mt), m_shouldDuplicateSamples(true), m_transform(transform) + QMemInputPin::QMemInputPin(QBaseFilter *parent, const QVector<AM_MEDIA_TYPE> &mt, bool transform, QPin *output) : + QPin(parent, PINDIR_INPUT, mt), m_shouldDuplicateSamples(true), m_transform(transform), m_output(output) { } @@ -66,11 +66,9 @@ namespace Phonon { //this allows to serialize with Receive calls QMutexLocker locker(&m_mutexReceive); - for(int i = 0; i < m_outputs.count(); ++i) { - IPin *conn = m_outputs.at(i)->connected(); - if (conn) { - conn->EndOfStream(); - } + IPin *conn = m_output ? m_output->connected() : 0; + if (conn) { + conn->EndOfStream(); } return S_OK; } @@ -78,13 +76,11 @@ namespace Phonon STDMETHODIMP QMemInputPin::BeginFlush() { //pass downstream - for(int i = 0; i < m_outputs.count(); ++i) { - IPin *conn = m_outputs.at(i)->connected(); - if (conn) { - conn->BeginFlush(); - } + IPin *conn = m_output ? m_output->connected() : 0; + if (conn) { + conn->BeginFlush(); } - QWriteLocker locker(&m_lock); + QMutexLocker locker(&m_mutex); m_flushing = true; return S_OK; } @@ -92,22 +88,19 @@ namespace Phonon STDMETHODIMP QMemInputPin::EndFlush() { //pass downstream - for(int i = 0; i < m_outputs.count(); ++i) { - IPin *conn = m_outputs.at(i)->connected(); - if (conn) { - conn->EndFlush(); - } + IPin *conn = m_output ? m_output->connected() : 0; + if (conn) { + conn->EndFlush(); } - QWriteLocker locker(&m_lock); + QMutexLocker locker(&m_mutex); m_flushing = false; return S_OK; } STDMETHODIMP QMemInputPin::NewSegment(REFERENCE_TIME start, REFERENCE_TIME stop, double rate) { - for(int i = 0; i < m_outputs.count(); ++i) { - m_outputs.at(i)->NewSegment(start, stop, rate); - } + if (m_output) + m_output->NewSegment(start, stop, rate); return S_OK; } @@ -119,14 +112,9 @@ namespace Phonon if (hr == S_OK && mt->majortype != MEDIATYPE_NULL && mt->subtype != MEDIASUBTYPE_NULL && - mt->formattype != GUID_NULL) { - //we tell the output pins that they should connect with this type - for(int i = 0; i < m_outputs.count(); ++i) { - hr = m_outputs.at(i)->setAcceptedMediaType(connectedType()); - if (FAILED(hr)) { - break; - } - } + mt->formattype != GUID_NULL && m_output) { + //we tell the output pin that it should connect with this type + hr = m_output->setAcceptedMediaType(connectedType()); } return hr; } @@ -137,7 +125,8 @@ namespace Phonon return E_POINTER; } - if (*alloc = memoryAllocator(true)) { + *alloc = memoryAllocator(true); + if (*alloc) { return S_OK; } @@ -151,18 +140,15 @@ namespace Phonon } { - QWriteLocker locker(&m_lock); + QMutexLocker locker(&m_mutex); m_shouldDuplicateSamples = m_transform && readonly; } setMemoryAllocator(alloc); - for(int i = 0; i < m_outputs.count(); ++i) { - IPin *pin = m_outputs.at(i)->connected(); - if (pin) { - ComPointer<IMemInputPin> input(pin, IID_IMemInputPin); - input->NotifyAllocator(alloc, m_shouldDuplicateSamples); - } + if (m_output) { + ComPointer<IMemInputPin> input(m_output, IID_IMemInputPin); + input->NotifyAllocator(alloc, m_shouldDuplicateSamples); } return S_OK; @@ -201,22 +187,18 @@ namespace Phonon } } - for (int i = 0; i < m_outputs.count(); ++i) { - QPin *current = m_outputs.at(i); + if (m_output) { IMediaSample *outSample = m_shouldDuplicateSamples ? - duplicateSampleForOutput(sample, current->memoryAllocator()) + duplicateSampleForOutput(sample, m_output->memoryAllocator()) : sample; if (m_shouldDuplicateSamples) { m_parent->processSample(outSample); } - IPin *pin = current->connected(); - if (pin) { - ComPointer<IMemInputPin> input(pin, IID_IMemInputPin); - if (input) { - input->Receive(outSample); - } + ComPointer<IMemInputPin> input(m_output->connected(), IID_IMemInputPin); + if (input) { + input->Receive(outSample); } if (m_shouldDuplicateSamples) { @@ -247,39 +229,16 @@ namespace Phonon STDMETHODIMP QMemInputPin::ReceiveCanBlock() { - //we test the output to see if they can block - for(int i = 0; i < m_outputs.count(); ++i) { - IPin *input = m_outputs.at(i)->connected(); - if (input) { - ComPointer<IMemInputPin> meminput(input, IID_IMemInputPin); - if (meminput && meminput->ReceiveCanBlock() != S_FALSE) { - return S_OK; - } + //we test the output to see if it can block + if (m_output) { + ComPointer<IMemInputPin> meminput(m_output->connected(), IID_IMemInputPin); + if (meminput && meminput->ReceiveCanBlock() != S_FALSE) { + return S_OK; } } return S_FALSE; } - //addition - //this should be used by the filter to tell its input pins to which output they should route the samples - - void QMemInputPin::addOutput(QPin *output) - { - QWriteLocker locker(&m_lock); - m_outputs += output; - } - - void QMemInputPin::removeOutput(QPin *output) - { - QWriteLocker locker(&m_lock); - m_outputs.removeOne(output); - } - - QList<QPin*> QMemInputPin::outputs() const - { - QReadLocker locker(&m_lock); - return m_outputs; - } ALLOCATOR_PROPERTIES QMemInputPin::getDefaultAllocatorProperties() const { @@ -294,7 +253,7 @@ namespace Phonon LONG length = sample->GetActualDataLength(); HRESULT hr = alloc->Commit(); - if (hr == VFW_E_SIZENOTSET) { + if (hr == HRESULT(VFW_E_SIZENOTSET)) { ALLOCATOR_PROPERTIES prop = getDefaultAllocatorProperties(); prop.cbBuffer = qMax(prop.cbBuffer, length); ALLOCATOR_PROPERTIES actual; @@ -324,7 +283,7 @@ namespace Phonon { LONGLONG start, end; hr = sample->GetMediaTime(&start, &end); - if (hr != VFW_E_MEDIA_TIME_NOT_SET) { + if (hr != HRESULT(VFW_E_MEDIA_TIME_NOT_SET)) { hr = out->SetMediaTime(&start, &end); Q_ASSERT(SUCCEEDED(hr)); } diff --git a/src/3rdparty/phonon/ds9/qmeminputpin.h b/src/3rdparty/phonon/ds9/qmeminputpin.h index c449721..d74c451 100644 --- a/src/3rdparty/phonon/ds9/qmeminputpin.h +++ b/src/3rdparty/phonon/ds9/qmeminputpin.h @@ -37,7 +37,7 @@ namespace Phonon class QMemInputPin : public QPin, public IMemInputPin { public: - QMemInputPin(QBaseFilter *, const QVector<AM_MEDIA_TYPE> &, bool transform); + QMemInputPin(QBaseFilter *, const QVector<AM_MEDIA_TYPE> &, bool transform, QPin *output); ~QMemInputPin(); //reimplementation from IUnknown @@ -60,18 +60,13 @@ namespace Phonon STDMETHODIMP ReceiveMultiple(IMediaSample **,long,long *); STDMETHODIMP ReceiveCanBlock(); - //addition - void addOutput(QPin *output); - void removeOutput(QPin *output); - QList<QPin*> outputs() const; - private: IMediaSample *duplicateSampleForOutput(IMediaSample *, IMemAllocator *); ALLOCATOR_PROPERTIES getDefaultAllocatorProperties() const; bool m_shouldDuplicateSamples; const bool m_transform; //defines if the pin is transforming the samples - QList<QPin*> m_outputs; + QPin* const m_output; QMutex m_mutexReceive; }; } diff --git a/src/3rdparty/phonon/ds9/qpin.cpp b/src/3rdparty/phonon/ds9/qpin.cpp index 37fe48d..b4afd10 100644 --- a/src/3rdparty/phonon/ds9/qpin.cpp +++ b/src/3rdparty/phonon/ds9/qpin.cpp @@ -28,20 +28,7 @@ namespace Phonon namespace DS9 { - static const AM_MEDIA_TYPE defaultMediaType() - { - AM_MEDIA_TYPE ret; - ret.majortype = MEDIATYPE_NULL; - ret.subtype = MEDIASUBTYPE_NULL; - ret.bFixedSizeSamples = TRUE; - ret.bTemporalCompression = FALSE; - ret.lSampleSize = 1; - ret.formattype = GUID_NULL; - ret.pUnk = 0; - ret.cbFormat = 0; - ret.pbFormat = 0; - return ret; - } + static const AM_MEDIA_TYPE defaultMediaType = { MEDIATYPE_NULL, MEDIASUBTYPE_NULL, TRUE, FALSE, 1, GUID_NULL, 0, 0, 0}; class QEnumMediaTypes : public IEnumMediaTypes { @@ -104,8 +91,8 @@ namespace Phonon return E_INVALIDARG; } - int nbFetched = 0; - while (nbFetched < int(count) && m_index < m_pin->mediaTypes().count()) { + uint nbFetched = 0; + while (nbFetched < count && m_index < m_pin->mediaTypes().count()) { //the caller will deallocate the memory *out = static_cast<AM_MEDIA_TYPE *>(::CoTaskMemAlloc(sizeof(AM_MEDIA_TYPE))); const AM_MEDIA_TYPE original = m_pin->mediaTypes().at(m_index); @@ -158,9 +145,9 @@ namespace Phonon QPin::QPin(QBaseFilter *parent, PIN_DIRECTION dir, const QVector<AM_MEDIA_TYPE> &mt) : - m_memAlloc(0), m_parent(parent), m_refCount(1), m_connected(0), - m_direction(dir), m_mediaTypes(mt), m_connectedType(defaultMediaType()), - m_flushing(false) + m_parent(parent), m_flushing(false), m_refCount(1), m_connected(0), + m_direction(dir), m_mediaTypes(mt), m_connectedType(defaultMediaType), + m_memAlloc(0) { Q_ASSERT(m_parent); m_parent->addPin(this); @@ -273,7 +260,7 @@ namespace Phonon if (FAILED(hr)) { setConnected(0); - setConnectedType(defaultMediaType()); + setConnectedType(defaultMediaType); } else { ComPointer<IMemInputPin> input(pin, IID_IMemInputPin); if (input) { @@ -315,10 +302,8 @@ namespace Phonon } setConnected(0); - setConnectedType(defaultMediaType()); - if (m_direction == PINDIR_INPUT) { - setMemoryAllocator(0); - } + setConnectedType(defaultMediaType); + setMemoryAllocator(0); return S_OK; } @@ -338,7 +323,7 @@ namespace Phonon STDMETHODIMP QPin::ConnectionMediaType(AM_MEDIA_TYPE *type) { - QReadLocker locker(&m_lock); + QMutexLocker locker(&m_mutex); if (!type) { return E_POINTER; } @@ -353,7 +338,6 @@ namespace Phonon STDMETHODIMP QPin::QueryPinInfo(PIN_INFO *info) { - QReadLocker locker(&m_lock); if (!info) { return E_POINTER; } @@ -361,14 +345,12 @@ namespace Phonon info->dir = m_direction; info->pFilter = m_parent; m_parent->AddRef(); - qMemCopy(info->achName, m_name.utf16(), qMin(MAX_FILTER_NAME, m_name.length()+1) *2); - + info->achName[0] = 0; return S_OK; } STDMETHODIMP QPin::QueryDirection(PIN_DIRECTION *dir) { - QReadLocker locker(&m_lock); if (!dir) { return E_POINTER; } @@ -379,20 +361,18 @@ namespace Phonon STDMETHODIMP QPin::QueryId(LPWSTR *id) { - QReadLocker locker(&m_lock); if (!id) { return E_POINTER; } - int nbBytes = (m_name.length()+1)*2; - *id = static_cast<LPWSTR>(::CoTaskMemAlloc(nbBytes)); - qMemCopy(*id, m_name.utf16(), nbBytes); + *id = static_cast<LPWSTR>(::CoTaskMemAlloc(2)); + *id[0] = 0; return S_OK; } STDMETHODIMP QPin::QueryAccept(const AM_MEDIA_TYPE *type) { - QReadLocker locker(&m_lock); + QMutexLocker locker(&m_mutex); if (!type) { return E_POINTER; } @@ -439,7 +419,7 @@ namespace Phonon STDMETHODIMP QPin::NewSegment(REFERENCE_TIME start, REFERENCE_TIME stop, double rate) { - QReadLocker locker(&m_lock); + QMutexLocker locker(&m_mutex); if (m_direction == PINDIR_OUTPUT && m_connected) { //we deliver this downstream m_connected->NewSegment(start, stop, rate); @@ -456,8 +436,8 @@ namespace Phonon HRESULT QPin::checkOutputMediaTypesConnection(IPin *pin) { - IEnumMediaTypes *emt = 0; - HRESULT hr = pin->EnumMediaTypes(&emt); + ComPointer<IEnumMediaTypes> emt; + HRESULT hr = pin->EnumMediaTypes(emt.pparam()); if (hr != S_OK) { return hr; } @@ -470,7 +450,7 @@ namespace Phonon freeMediaType(type); return S_OK; } else { - setConnectedType(defaultMediaType()); + setConnectedType(defaultMediaType); freeMediaType(type); } } @@ -520,7 +500,7 @@ namespace Phonon void QPin::setConnectedType(const AM_MEDIA_TYPE &type) { - QWriteLocker locker(&m_lock); + QMutexLocker locker(&m_mutex); //1st we free memory freeMediaType(m_connectedType); @@ -530,13 +510,13 @@ namespace Phonon const AM_MEDIA_TYPE &QPin::connectedType() const { - QReadLocker locker(&m_lock); + QMutexLocker locker(&m_mutex); return m_connectedType; } void QPin::setConnected(IPin *pin) { - QWriteLocker locker(&m_lock); + QMutexLocker locker(&m_mutex); if (pin) { pin->AddRef(); } @@ -548,7 +528,7 @@ namespace Phonon IPin *QPin::connected(bool addref) const { - QReadLocker locker(&m_lock); + QMutexLocker locker(&m_mutex); if (addref && m_connected) { m_connected->AddRef(); } @@ -557,13 +537,12 @@ namespace Phonon bool QPin::isFlushing() const { - QReadLocker locker(&m_lock); + QMutexLocker locker(&m_mutex); return m_flushing; } FILTER_STATE QPin::filterState() const { - QReadLocker locker(&m_lock); FILTER_STATE fstate = State_Stopped; m_parent->GetState(0, &fstate); return fstate; @@ -571,7 +550,7 @@ namespace Phonon QVector<AM_MEDIA_TYPE> QPin::mediaTypes() const { - QReadLocker locker(&m_lock); + QMutexLocker locker(&m_mutex); return m_mediaTypes; } @@ -607,7 +586,7 @@ namespace Phonon void QPin::setMemoryAllocator(IMemAllocator *alloc) { - QWriteLocker locker(&m_lock); + QMutexLocker locker(&m_mutex); if (alloc) { alloc->AddRef(); } @@ -619,7 +598,7 @@ namespace Phonon IMemAllocator *QPin::memoryAllocator(bool addref) const { - QReadLocker locker(&m_lock); + QMutexLocker locker(&m_mutex); if (addref && m_memAlloc) { m_memAlloc->AddRef(); } diff --git a/src/3rdparty/phonon/ds9/qpin.h b/src/3rdparty/phonon/ds9/qpin.h index a3287c4..280ad61 100644 --- a/src/3rdparty/phonon/ds9/qpin.h +++ b/src/3rdparty/phonon/ds9/qpin.h @@ -22,7 +22,7 @@ along with this library. If not, see <http://www.gnu.org/licenses/>. #include <QtCore/QString> #include <QtCore/QVector> -#include <QtCore/QReadWriteLock> +#include <QtCore/QMutex> #include <dshow.h> @@ -85,8 +85,8 @@ namespace Phonon protected: //this can be used by sub-classes - mutable QReadWriteLock m_lock; - QBaseFilter *m_parent; + mutable QMutex m_mutex; + QBaseFilter * const m_parent; bool m_flushing; private: @@ -98,7 +98,6 @@ namespace Phonon const PIN_DIRECTION m_direction; QVector<AM_MEDIA_TYPE> m_mediaTypes; //accepted media types AM_MEDIA_TYPE m_connectedType; - QString m_name; IMemAllocator *m_memAlloc; }; diff --git a/src/3rdparty/phonon/ds9/videorenderer_default.cpp b/src/3rdparty/phonon/ds9/videorenderer_default.cpp new file mode 100644 index 0000000..0045a49 --- /dev/null +++ b/src/3rdparty/phonon/ds9/videorenderer_default.cpp @@ -0,0 +1,153 @@ +/* This file is part of the KDE project. + +Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). + +This library is free software: you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation, either version 2.1 or 3 of the License. + +This library is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU Lesser General Public License for more details. + +You should have received a copy of the GNU Lesser General Public License +along with this library. If not, see <http://www.gnu.org/licenses/>. +*/ + + +#include "videorenderer_default.h" + +#ifndef QT_NO_PHONON_VIDEO + +#include <QtGui/QWidget> +#include <QtGui/QPainter> + +#include <uuids.h> + +QT_BEGIN_NAMESPACE + + +namespace Phonon +{ + namespace DS9 + { + VideoRendererDefault::~VideoRendererDefault() + { + } + + bool VideoRendererDefault::isNative() const + { + return true; + } + + + VideoRendererDefault::VideoRendererDefault(QWidget *target) : m_target(target) + { + m_target->setAttribute(Qt::WA_PaintOnScreen, true); + m_filter = Filter(CLSID_VideoRenderer, IID_IBaseFilter); + } + + QSize VideoRendererDefault::videoSize() const + { + LONG w = 0, + h = 0; + ComPointer<IBasicVideo> basic(m_filter, IID_IBasicVideo); + if (basic) { + basic->GetVideoSize( &w, &h); + } + return QSize(w, h); + } + + void VideoRendererDefault::repaintCurrentFrame(QWidget * /*target*/, const QRect & /*rect*/) + { + //nothing to do here: the renderer paints everything + } + + void VideoRendererDefault::notifyResize(const QSize &size, Phonon::VideoWidget::AspectRatio aspectRatio, + Phonon::VideoWidget::ScaleMode scaleMode) + { + if (!isActive()) { + ComPointer<IBasicVideo> basic(m_filter, IID_IBasicVideo); + if (basic) { + basic->SetDestinationPosition(0, 0, 0, 0); + } + return; + } + + ComPointer<IVideoWindow> video(m_filter, IID_IVideoWindow); + + OAHWND owner; + HRESULT hr = video->get_Owner(&owner); + if (FAILED(hr)) { + return; + } + + const OAHWND newOwner = reinterpret_cast<OAHWND>(m_target->winId()); + if (owner != newOwner) { + video->put_Owner(newOwner); + video->put_MessageDrain(newOwner); + video->put_WindowStyle(WS_CHILD | WS_CLIPCHILDREN | WS_CLIPSIBLINGS); + } + + //make sure the widget takes the whole size of the parent + video->SetWindowPosition(0, 0, size.width(), size.height()); + + const QSize vsize = videoSize(); + internalNotifyResize(size, vsize, aspectRatio, scaleMode); + + ComPointer<IBasicVideo> basic(m_filter, IID_IBasicVideo); + if (basic) { + basic->SetDestinationPosition(m_dstX, m_dstY, m_dstWidth, m_dstHeight); + } + } + + void VideoRendererDefault::applyMixerSettings(qreal /*brightness*/, qreal /*contrast*/, qreal /*m_hue*/, qreal /*saturation*/) + { + //this can't be supported for the default renderer + } + + QImage VideoRendererDefault::snapshot() const + { + ComPointer<IBasicVideo> basic(m_filter, IID_IBasicVideo); + if (basic) { + LONG bufferSize = 0; + //1st we get the buffer size + basic->GetCurrentImage(&bufferSize, 0); + + QByteArray buffer; + buffer.resize(bufferSize); + HRESULT hr = basic->GetCurrentImage(&bufferSize, reinterpret_cast<long*>(buffer.data())); + + if (SUCCEEDED(hr)) { + + const BITMAPINFOHEADER *bmi = reinterpret_cast<const BITMAPINFOHEADER*>(buffer.constData()); + + const int w = qAbs(bmi->biWidth), + h = qAbs(bmi->biHeight); + + // Create image and copy data into image. + QImage ret(w, h, QImage::Format_RGB32); + + if (!ret.isNull()) { + const char *data = buffer.constData() + bmi->biSize; + const int bytes_per_line = w * sizeof(QRgb); + for (int y = h - 1; y >= 0; --y) { + qMemCopy(ret.scanLine(y), //destination + data, //source + bytes_per_line); + data += bytes_per_line; + } + } + return ret; + } + } + return QImage(); + } + + } +} + +QT_END_NAMESPACE + +#endif //QT_NO_PHONON_VIDEO diff --git a/src/3rdparty/phonon/ds9/videorenderer_default.h b/src/3rdparty/phonon/ds9/videorenderer_default.h new file mode 100644 index 0000000..43768d9 --- /dev/null +++ b/src/3rdparty/phonon/ds9/videorenderer_default.h @@ -0,0 +1,55 @@ +/* This file is part of the KDE project. + +Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). + +This library is free software: you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation, either version 2.1 or 3 of the License. + +This library is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU Lesser General Public License for more details. + +You should have received a copy of the GNU Lesser General Public License +along with this library. If not, see <http://www.gnu.org/licenses/>. +*/ + +#ifndef PHONON_VIDEORENDERER_DEFAULT_H +#define PHONON_VIDEORENDERER_DEFAULT_H + +#include "abstractvideorenderer.h" + +QT_BEGIN_NAMESPACE + +#ifndef QT_NO_PHONON_VIDEO + +namespace Phonon +{ + namespace DS9 + { + class VideoRendererDefault : public AbstractVideoRenderer + { + public: + VideoRendererDefault(QWidget *target); + ~VideoRendererDefault(); + + //Implementation from AbstractVideoRenderer + void repaintCurrentFrame(QWidget *target, const QRect &rect); + void notifyResize(const QSize&, Phonon::VideoWidget::AspectRatio, Phonon::VideoWidget::ScaleMode); + QSize videoSize() const; + QImage snapshot() const; + void applyMixerSettings(qreal brightness, qreal contrast, qreal m_hue, qreal saturation); + bool isNative() const; + private: + QWidget *m_target; + }; + } +} + +#endif //QT_NO_PHONON_VIDEO + +QT_END_NAMESPACE + +#endif + diff --git a/src/3rdparty/phonon/ds9/videorenderer_evr.cpp b/src/3rdparty/phonon/ds9/videorenderer_evr.cpp new file mode 100644 index 0000000..d23d9ce --- /dev/null +++ b/src/3rdparty/phonon/ds9/videorenderer_evr.cpp @@ -0,0 +1,215 @@ +/* This file is part of the KDE project. + +Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). + +This library is free software: you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation, either version 2.1 or 3 of the License. + +This library is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU Lesser General Public License for more details. + +You should have received a copy of the GNU Lesser General Public License +along with this library. If not, see <http://www.gnu.org/licenses/>. +*/ + + +#include "videorenderer_evr.h" +#include "qevr9.h" + +#ifndef QT_NO_PHONON_VIDEO + +#include <QtGui/QWidget> +#include <QtGui/QPainter> + +QT_BEGIN_NAMESPACE + +namespace Phonon +{ + namespace DS9 + { + //we have to define them here because not all compilers/sdk have them + static const GUID MR_VIDEO_RENDER_SERVICE = {0x1092a86c, 0xab1a, 0x459a, {0xa3, 0x36, 0x83, 0x1f, 0xbc, 0x4d, 0x11, 0xff} }; + static const GUID MR_VIDEO_MIXER_SERVICE = { 0x73cd2fc, 0x6cf4, 0x40b7, {0x88, 0x59, 0xe8, 0x95, 0x52, 0xc8, 0x41, 0xf8} }; + static const IID IID_IMFVideoDisplayControl = {0xa490b1e4, 0xab84, 0x4d31, {0xa1, 0xb2, 0x18, 0x1e, 0x03, 0xb1, 0x07, 0x7a} }; + static const IID IID_IMFVideoMixerControl = {0xA5C6C53F, 0xC202, 0x4aa5, {0x96, 0x95, 0x17, 0x5B, 0xA8, 0xC5, 0x08, 0xA5} }; + static const IID IID_IMFVideoProcessor = {0x6AB0000C, 0xFECE, 0x4d1f, {0xA2, 0xAC, 0xA9, 0x57, 0x35, 0x30, 0x65, 0x6E} }; + static const IID IID_IMFGetService = {0xFA993888, 0x4383, 0x415A, {0xA9, 0x30, 0xDD, 0x47, 0x2A, 0x8C, 0xF6, 0xF7} }; + static const GUID CLSID_EnhancedVideoRenderer = {0xfa10746c, 0x9b63, 0x4b6c, {0xbc, 0x49, 0xfc, 0x30, 0xe, 0xa5, 0xf2, 0x56} }; + + template <typename T> ComPointer<T> getService(const Filter &filter, REFGUID guidService, REFIID riid) + { + //normally we should use IID_IMFGetService but this introduces another dependency + //so here we simply define our own IId with the same value + ComPointer<IMFGetService> getService(filter, IID_IMFGetService); + Q_ASSERT(getService); + T *ptr = 0; + HRESULT hr = getService->GetService(guidService, riid, reinterpret_cast<void **>(&ptr)); + if (!SUCCEEDED(hr) || ptr == 0) + Q_ASSERT(!SUCCEEDED(hr) && ptr != 0); + ComPointer<T> service(ptr); + return service; + } + + VideoRendererEVR::~VideoRendererEVR() + { + } + + bool VideoRendererEVR::isNative() const + { + return true; + } + + VideoRendererEVR::VideoRendererEVR(QWidget *target) : m_target(target) + { + m_filter = Filter(CLSID_EnhancedVideoRenderer, IID_IBaseFilter); + if (!m_filter) { + return; + } + + ComPointer<IMFVideoDisplayControl> filterControl = getService<IMFVideoDisplayControl>(m_filter, MR_VIDEO_RENDER_SERVICE, IID_IMFVideoDisplayControl); + + filterControl->SetVideoWindow(reinterpret_cast<HWND>(target->winId())); + filterControl->SetAspectRatioMode(MFVideoARMode_None); // We're in control of the size + } + + QImage VideoRendererEVR::snapshot() const + { + // This will always capture black areas where no video is drawn, if any are present. + // Due to the hack in notifyResize() + ComPointer<IMFVideoDisplayControl> filterControl = getService<IMFVideoDisplayControl>(m_filter, MR_VIDEO_RENDER_SERVICE, IID_IMFVideoDisplayControl); + if (filterControl) { + BITMAPINFOHEADER bmi; + BYTE *buffer = 0; + DWORD bufferSize; + LONGLONG timeStamp; + + bmi.biSize = sizeof(BITMAPINFOHEADER); + + HRESULT hr = filterControl->GetCurrentImage(&bmi, &buffer, &bufferSize, &timeStamp); + if (SUCCEEDED(hr)) { + + const int w = qAbs(bmi.biWidth), + h = qAbs(bmi.biHeight); + + // Create image and copy data into image. + QImage ret(w, h, QImage::Format_RGB32); + + if (!ret.isNull()) { + uchar *data = buffer; + const int bytes_per_line = w * sizeof(QRgb); + for (int y = h - 1; y >= 0; --y) { + qMemCopy(ret.scanLine(y), //destination + data, //source + bytes_per_line); + data += bytes_per_line; + } + } + ::CoTaskMemFree(buffer); + return ret; + } + } + return QImage(); + } + + QSize VideoRendererEVR::videoSize() const + { + SIZE nativeSize; + SIZE aspectRatioSize; + + ComPointer<IMFVideoDisplayControl> filterControl = getService<IMFVideoDisplayControl>(m_filter, MR_VIDEO_RENDER_SERVICE, IID_IMFVideoDisplayControl); + + filterControl->GetNativeVideoSize(&nativeSize, &aspectRatioSize); + + return QSize(nativeSize.cx, nativeSize.cy); + } + + void VideoRendererEVR::repaintCurrentFrame(QWidget *target, const QRect &rect) + { + // repaint the video + ComPointer<IMFVideoDisplayControl> filterControl = getService<IMFVideoDisplayControl>(m_filter, MR_VIDEO_RENDER_SERVICE, IID_IMFVideoDisplayControl); + // All failed results can be safely ignored + filterControl->RepaintVideo(); + } + + void VideoRendererEVR::notifyResize(const QSize &size, Phonon::VideoWidget::AspectRatio aspectRatio, + Phonon::VideoWidget::ScaleMode scaleMode) + { + if (!isActive()) { + RECT dummyRect = { 0, 0, 0, 0}; + ComPointer<IMFVideoDisplayControl> filterControl = getService<IMFVideoDisplayControl>(m_filter, MR_VIDEO_RENDER_SERVICE, IID_IMFVideoDisplayControl); + filterControl->SetVideoPosition(0, &dummyRect); + return; + } + + const QSize vsize = videoSize(); + internalNotifyResize(size, vsize, aspectRatio, scaleMode); + + RECT dstRectWin = { 0, 0, size.width(), size.height()}; + + // Resize the Stream output rect instead of the destination rect. + // Hacky workaround for flicker in the areas outside of the destination rect + // This way these areas don't exist + MFVideoNormalizedRect streamOutputRect = { float(m_dstX) / float(size.width()), float(m_dstY) / float(size.height()), + float(m_dstWidth + m_dstX) / float(size.width()), float(m_dstHeight + m_dstY) / float(size.height())}; + + ComPointer<IMFVideoMixerControl> filterMixer = getService<IMFVideoMixerControl>(m_filter, MR_VIDEO_MIXER_SERVICE, IID_IMFVideoMixerControl); + ComPointer<IMFVideoDisplayControl> filterControl = getService<IMFVideoDisplayControl>(m_filter, MR_VIDEO_RENDER_SERVICE, IID_IMFVideoDisplayControl); + + filterMixer->SetStreamOutputRect(0, &streamOutputRect); + filterControl->SetVideoPosition(0, &dstRectWin); + } + + void VideoRendererEVR::applyMixerSettings(qreal brightness, qreal contrast, qreal hue, qreal saturation) + { + InputPin sink = BackendNode::pins(m_filter, PINDIR_INPUT).first(); + OutputPin source; + if (FAILED(sink->ConnectedTo(source.pparam()))) { + return; //it must be connected to work + } + + // Get the "Video Processor" (used for brightness/contrast/saturation/hue) + ComPointer<IMFVideoProcessor> processor = getService<IMFVideoProcessor>(m_filter, MR_VIDEO_MIXER_SERVICE, IID_IMFVideoProcessor); + Q_ASSERT(processor); + + DXVA2_ValueRange contrastRange; + DXVA2_ValueRange brightnessRange; + DXVA2_ValueRange saturationRange; + DXVA2_ValueRange hueRange; + + if (FAILED(processor->GetProcAmpRange(DXVA2_ProcAmp_Contrast, &contrastRange))) + return; + if (FAILED(processor->GetProcAmpRange(DXVA2_ProcAmp_Brightness, &brightnessRange))) + return; + if (FAILED(processor->GetProcAmpRange(DXVA2_ProcAmp_Saturation, &saturationRange))) + return; + if (FAILED(processor->GetProcAmpRange(DXVA2_ProcAmp_Hue, &hueRange))) + return; + + DXVA2_ProcAmpValues values; + + values.Contrast = DXVA2FloatToFixed(((contrast < 0 + ? DXVA2FixedToFloat(contrastRange.MinValue) : DXVA2FixedToFloat(contrastRange.MaxValue)) + - DXVA2FixedToFloat(contrastRange.DefaultValue)) * qAbs(contrast) + DXVA2FixedToFloat(contrastRange.DefaultValue)); + values.Brightness = DXVA2FloatToFixed(((brightness < 0 + ? DXVA2FixedToFloat(brightnessRange.MinValue) : DXVA2FixedToFloat(brightnessRange.MaxValue)) + - DXVA2FixedToFloat(brightnessRange.DefaultValue)) * qAbs(brightness) + DXVA2FixedToFloat(brightnessRange.DefaultValue)); + values.Saturation = DXVA2FloatToFixed(((saturation < 0 + ? DXVA2FixedToFloat(saturationRange.MinValue) : DXVA2FixedToFloat(saturationRange.MaxValue)) + - DXVA2FixedToFloat(saturationRange.DefaultValue)) * qAbs(saturation) + DXVA2FixedToFloat(saturationRange.DefaultValue)); + values.Hue = DXVA2FloatToFixed(((hue < 0 + ? DXVA2FixedToFloat(hueRange.MinValue) : DXVA2FixedToFloat(hueRange.MaxValue)) + - DXVA2FixedToFloat(hueRange.DefaultValue)) * qAbs(hue) + DXVA2FixedToFloat(hueRange.DefaultValue)); + + //finally set the settings + processor->SetProcAmpValues(DXVA2_ProcAmp_Contrast | DXVA2_ProcAmp_Brightness | DXVA2_ProcAmp_Saturation | DXVA2_ProcAmp_Hue, &values); + + } + } +} + +QT_END_NAMESPACE + +#endif //QT_NO_PHONON_VIDEO diff --git a/src/3rdparty/phonon/ds9/videorenderer_evr.h b/src/3rdparty/phonon/ds9/videorenderer_evr.h new file mode 100644 index 0000000..229c36d --- /dev/null +++ b/src/3rdparty/phonon/ds9/videorenderer_evr.h @@ -0,0 +1,56 @@ +/* This file is part of the KDE project. + +Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). + +This library is free software: you can redistribute it and/or modify +it under the terms of the GNU Lesser General Public License as published by +the Free Software Foundation, either version 2.1 or 3 of the License. + +This library is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU Lesser General Public License for more details. + +You should have received a copy of the GNU Lesser General Public License +along with this library. If not, see <http://www.gnu.org/licenses/>. +*/ + +#ifndef PHONON_VIDEORENDERER_EVR_H +#define PHONON_VIDEORENDERER_EVR_H + +#include "abstractvideorenderer.h" +#include "compointer.h" + +QT_BEGIN_NAMESPACE + +#ifndef QT_NO_PHONON_VIDEO + +namespace Phonon +{ + namespace DS9 + { + class VideoRendererEVR : public AbstractVideoRenderer + { + public: + VideoRendererEVR(QWidget *target); + ~VideoRendererEVR(); + + //Implementation from AbstractVideoRenderer + void repaintCurrentFrame(QWidget *target, const QRect &rect); + void notifyResize(const QSize&, Phonon::VideoWidget::AspectRatio, Phonon::VideoWidget::ScaleMode); + QSize videoSize() const; + QImage snapshot() const; + void applyMixerSettings(qreal brightness, qreal contrast, qreal m_hue, qreal saturation); + bool isNative() const; + private: + QWidget *m_target; + }; + } +} + +#endif //QT_NO_PHONON_VIDEO + +QT_END_NAMESPACE + +#endif + diff --git a/src/3rdparty/phonon/ds9/videorenderer_soft.cpp b/src/3rdparty/phonon/ds9/videorenderer_soft.cpp index 491d1bd..9c7993c 100644 --- a/src/3rdparty/phonon/ds9/videorenderer_soft.cpp +++ b/src/3rdparty/phonon/ds9/videorenderer_soft.cpp @@ -194,8 +194,8 @@ namespace Phonon m_sampleBuffer = ComPointer<IMediaSample>(); #ifndef QT_NO_OPENGL freeGLResources(); -#endif // QT_NO_OPENGL m_textureUploaded = false; +#endif // QT_NO_OPENGL } void endOfStream() @@ -314,7 +314,6 @@ namespace Phonon REFERENCE_TIME m_start; HANDLE m_renderEvent, m_receiveCanWait; // Signals sample to render QSize m_size; - bool m_textureUploaded; //mixer settings qreal m_brightness, @@ -356,6 +355,7 @@ namespace Phonon bool m_checkedPrograms; bool m_usingOpenGL; + bool m_textureUploaded; GLuint m_program[2]; GLuint m_texture[3]; #endif @@ -365,7 +365,7 @@ namespace Phonon { public: VideoRendererSoftPin(VideoRendererSoftFilter *parent) : - QMemInputPin(parent, videoMediaTypes(), false /*no transformation of the samples*/), + QMemInputPin(parent, videoMediaTypes(), false /*no transformation of the samples*/, 0), m_renderer(parent) { } @@ -436,7 +436,7 @@ namespace Phonon QBaseFilter(CLSID_NULL), m_inputPin(new VideoRendererSoftPin(this)), m_renderer(renderer), m_start(0) #ifndef QT_NO_OPENGL - ,m_usingOpenGL(false), m_checkedPrograms(false), m_textureUploaded(false) + , m_checkedPrograms(false), m_usingOpenGL(false), m_textureUploaded(false) #endif { m_renderEvent = ::CreateEvent(0, 0, 0, 0); @@ -661,7 +661,10 @@ namespace Phonon #ifndef QT_NO_OPENGL - if (painter.paintEngine() && painter.paintEngine()->type() == QPaintEngine::OpenGL && checkGLPrograms()) { + if (painter.paintEngine() && + (painter.paintEngine()->type() == QPaintEngine::OpenGL || painter.paintEngine()->type() == QPaintEngine::OpenGL2) + && checkGLPrograms()) { + //for now we only support YUV (both YV12 and YUY2) updateTexture(); @@ -673,6 +676,7 @@ namespace Phonon } //let's draw the texture + painter.beginNativePainting(); //Let's pass the other arguments const Program prog = (m_inputPin->connectedType().subtype == MEDIASUBTYPE_YV12) ? YV12toRGB : YUY2toRGB; @@ -722,6 +726,7 @@ namespace Phonon glDisableClientState(GL_VERTEX_ARRAY); glDisable(GL_FRAGMENT_PROGRAM_ARB); + painter.endNativePainting(); return; } else #endif diff --git a/src/3rdparty/phonon/ds9/videorenderer_vmr9.cpp b/src/3rdparty/phonon/ds9/videorenderer_vmr9.cpp index 298e9fa..545b31e 100644 --- a/src/3rdparty/phonon/ds9/videorenderer_vmr9.cpp +++ b/src/3rdparty/phonon/ds9/videorenderer_vmr9.cpp @@ -22,14 +22,9 @@ along with this library. If not, see <http://www.gnu.org/licenses/>. #include <QtGui/QWidget> #include <QtGui/QPainter> -#include <QtCore/QTimerEvent> -#ifndef Q_OS_WINCE #include <d3d9.h> #include <vmr9.h> -#else -#include <uuids.h> -#endif QT_BEGIN_NAMESPACE @@ -48,116 +43,10 @@ namespace Phonon } -#ifdef Q_OS_WINCE - VideoRendererVMR9::VideoRendererVMR9(QWidget *target) : m_target(target) - { - m_target->setAttribute(Qt::WA_PaintOnScreen, true); - m_filter = Filter(CLSID_VideoRenderer, IID_IBaseFilter); - } - - QSize VideoRendererVMR9::videoSize() const - { - LONG w = 0, - h = 0; - ComPointer<IBasicVideo> basic(m_filter, IID_IBasicVideo); - if (basic) { - basic->GetVideoSize( &w, &h); - } - return QSize(w, h); - } - - void VideoRendererVMR9::repaintCurrentFrame(QWidget * /*target*/, const QRect & /*rect*/) - { - //nothing to do here: the renderer paints everything - } - - void VideoRendererVMR9::notifyResize(const QSize &size, Phonon::VideoWidget::AspectRatio aspectRatio, - Phonon::VideoWidget::ScaleMode scaleMode) - { - if (!isActive()) { - ComPointer<IBasicVideo> basic(m_filter, IID_IBasicVideo); - if (basic) { - basic->SetDestinationPosition(0, 0, 0, 0); - } - return; - } - - ComPointer<IVideoWindow> video(m_filter, IID_IVideoWindow); - - OAHWND owner; - HRESULT hr = video->get_Owner(&owner); - if (FAILED(hr)) { - return; - } - - const OAHWND newOwner = reinterpret_cast<OAHWND>(m_target->winId()); - if (owner != newOwner) { - video->put_Owner(newOwner); - video->put_MessageDrain(newOwner); - video->put_WindowStyle(WS_CHILD | WS_CLIPCHILDREN | WS_CLIPSIBLINGS); - } - - //make sure the widget takes the whole size of the parent - video->SetWindowPosition(0, 0, size.width(), size.height()); - - const QSize vsize = videoSize(); - internalNotifyResize(size, vsize, aspectRatio, scaleMode); - - ComPointer<IBasicVideo> basic(m_filter, IID_IBasicVideo); - if (basic) { - basic->SetDestinationPosition(m_dstX, m_dstY, m_dstWidth, m_dstHeight); - } - } - - void VideoRendererVMR9::applyMixerSettings(qreal /*brightness*/, qreal /*contrast*/, qreal /*m_hue*/, qreal /*saturation*/) - { - //this can't be supported for WinCE - } - - QImage VideoRendererVMR9::snapshot() const - { - ComPointer<IBasicVideo> basic(m_filter, IID_IBasicVideo); - if (basic) { - LONG bufferSize = 0; - //1st we get the buffer size - basic->GetCurrentImage(&bufferSize, 0); - - QByteArray buffer; - buffer.resize(bufferSize); - HRESULT hr = basic->GetCurrentImage(&bufferSize, reinterpret_cast<long*>(buffer.data())); - - if (SUCCEEDED(hr)) { - - const BITMAPINFOHEADER *bmi = reinterpret_cast<const BITMAPINFOHEADER*>(buffer.constData()); - - const int w = qAbs(bmi->biWidth), - h = qAbs(bmi->biHeight); - - // Create image and copy data into image. - QImage ret(w, h, QImage::Format_RGB32); - - if (!ret.isNull()) { - const char *data = buffer.constData() + bmi->biSize; - const int bytes_per_line = w * sizeof(QRgb); - for (int y = h - 1; y >= 0; --y) { - qMemCopy(ret.scanLine(y), //destination - data, //source - bytes_per_line); - data += bytes_per_line; - } - } - return ret; - } - } - return QImage(); - } - -#else VideoRendererVMR9::VideoRendererVMR9(QWidget *target) : m_target(target) { m_filter = Filter(CLSID_VideoMixingRenderer9, IID_IBaseFilter); if (!m_filter) { - qWarning("the video widget could not be initialized correctly"); return; } @@ -169,6 +58,7 @@ namespace Phonon Q_ASSERT(SUCCEEDED(hr)); ComPointer<IVMRWindowlessControl9> windowlessControl(m_filter, IID_IVMRWindowlessControl9); windowlessControl->SetVideoClippingWindow(reinterpret_cast<HWND>(target->winId())); + windowlessControl->SetAspectRatioMode(VMR9ARMode_None); //we're in control of the size } QImage VideoRendererVMR9::snapshot() const @@ -324,7 +214,6 @@ namespace Phonon //finally set the settings mixer->SetProcAmpControl(0, &ctrl); } -#endif } } diff --git a/src/3rdparty/phonon/ds9/videorenderer_vmr9.h b/src/3rdparty/phonon/ds9/videorenderer_vmr9.h index 4eb237e..516d79d 100644 --- a/src/3rdparty/phonon/ds9/videorenderer_vmr9.h +++ b/src/3rdparty/phonon/ds9/videorenderer_vmr9.h @@ -19,7 +19,6 @@ along with this library. If not, see <http://www.gnu.org/licenses/>. #define PHONON_VIDEORENDERER_VMR9_H #include "abstractvideorenderer.h" -#include "compointer.h" QT_BEGIN_NAMESPACE diff --git a/src/3rdparty/phonon/ds9/videowidget.cpp b/src/3rdparty/phonon/ds9/videowidget.cpp index de7ce5f..09d42a4 100644 --- a/src/3rdparty/phonon/ds9/videowidget.cpp +++ b/src/3rdparty/phonon/ds9/videowidget.cpp @@ -24,7 +24,12 @@ along with this library. If not, see <http://www.gnu.org/licenses/>. #include "mediaobject.h" +#ifndef Q_OS_WINCE +#include "videorenderer_evr.h" #include "videorenderer_vmr9.h" +#else +#include "videorenderer_default.h" +#endif #include "videorenderer_soft.h" QT_BEGIN_NAMESPACE @@ -84,7 +89,19 @@ namespace Phonon void setCurrentRenderer(AbstractVideoRenderer *renderer) { m_currentRenderer = renderer; - update(); + //we disallow repaint on that widget for just a fraction of second + //this allows better transition between videos + setUpdatesEnabled(false); + m_flickerFreeTimer.start(20, this); + } + + void timerEvent(QTimerEvent *e) + { + if (e->timerId() == m_flickerFreeTimer.timerId()) { + m_flickerFreeTimer.stop(); + setUpdatesEnabled(true); + } + QWidget::timerEvent(e); } QSize sizeHint() const @@ -106,6 +123,8 @@ namespace Phonon void paintEvent(QPaintEvent *e) { + if (!updatesEnabled()) + return; //this avoids repaint from native events checkCurrentRenderingMode(); m_currentRenderer->repaintCurrentFrame(this, e->rect()); } @@ -153,13 +172,14 @@ namespace Phonon } } else if (!isEmbedded()) { m_currentRenderer = m_node->switchRendering(m_currentRenderer); - setAttribute(Qt::WA_PaintOnScreen, true); + setAttribute(Qt::WA_PaintOnScreen, false); } } VideoWidget *m_node; AbstractVideoRenderer *m_currentRenderer; QVariant m_restoreScreenSaverActive; + QBasicTimer m_flickerFreeTimer; }; VideoWidget::VideoWidget(QWidget *parent) @@ -203,6 +223,9 @@ namespace Phonon if (toNative && m_noNativeRendererSupported) return current; //no switch here + if (!mediaObject()) + return current; + //firt we delete the renderer //initialization of the widgets for(int i = 0; i < FILTER_COUNT; ++i) { @@ -261,6 +284,7 @@ namespace Phonon { m_aspectRatio = aspectRatio; updateVideoSize(); + m_widget->update(); } Phonon::VideoWidget::ScaleMode VideoWidget::scaleMode() const @@ -279,6 +303,7 @@ namespace Phonon { m_scaleMode = scaleMode; updateVideoSize(); + m_widget->update(); } void VideoWidget::setBrightness(qreal b) @@ -332,14 +357,29 @@ namespace Phonon int index = graphIndex * 2 + type; if (m_renderers[index] == 0 && autoCreate) { AbstractVideoRenderer *renderer = 0; - if (type == Native) { - renderer = new VideoRendererVMR9(m_widget); + if (type == Native) { +#ifndef Q_OS_WINCE + renderer = new VideoRendererEVR(m_widget); + if (renderer->getFilter() == 0) { + delete renderer; + //EVR not present, let's try VMR + renderer = new VideoRendererVMR9(m_widget); + if (renderer->getFilter() == 0) { + //instanciating the renderer might fail + m_noNativeRendererSupported = true; + delete renderer; + renderer = 0; + } + } +#else + renderer = new VideoRendererDefault(m_widget); if (renderer->getFilter() == 0) { - //instanciating the renderer might fail with error VFW_E_DDRAW_CAPS_NOT_SUITABLE (0x80040273) + //instanciating the renderer might fail m_noNativeRendererSupported = true; delete renderer; renderer = 0; } +#endif } if (renderer == 0) { diff --git a/src/3rdparty/phonon/ds9/volumeeffect.cpp b/src/3rdparty/phonon/ds9/volumeeffect.cpp index b9a5fce..a93b074 100644 --- a/src/3rdparty/phonon/ds9/volumeeffect.cpp +++ b/src/3rdparty/phonon/ds9/volumeeffect.cpp @@ -76,7 +76,7 @@ namespace Phonon class VolumeMemInputPin : public QMemInputPin { public: - VolumeMemInputPin(QBaseFilter *parent, const QVector<AM_MEDIA_TYPE> &mt) : QMemInputPin(parent, mt, true /*transform*/) + VolumeMemInputPin(QBaseFilter *parent, const QVector<AM_MEDIA_TYPE> &mt, QPin *output) : QMemInputPin(parent, mt, true /*transform*/, output) { } @@ -139,8 +139,7 @@ namespace Phonon //then creating the input mt << audioMediaType(); - m_input = new VolumeMemInputPin(this, mt); - m_input->addOutput(m_output); //make the connection here + m_input = new VolumeMemInputPin(this, mt, m_output); } void VolumeEffectFilter::treatOneSamplePerChannel(BYTE **buffer, int sampleSize, int channelCount, int frequency) diff --git a/src/3rdparty/phonon/ds9/volumeeffect.h b/src/3rdparty/phonon/ds9/volumeeffect.h index 39b20d0..d1b0186 100644 --- a/src/3rdparty/phonon/ds9/volumeeffect.h +++ b/src/3rdparty/phonon/ds9/volumeeffect.h @@ -47,7 +47,7 @@ namespace Phonon private: float m_volume; - //parameters used to fade + //paramaters used to fade Phonon::VolumeFaderEffect::FadeCurve m_fadeCurve; bool m_fading; //determines if we should be fading. diff --git a/src/3rdparty/phonon/mmf/videowidget.cpp b/src/3rdparty/phonon/mmf/videowidget.cpp index 4ed9979..122094e 100644 --- a/src/3rdparty/phonon/mmf/videowidget.cpp +++ b/src/3rdparty/phonon/mmf/videowidget.cpp @@ -123,7 +123,7 @@ Phonon::VideoWidget::ScaleMode MMF::VideoWidget::scaleMode() const void MMF::VideoWidget::setScaleMode(Phonon::VideoWidget::ScaleMode scaleMode) { TRACE_CONTEXT(VideoWidget::setScaleMode, EVideoApi); - TRACE("setScaleMode %d", setScaleMode); + TRACE("setScaleMode %d", scaleMode); m_videoOutput->setScaleMode(scaleMode); } diff --git a/src/corelib/global/qfeatures.h b/src/corelib/global/qfeatures.h index 74fa8ee..c66047a 100644 --- a/src/corelib/global/qfeatures.h +++ b/src/corelib/global/qfeatures.h @@ -505,6 +505,11 @@ #define QT_NO_XMLSTREAMWRITER #endif +// Bearer Management +#if !defined(QT_NO_BEARERMANAGEMENT) && (defined(QT_NO_LIBRARY)) +#define QT_NO_BEARERMANAGEMENT +#endif + // Context menu #if !defined(QT_NO_CONTEXTMENU) && (defined(QT_NO_MENU)) #define QT_NO_CONTEXTMENU diff --git a/src/corelib/global/qfeatures.txt b/src/corelib/global/qfeatures.txt index 0053556..ed173b1 100644 --- a/src/corelib/global/qfeatures.txt +++ b/src/corelib/global/qfeatures.txt @@ -1098,6 +1098,14 @@ Requires: TEMPORARYFILE Name: QNetworkDiskCache SeeAlso: ??? +Feature: BEARERMANAGEMENT +Description: Provides bearer management support +Section: Networking +Requires: LIBRARY +Name: Bearer Management +SeeAlso: ??? + + # Utilities Feature: COMPLETER diff --git a/src/corelib/io/qwindowspipewriter.cpp b/src/corelib/io/qwindowspipewriter.cpp index 417439f..2fe4424 100644 --- a/src/corelib/io/qwindowspipewriter.cpp +++ b/src/corelib/io/qwindowspipewriter.cpp @@ -128,11 +128,9 @@ void QWindowsPipeWriter::run() overl.OffsetHigh = 0; while ((!quitNow) && totalWritten < maxlen) { DWORD written = 0; - // Write 2k at a time to prevent flooding the pipe. If you - // write too much (4k-8k), the pipe can close - // unexpectedly. if (!WriteFile(writePipe, ptrData + totalWritten, - qMin<int>(2048, maxlen - totalWritten), &written, &overl)) { + maxlen - totalWritten, &written, &overl)) { + if (GetLastError() == 0xE8/*NT_STATUS_INVALID_USER_BUFFER*/) { // give the os a rest msleep(100); diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp index 1a1f978..bf2e2e4 100644 --- a/src/corelib/kernel/qcoreapplication.cpp +++ b/src/corelib/kernel/qcoreapplication.cpp @@ -523,8 +523,6 @@ QCoreApplication::QCoreApplication(int &argc, char **argv) } -extern void set_winapp_name(); - // ### move to QCoreApplicationPrivate constructor? void QCoreApplication::init() { @@ -535,11 +533,6 @@ void QCoreApplication::init() qt_locale_initialized = true; #endif -#ifdef Q_WS_WIN - // Get the application name/instance if qWinMain() was not invoked - set_winapp_name(); -#endif - Q_ASSERT_X(!self, "QCoreApplication", "there should be only one application object"); QCoreApplication::self = this; diff --git a/src/corelib/kernel/qcoreapplication_win.cpp b/src/corelib/kernel/qcoreapplication_win.cpp index c1925e7..320f801 100644 --- a/src/corelib/kernel/qcoreapplication_win.cpp +++ b/src/corelib/kernel/qcoreapplication_win.cpp @@ -52,26 +52,31 @@ QT_BEGIN_NAMESPACE -char appFileName[MAX_PATH]; // application file name -char theAppName[MAX_PATH]; // application name -HINSTANCE appInst = 0; // handle to app instance -HINSTANCE appPrevInst = 0; // handle to prev app instance -int appCmdShow = 0; bool usingWinMain = false; // whether the qWinMain() is used or not +int appCmdShow = 0; Q_CORE_EXPORT HINSTANCE qWinAppInst() // get Windows app handle { - return appInst; + return GetModuleHandle(0); } Q_CORE_EXPORT HINSTANCE qWinAppPrevInst() // get Windows prev app handle { - return appPrevInst; + return 0; } Q_CORE_EXPORT int qWinAppCmdShow() // get main window show command { +#if defined(Q_OS_WINCE) return appCmdShow; +#else + STARTUPINFO startupInfo; + GetStartupInfo(&startupInfo); + + return (startupInfo.dwFlags & STARTF_USESHOWWINDOW) + ? startupInfo.wShowWindow + : SW_SHOWDEFAULT; +#endif } Q_CORE_EXPORT QString qAppFileName() // get application file name @@ -115,25 +120,6 @@ Q_CORE_EXPORT QString qAppFileName() // get application file name return res; } -void set_winapp_name() -{ - static bool already_set = false; - if (!already_set) { - already_set = true; - - QString moduleName = qAppFileName(); - - QByteArray filePath = moduleName.toLocal8Bit(); - QByteArray fileName = QFileInfo(moduleName).baseName().toLocal8Bit(); - - memcpy(appFileName, filePath.constData(), filePath.length()); - memcpy(theAppName, fileName.constData(), fileName.length()); - - if (appInst == 0) - appInst = GetModuleHandle(0); - } -} - QString QCoreApplicationPrivate::appName() const { return QFileInfo(qAppFileName()).baseName(); @@ -198,20 +184,17 @@ void qWinMain(HINSTANCE instance, HINSTANCE prevInstance, LPSTR cmdParam, already_called = true; usingWinMain = true; - // Install default debug handler - + // Install default debug handler qInstallMsgHandler(qWinMsgHandler); - // Create command line - + // Create command line argv = qWinCmdLine<char>(cmdParam, int(strlen(cmdParam)), argc); - // Get Windows parameters - appInst = instance; - appPrevInst = prevInstance; appCmdShow = cmdShow; - set_winapp_name(); + // Ignore Windows parameters + Q_UNUSED(instance); + Q_UNUSED(prevInstance); } /*! diff --git a/src/corelib/thread/qthread.cpp b/src/corelib/thread/qthread.cpp index c35eb28..cdcb65c 100644 --- a/src/corelib/thread/qthread.cpp +++ b/src/corelib/thread/qthread.cpp @@ -174,7 +174,7 @@ void QAdoptedThread::run() QThreadPrivate::QThreadPrivate(QThreadData *d) : QObjectPrivate(), running(false), finished(false), terminated(false), - stackSize(0), priority(QThread::InheritPriority), data(d), object(0) + stackSize(0), priority(QThread::InheritPriority), data(d) { #if defined (Q_OS_UNIX) thread_id = 0; @@ -377,9 +377,6 @@ QThread::QThread(QObject *parent) Q_D(QThread); // fprintf(stderr, "QThreadData %p created for thread %p\n", d->data, this); d->data->thread = this; - - d->object = new QThreadPrivateInternalObject; - d->object->moveToThread(this); } /*! \internal @@ -390,8 +387,6 @@ QThread::QThread(QThreadPrivate &dd, QObject *parent) Q_D(QThread); // fprintf(stderr, "QThreadData %p taken from private data for thread %p\n", d->data, this); d->data->thread = this; - - // do not create the internal object for adopted threads } /*! @@ -413,9 +408,6 @@ QThread::~QThread() d->data->thread = 0; } - - delete d->object; - d->object = 0; } /*! @@ -488,11 +480,11 @@ uint QThread::stackSize() const int QThread::exec() { Q_D(QThread); - QMutexLocker locker(&d->mutex); - d->data->quitNow = false; QEventLoop eventLoop; - locker.unlock(); int returnCode = eventLoop.exec(); + + QMutexLocker locker(&d->mutex); + d->data->quitNow = false; return returnCode; } @@ -518,21 +510,6 @@ int QThread::exec() void QThread::exit(int returnCode) { Q_D(QThread); - if (d->object) { - QMetaObject::invokeMethod(d->object, "exit", Q_ARG(int, returnCode)); - } else { - QMutexLocker locker(&d->mutex); - d->data->quitNow = true; - for (int i = 0; i < d->data->eventLoops.size(); ++i) { - QEventLoop *eventLoop = d->data->eventLoops.at(i); - eventLoop->exit(returnCode); - } - } -} - -void QThreadPrivateInternalObject::exit(int returnCode) -{ - QThreadPrivate *d = static_cast<QThreadPrivate *>(QObjectPrivate::get(thread())); QMutexLocker locker(&d->mutex); d->data->quitNow = true; for (int i = 0; i < d->data->eventLoops.size(); ++i) { diff --git a/src/corelib/thread/qthread_p.h b/src/corelib/thread/qthread_p.h index 54ffd80..44eb8f8 100644 --- a/src/corelib/thread/qthread_p.h +++ b/src/corelib/thread/qthread_p.h @@ -113,14 +113,6 @@ public: #ifndef QT_NO_THREAD -class QThreadPrivateInternalObject : public QObject -{ - Q_OBJECT - -public slots: - void exit(int); -}; - class QThreadPrivate : public QObjectPrivate { Q_DECLARE_PUBLIC(QThread) @@ -165,7 +157,6 @@ public: bool terminationEnabled, terminatePending; # endif QThreadData *data; - QThreadPrivateInternalObject *object; static void createEventDispatcher(QThreadData *data); }; diff --git a/src/corelib/thread/qthread_unix.cpp b/src/corelib/thread/qthread_unix.cpp index 6b34b5f..bd31d9c 100644 --- a/src/corelib/thread/qthread_unix.cpp +++ b/src/corelib/thread/qthread_unix.cpp @@ -253,7 +253,6 @@ void *QThreadPrivate::start(void *arg) pthread_setspecific(current_thread_data_key, data); data->ref(); - data->quitNow = false; // ### TODO: allow the user to create a custom event dispatcher createEventDispatcher(data); @@ -495,6 +494,7 @@ void QThread::start(Priority priority) d->running = true; d->finished = false; d->terminated = false; + d->data->quitNow = false; pthread_attr_t attr; pthread_attr_init(&attr); diff --git a/src/corelib/thread/qthread_win.cpp b/src/corelib/thread/qthread_win.cpp index 37d5b87..9826dcb 100644 --- a/src/corelib/thread/qthread_win.cpp +++ b/src/corelib/thread/qthread_win.cpp @@ -298,7 +298,6 @@ unsigned int __stdcall QThreadPrivate::start(void *arg) QThread::setTerminationEnabled(false); - data->quitNow = false; // ### TODO: allow the user to create a custom event dispatcher createEventDispatcher(data); @@ -405,6 +404,7 @@ void QThread::start(Priority priority) d->running = true; d->finished = false; d->terminated = false; + d->data->quitNow = false; /* NOTE: we create the thread in the suspended state, set the diff --git a/src/corelib/tools/qsimd_p.h b/src/corelib/tools/qsimd_p.h index c69dd09..cbe6146 100644 --- a/src/corelib/tools/qsimd_p.h +++ b/src/corelib/tools/qsimd_p.h @@ -66,6 +66,9 @@ QT_BEGIN_HEADER # include <emmintrin.h> # undef posix_memalign #else +# ifdef Q_CC_MINGW +# include <windows.h> +# endif # include <emmintrin.h> #endif diff --git a/src/declarative/graphicsitems/graphicsitems.pri b/src/declarative/graphicsitems/graphicsitems.pri index eab41e3..ad7ccb5 100644 --- a/src/declarative/graphicsitems/graphicsitems.pri +++ b/src/declarative/graphicsitems/graphicsitems.pri @@ -50,7 +50,8 @@ HEADERS += \ $$PWD/qdeclarativelistview_p.h \ $$PWD/qdeclarativelayoutitem_p.h \ $$PWD/qdeclarativeitemchangelistener_p.h \ - $$PWD/qdeclarativeeffects.cpp + $$PWD/qdeclarativeeffects.cpp \ + $$PWD/qdeclarativegraphicswidget_p.h SOURCES += \ $$PWD/qdeclarativeitemsmodule.cpp \ @@ -81,4 +82,5 @@ SOURCES += \ $$PWD/qdeclarativetextedit.cpp \ $$PWD/qdeclarativevisualitemmodel.cpp \ $$PWD/qdeclarativelistview.cpp \ - $$PWD/qdeclarativelayoutitem.cpp + $$PWD/qdeclarativelayoutitem.cpp \ + $$PWD/qdeclarativegraphicswidget.cpp diff --git a/src/declarative/graphicsitems/qdeclarativeanchors.cpp b/src/declarative/graphicsitems/qdeclarativeanchors.cpp index 7a7e5be..96d0867 100644 --- a/src/declarative/graphicsitems/qdeclarativeanchors.cpp +++ b/src/declarative/graphicsitems/qdeclarativeanchors.cpp @@ -55,30 +55,32 @@ QT_BEGIN_NAMESPACE //### const item? //local position -static qreal position(QDeclarativeItem *item, QDeclarativeAnchorLine::AnchorLine anchorLine) +static qreal position(QGraphicsObject *item, QDeclarativeAnchorLine::AnchorLine anchorLine) { qreal ret = 0.0; + QGraphicsItemPrivate *d = QGraphicsItemPrivate::get(item); switch(anchorLine) { case QDeclarativeAnchorLine::Left: ret = item->x(); break; case QDeclarativeAnchorLine::Right: - ret = item->x() + item->width(); + ret = item->x() + d->width(); break; case QDeclarativeAnchorLine::Top: ret = item->y(); break; case QDeclarativeAnchorLine::Bottom: - ret = item->y() + item->height(); + ret = item->y() + d->height(); break; case QDeclarativeAnchorLine::HCenter: - ret = item->x() + item->width()/2; + ret = item->x() + d->width()/2; break; case QDeclarativeAnchorLine::VCenter: - ret = item->y() + item->height()/2; + ret = item->y() + d->height()/2; break; case QDeclarativeAnchorLine::Baseline: - ret = item->y() + item->baselineOffset(); + if (d->isDeclarativeItem) + ret = item->y() + static_cast<QDeclarativeItem*>(item)->baselineOffset(); break; default: break; @@ -88,30 +90,32 @@ static qreal position(QDeclarativeItem *item, QDeclarativeAnchorLine::AnchorLine } //position when origin is 0,0 -static qreal adjustedPosition(QDeclarativeItem *item, QDeclarativeAnchorLine::AnchorLine anchorLine) +static qreal adjustedPosition(QGraphicsObject *item, QDeclarativeAnchorLine::AnchorLine anchorLine) { int ret = 0; + QGraphicsItemPrivate *d = QGraphicsItemPrivate::get(item); switch(anchorLine) { case QDeclarativeAnchorLine::Left: ret = 0; break; case QDeclarativeAnchorLine::Right: - ret = item->width(); + ret = d->width(); break; case QDeclarativeAnchorLine::Top: ret = 0; break; case QDeclarativeAnchorLine::Bottom: - ret = item->height(); + ret = d->height(); break; case QDeclarativeAnchorLine::HCenter: - ret = item->width()/2; + ret = d->width()/2; break; case QDeclarativeAnchorLine::VCenter: - ret = item->height()/2; + ret = d->height()/2; break; case QDeclarativeAnchorLine::Baseline: - ret = item->baselineOffset(); + if (d->isDeclarativeItem) + ret = static_cast<QDeclarativeItem*>(item)->baselineOffset(); break; default: break; @@ -136,7 +140,7 @@ QDeclarativeAnchors::QDeclarativeAnchors(QObject *parent) qFatal("QDeclarativeAnchors::QDeclarativeAnchors(QObject*) called"); } -QDeclarativeAnchors::QDeclarativeAnchors(QDeclarativeItem *item, QObject *parent) +QDeclarativeAnchors::QDeclarativeAnchors(QGraphicsObject *item, QObject *parent) : QObject(*new QDeclarativeAnchorsPrivate(item), parent) { } @@ -168,7 +172,8 @@ void QDeclarativeAnchorsPrivate::fillChanged() } else if (fill->parentItem() == item->parentItem()) { //siblings setItemPos(QPointF(fill->x()+leftMargin, fill->y()+topMargin)); } - setItemSize(QSizeF(fill->width()-leftMargin-rightMargin, fill->height()-topMargin-bottomMargin)); + QGraphicsItemPrivate *fillPrivate = QGraphicsItemPrivate::get(fill); + setItemSize(QSizeF(fillPrivate->width()-leftMargin-rightMargin, fillPrivate->height()-topMargin-bottomMargin)); --updatingFill; } else { @@ -185,16 +190,17 @@ void QDeclarativeAnchorsPrivate::centerInChanged() if (updatingCenterIn < 2) { ++updatingCenterIn; - + QGraphicsItemPrivate *itemPrivate = QGraphicsItemPrivate::get(item); if (centerIn == item->parentItem()) { - QPointF p((item->parentItem()->width() - item->width()) / 2. + hCenterOffset, - (item->parentItem()->height() - item->height()) / 2. + vCenterOffset); + QGraphicsItemPrivate *parentPrivate = QGraphicsItemPrivate::get(item->parentItem()); + QPointF p((parentPrivate->width() - itemPrivate->width()) / 2. + hCenterOffset, + (parentPrivate->height() - itemPrivate->height()) / 2. + vCenterOffset); setItemPos(p); } else if (centerIn->parentItem() == item->parentItem()) { - - QPointF p(centerIn->x() + (centerIn->width() - item->width()) / 2. + hCenterOffset, - centerIn->y() + (centerIn->height() - item->height()) / 2. + vCenterOffset); + QGraphicsItemPrivate *centerPrivate = QGraphicsItemPrivate::get(centerIn); + QPointF p(centerIn->x() + (centerPrivate->width() - itemPrivate->width()) / 2. + hCenterOffset, + centerIn->y() + (centerPrivate->height() - itemPrivate->height()) / 2. + vCenterOffset); setItemPos(p); } @@ -205,7 +211,7 @@ void QDeclarativeAnchorsPrivate::centerInChanged() } } -void QDeclarativeAnchorsPrivate::clearItem(QDeclarativeItem *item) +void QDeclarativeAnchorsPrivate::clearItem(QGraphicsObject *item) { if (!item) return; @@ -243,22 +249,38 @@ void QDeclarativeAnchorsPrivate::clearItem(QDeclarativeItem *item) } } -void QDeclarativeAnchorsPrivate::addDepend(QDeclarativeItem *item) +void QDeclarativeAnchorsPrivate::addDepend(QGraphicsObject *item) { if (!item) return; - QDeclarativeItemPrivate *p = - static_cast<QDeclarativeItemPrivate *>(QGraphicsItemPrivate::get(item)); - p->addItemChangeListener(this, QDeclarativeItemPrivate::Geometry); + QGraphicsItemPrivate * itemPrivate = QGraphicsItemPrivate::get(item); + if (itemPrivate->isDeclarativeItem) { + QDeclarativeItemPrivate *p = + static_cast<QDeclarativeItemPrivate *>(QGraphicsItemPrivate::get(item)); + p->addItemChangeListener(this, QDeclarativeItemPrivate::Geometry); + } else if(itemPrivate->isWidget) { + Q_Q(QDeclarativeAnchors); + QGraphicsWidget *widget = static_cast<QGraphicsWidget *>(item); + QObject::connect(widget, SIGNAL(destroyed(QObject *)), q, SLOT(_q_widgetDestroyed(QObject *))); + QObject::connect(widget, SIGNAL(geometryChanged()), q, SLOT(_q_widgetGeometryChanged())); + } } -void QDeclarativeAnchorsPrivate::remDepend(QDeclarativeItem *item) +void QDeclarativeAnchorsPrivate::remDepend(QGraphicsObject *item) { if (!item) return; - QDeclarativeItemPrivate *p = - static_cast<QDeclarativeItemPrivate *>(QGraphicsItemPrivate::get(item)); - p->removeItemChangeListener(this, QDeclarativeItemPrivate::Geometry); + QGraphicsItemPrivate * itemPrivate = QGraphicsItemPrivate::get(item); + if (itemPrivate->isDeclarativeItem) { + QDeclarativeItemPrivate *p = + static_cast<QDeclarativeItemPrivate *>(itemPrivate); + p->removeItemChangeListener(this, QDeclarativeItemPrivate::Geometry); + } else if(itemPrivate->isWidget) { + Q_Q(QDeclarativeAnchors); + QGraphicsWidget *widget = static_cast<QGraphicsWidget *>(item); + QObject::disconnect(widget, SIGNAL(destroyed(QObject *)), q, SLOT(_q_widgetDestroyed(QObject *))); + QObject::disconnect(widget, SIGNAL(geometryChanged()), q, SLOT(_q_widgetGeometryChanged())); + } } bool QDeclarativeAnchorsPrivate::isItemComplete() const @@ -281,14 +303,14 @@ void QDeclarativeAnchors::componentComplete() void QDeclarativeAnchorsPrivate::setItemHeight(qreal v) { updatingMe = true; - item->setHeight(v); + QGraphicsItemPrivate::get(item)->setHeight(v); updatingMe = false; } void QDeclarativeAnchorsPrivate::setItemWidth(qreal v) { updatingMe = true; - item->setWidth(v); + QGraphicsItemPrivate::get(item)->setWidth(v); updatingMe = false; } @@ -316,7 +338,10 @@ void QDeclarativeAnchorsPrivate::setItemPos(const QPointF &v) void QDeclarativeAnchorsPrivate::setItemSize(const QSizeF &v) { updatingMe = true; - item->setSize(v); + if(QGraphicsItemPrivate::get(item)->isWidget) + static_cast<QGraphicsWidget *>(item)->resize(v); + else if (QGraphicsItemPrivate::get(item)->isDeclarativeItem) + static_cast<QDeclarativeItem *>(item)->setSize(v); updatingMe = false; } @@ -341,24 +366,36 @@ void QDeclarativeAnchorsPrivate::updateOnComplete() updateVerticalAnchors(); } -void QDeclarativeAnchorsPrivate::itemGeometryChanged(QDeclarativeItem *, const QRectF &newG, const QRectF &oldG) +void QDeclarativeAnchorsPrivate::_q_widgetDestroyed(QObject *obj) +{ + clearItem(qobject_cast<QGraphicsObject*>(obj)); +} + +void QDeclarativeAnchorsPrivate::_q_widgetGeometryChanged() { fillChanged(); centerInChanged(); + updateHorizontalAnchors(); + updateVerticalAnchors(); +} +void QDeclarativeAnchorsPrivate::itemGeometryChanged(QDeclarativeItem *, const QRectF &newG, const QRectF &oldG) +{ + fillChanged(); + centerInChanged(); if (newG.x() != oldG.x() || newG.width() != oldG.width()) updateHorizontalAnchors(); if (newG.y() != oldG.y() || newG.height() != oldG.height()) updateVerticalAnchors(); } -QDeclarativeItem *QDeclarativeAnchors::fill() const +QGraphicsObject *QDeclarativeAnchors::fill() const { Q_D(const QDeclarativeAnchors); return d->fill; } -void QDeclarativeAnchors::setFill(QDeclarativeItem *f) +void QDeclarativeAnchors::setFill(QGraphicsObject *f) { Q_D(QDeclarativeAnchors); if (d->fill == f) @@ -386,13 +423,13 @@ void QDeclarativeAnchors::resetFill() setFill(0); } -QDeclarativeItem *QDeclarativeAnchors::centerIn() const +QGraphicsObject *QDeclarativeAnchors::centerIn() const { Q_D(const QDeclarativeAnchors); return d->centerIn; } -void QDeclarativeAnchors::setCenterIn(QDeclarativeItem* c) +void QDeclarativeAnchors::setCenterIn(QGraphicsObject* c) { Q_D(QDeclarativeAnchors); if (d->centerIn == c) @@ -439,10 +476,10 @@ bool QDeclarativeAnchorsPrivate::calcStretch(const QDeclarativeAnchorLine &edge1 - ((int)position(edge1.item, edge1.anchorLine) + offset1); } else if (edge2IsParent && edge1IsSibling) { stretch = ((int)position(edge2.item, edge2.anchorLine) + offset2) - - ((int)position(item->parentItem(), line) + - ((int)position(item->parentObject(), line) + (int)position(edge1.item, edge1.anchorLine) + offset1); } else if (edge2IsSibling && edge1IsParent) { - stretch = ((int)position(item->parentItem(), line) + (int)position(edge2.item, edge2.anchorLine) + offset2) + stretch = ((int)position(item->parentObject(), line) + (int)position(edge2.item, edge2.anchorLine) + offset2) - ((int)position(edge1.item, edge1.anchorLine) + offset1); } else invalid = true; @@ -457,6 +494,7 @@ void QDeclarativeAnchorsPrivate::updateVerticalAnchors() if (updatingVerticalAnchor < 2) { ++updatingVerticalAnchor; + QGraphicsItemPrivate *itemPrivate = QGraphicsItemPrivate::get(item); if (usedAnchors & QDeclarativeAnchors::HasTopAnchor) { //Handle stretching bool invalid = true; @@ -488,9 +526,9 @@ void QDeclarativeAnchorsPrivate::updateVerticalAnchors() //Handle bottom if (bottom.item == item->parentItem()) { - setItemY(adjustedPosition(bottom.item, bottom.anchorLine) - item->height() - bottomMargin); + setItemY(adjustedPosition(bottom.item, bottom.anchorLine) - itemPrivate->height() - bottomMargin); } else if (bottom.item->parentItem() == item->parentItem()) { - setItemY(position(bottom.item, bottom.anchorLine) - item->height() - bottomMargin); + setItemY(position(bottom.item, bottom.anchorLine) - itemPrivate->height() - bottomMargin); } } else if (usedAnchors & QDeclarativeAnchors::HasVCenterAnchor) { //(stetching handled above) @@ -498,18 +536,20 @@ void QDeclarativeAnchorsPrivate::updateVerticalAnchors() //Handle vCenter if (vCenter.item == item->parentItem()) { setItemY(adjustedPosition(vCenter.item, vCenter.anchorLine) - - item->height()/2 + vCenterOffset); + - itemPrivate->height()/2 + vCenterOffset); } else if (vCenter.item->parentItem() == item->parentItem()) { - setItemY(position(vCenter.item, vCenter.anchorLine) - item->height()/2 + vCenterOffset); + setItemY(position(vCenter.item, vCenter.anchorLine) - itemPrivate->height()/2 + vCenterOffset); } } else if (usedAnchors & QDeclarativeAnchors::HasBaselineAnchor) { //Handle baseline if (baseline.item == item->parentItem()) { - setItemY(adjustedPosition(baseline.item, baseline.anchorLine) - - item->baselineOffset() + baselineOffset); + if (itemPrivate->isDeclarativeItem) + setItemY(adjustedPosition(baseline.item, baseline.anchorLine) + - static_cast<QDeclarativeItem *>(item)->baselineOffset() + baselineOffset); } else if (baseline.item->parentItem() == item->parentItem()) { - setItemY(position(baseline.item, baseline.anchorLine) - - item->baselineOffset() + baselineOffset); + if (itemPrivate->isDeclarativeItem) + setItemY(position(baseline.item, baseline.anchorLine) + - static_cast<QDeclarativeItem *>(item)->baselineOffset() + baselineOffset); } } --updatingVerticalAnchor; @@ -526,7 +566,7 @@ void QDeclarativeAnchorsPrivate::updateHorizontalAnchors() if (updatingHorizontalAnchor < 2) { ++updatingHorizontalAnchor; - + QGraphicsItemPrivate *itemPrivate = QGraphicsItemPrivate::get(item); if (usedAnchors & QDeclarativeAnchors::HasLeftAnchor) { //Handle stretching bool invalid = true; @@ -558,16 +598,16 @@ void QDeclarativeAnchorsPrivate::updateHorizontalAnchors() //Handle right if (right.item == item->parentItem()) { - setItemX(adjustedPosition(right.item, right.anchorLine) - item->width() - rightMargin); + setItemX(adjustedPosition(right.item, right.anchorLine) - itemPrivate->width() - rightMargin); } else if (right.item->parentItem() == item->parentItem()) { - setItemX(position(right.item, right.anchorLine) - item->width() - rightMargin); + setItemX(position(right.item, right.anchorLine) - itemPrivate->width() - rightMargin); } } else if (usedAnchors & QDeclarativeAnchors::HasHCenterAnchor) { //Handle hCenter if (hCenter.item == item->parentItem()) { - setItemX(adjustedPosition(hCenter.item, hCenter.anchorLine) - item->width()/2 + hCenterOffset); + setItemX(adjustedPosition(hCenter.item, hCenter.anchorLine) - itemPrivate->width()/2 + hCenterOffset); } else if (hCenter.item->parentItem() == item->parentItem()) { - setItemX(position(hCenter.item, hCenter.anchorLine) - item->width()/2 + hCenterOffset); + setItemX(position(hCenter.item, hCenter.anchorLine) - itemPrivate->width()/2 + hCenterOffset); } } diff --git a/src/declarative/graphicsitems/qdeclarativeanchors_p.h b/src/declarative/graphicsitems/qdeclarativeanchors_p.h index 1961fdd..f2e57cc 100644 --- a/src/declarative/graphicsitems/qdeclarativeanchors_p.h +++ b/src/declarative/graphicsitems/qdeclarativeanchors_p.h @@ -55,7 +55,7 @@ QT_BEGIN_NAMESPACE QT_MODULE(Declarative) class QDeclarativeAnchorsPrivate; -struct QDeclarativeAnchorLine; +class QDeclarativeAnchorLine; class Q_DECLARATIVE_EXPORT QDeclarativeAnchors : public QObject { Q_OBJECT @@ -75,12 +75,12 @@ class Q_DECLARATIVE_EXPORT QDeclarativeAnchors : public QObject Q_PROPERTY(qreal bottomMargin READ bottomMargin WRITE setBottomMargin NOTIFY bottomMarginChanged) Q_PROPERTY(qreal verticalCenterOffset READ verticalCenterOffset WRITE setVerticalCenterOffset NOTIFY verticalCenterOffsetChanged()) Q_PROPERTY(qreal baselineOffset READ baselineOffset WRITE setBaselineOffset NOTIFY baselineOffsetChanged()) - Q_PROPERTY(QDeclarativeItem *fill READ fill WRITE setFill RESET resetFill NOTIFY fillChanged) - Q_PROPERTY(QDeclarativeItem *centerIn READ centerIn WRITE setCenterIn RESET resetCenterIn NOTIFY centerInChanged) + Q_PROPERTY(QGraphicsObject *fill READ fill WRITE setFill RESET resetFill NOTIFY fillChanged) + Q_PROPERTY(QGraphicsObject *centerIn READ centerIn WRITE setCenterIn RESET resetCenterIn NOTIFY centerInChanged) public: QDeclarativeAnchors(QObject *parent=0); - QDeclarativeAnchors(QDeclarativeItem *item, QObject *parent=0); + QDeclarativeAnchors(QGraphicsObject *item, QObject *parent=0); virtual ~QDeclarativeAnchors(); enum UsedAnchor { @@ -148,12 +148,12 @@ public: qreal baselineOffset() const; void setBaselineOffset(qreal); - QDeclarativeItem *fill() const; - void setFill(QDeclarativeItem *); + QGraphicsObject *fill() const; + void setFill(QGraphicsObject *); void resetFill(); - QDeclarativeItem *centerIn() const; - void setCenterIn(QDeclarativeItem *); + QGraphicsObject *centerIn() const; + void setCenterIn(QGraphicsObject *); void resetCenterIn(); UsedAnchors usedAnchors() const; @@ -182,8 +182,11 @@ Q_SIGNALS: private: friend class QDeclarativeItem; + friend class QDeclarativeGraphicsWidget; Q_DISABLE_COPY(QDeclarativeAnchors) Q_DECLARE_PRIVATE(QDeclarativeAnchors) + Q_PRIVATE_SLOT(d_func(), void _q_widgetGeometryChanged()) + Q_PRIVATE_SLOT(d_func(), void _q_widgetDestroyed(QObject *obj)) }; Q_DECLARE_OPERATORS_FOR_FLAGS(QDeclarativeAnchors::UsedAnchors) diff --git a/src/declarative/graphicsitems/qdeclarativeanchors_p_p.h b/src/declarative/graphicsitems/qdeclarativeanchors_p_p.h index ba6359a..f8489aa 100644 --- a/src/declarative/graphicsitems/qdeclarativeanchors_p_p.h +++ b/src/declarative/graphicsitems/qdeclarativeanchors_p_p.h @@ -59,8 +59,9 @@ QT_BEGIN_NAMESPACE -struct QDeclarativeAnchorLine +class QDeclarativeAnchorLine { +public: QDeclarativeAnchorLine() : item(0), anchorLine(Invalid) {} enum AnchorLine { @@ -76,7 +77,7 @@ struct QDeclarativeAnchorLine Vertical_Mask = Top | Bottom | VCenter | Baseline }; - QDeclarativeItem *item; + QGraphicsObject *item; AnchorLine anchorLine; }; @@ -89,7 +90,7 @@ class QDeclarativeAnchorsPrivate : public QObjectPrivate, public QDeclarativeIte { Q_DECLARE_PUBLIC(QDeclarativeAnchors) public: - QDeclarativeAnchorsPrivate(QDeclarativeItem *i) + QDeclarativeAnchorsPrivate(QGraphicsObject *i) : componentComplete(true), updatingMe(false), updatingHorizontalAnchor(0), updatingVerticalAnchor(0), updatingFill(0), updatingCenterIn(0), item(i), usedAnchors(0), fill(0), centerIn(0), leftMargin(0), rightMargin(0), topMargin(0), bottomMargin(0), @@ -97,10 +98,10 @@ public: { } - void clearItem(QDeclarativeItem *); + void clearItem(QGraphicsObject *); - void addDepend(QDeclarativeItem *); - void remDepend(QDeclarativeItem *); + void addDepend(QGraphicsObject *); + void remDepend(QGraphicsObject *); bool isItemComplete() const; bool componentComplete:1; @@ -122,6 +123,8 @@ public: // QDeclarativeItemGeometryListener interface void itemGeometryChanged(QDeclarativeItem *, const QRectF &, const QRectF &); + void _q_widgetDestroyed(QObject *); + void _q_widgetGeometryChanged(); QDeclarativeAnchorsPrivate *anchorPrivate() { return this; } bool checkHValid() const; @@ -135,11 +138,11 @@ public: void fillChanged(); void centerInChanged(); - QDeclarativeItem *item; + QGraphicsObject *item; QDeclarativeAnchors::UsedAnchors usedAnchors; - QDeclarativeItem *fill; - QDeclarativeItem *centerIn; + QGraphicsObject *fill; + QGraphicsObject *centerIn; QDeclarativeAnchorLine left; QDeclarativeAnchorLine right; diff --git a/src/declarative/graphicsitems/qdeclarativeanimatedimage.cpp b/src/declarative/graphicsitems/qdeclarativeanimatedimage.cpp index cc062f0..6ab126d 100644 --- a/src/declarative/graphicsitems/qdeclarativeanimatedimage.cpp +++ b/src/declarative/graphicsitems/qdeclarativeanimatedimage.cpp @@ -42,6 +42,8 @@ #include "private/qdeclarativeanimatedimage_p.h" #include "private/qdeclarativeanimatedimage_p_p.h" +#ifndef QT_NO_MOVIE + #include <qdeclarativeengine.h> #include <QMovie> @@ -320,3 +322,5 @@ void QDeclarativeAnimatedImage::componentComplete() } QT_END_NAMESPACE + +#endif // QT_NO_MOVIE diff --git a/src/declarative/graphicsitems/qdeclarativeanimatedimage_p.h b/src/declarative/graphicsitems/qdeclarativeanimatedimage_p.h index 9d8087c..5981cd3 100644 --- a/src/declarative/graphicsitems/qdeclarativeanimatedimage_p.h +++ b/src/declarative/graphicsitems/qdeclarativeanimatedimage_p.h @@ -44,6 +44,8 @@ #include "private/qdeclarativeimage_p.h" +#ifndef QT_NO_MOVIE + QT_BEGIN_HEADER QT_BEGIN_NAMESPACE @@ -108,4 +110,6 @@ QML_DECLARE_TYPE(QDeclarativeAnimatedImage) QT_END_HEADER +#endif // QT_NO_MOVIE + #endif diff --git a/src/declarative/graphicsitems/qdeclarativeanimatedimage_p_p.h b/src/declarative/graphicsitems/qdeclarativeanimatedimage_p_p.h index 8ca9755..a02893d 100644 --- a/src/declarative/graphicsitems/qdeclarativeanimatedimage_p_p.h +++ b/src/declarative/graphicsitems/qdeclarativeanimatedimage_p_p.h @@ -55,6 +55,8 @@ #include "private/qdeclarativeimage_p_p.h" +#ifndef QT_NO_MOVIE + QT_BEGIN_NAMESPACE class QMovie; @@ -80,4 +82,6 @@ public: QT_END_NAMESPACE +#endif // QT_NO_MOVIE + #endif // QDECLARATIVEANIMATEDIMAGE_P_H diff --git a/src/declarative/graphicsitems/qdeclarativeeffects_p.h b/src/declarative/graphicsitems/qdeclarativeeffects_p.h index 73eec6a..0de5854 100644 --- a/src/declarative/graphicsitems/qdeclarativeeffects_p.h +++ b/src/declarative/graphicsitems/qdeclarativeeffects_p.h @@ -56,10 +56,12 @@ #include <qdeclarative.h> #include <QtGui/qgraphicseffect.h> +#ifndef QT_NO_GRAPHICSEFFECT QML_DECLARE_TYPE(QGraphicsEffect) QML_DECLARE_TYPE(QGraphicsBlurEffect) QML_DECLARE_TYPE(QGraphicsColorizeEffect) QML_DECLARE_TYPE(QGraphicsDropShadowEffect) QML_DECLARE_TYPE(QGraphicsOpacityEffect) +#endif #endif // QDECLARATIVEEFFECTS_P_H diff --git a/src/declarative/graphicsitems/qdeclarativeflickable.cpp b/src/declarative/graphicsitems/qdeclarativeflickable.cpp index fc7a87b..951b171 100644 --- a/src/declarative/graphicsitems/qdeclarativeflickable.cpp +++ b/src/declarative/graphicsitems/qdeclarativeflickable.cpp @@ -816,6 +816,8 @@ void QDeclarativeFlickable::wheelEvent(QGraphicsSceneWheelEvent *event) d->vData.velocity = qMin(event->delta() - d->vData.smoothVelocity.value(), qreal(-250.0)); d->flicked = false; d->flickY(d->vData.velocity); + if (d->flicked) + movementStarting(); event->accept(); } else if (xflick()) { if (event->delta() > 0) @@ -824,6 +826,8 @@ void QDeclarativeFlickable::wheelEvent(QGraphicsSceneWheelEvent *event) d->hData.velocity = qMin(event->delta() - d->hData.smoothVelocity.value(), qreal(-250.0)); d->flicked = false; d->flickX(d->hData.velocity); + if (d->flicked) + movementStarting(); event->accept(); } else { QDeclarativeItem::wheelEvent(event); diff --git a/src/declarative/graphicsitems/qdeclarativegraphicswidget.cpp b/src/declarative/graphicsitems/qdeclarativegraphicswidget.cpp new file mode 100644 index 0000000..ee45406 --- /dev/null +++ b/src/declarative/graphicsitems/qdeclarativegraphicswidget.cpp @@ -0,0 +1,144 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qdeclarativegraphicswidget_p.h" +#include "private/qdeclarativeanchors_p.h" +#include "private/qdeclarativeitem_p.h" +#include "private/qdeclarativeanchors_p_p.h" + +QT_BEGIN_NAMESPACE + +class QDeclarativeGraphicsWidgetPrivate : public QObjectPrivate { + Q_DECLARE_PUBLIC(QDeclarativeGraphicsWidget) +public : + QDeclarativeGraphicsWidgetPrivate() : + _anchors(0), _anchorLines(0) + {} + QDeclarativeItemPrivate::AnchorLines *anchorLines() const; + QDeclarativeAnchors *_anchors; + mutable QDeclarativeItemPrivate::AnchorLines *_anchorLines; +}; + +QDeclarativeGraphicsWidget::QDeclarativeGraphicsWidget(QObject *parent) : + QObject(*new QDeclarativeGraphicsWidgetPrivate, parent) +{ +} +QDeclarativeGraphicsWidget::~QDeclarativeGraphicsWidget() +{ + Q_D(QDeclarativeGraphicsWidget); + delete d->_anchorLines; d->_anchorLines = 0; + delete d->_anchors; d->_anchors = 0; +} + +/*! \internal */ +QDeclarativeAnchors *QDeclarativeGraphicsWidget::anchors() +{ + Q_D(QDeclarativeGraphicsWidget); + if (!d->_anchors) + d->_anchors = new QDeclarativeAnchors(static_cast<QGraphicsObject *>(parent())); + return d->_anchors; +} + +QDeclarativeItemPrivate::AnchorLines *QDeclarativeGraphicsWidgetPrivate::anchorLines() const +{ + Q_Q(const QDeclarativeGraphicsWidget); + if (!_anchorLines) + _anchorLines = new QDeclarativeItemPrivate::AnchorLines(static_cast<QGraphicsObject *>(q->parent())); + return _anchorLines; +} + +/*! + \internal +*/ +QDeclarativeAnchorLine QDeclarativeGraphicsWidget::left() const +{ + Q_D(const QDeclarativeGraphicsWidget); + return d->anchorLines()->left; +} + +/*! + \internal +*/ +QDeclarativeAnchorLine QDeclarativeGraphicsWidget::right() const +{ + Q_D(const QDeclarativeGraphicsWidget); + return d->anchorLines()->right; +} + +/*! + \internal +*/ +QDeclarativeAnchorLine QDeclarativeGraphicsWidget::horizontalCenter() const +{ + Q_D(const QDeclarativeGraphicsWidget); + return d->anchorLines()->hCenter; +} + +/*! + \internal +*/ +QDeclarativeAnchorLine QDeclarativeGraphicsWidget::top() const +{ + Q_D(const QDeclarativeGraphicsWidget); + return d->anchorLines()->top; +} + +/*! + \internal +*/ +QDeclarativeAnchorLine QDeclarativeGraphicsWidget::bottom() const +{ + Q_D(const QDeclarativeGraphicsWidget); + return d->anchorLines()->bottom; +} + +/*! + \internal +*/ +QDeclarativeAnchorLine QDeclarativeGraphicsWidget::verticalCenter() const +{ + Q_D(const QDeclarativeGraphicsWidget); + return d->anchorLines()->vCenter; +} + +QT_END_NAMESPACE + +#include <moc_qdeclarativegraphicswidget_p.cpp> diff --git a/src/declarative/graphicsitems/qdeclarativegraphicswidget_p.h b/src/declarative/graphicsitems/qdeclarativegraphicswidget_p.h new file mode 100644 index 0000000..987303e --- /dev/null +++ b/src/declarative/graphicsitems/qdeclarativegraphicswidget_p.h @@ -0,0 +1,90 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtDeclarative module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QDECLARATIVEGRAPHICSWIDGET_P_H +#define QDECLARATIVEGRAPHICSWIDGET_P_H + +#include <QObject> +#include <QtDeclarative/qdeclarativecomponent.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Declarative) + +class QDeclarativeAnchorLine; +class QDeclarativeAnchors; +class QGraphicsObject; +class QDeclarativeGraphicsWidgetPrivate; + +// ### TODO can the extension object be the anchor directly? We save one allocation -> awesome. +class QDeclarativeGraphicsWidget : public QObject +{ + Q_OBJECT + Q_PROPERTY(QDeclarativeAnchors * anchors READ anchors DESIGNABLE false CONSTANT FINAL) + Q_PROPERTY(QDeclarativeAnchorLine left READ left CONSTANT FINAL) + Q_PROPERTY(QDeclarativeAnchorLine right READ right CONSTANT FINAL) + Q_PROPERTY(QDeclarativeAnchorLine horizontalCenter READ horizontalCenter CONSTANT FINAL) + Q_PROPERTY(QDeclarativeAnchorLine top READ top CONSTANT FINAL) + Q_PROPERTY(QDeclarativeAnchorLine bottom READ bottom CONSTANT FINAL) + Q_PROPERTY(QDeclarativeAnchorLine verticalCenter READ verticalCenter CONSTANT FINAL) + // ### TODO : QGraphicsWidget don't have a baseline concept yet. + //Q_PROPERTY(QDeclarativeAnchorLine baseline READ baseline CONSTANT FINAL) +public: + QDeclarativeGraphicsWidget(QObject *parent = 0); + ~QDeclarativeGraphicsWidget(); + QDeclarativeAnchors *anchors(); + QDeclarativeAnchorLine left() const; + QDeclarativeAnchorLine right() const; + QDeclarativeAnchorLine horizontalCenter() const; + QDeclarativeAnchorLine top() const; + QDeclarativeAnchorLine bottom() const; + QDeclarativeAnchorLine verticalCenter() const; + Q_DISABLE_COPY(QDeclarativeGraphicsWidget) + Q_DECLARE_PRIVATE(QDeclarativeGraphicsWidget) +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QDECLARATIVEGRAPHICSWIDGET_P_H diff --git a/src/declarative/graphicsitems/qdeclarativegridview.cpp b/src/declarative/graphicsitems/qdeclarativegridview.cpp index 9be025a..562ba2a 100644 --- a/src/declarative/graphicsitems/qdeclarativegridview.cpp +++ b/src/declarative/graphicsitems/qdeclarativegridview.cpp @@ -613,8 +613,6 @@ void QDeclarativeGridViewPrivate::updateTrackedItem() if (highlight) item = highlight; - FxGridItem *oldTracked = trackedItem; - if (trackedItem && item != trackedItem) { QObject::disconnect(trackedItem->item, SIGNAL(yChanged()), q, SLOT(trackedPositionChanged())); QObject::disconnect(trackedItem->item, SIGNAL(xChanged()), q, SLOT(trackedPositionChanged())); @@ -626,7 +624,7 @@ void QDeclarativeGridViewPrivate::updateTrackedItem() QObject::connect(trackedItem->item, SIGNAL(yChanged()), q, SLOT(trackedPositionChanged())); QObject::connect(trackedItem->item, SIGNAL(xChanged()), q, SLOT(trackedPositionChanged())); } - if (trackedItem && trackedItem != oldTracked) + if (trackedItem) q->trackedPositionChanged(); } @@ -938,10 +936,10 @@ QDeclarativeGridView::~QDeclarativeGridView() id: myDelegate Item { id: wrapper - SequentialAnimation on GridView.onRemove { - PropertyAction { target: wrapper.GridView; property: "delayRemove"; value: true } + GridView.onRemove: SequentialAnimation { + PropertyAction { target: wrapper; property: "GridView.delayRemove"; value: true } NumberAnimation { target: wrapper; property: "scale"; to: 0; duration: 250; easing.type: "InOutQuad" } - PropertyAction { target: wrapper.GridView; property: "delayRemove"; value: false } + PropertyAction { target: wrapper; property: "GridView.delayRemove"; value: false } } } } diff --git a/src/declarative/graphicsitems/qdeclarativeimage.cpp b/src/declarative/graphicsitems/qdeclarativeimage.cpp index e4f3464..ca86637 100644 --- a/src/declarative/graphicsitems/qdeclarativeimage.cpp +++ b/src/declarative/graphicsitems/qdeclarativeimage.cpp @@ -311,6 +311,12 @@ void QDeclarativeImage::updatePaintedGeometry() d->paintedWidth = heightScale * qreal(d->pix.width()); d->paintedHeight = height(); } + if (widthValid() && !heightValid()) { + setImplicitHeight(d->paintedHeight); + } + if (heightValid() && !widthValid()) { + setImplicitWidth(d->paintedWidth); + } } else { d->paintedWidth = width(); d->paintedHeight = height(); diff --git a/src/declarative/graphicsitems/qdeclarativeitem.cpp b/src/declarative/graphicsitems/qdeclarativeitem.cpp index 55a81f4..86dbaf0 100644 --- a/src/declarative/graphicsitems/qdeclarativeitem.cpp +++ b/src/declarative/graphicsitems/qdeclarativeitem.cpp @@ -2507,7 +2507,7 @@ QDeclarativeStateGroup *QDeclarativeItemPrivate::states() return _stateGroup; } -QDeclarativeItemPrivate::AnchorLines::AnchorLines(QDeclarativeItem *q) +QDeclarativeItemPrivate::AnchorLines::AnchorLines(QGraphicsObject *q) { left.item = q; left.anchorLine = QDeclarativeAnchorLine::Left; diff --git a/src/declarative/graphicsitems/qdeclarativeitem.h b/src/declarative/graphicsitems/qdeclarativeitem.h index 917e480..51889f6 100644 --- a/src/declarative/graphicsitems/qdeclarativeitem.h +++ b/src/declarative/graphicsitems/qdeclarativeitem.h @@ -59,7 +59,7 @@ QT_BEGIN_NAMESPACE QT_MODULE(Declarative) class QDeclarativeState; -struct QDeclarativeAnchorLine; +class QDeclarativeAnchorLine; class QDeclarativeTransition; class QDeclarativeKeyEvent; class QDeclarativeAnchors; @@ -91,7 +91,6 @@ class Q_DECLARATIVE_EXPORT QDeclarativeItem : public QGraphicsObject, public QDe Q_PROPERTY(QDeclarativeListProperty<QGraphicsTransform> transform READ transform DESIGNABLE false FINAL) Q_PROPERTY(TransformOrigin transformOrigin READ transformOrigin WRITE setTransformOrigin NOTIFY transformOriginChanged) Q_PROPERTY(bool smooth READ smooth WRITE setSmooth NOTIFY smoothChanged) - Q_PROPERTY(QGraphicsEffect *effect READ graphicsEffect WRITE setGraphicsEffect) Q_ENUMS(TransformOrigin) Q_CLASSINFO("DefaultProperty", "data") diff --git a/src/declarative/graphicsitems/qdeclarativeitem_p.h b/src/declarative/graphicsitems/qdeclarativeitem_p.h index 2607137..cf138c3 100644 --- a/src/declarative/graphicsitems/qdeclarativeitem_p.h +++ b/src/declarative/graphicsitems/qdeclarativeitem_p.h @@ -120,6 +120,7 @@ public: mWidth(0), mHeight(0), implicitWidth(0), implicitHeight(0) { QGraphicsItemPrivate::acceptedMouseButtons = 0; + isDeclarativeItem = 1; QGraphicsItemPrivate::flags = QGraphicsItem::GraphicsItemFlags( QGraphicsItem::ItemHasNoContents | QGraphicsItem::ItemIsFocusable @@ -183,7 +184,7 @@ public: QDeclarativeNullableValue<qreal> _baselineOffset; struct AnchorLines { - AnchorLines(QDeclarativeItem *); + AnchorLines(QGraphicsObject *); QDeclarativeAnchorLine left; QDeclarativeAnchorLine right; QDeclarativeAnchorLine hCenter; diff --git a/src/declarative/graphicsitems/qdeclarativeitemsmodule.cpp b/src/declarative/graphicsitems/qdeclarativeitemsmodule.cpp index 8e5b863..2d01eef 100644 --- a/src/declarative/graphicsitems/qdeclarativeitemsmodule.cpp +++ b/src/declarative/graphicsitems/qdeclarativeitemsmodule.cpp @@ -73,6 +73,7 @@ #include "private/qdeclarativetextedit_p.h" #include "private/qdeclarativetextinput_p.h" #include "private/qdeclarativevisualitemmodel_p.h" +#include "private/qdeclarativegraphicswidget_p.h" #ifdef QT_WEBKIT_LIB #include "private/qdeclarativewebview_p.h" #include "private/qdeclarativewebview_p_p.h" @@ -81,13 +82,12 @@ void QDeclarativeItemModule::defineModule() { +#ifndef QT_NO_MOVIE qmlRegisterType<QDeclarativeAnimatedImage>("Qt",4,6,"AnimatedImage"); - qmlRegisterType<QGraphicsBlurEffect>("Qt",4,6,"Blur"); +#endif qmlRegisterType<QDeclarativeBorderImage>("Qt",4,6,"BorderImage"); - qmlRegisterType<QGraphicsColorizeEffect>("Qt",4,6,"Colorize"); qmlRegisterType<QDeclarativeColumn>("Qt",4,6,"Column"); qmlRegisterType<QDeclarativeDrag>("Qt",4,6,"Drag"); - qmlRegisterType<QGraphicsDropShadowEffect>("Qt",4,6,"DropShadow"); qmlRegisterType<QDeclarativeFlickable>("Qt",4,6,"Flickable"); qmlRegisterType<QDeclarativeFlipable>("Qt",4,6,"Flipable"); qmlRegisterType<QDeclarativeFlow>("Qt",4,6,"Flow"); @@ -103,7 +103,6 @@ void QDeclarativeItemModule::defineModule() qmlRegisterType<QDeclarativeListView>("Qt",4,6,"ListView"); qmlRegisterType<QDeclarativeLoader>("Qt",4,6,"Loader"); qmlRegisterType<QDeclarativeMouseArea>("Qt",4,6,"MouseArea"); - qmlRegisterType<QGraphicsOpacityEffect>("Qt",4,6,"Opacity"); qmlRegisterType<QDeclarativePath>("Qt",4,6,"Path"); qmlRegisterType<QDeclarativePathAttribute>("Qt",4,6,"PathAttribute"); qmlRegisterType<QDeclarativePathCubic>("Qt",4,6,"PathCubic"); @@ -128,11 +127,11 @@ void QDeclarativeItemModule::defineModule() qmlRegisterType<QDeclarativeVisualItemModel>("Qt",4,6,"VisualItemModel"); qmlRegisterType<QDeclarativeAnchors>(); - qmlRegisterType<QGraphicsEffect>(); qmlRegisterType<QDeclarativeKeyEvent>(); qmlRegisterType<QDeclarativeMouseEvent>(); qmlRegisterType<QGraphicsObject>(); - qmlRegisterType<QGraphicsWidget>(); + qmlRegisterType<QGraphicsWidget>("Qt",4,6,"QGraphicsWidget"); + qmlRegisterExtendedType<QGraphicsWidget,QDeclarativeGraphicsWidget>("Qt",4,6,"QGraphicsWidget"); qmlRegisterType<QGraphicsTransform>(); qmlRegisterType<QDeclarativePathElement>(); qmlRegisterType<QDeclarativeCurve>(); @@ -142,6 +141,13 @@ void QDeclarativeItemModule::defineModule() qmlRegisterType<QAction>(); qmlRegisterType<QDeclarativePen>(); qmlRegisterType<QDeclarativeFlickableVisibleArea>(); +#ifndef QT_NO_GRAPHICSEFFECT + qmlRegisterType<QGraphicsEffect>(); + qmlRegisterType<QGraphicsBlurEffect>("Qt",4,6,"Blur"); + qmlRegisterType<QGraphicsColorizeEffect>("Qt",4,6,"Colorize"); + qmlRegisterType<QGraphicsDropShadowEffect>("Qt",4,6,"DropShadow"); + qmlRegisterType<QGraphicsOpacityEffect>("Qt",4,6,"Opacity"); +#endif #ifdef QT_WEBKIT_LIB qmlRegisterType<QDeclarativeWebSettings>(); #endif diff --git a/src/declarative/graphicsitems/qdeclarativelistview.cpp b/src/declarative/graphicsitems/qdeclarativelistview.cpp index b4506ef..cf7b96f 100644 --- a/src/declarative/graphicsitems/qdeclarativelistview.cpp +++ b/src/declarative/graphicsitems/qdeclarativelistview.cpp @@ -770,8 +770,6 @@ void QDeclarativeListViewPrivate::updateTrackedItem() if (highlight) item = highlight; - FxListItem *oldTracked = trackedItem; - const char *notifier1 = orient == QDeclarativeListView::Vertical ? SIGNAL(yChanged()) : SIGNAL(xChanged()); const char *notifier2 = orient == QDeclarativeListView::Vertical ? SIGNAL(heightChanged()) : SIGNAL(widthChanged()); @@ -786,7 +784,7 @@ void QDeclarativeListViewPrivate::updateTrackedItem() QObject::connect(trackedItem->item, notifier1, q, SLOT(trackedPositionChanged())); QObject::connect(trackedItem->item, notifier2, q, SLOT(trackedPositionChanged())); } - if (trackedItem && trackedItem != oldTracked) + if (trackedItem) q->trackedPositionChanged(); } @@ -1364,10 +1362,10 @@ QDeclarativeListView::~QDeclarativeListView() id: myDelegate Item { id: wrapper - SequentialAnimation on ListView.onRemove { - PropertyAction { target: wrapper.ListView; property: "delayRemove"; value: true } + ListView.onRemove: SequentialAnimation { + PropertyAction { target: wrapper; property: "ListView.delayRemove"; value: true } NumberAnimation { target: wrapper; property: "scale"; to: 0; duration: 250; easing.type: "InOutQuad" } - PropertyAction { target: wrapper.ListView; property: "delayRemove"; value: false } + PropertyAction { target: wrapper; property: "ListView.delayRemove"; value: false } } } } diff --git a/src/declarative/graphicsitems/qdeclarativepathview.cpp b/src/declarative/graphicsitems/qdeclarativepathview.cpp index 06e3540..4aaa28d 100644 --- a/src/declarative/graphicsitems/qdeclarativepathview.cpp +++ b/src/declarative/graphicsitems/qdeclarativepathview.cpp @@ -1102,7 +1102,6 @@ void QDeclarativePathView::refill() // qDebug() << "append" << idx; QDeclarativeItem *item = d->getItem(idx); item->setZValue(idx+1); - d->model->completeItem(); if (d->currentIndex == idx) { item->setFocus(true); if (QDeclarativePathViewAttached *att = d->attached(item)) @@ -1115,6 +1114,7 @@ void QDeclarativePathView::refill() d->firstIndex = idx; d->items.append(item); d->updateItem(item, pos); + d->model->completeItem(); ++idx; if (idx >= d->model->count()) idx = 0; @@ -1129,7 +1129,6 @@ void QDeclarativePathView::refill() // qDebug() << "prepend" << idx; QDeclarativeItem *item = d->getItem(idx); item->setZValue(idx+1); - d->model->completeItem(); if (d->currentIndex == idx) { item->setFocus(true); if (QDeclarativePathViewAttached *att = d->attached(item)) @@ -1140,6 +1139,7 @@ void QDeclarativePathView::refill() } d->items.prepend(item); d->updateItem(item, pos); + d->model->completeItem(); d->firstIndex = idx; idx = d->firstIndex - 1; if (idx < 0) diff --git a/src/declarative/graphicsitems/qdeclarativepositioners.cpp b/src/declarative/graphicsitems/qdeclarativepositioners.cpp index d33a8be..f436471 100644 --- a/src/declarative/graphicsitems/qdeclarativepositioners.cpp +++ b/src/declarative/graphicsitems/qdeclarativepositioners.cpp @@ -700,14 +700,15 @@ void QDeclarativeGrid::setRows(const int rows) void QDeclarativeGrid::doPositioning(QSizeF *contentSize) { - int c=_columns,r=_rows;//Actual number of rows/columns + int c = _columns; + int r = _rows; int numVisible = positionedItems.count(); - if (_columns==-1 && _rows==-1){ + if (_columns <= 0 && _rows <= 0){ c = 4; r = (numVisible+3)/4; - }else if (_rows==-1){ + } else if (_rows <= 0){ r = (numVisible+(_columns-1))/_columns; - }else if (_columns==-1){ + } else if (_columns <= 0){ c = (numVisible+(_rows-1))/_rows; } diff --git a/src/declarative/graphicsitems/qdeclarativetextinput.cpp b/src/declarative/graphicsitems/qdeclarativetextinput.cpp index 89ec834..e00d333 100644 --- a/src/declarative/graphicsitems/qdeclarativetextinput.cpp +++ b/src/declarative/graphicsitems/qdeclarativetextinput.cpp @@ -554,6 +554,75 @@ void QDeclarativeTextInput::setAutoScroll(bool b) } /*! + \qmlclass IntValidator QIntValidator + + This element provides a validator for integer values +*/ +/*! + \qmlproperty int IntValidator::top + + This property holds the validator's highest acceptable value. + By default, this property's value is derived from the highest signed integer available (typically 2147483647). +*/ +/*! + \qmlproperty int IntValidator::bottom + + This property holds the validator's lowest acceptable value. + By default, this property's value is derived from the lowest signed integer available (typically -2147483647). +*/ + +/*! + \qmlclass DoubleValidator QDoubleValidator + + This element provides a validator for non-integer numbers. +*/ + +/*! + \qmlproperty real DoubleValidator::top + + This property holds the validator's maximum acceptable value. + By default, this property contains a value of infinity. +*/ +/*! + \qmlproperty real DoubleValidator::bottom + + This property holds the validator's minimum acceptable value. + By default, this property contains a value of -infinity. +*/ +/*! + \qmlproperty int DoubleValidator::decimals + + This property holds the validator's maximum number of digits after the decimal point. + By default, this property contains a value of 1000. +*/ +/*! + \qmlproperty enumeration DoubleValidator::notation + This property holds the notation of how a string can describe a number. + + The values for this property are DoubleValidator.StandardNotation or DoubleValidator.ScientificNotation. + If this property is set to ScientificNotation, the written number may have an exponent part(i.e. 1.5E-2). + + By default, this property is set to ScientificNotation. +*/ + +/*! + \qmlclass RegExpValidator QRegExpValidator + + This element provides a validator, which counts as valid any string which + matches a specified regular expression. +*/ +/*! + \qmlproperty regExp RegExpValidator::regExp + + This property holds the regular expression used for validation. + + Note that this property should be a regular expression in JS syntax, e.g /a/ for the regular expression + matching "a". + + By default, this property contains a regular expression with the pattern .* that matches any string. +*/ + +/*! \qmlproperty Validator TextInput::validator Allows you to set a validator on the TextInput. When a validator is set @@ -562,15 +631,7 @@ void QDeclarativeTextInput::setAutoScroll(bool b) if the text is in an acceptable state when enter is pressed. Currently supported validators are IntValidator, DoubleValidator and - RegExpValidator. For details, refer to their C++ documentation (QIntValidator, - QDoubleValidator, and QRegExpValidator) and remember - that all Q_PROPERTIES are accessible from Qml. A brief usage guide follows: - - IntValidator and DoubleValidator both are controllable through two properties, - top and bottom. The difference is that for IntValidator the top and bottom properties - should be integers, and for DoubleValidator they should be doubles. RegExpValidator - has a single string property, regExp, which should be set to the regular expression to - be used for validation. An example of using validators is shown below, which allows + RegExpValidator. An example of using validators is shown below, which allows input of integers between 11 and 31 into the text input: \code diff --git a/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp b/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp index 15348ed..03e4703 100644 --- a/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp +++ b/src/declarative/graphicsitems/qdeclarativevisualitemmodel.cpp @@ -243,7 +243,7 @@ public: QString m_part; QDeclarativeComponent *m_delegate; - QDeclarativeContext *m_context; + QDeclarativeGuard<QDeclarativeContext> m_context; QList<int> m_roles; QHash<QByteArray,int> m_roleNames; void ensureRoles() { @@ -1127,20 +1127,21 @@ void QDeclarativeVisualDataModel::_q_itemsChanged(int index, int count, const QList<int> &roles) { Q_D(QDeclarativeVisualDataModel); - // XXX - highly inefficient - for (int ii = index; ii < index + count; ++ii) { - - if (QObject *item = d->m_cache.item(ii)) { - QDeclarativeVisualDataModelData *data = d->data(item); + for (QHash<int,QDeclarativeVisualDataModelPrivate::ObjectRef>::ConstIterator iter = d->m_cache.begin(); + iter != d->m_cache.end(); ++iter) { + const int idx = iter.key(); + if (idx >= index && idx < index+count) { + QDeclarativeVisualDataModelPrivate::ObjectRef objRef = *iter; + QDeclarativeVisualDataModelData *data = d->data(objRef.obj); for (int roleIdx = 0; roleIdx < roles.count(); ++roleIdx) { int role = roles.at(roleIdx); int propId = data->propForRole(role); if (propId != -1) { if (d->m_listModelInterface) { - data->setValue(propId, d->m_listModelInterface->data(ii, QList<int>() << role).value(role)); + data->setValue(propId, d->m_listModelInterface->data(idx, QList<int>() << role).value(role)); } else if (d->m_abstractItemModel) { - QModelIndex index = d->m_abstractItemModel->index(ii, 0, d->m_root); + QModelIndex index = d->m_abstractItemModel->index(idx, 0, d->m_root); data->setValue(propId, d->m_abstractItemModel->data(index, role)); } } diff --git a/src/declarative/qml/qdeclarativebinding.cpp b/src/declarative/qml/qdeclarativebinding.cpp index e172a8b..664118d 100644 --- a/src/declarative/qml/qdeclarativebinding.cpp +++ b/src/declarative/qml/qdeclarativebinding.cpp @@ -126,7 +126,7 @@ void QDeclarativeBinding::update(QDeclarativePropertyPrivate::WriteFlags flags) QDeclarativeBindingData *data = d->bindingData(); - if (!data->enabled || !data->context() || !data->context()->engine) + if (!data->enabled || !data->context() || !data->context()->isValid()) return; data->addref(); diff --git a/src/declarative/qml/qdeclarativeboundsignal.cpp b/src/declarative/qml/qdeclarativeboundsignal.cpp index 762c6428..8c7a977 100644 --- a/src/declarative/qml/qdeclarativeboundsignal.cpp +++ b/src/declarative/qml/qdeclarativeboundsignal.cpp @@ -176,7 +176,7 @@ int QDeclarativeBoundSignal::qt_metacall(QMetaObject::Call c, int id, void **a) } if (m_params) m_params->setValues(a); - if (m_expression) { + if (m_expression && m_expression->engine()) { QDeclarativeExpressionPrivate::get(m_expression)->value(m_params); if (m_expression && m_expression->hasError()) qWarning().nospace() << qPrintable(m_expression->error().toString()); diff --git a/src/declarative/qml/qdeclarativecompiledbindings.cpp b/src/declarative/qml/qdeclarativecompiledbindings.cpp index 0c824fc..6fdf706 100644 --- a/src/declarative/qml/qdeclarativecompiledbindings.cpp +++ b/src/declarative/qml/qdeclarativecompiledbindings.cpp @@ -285,12 +285,7 @@ void QDeclarativeCompiledBindingsPrivate::run(Binding *binding, QDeclarativeProp return; QDeclarativeContextData *context = q->QDeclarativeAbstractExpression::context(); - if (!context) { - qWarning("QDeclarativeCompiledBindings: Attempted to evaluate an expression in an invalid context"); - return; - } - - if (!context->engine) + if (!context || !context->isValid()) return; if (binding->updating) { diff --git a/src/declarative/qml/qdeclarativecomponent.cpp b/src/declarative/qml/qdeclarativecomponent.cpp index e180374..5f26ad5 100644 --- a/src/declarative/qml/qdeclarativecomponent.cpp +++ b/src/declarative/qml/qdeclarativecomponent.cpp @@ -320,6 +320,9 @@ QDeclarativeComponent::QDeclarativeComponent(QDeclarativeEngine *engine, QObject Create a QDeclarativeComponent from the given \a url and give it the specified \a parent and \a engine. + Ensure that the URL provided is full and correct, in particular, use + \l QUrl::fromLocalFile() when loading a file from the local filesystem. + \sa loadUrl() */ QDeclarativeComponent::QDeclarativeComponent(QDeclarativeEngine *engine, const QUrl &url, QObject *parent) @@ -409,6 +412,9 @@ QDeclarativeContext *QDeclarativeComponent::creationContext() const /*! Load the QDeclarativeComponent from the provided \a url. + + Ensure that the URL provided is full and correct, in particular, use + \l QUrl::fromLocalFile() when loading a file from the local filesystem. */ void QDeclarativeComponent::loadUrl(const QUrl &url) { @@ -591,6 +597,11 @@ QDeclarativeComponentPrivate::beginCreate(QDeclarativeContextData *context, cons return 0; } + if (!context->isValid()) { + qWarning("QDeclarativeComponent::beginCreate(): Cannot create a component in an invalid context"); + return 0; + } + if (context->engine != engine) { qWarning("QDeclarativeComponent::beginCreate(): Must create component in context from the same QDeclarativeEngine"); return 0; diff --git a/src/declarative/qml/qdeclarativecompositetypemanager.cpp b/src/declarative/qml/qdeclarativecompositetypemanager.cpp index 05e8d22..133b71f 100644 --- a/src/declarative/qml/qdeclarativecompositetypemanager.cpp +++ b/src/declarative/qml/qdeclarativecompositetypemanager.cpp @@ -723,6 +723,10 @@ void QDeclarativeCompositeTypeManager::compile(QDeclarativeCompositeTypeData *un } } + QUrl importUrl = unit->imports.baseUrl().resolved(QUrl(QLatin1String("qmldir"))); + if (toLocalFileOrQrc(importUrl).isEmpty()) + resourceList.prepend(importUrl); + for (int ii = 0; ii < resourceList.count(); ++ii) { QUrl url = unit->imports.baseUrl().resolved(resourceList.at(ii)); diff --git a/src/declarative/qml/qdeclarativecontext.cpp b/src/declarative/qml/qdeclarativecontext.cpp index 9307bcc..ba4da95 100644 --- a/src/declarative/qml/qdeclarativecontext.cpp +++ b/src/declarative/qml/qdeclarativecontext.cpp @@ -202,6 +202,12 @@ QDeclarativeContext::~QDeclarativeContext() d->data->destroy(); } +bool QDeclarativeContext::isValid() const +{ + Q_D(const QDeclarativeContext); + return d->data && d->data->isValid(); +} + /*! Return the context's QDeclarativeEngine, or 0 if the context has no QDeclarativeEngine or the QDeclarativeEngine was destroyed. @@ -245,6 +251,11 @@ void QDeclarativeContext::setContextObject(QObject *object) return; } + if (!isValid()) { + qWarning("QDeclarativeContext: Cannot set context object on invalid context."); + return; + } + data->contextObject = object; } @@ -264,6 +275,11 @@ void QDeclarativeContext::setContextProperty(const QString &name, const QVariant return; } + if (!isValid()) { + qWarning("QDeclarativeContext: Cannot set property on invalid context."); + return; + } + if (data->engine) { bool ok; QObject *o = QDeclarativeEnginePrivate::get(data->engine)->toQObject(value, &ok); @@ -305,6 +321,11 @@ void QDeclarativeContext::setContextProperty(const QString &name, QObject *value return; } + if (!isValid()) { + qWarning("QDeclarativeContext: Cannot set property on invalid context."); + return; + } + if (!data->propertyNames) data->propertyNames = new QDeclarativeIntegerCache(data->engine); int idx = data->propertyNames->value(name); diff --git a/src/declarative/qml/qdeclarativecontext.h b/src/declarative/qml/qdeclarativecontext.h index a349628..94c9f4a 100644 --- a/src/declarative/qml/qdeclarativecontext.h +++ b/src/declarative/qml/qdeclarativecontext.h @@ -46,6 +46,7 @@ #include <QtCore/qobject.h> #include <QtScript/qscriptvalue.h> #include <QtCore/qmetatype.h> +#include <QtCore/qvariant.h> QT_BEGIN_HEADER @@ -70,6 +71,8 @@ public: QDeclarativeContext(QDeclarativeContext *parent, QObject *objParent=0); virtual ~QDeclarativeContext(); + bool isValid() const; + QDeclarativeEngine *engine() const; QDeclarativeContext *parentContext() const; diff --git a/src/declarative/qml/qdeclarativecontext_p.h b/src/declarative/qml/qdeclarativecontext_p.h index eee72b6..7a16179 100644 --- a/src/declarative/qml/qdeclarativecontext_p.h +++ b/src/declarative/qml/qdeclarativecontext_p.h @@ -114,6 +114,10 @@ public: QDeclarativeContextData(QDeclarativeContext *); void destroy(); + inline bool isValid() const { + return engine && (!isInternal || !contextObject || !QObjectPrivate::get(contextObject)->wasDeleted); + } + // My parent context and engine QDeclarativeContextData *parent; QDeclarativeEngine *engine; diff --git a/src/declarative/qml/qdeclarativeengine.cpp b/src/declarative/qml/qdeclarativeengine.cpp index f1adc16..c5afe92 100644 --- a/src/declarative/qml/qdeclarativeengine.cpp +++ b/src/declarative/qml/qdeclarativeengine.cpp @@ -212,10 +212,13 @@ QDeclarativeScriptEngine::QDeclarativeScriptEngine(QDeclarativeEnginePrivate *pr newQMetaObject(StaticQtMetaObject::get()); globalObject().setProperty(QLatin1String("Qt"), qtObject); +#ifndef QT_NO_DESKTOPSERVICES offlineStoragePath = QDesktopServices::storageLocation(QDesktopServices::DataLocation).replace(QLatin1Char('/'), QDir::separator()) + QDir::separator() + QLatin1String("QML") + QDir::separator() + QLatin1String("OfflineStorage"); - +#else + qWarning("offlineStoragePath is not set by default with QT_NO_DESKTOPSERVICES"); +#endif qt_add_qmlxmlhttprequest(this); qt_add_qmlsqldatabase(this); @@ -848,6 +851,9 @@ void QDeclarativeDeclarativeData::destroyed(QObject *object) if (propertyCache) propertyCache->release(); + if (ownContext) + context->destroy(); + QDeclarativeGuard<QObject> *guard = guards; while (guard) { QDeclarativeGuard<QObject> *g = guard; @@ -858,9 +864,6 @@ void QDeclarativeDeclarativeData::destroyed(QObject *object) g->objectDestroyed(object); } - if (ownContext) - context->destroy(); - if (scriptValue) delete scriptValue; @@ -1214,7 +1217,10 @@ QScriptValue QDeclarativeEnginePrivate::desktopOpenUrl(QScriptContext *ctxt, QSc { if(ctxt->argumentCount() < 1) return e->newVariant(QVariant(false)); - bool ret = QDesktopServices::openUrl(QUrl(ctxt->argument(0).toString())); + bool ret = false; +#ifndef QT_NO_DESKTOPSERVICES + ret = QDesktopServices::openUrl(QUrl(ctxt->argument(0).toString())); +#endif return e->newVariant(QVariant(ret)); } @@ -1486,13 +1492,17 @@ public: QSet<QString> qmlDirFilesForWhichPluginsHaveBeenLoaded; - QDeclarativeDirComponents importExtension(const QString &absoluteFilePath, const QString &uri, QDeclarativeEngine *engine) { + bool importExtension(const QString &absoluteFilePath, const QString &uri, QDeclarativeEngine *engine, QDeclarativeDirComponents* components, QString *errorString) { QFile file(absoluteFilePath); QString filecontent; if (file.open(QFile::ReadOnly)) { filecontent = QString::fromUtf8(file.readAll()); if (qmlImportTrace()) qDebug() << "QDeclarativeEngine::add: loaded" << absoluteFilePath; + } else { + if (errorString) + *errorString = QDeclarativeEngine::tr("module \"%1\" definition \"%2\" not readable").arg(uri).arg(absoluteFilePath); + return false; } QDir dir = QFileInfo(file).dir(); @@ -1512,11 +1522,23 @@ public: plugin.name); if (!resolvedFilePath.isEmpty()) { - engine->importPlugin(resolvedFilePath, uri); + if (!engine->importPlugin(resolvedFilePath, uri, errorString)) { + if (errorString) + *errorString = QDeclarativeEngine::tr("plugin cannot be loaded for module \"%1\": %2").arg(uri).arg(*errorString); + return false; + } + } else { + if (errorString) + *errorString = QDeclarativeEngine::tr("module \"%1\" plugin \"%2\" not found").arg(uri).arg(plugin.name); + return false; } } } - return qmldirParser.components(); + + if (components) + *components = qmldirParser.components(); + + return true; } QString resolvedUri(const QString &dir_arg, QDeclarativeEngine *engine) @@ -1577,7 +1599,8 @@ public: url = QUrl::fromLocalFile(fi.absolutePath()).toString(); uri = resolvedUri(dir, engine); - qmldircomponents = importExtension(absoluteFilePath, uri, engine); + if (!importExtension(absoluteFilePath, uri, engine, &qmldircomponents, errorString)) + return false; break; } } @@ -1608,12 +1631,12 @@ public: return false; // local import dirs must exist } uri = resolvedUri(toLocalFileOrQrc(base.resolved(QUrl(uri))), engine); - qmldircomponents = importExtension(localFileOrQrc, - uri, - engine); - if (uri.endsWith(QLatin1Char('/'))) uri.chop(1); + if (QFile::exists(localFileOrQrc)) { + if (!importExtension(localFileOrQrc,uri,engine,&qmldircomponents,errorString)) + return false; + } } else { if (prefix.isEmpty()) { // directory must at least exist for valid import @@ -1926,8 +1949,10 @@ void QDeclarativeEngine::setPluginPathList(const QStringList &paths) /*! Imports the plugin named \a filePath with the \a uri provided. Returns true if the plugin was successfully imported; otherwise returns false. + + The plugin has to be a Qt plugin which implements the QDeclarativeExtensionPlugin interface. */ -bool QDeclarativeEngine::importPlugin(const QString &filePath, const QString &uri) +bool QDeclarativeEngine::importPlugin(const QString &filePath, const QString &uri, QString *errorString) { if (qmlImportTrace()) qDebug() << "QDeclarativeEngine::importPlugin" << uri << "from" << filePath; @@ -1948,9 +1973,8 @@ bool QDeclarativeEngine::importPlugin(const QString &filePath, const QString &ur QPluginLoader loader(absoluteFilePath); if (!loader.load()) { - if (qmlImportTrace()) { - qDebug() << "QDeclarativeEngine::importPlugin: " << loader.errorString(); - } + if (errorString) + *errorString = loader.errorString(); return false; } @@ -1972,8 +1996,8 @@ bool QDeclarativeEngine::importPlugin(const QString &filePath, const QString &ur iface->initializeEngine(this, moduleId); } } else { - if (qmlImportTrace()) - qDebug() << "QDeclarativeEngine::importPlugin: no DeclarativeExtensionInterface error"; + if (errorString) + *errorString = loader.errorString(); return false; } } diff --git a/src/declarative/qml/qdeclarativeengine.h b/src/declarative/qml/qdeclarativeengine.h index fcaddcf..7b058ea 100644 --- a/src/declarative/qml/qdeclarativeengine.h +++ b/src/declarative/qml/qdeclarativeengine.h @@ -85,7 +85,7 @@ public: void setPluginPathList(const QStringList &paths); void addPluginPath(const QString& dir); - bool importPlugin(const QString &filePath, const QString &uri); + bool importPlugin(const QString &filePath, const QString &uri, QString *errorString); void setNetworkAccessManagerFactory(QDeclarativeNetworkAccessManagerFactory *); QDeclarativeNetworkAccessManagerFactory *networkAccessManagerFactory() const; diff --git a/src/declarative/qml/qdeclarativeexpression.cpp b/src/declarative/qml/qdeclarativeexpression.cpp index 2a3e557..05240a2 100644 --- a/src/declarative/qml/qdeclarativeexpression.cpp +++ b/src/declarative/qml/qdeclarativeexpression.cpp @@ -468,7 +468,7 @@ QVariant QDeclarativeExpressionPrivate::value(QObject *secondaryScope, bool *isU { Q_Q(QDeclarativeExpression); - if (!q->engine()) { + if (!data || !data->context() || !data->context()->isValid()) { qWarning("QDeclarativeExpression: Attempted to evaluate an expression in an invalid context"); return QVariant(); } diff --git a/src/declarative/qml/qdeclarativeextensionplugin.cpp b/src/declarative/qml/qdeclarativeextensionplugin.cpp index 5b7f1e8..762c642d 100644 --- a/src/declarative/qml/qdeclarativeextensionplugin.cpp +++ b/src/declarative/qml/qdeclarativeextensionplugin.cpp @@ -55,17 +55,21 @@ QT_BEGIN_NAMESPACE applications using the QDeclarativeEngine class. Writing a QML extension plugin is achieved by subclassing this - base class, reimplementing the pure virtual initialize() + base class, reimplementing the pure virtual registerTypes() function, and exporting the class using the Q_EXPORT_PLUGIN2() - macro. See \l {How to Create Qt Plugins} for details. + macro. - \sa QDeclarativeEngine::importExtension() + See \l {Extending QML in C++} for details how to write a QML extension plugin. + See \l {How to Create Qt Plugins} for general Qt plugin documentation. + + \sa QDeclarativeEngine::importPlugin() */ /*! \fn void QDeclarativeExtensionPlugin::registerTypes(const char *uri) - Registers the QML types in the given \a uri. + Registers the QML types in the given \a uri. Here you call qmlRegisterType() for + all types which are provided by the extension plugin. */ /*! diff --git a/src/declarative/qml/qdeclarativevme.cpp b/src/declarative/qml/qdeclarativevme.cpp index 0addfabd..3575c17 100644 --- a/src/declarative/qml/qdeclarativevme.cpp +++ b/src/declarative/qml/qdeclarativevme.cpp @@ -246,12 +246,7 @@ QObject *QDeclarativeVME::run(QDeclarativeVMEStack<QObject *> &stack, { QObject *o = (QObject *)operator new(instr.createSimple.typeSize + sizeof(QDeclarativeDeclarativeData)); -#if defined(Q_OS_WIN32) || defined(Q_OS_WINCE) ::memset(o, 0, instr.createSimple.typeSize + sizeof(QDeclarativeDeclarativeData)); -#else - // faster than memset - ::bzero(o, instr.createSimple.typeSize + sizeof(QDeclarativeDeclarativeData)); -#endif instr.createSimple.create(o); QDeclarativeDeclarativeData *ddata = diff --git a/src/declarative/util/qdeclarativelistmodel.cpp b/src/declarative/util/qdeclarativelistmodel.cpp index e3680f2..2616ccf 100644 --- a/src/declarative/util/qdeclarativelistmodel.cpp +++ b/src/declarative/util/qdeclarativelistmodel.cpp @@ -219,13 +219,13 @@ QDeclarativeListModelParser::ListInstruction *QDeclarativeListModelParser::ListM \tt dataloader.js, which appends the current time to the list model. Note the call to sync() from the \c WorkerScript.onMessage() handler. - Without this call, the changes made to the list are not reflected in the - list model in the main thread. + You must call sync() or else the changes made to the list from the external + thread will not be reflected in the list model in the main thread. \section3 Limitations If a list model is to be accessed from a WorkerScript, it \bold cannot - contain nested list data. So, the following model cannot be used from a WorkerScript + contain list data. So, the following model cannot be used from a WorkerScript because of the list contained in the "attributes" property: \code @@ -242,7 +242,7 @@ QDeclarativeListModelParser::ListInstruction *QDeclarativeListModelParser::ListM } \endcode - In addition, the WorkerScript cannot add any nested list data to the model. + In addition, the WorkerScript cannot add any list data to the model. \sa {qmlmodels}{Data Models}, WorkerScript */ diff --git a/src/declarative/util/qdeclarativesmoothedfollow.cpp b/src/declarative/util/qdeclarativesmoothedfollow.cpp index 63c9618..9f155fc 100644 --- a/src/declarative/util/qdeclarativesmoothedfollow.cpp +++ b/src/declarative/util/qdeclarativesmoothedfollow.cpp @@ -86,7 +86,7 @@ public: The follow example shows one rectangle tracking the position of another. \code -import Qt 4.6 +import Qt 4.7 Rectangle { width: 800; height: 600; color: "blue" diff --git a/src/declarative/util/qdeclarativeview.cpp b/src/declarative/util/qdeclarativeview.cpp index 22a7873..c0425ef 100644 --- a/src/declarative/util/qdeclarativeview.cpp +++ b/src/declarative/util/qdeclarativeview.cpp @@ -204,7 +204,7 @@ void QDeclarativeViewPrivate::execute() QDeclarativeView *view = new QDeclarativeView(this); vbox->addWidget(view); - QUrl url(fileName); + QUrl url = QUrl::fromLocalFile(fileName); view->setSource(url); view->show(); \endcode @@ -279,11 +279,17 @@ QDeclarativeView::~QDeclarativeView() \brief The URL of the source of the QML component. Changing this property causes the QML component to be reloaded. + + Ensure that the URL provided is full and correct, in particular, use + \l QUrl::fromLocalFile() when loading a file from the local filesystem. */ /*! Sets the source to the \a url, loads the QML component and instantiates it. + Ensure that the URL provided is full and correct, in particular, use + \l QUrl::fromLocalFile() when loading a file from the local filesystem. + Calling this methods multiple times with the same url will result in the QML being reloaded. */ diff --git a/src/gui/animation/qguivariantanimation.cpp b/src/gui/animation/qguivariantanimation.cpp index 52303f5..28cde3e 100644 --- a/src/gui/animation/qguivariantanimation.cpp +++ b/src/gui/animation/qguivariantanimation.cpp @@ -38,12 +38,11 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ - -#ifndef QT_NO_ANIMATION - #include <QtCore/qvariantanimation.h> #include <private/qvariantanimation_p.h> +#ifndef QT_NO_ANIMATION + #include <QtGui/qcolor.h> #include <QtGui/qvector2d.h> #include <QtGui/qvector3d.h> diff --git a/src/gui/dialogs/qfiledialog.cpp b/src/gui/dialogs/qfiledialog.cpp index 3b5fb9f..cb74a3c 100644 --- a/src/gui/dialogs/qfiledialog.cpp +++ b/src/gui/dialogs/qfiledialog.cpp @@ -723,15 +723,19 @@ void QFileDialog::setVisible(bool visible) // Set WA_DontShowOnScreen so that QDialog::setVisible(visible) below // updates the state correctly, but skips showing the non-native version: setAttribute(Qt::WA_DontShowOnScreen); +#ifndef QT_NO_FSCOMPLETER //So the completer don't try to complete and therefore to show a popup d->completer->setModel(0); +#endif } else { d->nativeDialogInUse = false; setAttribute(Qt::WA_DontShowOnScreen, false); +#ifndef QT_NO_FSCOMPLETER if (d->proxyModel != 0) d->completer->setModel(d->proxyModel); else d->completer->setModel(d->model); +#endif } } diff --git a/src/gui/dialogs/qfiledialog_win.cpp b/src/gui/dialogs/qfiledialog_win.cpp index afeed8e..258707c 100644 --- a/src/gui/dialogs/qfiledialog_win.cpp +++ b/src/gui/dialogs/qfiledialog_win.cpp @@ -218,7 +218,6 @@ static OPENFILENAME* qt_win_make_OFN(QWidget *parent, memset(ofn, 0, sizeof(OPENFILENAME)); ofn->lStructSize = sizeof(OPENFILENAME); - Q_ASSERT(!parent ||parent->testAttribute(Qt::WA_WState_Created)); ofn->hwndOwner = parent ? parent->winId() : 0; ofn->lpstrFilter = (wchar_t*)tFilters.utf16(); ofn->lpstrFile = tInitSel; diff --git a/src/gui/dialogs/qprintdialog_unix.cpp b/src/gui/dialogs/qprintdialog_unix.cpp index 9b4d6e8..e3c62be 100644 --- a/src/gui/dialogs/qprintdialog_unix.cpp +++ b/src/gui/dialogs/qprintdialog_unix.cpp @@ -703,7 +703,7 @@ QUnixPrintWidgetPrivate::QUnixPrintWidgetPrivate(QUnixPrintWidget *p) } #endif -#ifndef QT_NO_FILESYSTEMMODEL +#if !defined(QT_NO_FILESYSTEMMODEL) && !defined(QT_NO_COMPLETER) QFileSystemModel *fsm = new QFileSystemModel(widget.filename); fsm->setRootPath(QDir::homePath()); widget.filename->setCompleter(new QCompleter(fsm, widget.filename)); diff --git a/src/gui/egl/qegl_p.h b/src/gui/egl/qegl_p.h index 540cd3d..f81add6 100644 --- a/src/gui/egl/qegl_p.h +++ b/src/gui/egl/qegl_p.h @@ -139,6 +139,12 @@ QT_BEGIN_NAMESPACE typedef void *EGLImageKHR; #define EGL_NO_IMAGE_KHR ((EGLImageKHR)0) #define EGL_IMAGE_PRESERVED_KHR 0x30D2 +#define EGL_KHR_image_base +#endif + +#if !defined(EGL_KHR_image) && !defined(EGL_KHR_image_pixmap) +#define EGL_NATIVE_PIXMAP_KHR 0x30B0 +#define EGL_KHR_image_pixmap #endif // It is possible that something has included eglext.h (like Symbian 10.1's broken egl.h), in @@ -154,9 +160,6 @@ extern Q_GUI_EXPORT _eglCreateImageKHR eglCreateImageKHR; extern Q_GUI_EXPORT _eglDestroyImageKHR eglDestroyImageKHR; #endif // (defined(EGL_KHR_image) || defined(EGL_KHR_image_base)) && !defined(EGL_EGLEXT_PROTOTYPES) -#if !defined(EGL_KHR_image) && !defined(EGL_KHR_image_pixmap) -#define EGL_NATIVE_PIXMAP_KHR 0x30B0 -#endif class QEglProperties; diff --git a/src/gui/egl/qegl_x11.cpp b/src/gui/egl/qegl_x11.cpp index 91423c8..5341ea1 100644 --- a/src/gui/egl/qegl_x11.cpp +++ b/src/gui/egl/qegl_x11.cpp @@ -147,9 +147,6 @@ VisualID QEgl::getCompatibleVisualId(EGLConfig config) EGLint configAlphaSize = 0; eglGetConfigAttrib(display(), config, EGL_ALPHA_SIZE, &configAlphaSize); - eglGetConfigAttrib(display(), config, EGL_BUFFER_SIZE, &eglValue); - int configBitDepth = eglValue; - eglGetConfigAttrib(display(), config, EGL_CONFIG_ID, &eglValue); int configId = eglValue; @@ -166,28 +163,53 @@ VisualID QEgl::getCompatibleVisualId(EGLConfig config) int matchingCount = 0; chosenVisualInfo = XGetVisualInfo(X11->display, VisualIDMask, &visualInfoTemplate, &matchingCount); if (chosenVisualInfo) { - if (configBitDepth == chosenVisualInfo->depth) { + int visualRedSize = countBits(chosenVisualInfo->red_mask); + int visualGreenSize = countBits(chosenVisualInfo->green_mask); + int visualBlueSize = countBits(chosenVisualInfo->blue_mask); + int visualAlphaSize = -1; // Need XRender to tell us the alpha channel size + #if !defined(QT_NO_XRENDER) + if (X11->use_xrender) { // If we have XRender, actually check the visual supplied by EGL is ARGB - if (configAlphaSize > 0) { - XRenderPictFormat *format; - format = XRenderFindVisualFormat(X11->display, chosenVisualInfo->visual); - if (!format || (format->type != PictTypeDirect) || (!format->direct.alphaMask)) { - qWarning("Warning: EGL suggested using X visual ID %d for config %d, but this is not ARGB", - (int)visualId, configId); - visualId = 0; - } - } + XRenderPictFormat *format; + format = XRenderFindVisualFormat(X11->display, chosenVisualInfo->visual); + if (format && (format->type == PictTypeDirect)) + visualAlphaSize = countBits(format->direct.alphaMask); + } #endif - } else { - qWarning("Warning: EGL suggested using X visual ID %d (%d bpp) for config %d (%d bpp), but the depths do not match!", - (int)visualId, chosenVisualInfo->depth, configId, configBitDepth); + + bool visualMatchesConfig = false; + if ( visualRedSize == configRedSize && + visualGreenSize == configGreenSize && + visualBlueSize == configBlueSize ) + { + // We need XRender to check the alpha channel size of the visual. If we don't have + // the alpha size, we don't check it against the EGL config's alpha size. + if (visualAlphaSize >= 0) + visualMatchesConfig = visualAlphaSize == configAlphaSize; + else + visualMatchesConfig = true; + } + + if (!visualMatchesConfig) { + if (visualAlphaSize >= 0) { + qWarning("Warning: EGL suggested using X Visual ID %d (ARGB%d%d%d%d) for EGL config %d (ARGB%d%d%d%d), but this is incompatable", + (int)visualId, visualAlphaSize, visualRedSize, visualGreenSize, visualBlueSize, + configId, configAlphaSize, configRedSize, configGreenSize, configBlueSize); + } else { + qWarning("Warning: EGL suggested using X Visual ID %d (RGB%d%d%d) for EGL config %d (RGB%d%d%d), but this is incompatable", + (int)visualId, visualRedSize, visualGreenSize, visualBlueSize, + configId, configRedSize, configGreenSize, configBlueSize); + } visualId = 0; } + } else { + qWarning("Warning: EGL suggested using X Visual ID %d for EGL config %d, but that isn't a valid ID", + (int)visualId, configId); + visualId = 0; } XFree(chosenVisualInfo); } - if (visualId) { #ifdef QT_DEBUG_X11_VISUAL_SELECTION if (configAlphaSize > 0) @@ -201,17 +223,16 @@ VisualID QEgl::getCompatibleVisualId(EGLConfig config) // If EGL didn't give us a valid visual ID, try XRender #if !defined(QT_NO_XRENDER) - if (!visualId) { + if (!visualId && X11->use_xrender) { XVisualInfo visualInfoTemplate; memset(&visualInfoTemplate, 0, sizeof(XVisualInfo)); - visualInfoTemplate.depth = configBitDepth; visualInfoTemplate.c_class = TrueColor; XVisualInfo *matchingVisuals; int matchingCount = 0; matchingVisuals = XGetVisualInfo(X11->display, - VisualDepthMask|VisualClassMask, + VisualClassMask, &visualInfoTemplate, &matchingCount); @@ -246,19 +267,27 @@ VisualID QEgl::getCompatibleVisualId(EGLConfig config) // Finally, if XRender also failed to find a visual (or isn't present), try to - // use XGetVisualInfo and only use the bit depth to match on: + // use XGetVisualInfo and only use the bit depths to match on: if (!visualId) { XVisualInfo visualInfoTemplate; memset(&visualInfoTemplate, 0, sizeof(XVisualInfo)); - - visualInfoTemplate.depth = configBitDepth; - XVisualInfo *matchingVisuals; int matchingCount = 0; + + visualInfoTemplate.depth = configRedSize + configGreenSize + configBlueSize + configAlphaSize; matchingVisuals = XGetVisualInfo(X11->display, VisualDepthMask, &visualInfoTemplate, &matchingCount); + if (!matchingVisuals) { + // Try again without taking the alpha channel into account: + visualInfoTemplate.depth = configRedSize + configGreenSize + configBlueSize; + matchingVisuals = XGetVisualInfo(X11->display, + VisualDepthMask, + &visualInfoTemplate, + &matchingCount); + } + if (matchingVisuals) { visualId = matchingVisuals[0].visualid; XFree(matchingVisuals); diff --git a/src/gui/embedded/qscreenlinuxfb_qws.cpp b/src/gui/embedded/qscreenlinuxfb_qws.cpp index 8a21022..1effcfa 100644 --- a/src/gui/embedded/qscreenlinuxfb_qws.cpp +++ b/src/gui/embedded/qscreenlinuxfb_qws.cpp @@ -91,6 +91,7 @@ public: int startuph; int startupd; bool blank; + QLinuxFbScreen::DriverTypes driverType; bool doGraphicsMode; #ifdef QT_QWS_DEPTH_GENERIC @@ -165,6 +166,36 @@ void QLinuxFbScreenPrivate::closeTty() } /*! + \enum QLinuxFbScreen::DriverTypes + + This enum describes the driver type. + + \value GenericDriver Generic Linux framebuffer driver + \value EInk8Track e-Ink framebuffer driver using the 8Track chipset + */ + +/*! + \fn QLinuxFbScreen::fixupScreenInfo(fb_fix_screeninfo &finfo, fb_var_screeninfo &vinfo) + + Adjust the values returned by the framebuffer driver, to work + around driver bugs or nonstandard behavior in certain drivers. + \a finfo and \a vinfo specify the fixed and variable screen info + returned by the driver. + */ +void QLinuxFbScreen::fixupScreenInfo(fb_fix_screeninfo &finfo, fb_var_screeninfo &vinfo) +{ + // 8Track e-ink devices (as found in Sony PRS-505) lie + // about their bit depth -- they claim they're 1 bit per + // pixel while the only supported mode is 8 bit per pixel + // grayscale. + // Caused by this, they also miscalculate their line length. + if(!strcmp(finfo.id, "8TRACKFB") && vinfo.bits_per_pixel == 1) { + vinfo.bits_per_pixel = 8; + finfo.line_length = vinfo.xres; + } +} + +/*! \internal \class QLinuxFbScreen @@ -306,6 +337,8 @@ bool QLinuxFbScreen::connect(const QString &displaySpec) return false; } + d_ptr->driverType = strcmp(finfo.id, "8TRACKFB") ? GenericDriver : EInk8Track; + if (finfo.type == FB_TYPE_VGA_PLANES) { qWarning("VGA16 video mode not supported"); return false; @@ -318,6 +351,8 @@ bool QLinuxFbScreen::connect(const QString &displaySpec) return false; } + fixupScreenInfo(finfo, vinfo); + grayscale = vinfo.grayscale; d = vinfo.bits_per_pixel; if (d == 24) { @@ -664,11 +699,6 @@ bool QLinuxFbScreen::initDevice() vinfo.transp.msb_right); #endif - d_ptr->startupw=vinfo.xres; - d_ptr->startuph=vinfo.yres; - d_ptr->startupd=vinfo.bits_per_pixel; - grayscale = vinfo.grayscale; - if (ioctl(d_ptr->fd, FBIOGET_FSCREENINFO, &finfo)) { perror("QLinuxFbScreen::initDevice"); qCritical("Error reading fixed information in card init"); @@ -677,6 +707,13 @@ bool QLinuxFbScreen::initDevice() return true; } + fixupScreenInfo(finfo, vinfo); + + d_ptr->startupw=vinfo.xres; + d_ptr->startuph=vinfo.yres; + d_ptr->startupd=vinfo.bits_per_pixel; + grayscale = vinfo.grayscale; + #ifdef __i386__ // Now init mtrr if(!::getenv("QWS_NOMTRR")) { @@ -1122,6 +1159,7 @@ void QLinuxFbScreen::setMode(int nw,int nh,int nd) qFatal("Error reading fixed information"); } + fixupScreenInfo(finfo, vinfo); disconnect(); connect(d_ptr->displaySpec); exposeRegion(region(), 0); @@ -1200,6 +1238,26 @@ int QLinuxFbScreen::sharedRamSize(void * end) /*! \reimp */ +void QLinuxFbScreen::setDirty(const QRect &r) +{ + if(d_ptr->driverType == EInk8Track) { + // e-Ink displays need a trigger to actually show what is + // in their framebuffer memory. The 8-Track driver does this + // by adding custom IOCTLs - FBIO_EINK_DISP_PIC (0x46a2) takes + // an argument specifying whether or not to flash the screen + // while updating. + // There doesn't seem to be a way to tell it to just update + // a subset of the screen. + if(r.left() == 0 && r.top() == 0 && r.width() == dw && r.height() == dh) + ioctl(d_ptr->fd, 0x46a2, 1); + else + ioctl(d_ptr->fd, 0x46a2, 0); + } +} + +/*! + \reimp +*/ void QLinuxFbScreen::blank(bool on) { if (d_ptr->blank == on) @@ -1315,7 +1373,9 @@ void QLinuxFbScreen::setPixelFormat(struct fb_var_screeninfo info) bool QLinuxFbScreen::useOffscreen() { - if ((mapsize - size) < 16*1024) + // Not done for 8Track because on e-Ink displays, + // everything is offscreen anyway + if (d_ptr->driverType == EInk8Track || ((mapsize - size) < 16*1024)) return false; return true; diff --git a/src/gui/embedded/qscreenlinuxfb_qws.h b/src/gui/embedded/qscreenlinuxfb_qws.h index ac488b7..6abadbf 100644 --- a/src/gui/embedded/qscreenlinuxfb_qws.h +++ b/src/gui/embedded/qscreenlinuxfb_qws.h @@ -88,6 +88,8 @@ public: virtual bool useOffscreen(); + enum DriverTypes { GenericDriver, EInk8Track }; + virtual void disconnect(); virtual void shutdownDevice(); virtual void setMode(int,int,int); @@ -98,6 +100,7 @@ public: virtual uchar * cache(int); virtual void uncache(uchar *); virtual int sharedRamSize(void *); + virtual void setDirty(const QRect&); QLinuxFb_Shared * shared; @@ -109,6 +112,7 @@ protected: int dataoffset; int cacheStart; + virtual void fixupScreenInfo(fb_fix_screeninfo &finfo, fb_var_screeninfo &vinfo); static void clearCache(QScreen *instance, int); private: diff --git a/src/gui/embedded/qscreenqnx_qws.cpp b/src/gui/embedded/qscreenqnx_qws.cpp index 705db7e..a0a697f 100644 --- a/src/gui/embedded/qscreenqnx_qws.cpp +++ b/src/gui/embedded/qscreenqnx_qws.cpp @@ -205,7 +205,7 @@ static bool createMemSurface(QQnxScreenContext * const d, int w, int h) int ret = gf_surface_create(&d->memSurface, d->device, w, h, GF_FORMAT_ARGB8888, 0, GF_SURFACE_CREATE_CPU_FAST_ACCESS | GF_SURFACE_CREATE_CPU_LINEAR_ACCESSIBLE - | GF_SURFACE_PHYS_CONTIG); + | GF_SURFACE_PHYS_CONTIG | GF_SURFACE_CREATE_SHAREABLE); if (ret != GF_ERR_OK) { qWarning("QQnxScreen: gf_surface_create(%dx%d) failed with error code %d", w, h, ret); diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp index 150343e..9e0ec2e 100644 --- a/src/gui/graphicsview/qgraphicsitem.cpp +++ b/src/gui/graphicsview/qgraphicsitem.cpp @@ -1408,8 +1408,16 @@ QGraphicsItem::QGraphicsItem(QGraphicsItemPrivate &dd, QGraphicsItem *parent, */ QGraphicsItem::~QGraphicsItem() { - if (d_ptr->isObject) - QObjectPrivate::get(static_cast<QGraphicsObject *>(this))->wasDeleted = true; + if (d_ptr->isObject) { + QGraphicsObject *o = static_cast<QGraphicsObject *>(this); + QObjectPrivate *p = QObjectPrivate::get(o); + p->wasDeleted = true; + if (p->declarativeData) { + QDeclarativeData::destroyed(p->declarativeData, o); + p->declarativeData = 0; + } + } + d_ptr->inDestructor = 1; d_ptr->removeExtraItemCache(); diff --git a/src/gui/graphicsview/qgraphicsitem.h b/src/gui/graphicsview/qgraphicsitem.h index 9cc75af..9891af3 100644 --- a/src/gui/graphicsview/qgraphicsitem.h +++ b/src/gui/graphicsview/qgraphicsitem.h @@ -554,6 +554,9 @@ class Q_GUI_EXPORT QGraphicsObject : public QObject, public QGraphicsItem Q_PROPERTY(qreal rotation READ rotation WRITE setRotation NOTIFY rotationChanged) Q_PROPERTY(qreal scale READ scale WRITE setScale NOTIFY scaleChanged) Q_PROPERTY(QPointF transformOriginPoint READ transformOriginPoint WRITE setTransformOriginPoint) +#ifndef QT_NO_GRAPHICSEFFECT + Q_PROPERTY(QGraphicsEffect *effect READ graphicsEffect WRITE setGraphicsEffect) +#endif Q_PRIVATE_PROPERTY(QGraphicsItem::d_func(), QDeclarativeListProperty<QGraphicsObject> children READ childrenList DESIGNABLE false NOTIFY childrenChanged) Q_PRIVATE_PROPERTY(QGraphicsItem::d_func(), qreal width READ width WRITE setWidth NOTIFY widthChanged RESET resetWidth FINAL) Q_PRIVATE_PROPERTY(QGraphicsItem::d_func(), qreal height READ height WRITE setHeight NOTIFY heightChanged RESET resetHeight FINAL) diff --git a/src/gui/graphicsview/qgraphicsitem_p.h b/src/gui/graphicsview/qgraphicsitem_p.h index 922581d..f922842 100644 --- a/src/gui/graphicsview/qgraphicsitem_p.h +++ b/src/gui/graphicsview/qgraphicsitem_p.h @@ -237,6 +237,7 @@ public: scenePosDescendants(0), pendingPolish(0), mayHaveChildWithGraphicsEffect(0), + isDeclarativeItem(0), globalStackingOrder(-1), q_ptr(0) { @@ -576,7 +577,8 @@ public: quint32 scenePosDescendants : 1; quint32 pendingPolish : 1; quint32 mayHaveChildWithGraphicsEffect : 1; - quint32 padding : 25; + quint32 isDeclarativeItem : 1; + quint32 padding : 24; // Optional stacking order int globalStackingOrder; diff --git a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp b/src/gui/inputmethod/qcoefepinputcontext_s60.cpp index cc60246..94036d0 100644 --- a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp +++ b/src/gui/inputmethod/qcoefepinputcontext_s60.cpp @@ -58,6 +58,11 @@ // MAknEdStateObserver::EAknActivatePenInputRequest #define QT_EAknActivatePenInputRequest MAknEdStateObserver::EAknEdwinStateEvent(7) +// EAknEditorFlagSelectionVisible is only valid from 3.2 onwards. +// Sym^3 AVKON FEP manager expects that this flag is used for FEP-aware editors +// that support text selection. +#define QT_EAknEditorFlagSelectionVisible 0x100000 + QT_BEGIN_NAMESPACE QCoeFepInputContext::QCoeFepInputContext(QObject *parent) @@ -75,7 +80,10 @@ QCoeFepInputContext::QCoeFepInputContext(QObject *parent) m_hasTempPreeditString(false) { m_fepState->SetObjectProvider(this); - m_fepState->SetFlags(EAknEditorFlagDefault); + if (QSysInfo::s60Version() > QSysInfo::SV_S60_5_0) + m_fepState->SetFlags(EAknEditorFlagDefault | QT_EAknEditorFlagSelectionVisible); + else + m_fepState->SetFlags(EAknEditorFlagDefault); m_fepState->SetDefaultInputMode( EAknEditorTextInputMode ); m_fepState->SetPermittedInputModes( EAknEditorAllInputModes ); m_fepState->SetDefaultCase( EAknEditorLowerCase ); @@ -432,7 +440,10 @@ void QCoeFepInputContext::applyHints(Qt::InputMethodHints hints) m_fepState->SetPermittedCases(flags); ReportAknEdStateEvent(MAknEdStateObserver::EAknEdwinStateCaseModeUpdate); - flags = 0; + if (QSysInfo::s60Version() > QSysInfo::SV_S60_5_0) + flags = QT_EAknEditorFlagSelectionVisible; + else + flags = 0; if (hints & ImhUppercaseOnly && !(hints & ImhLowercaseOnly) || hints & ImhLowercaseOnly && !(hints & ImhUppercaseOnly)) { flags |= EAknEditorFlagFixedCase; diff --git a/src/gui/itemviews/qitemselectionmodel.cpp b/src/gui/itemviews/qitemselectionmodel.cpp index d6e68f6..f848321 100644 --- a/src/gui/itemviews/qitemselectionmodel.cpp +++ b/src/gui/itemviews/qitemselectionmodel.cpp @@ -292,6 +292,27 @@ static void indexesFromRange(const QItemSelectionRange &range, QModelIndexList & } /*! + Returns true if the selection range contains no selectable item + \since 4.7 +*/ + +bool QItemSelectionRange::isEmpty() const +{ + if (!isValid() || !model()) + return true; + + for (int column = left(); column <= right(); ++column) { + for (int row = top(); row <= bottom(); ++row) { + QModelIndex index = model()->index(row, column, parent()); + Qt::ItemFlags flags = model()->flags(index); + if ((flags & Qt::ItemIsSelectable) && (flags & Qt::ItemIsEnabled)) + return false; + } + } + return true; +} + +/*! Returns the list of model index items stored in the selection. */ diff --git a/src/gui/itemviews/qitemselectionmodel.h b/src/gui/itemviews/qitemselectionmodel.h index 9980d0f..436514f 100644 --- a/src/gui/itemviews/qitemselectionmodel.h +++ b/src/gui/itemviews/qitemselectionmodel.h @@ -108,6 +108,8 @@ public: && top() <= bottom() && left() <= right()); } + bool isEmpty() const; + QModelIndexList indexes() const; private: diff --git a/src/gui/itemviews/qtableview.cpp b/src/gui/itemviews/qtableview.cpp index 31be224..80334a6 100644 --- a/src/gui/itemviews/qtableview.cpp +++ b/src/gui/itemviews/qtableview.cpp @@ -1846,7 +1846,9 @@ void QTableView::setSelection(const QRect &rect, QItemSelectionModel::SelectionF selection.append(QItemSelectionRange(topLeft, bottomRight)); } } else { // nothing moved - selection.append(QItemSelectionRange(tl, br)); + QItemSelectionRange range(tl, br); + if (!range.isEmpty()) + selection.append(range); } d->selectionModel->select(selection, command); diff --git a/src/gui/itemviews/qtreeview.cpp b/src/gui/itemviews/qtreeview.cpp index d934683..b797776 100644 --- a/src/gui/itemviews/qtreeview.cpp +++ b/src/gui/itemviews/qtreeview.cpp @@ -3194,12 +3194,16 @@ void QTreeViewPrivate::layout(int i, bool recursiveExpanding, bool afterIsUninit int QTreeViewPrivate::pageUp(int i) const { int index = itemAtCoordinate(coordinateForItem(i) - viewport->height()); + while (isItemHiddenOrDisabled(index)) + index--; return index == -1 ? 0 : index; } int QTreeViewPrivate::pageDown(int i) const { int index = itemAtCoordinate(coordinateForItem(i) + viewport->height()); + while (isItemHiddenOrDisabled(index)) + index++; return index == -1 ? viewItems.count() - 1 : index; } @@ -3424,25 +3428,6 @@ int QTreeViewPrivate::columnAt(int x) const return header->logicalIndexAt(x); } -void QTreeViewPrivate::relayout(const QModelIndex &parent) -{ - Q_Q(QTreeView); - // do a local relayout of the items - if (parent.isValid()) { - int parentViewIndex = viewIndex(parent); - if (parentViewIndex > -1 && viewItems.at(parentViewIndex).expanded) { - collapse(parentViewIndex, false); // remove the current layout - expand(parentViewIndex, false); // do the relayout - q->updateGeometries(); - viewport->update(); - } - } else { - viewItems.clear(); - q->doItemsLayout(); - } -} - - void QTreeViewPrivate::updateScrollBars() { Q_Q(QTreeView); diff --git a/src/gui/itemviews/qtreeview_p.h b/src/gui/itemviews/qtreeview_p.h index 261af31..cbbfd0e 100644 --- a/src/gui/itemviews/qtreeview_p.h +++ b/src/gui/itemviews/qtreeview_p.h @@ -150,7 +150,6 @@ public: int columnAt(int x) const; bool hasVisibleChildren( const QModelIndex& parent) const; - void relayout(const QModelIndex &parent); bool expandOrCollapseItemAtPos(const QPoint &pos); void updateScrollBars(); diff --git a/src/gui/itemviews/qtreewidget.cpp b/src/gui/itemviews/qtreewidget.cpp index 19ed10b..4c80325 100644 --- a/src/gui/itemviews/qtreewidget.cpp +++ b/src/gui/itemviews/qtreewidget.cpp @@ -3039,10 +3039,14 @@ QList<QTreeWidgetItem*> QTreeWidget::selectedItems() const Q_D(const QTreeWidget); QModelIndexList indexes = selectionModel()->selectedIndexes(); QList<QTreeWidgetItem*> items; + items.reserve(indexes.count()); + QSet<QTreeWidgetItem *> seen; + seen.reserve(indexes.count()); for (int i = 0; i < indexes.count(); ++i) { QTreeWidgetItem *item = d->item(indexes.at(i)); - if (isItemHidden(item) || items.contains(item)) // ### slow, optimize later + if (isItemHidden(item) || seen.contains(item)) continue; + seen.insert(item); items.append(item); } return items; diff --git a/src/gui/kernel/qaction.cpp b/src/gui/kernel/qaction.cpp index 8ddd051..a6d2594 100644 --- a/src/gui/kernel/qaction.cpp +++ b/src/gui/kernel/qaction.cpp @@ -81,6 +81,7 @@ static QString qt_strippedText(QString s) QActionPrivate::QActionPrivate() : group(0), enabled(1), forceDisabled(0), visible(1), forceInvisible(0), checkable(0), checked(0), separator(0), fontSet(false), + forceEnabledInSoftkeys(false), menuActionSoftkeys(false), menuRole(QAction::TextHeuristicRole), softKeyRole(QAction::NoSoftKey), priority(QAction::NormalPriority), iconVisibleInMenu(-1) { diff --git a/src/gui/kernel/qaction_p.h b/src/gui/kernel/qaction_p.h index b57e5d2..899b01b 100644 --- a/src/gui/kernel/qaction_p.h +++ b/src/gui/kernel/qaction_p.h @@ -75,6 +75,11 @@ public: QActionPrivate(); ~QActionPrivate(); + static QActionPrivate *get(QAction *q) + { + return q->d_func(); + } + bool showStatusText(QWidget *w, const QString &str); QPointer<QActionGroup> group; @@ -103,10 +108,16 @@ public: uint checked : 1; uint separator : 1; uint fontSet : 1; - QAction::MenuRole menuRole; - QAction::SoftKeyRole softKeyRole; - QAction::Priority priority; + + //for soft keys management + uint forceEnabledInSoftkeys : 1; + uint menuActionSoftkeys : 1; + + QAction::MenuRole menuRole : 3; + QAction::SoftKeyRole softKeyRole : 2; + QAction::Priority priority : 14; int iconVisibleInMenu : 3; // Only has values -1, 0, and 1 + QList<QWidget *> widgets; #ifndef QT_NO_GRAPHICSVIEW QList<QGraphicsWidget *> graphicsWidgets; diff --git a/src/gui/kernel/qapplication.cpp b/src/gui/kernel/qapplication.cpp index b0a23d4..5f5e29f 100644 --- a/src/gui/kernel/qapplication.cpp +++ b/src/gui/kernel/qapplication.cpp @@ -186,11 +186,9 @@ QApplicationPrivate::QApplicationPrivate(int &argc, char **argv, QApplication::T gestureManager = 0; gestureWidget = 0; -#if defined(Q_WS_X11) || defined(Q_WS_WIN) move_cursor = 0; copy_cursor = 0; link_cursor = 0; -#endif #if defined(Q_WS_WIN) ignore_cursor = 0; #endif @@ -1045,11 +1043,9 @@ QApplication::~QApplication() qt_clipboard = 0; #endif -#if defined(Q_WS_X11) || defined(Q_WS_WIN) delete d->move_cursor; d->move_cursor = 0; delete d->copy_cursor; d->copy_cursor = 0; delete d->link_cursor; d->link_cursor = 0; -#endif #if defined(Q_WS_WIN) delete d->ignore_cursor; d->ignore_cursor = 0; #endif diff --git a/src/gui/kernel/qsoftkeymanager.cpp b/src/gui/kernel/qsoftkeymanager.cpp index 23f1481..04e4685 100644 --- a/src/gui/kernel/qsoftkeymanager.cpp +++ b/src/gui/kernel/qsoftkeymanager.cpp @@ -43,7 +43,7 @@ #include "qevent.h" #include "qbitmap.h" #include "private/qsoftkeymanager_p.h" -#include "private/qobject_p.h" +#include "private/qaction_p.h" #include "private/qsoftkeymanager_common_p.h" #ifdef Q_WS_S60 @@ -104,7 +104,7 @@ QAction *QSoftKeyManager::createAction(StandardSoftKey standardKey, QWidget *act QAction::SoftKeyRole softKeyRole = QAction::NoSoftKey; switch (standardKey) { case MenuSoftKey: // FALL-THROUGH - action->setProperty(MENU_ACTION_PROPERTY, QVariant(true)); // TODO: can be refactored away to use _q_action_menubar + QActionPrivate::get(action)->menuActionSoftkeys = true; case OkSoftKey: case SelectSoftKey: case DoneSoftKey: @@ -255,16 +255,12 @@ bool QSoftKeyManager::handleUpdateSoftKeys() void QSoftKeyManager::setForceEnabledInSoftkeys(QAction *action) { - action->setProperty(FORCE_ENABLED_PROPERTY, QVariant(true)); + QActionPrivate::get(action)->forceEnabledInSoftkeys = true; } bool QSoftKeyManager::isForceEnabledInSofkeys(QAction *action) { - bool ret = false; - QVariant property = action->property(FORCE_ENABLED_PROPERTY); - if (property.isValid() && property.toBool()) - ret = true; - return ret; + return QActionPrivate::get(action)->forceEnabledInSoftkeys; } bool QSoftKeyManager::event(QEvent *e) diff --git a/src/gui/kernel/qsoftkeymanager_p.h b/src/gui/kernel/qsoftkeymanager_p.h index a5b258b..6eedfa8 100644 --- a/src/gui/kernel/qsoftkeymanager_p.h +++ b/src/gui/kernel/qsoftkeymanager_p.h @@ -63,9 +63,6 @@ QT_BEGIN_NAMESPACE class QSoftKeyManagerPrivate; -const char MENU_ACTION_PROPERTY[] = "_q_menuAction"; -const char FORCE_ENABLED_PROPERTY[] = "_q_forceEnabledInSoftkeys"; - class Q_AUTOTEST_EXPORT QSoftKeyManager : public QObject { Q_OBJECT diff --git a/src/gui/kernel/qsoftkeymanager_s60.cpp b/src/gui/kernel/qsoftkeymanager_s60.cpp index c0761f0..e4990b1 100644 --- a/src/gui/kernel/qsoftkeymanager_s60.cpp +++ b/src/gui/kernel/qsoftkeymanager_s60.cpp @@ -46,6 +46,7 @@ #include "qmenubar.h" #include "private/qt_s60_p.h" #include "private/qmenu_p.h" +#include "private/qaction_p.h" #include "private/qsoftkeymanager_p.h" #include "private/qsoftkeymanager_s60_p.h" #include "private/qobject_p.h" @@ -382,8 +383,8 @@ bool QSoftKeyManagerPrivateS60::handleCommand(int command) { QAction *action = realSoftKeyActions.value(command); if (action) { - QVariant property = action->property(MENU_ACTION_PROPERTY); - if (property.isValid() && property.toBool()) { + bool property = QActionPrivate::get(action)->menuActionSoftkeys; + if (property) { QT_TRAP_THROWING(tryDisplayMenuBarL()); } else if (action->menu()) { // TODO: This is hack, in order to use exising QMenuBar implementation for Symbian diff --git a/src/gui/painting/qbezier.cpp b/src/gui/painting/qbezier.cpp index ea7fe4f..a08c79e 100644 --- a/src/gui/painting/qbezier.cpp +++ b/src/gui/painting/qbezier.cpp @@ -117,8 +117,8 @@ QBezier QBezier::mapBy(const QTransform &transform) const return QBezier::fromPoints(transform.map(pt1()), transform.map(pt2()), transform.map(pt3()), transform.map(pt4())); } -//0.5 is really low -static const qreal flatness = 0.5; +//0.05 is really low, but required for scaled-up beziers... +static const qreal flatness = 0.05; //based on "Fast, precise flattening of cubic Bezier path and offset curves" // by T. F. Hain, A. L. Ahmad, S. V. R. Racherla and D. D. Langan diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp index 917b910..b440fce 100644 --- a/src/gui/painting/qdrawhelper.cpp +++ b/src/gui/painting/qdrawhelper.cpp @@ -70,8 +70,10 @@ static uint gccBug(uint value) constants and structures */ -static const int fixed_scale = 1 << 16; -static const int half_point = 1 << 15; +enum { + fixed_scale = 1 << 16, + half_point = 1 << 15 +}; static const int buffer_size = 2048; struct LinearGradientValues @@ -691,37 +693,42 @@ const uint * QT_FASTCALL fetchTransformedBilinear(uint *buffer, const Operator * fy -= half_point; while (b < end) { int x1 = (fx >> 16); - int x2 = x1 + 1; + int x2; int y1 = (fy >> 16); - int y2 = y1 + 1; - - int distx = ((fx - (x1 << 16)) >> 8); - int disty = ((fy - (y1 << 16)) >> 8); - int idistx = 256 - distx; - int idisty = 256 - disty; + int y2; if (blendType == BlendTransformedBilinearTiled) { x1 %= image_width; + if (x1 < 0) x1 += image_width; + x2 = x1 + 1; x2 %= image_width; - y1 %= image_height; - y2 %= image_height; - if (x1 < 0) x1 += image_width; - if (x2 < 0) x2 += image_width; + y1 %= image_height; if (y1 < 0) y1 += image_height; - if (y2 < 0) y2 += image_height; - - Q_ASSERT(x1 >= 0 && x1 < image_width); - Q_ASSERT(x2 >= 0 && x2 < image_width); - Q_ASSERT(y1 >= 0 && y1 < image_height); - Q_ASSERT(y2 >= 0 && y2 < image_height); + y2 = y1 + 1; + y2 %= image_height; } else { - x1 = qBound(0, x1, image_width - 1); - x2 = qBound(0, x2, image_width - 1); - y1 = qBound(0, y1, image_height - 1); - y2 = qBound(0, y2, image_height - 1); + if (x1 < 0) { + x2 = x1 = 0; + } else if (x1 >= image_width - 1) { + x2 = x1 = image_width - 1; + } else { + x2 = x1 + 1; + } + if (y1 < 0) { + y2 = y1 = 0; + } else if (y1 >= image_height - 1) { + y2 = y1 = image_height - 1; + } else { + y2 = y1 + 1; + } } + Q_ASSERT(x1 >= 0 && x1 < image_width); + Q_ASSERT(x2 >= 0 && x2 < image_width); + Q_ASSERT(y1 >= 0 && y1 < image_height); + Q_ASSERT(y2 >= 0 && y2 < image_height); + const uchar *s1 = data->texture.scanLine(y1); const uchar *s2 = data->texture.scanLine(y2); @@ -730,6 +737,11 @@ const uint * QT_FASTCALL fetchTransformedBilinear(uint *buffer, const Operator * uint bl = fetch(s2, x1, data->texture.colorTable); uint br = fetch(s2, x2, data->texture.colorTable); + int distx = (fx & 0x0000ffff) >> 8; + int disty = (fy & 0x0000ffff) >> 8; + int idistx = 256 - distx; + int idisty = 256 - disty; + uint xtop = INTERPOLATE_PIXEL_256(tl, idistx, tr, distx); uint xbot = INTERPOLATE_PIXEL_256(bl, idistx, br, distx); *b = INTERPOLATE_PIXEL_256(xtop, idisty, xbot, disty); @@ -753,9 +765,9 @@ const uint * QT_FASTCALL fetchTransformedBilinear(uint *buffer, const Operator * const qreal py = fy * iw - 0.5; int x1 = int(px) - (px < 0); - int x2 = x1 + 1; + int x2; int y1 = int(py) - (py < 0); - int y2 = y1 + 1; + int y2; int distx = int((px - x1) * 256); int disty = int((py - y1) * 256); @@ -764,26 +776,36 @@ const uint * QT_FASTCALL fetchTransformedBilinear(uint *buffer, const Operator * if (blendType == BlendTransformedBilinearTiled) { x1 %= image_width; + if (x1 < 0) x1 += image_width; + x2 = x1 + 1; x2 %= image_width; - y1 %= image_height; - y2 %= image_height; - if (x1 < 0) x1 += image_width; - if (x2 < 0) x2 += image_width; + y1 %= image_height; if (y1 < 0) y1 += image_height; - if (y2 < 0) y2 += image_height; - - Q_ASSERT(x1 >= 0 && x1 < image_width); - Q_ASSERT(x2 >= 0 && x2 < image_width); - Q_ASSERT(y1 >= 0 && y1 < image_height); - Q_ASSERT(y2 >= 0 && y2 < image_height); + y2 = y1 + 1; + y2 %= image_height; } else { - x1 = qBound(0, x1, image_width - 1); - x2 = qBound(0, x2, image_width - 1); - y1 = qBound(0, y1, image_height - 1); - y2 = qBound(0, y2, image_height - 1); + if (x1 < 0) { + x2 = x1 = 0; + } else if (x1 >= image_width - 1) { + x2 = x1 = image_width - 1; + } else { + x2 = x1 + 1; + } + if (y1 < 0) { + y2 = y1 = 0; + } else if (y1 >= image_height - 1) { + y2 = y1 = image_height - 1; + } else { + y2 = y1 + 1; + } } + Q_ASSERT(x1 >= 0 && x1 < image_width); + Q_ASSERT(x2 >= 0 && x2 < image_width); + Q_ASSERT(y1 >= 0 && y1 < image_height); + Q_ASSERT(y2 >= 0 && y2 < image_height); + const uchar *s1 = data->texture.scanLine(y1); const uchar *s2 = data->texture.scanLine(y2); @@ -5141,7 +5163,7 @@ static void blend_tiled_rgb444(int count, const QSpan *spans, void *userData) } -template <SpanMethod spanMethod> +template <SpanMethod spanMethod, TextureBlendType blendType> /* blendType must be either BlendTransformedBilinear or BlendTransformedBilinearTiled */ Q_STATIC_TEMPLATE_FUNCTION void blend_transformed_bilinear_argb(int count, const QSpan *spans, void *userData) { QSpanData *data = reinterpret_cast<QSpanData *>(userData); @@ -5154,10 +5176,12 @@ Q_STATIC_TEMPLATE_FUNCTION void blend_transformed_bilinear_argb(int count, const CompositionFunction func = functionForMode[data->rasterBuffer->compositionMode]; uint buffer[buffer_size]; - int image_x1 = data->texture.x1; - int image_y1 = data->texture.y1; - int image_x2 = data->texture.x2; - int image_y2 = data->texture.y2; + const int image_x1 = data->texture.x1; + const int image_y1 = data->texture.y1; + const int image_x2 = data->texture.x2; + const int image_y2 = data->texture.y2; + const int image_width = data->texture.width; + const int image_height = data->texture.height; const int scanline_offset = data->texture.bytesPerLine / 4; if (data->fast_matrix) { @@ -5187,19 +5211,41 @@ Q_STATIC_TEMPLATE_FUNCTION void blend_transformed_bilinear_argb(int count, const uint *b = buffer; while (b < end) { int x1 = (x >> 16); - int x2 = x1 + 1; + int x2; int y1 = (y >> 16); - int y2 = y1 + 1; - - int distx = ((x - (x1 << 16)) >> 8); - int disty = ((y - (y1 << 16)) >> 8); - int idistx = 256 - distx; - int idisty = 256 - disty; - - x1 = qBound(image_x1, x1, image_x2 - 1); - x2 = qBound(image_x1, x2, image_x2 - 1); - y1 = qBound(image_y1, y1, image_y2 - 1); - y2 = qBound(image_y1, y2, image_y2 - 1); + int y2; + + if (blendType == BlendTransformedBilinearTiled) { + x1 %= image_width; + if (x1 < 0) x1 += image_width; + x2 = x1 + 1; + x2 %= image_width; + + y1 %= image_height; + if (y1 < 0) y1 += image_height; + y2 = y1 + 1; + y2 %= image_height; + + Q_ASSERT(x1 >= 0 && x1 < image_width); + Q_ASSERT(x2 >= 0 && x2 < image_width); + Q_ASSERT(y1 >= 0 && y1 < image_height); + Q_ASSERT(y2 >= 0 && y2 < image_height); + } else { + if (x1 < image_x1) { + x2 = x1 = image_x1; + } else if (x1 >= image_x2 - 1) { + x2 = x1 = image_x2 - 1; + } else { + x2 = x1 + 1; + } + if (y1 < image_y1) { + y2 = y1 = image_y1; + } else if (y1 >= image_y2 - 1) { + y2 = y1 = image_y2 - 1; + } else { + y2 = y1 + 1; + } + } int y1_offset = y1 * scanline_offset; int y2_offset = y2 * scanline_offset; @@ -5216,6 +5262,11 @@ Q_STATIC_TEMPLATE_FUNCTION void blend_transformed_bilinear_argb(int count, const uint br = image_bits[y2_offset + x2]; #endif + int distx = (x & 0x0000ffff) >> 8; + int disty = (y & 0x0000ffff) >> 8; + int idistx = 256 - distx; + int idisty = 256 - disty; + uint xtop = INTERPOLATE_PIXEL_256(tl, idistx, tr, distx); uint xbot = INTERPOLATE_PIXEL_256(bl, idistx, br, distx); *b = INTERPOLATE_PIXEL_256(xtop, idisty, xbot, disty); @@ -5265,19 +5316,46 @@ Q_STATIC_TEMPLATE_FUNCTION void blend_transformed_bilinear_argb(int count, const const qreal py = y * iw - 0.5; int x1 = int(px) - (px < 0); - int x2 = x1 + 1; + int x2; int y1 = int(py) - (py < 0); - int y2 = y1 + 1; + int y2; int distx = int((px - x1) * 256); int disty = int((py - y1) * 256); int idistx = 256 - distx; int idisty = 256 - disty; - x1 = qBound(image_x1, x1, image_x2 - 1); - x2 = qBound(image_x1, x2, image_x2 - 1); - y1 = qBound(image_y1, y1, image_y2 - 1); - y2 = qBound(image_y1, y2, image_y2 - 1); + if (blendType == BlendTransformedBilinearTiled) { + x1 %= image_width; + if (x1 < 0) x1 += image_width; + x2 = x1 + 1; + x2 %= image_width; + + y1 %= image_height; + if (y1 < 0) y1 += image_height; + y2 = y1 + 1; + y2 %= image_height; + + Q_ASSERT(x1 >= 0 && x1 < image_width); + Q_ASSERT(x2 >= 0 && x2 < image_width); + Q_ASSERT(y1 >= 0 && y1 < image_height); + Q_ASSERT(y2 >= 0 && y2 < image_height); + } else { + if (x1 < image_x1) { + x2 = x1 = image_x1; + } else if (x1 >= image_x2 - 1) { + x2 = x1 = image_x2 - 1; + } else { + x2 = x1 + 1; + } + if (y1 < image_y1) { + y2 = y1 = image_y1; + } else if (y1 >= image_y2 - 1) { + y2 = y1 = image_y2 - 1; + } else { + y2 = y1 + 1; + } + } int y1_offset = y1 * scanline_offset; int y2_offset = y2 * scanline_offset; @@ -5366,17 +5444,27 @@ Q_STATIC_TEMPLATE_FUNCTION void blendTransformedBilinear(int count, const QSpan SRC *b = buffer; while (b < end) { int x1 = (x >> 16); - int x2 = x1 + 1; + int x2; int y1 = (y >> 16); - int y2 = y1 + 1; + int y2; - const int distx = ((x - (x1 << 16)) >> 8); - const int disty = ((y - (y1 << 16)) >> 8); - x1 = qBound(src_minx, x1, src_maxx); - x2 = qBound(src_minx, x2, src_maxx); - y1 = qBound(src_miny, y1, src_maxy); - y2 = qBound(src_miny, y2, src_maxy); + const int distx = (x & 0x0000ffff) >> 8; + const int disty = (y & 0x0000ffff) >> 8; + if (x1 < src_minx) { + x2 = x1 = src_minx; + } else if (x1 >= src_maxx) { + x2 = x1 = src_maxx; + } else { + x2 = x1 + 1; + } + if (y1 < src_miny) { + y2 = y1 = src_miny; + } else if (y1 >= src_maxy) { + y2 = y1 = src_maxy; + } else { + y2 = y1 + 1; + } #if 0 if (x1 == x2) { if (y1 == y2) { @@ -5467,17 +5555,27 @@ Q_STATIC_TEMPLATE_FUNCTION void blendTransformedBilinear(int count, const QSpan const qreal py = y * iw - qreal(0.5); int x1 = int(px) - (px < 0); - int x2 = x1 + 1; + int x2; int y1 = int(py) - (py < 0); - int y2 = y1 + 1; + int y2; const int distx = int((px - x1) * 256); const int disty = int((py - y1) * 256); - x1 = qBound(src_minx, x1, src_maxx); - x2 = qBound(src_minx, x2, src_maxx); - y1 = qBound(src_miny, y1, src_maxy); - y2 = qBound(src_miny, y2, src_maxy); + if (x1 < src_minx) { + x2 = x1 = src_minx; + } else if (x1 >= src_maxx) { + x2 = x1 = src_maxx; + } else { + x2 = x1 + 1; + } + if (y1 < src_miny) { + y2 = y1 = src_miny; + } else if (y1 >= src_maxy) { + y2 = y1 = src_maxy; + } else { + y2 = y1 + 1; + } const SRC *src1 = (SRC*)data->texture.scanLine(y1); const SRC *src2 = (SRC*)data->texture.scanLine(y2); @@ -5646,197 +5744,6 @@ static void blend_transformed_bilinear_rgb444(int count, const QSpan *spans, voi } template <SpanMethod spanMethod> -Q_STATIC_TEMPLATE_FUNCTION void blend_transformed_bilinear_tiled_argb(int count, const QSpan *spans, void *userData) -{ - QSpanData *data = reinterpret_cast<QSpanData *>(userData); - if (data->texture.format != QImage::Format_ARGB32_Premultiplied - && data->texture.format != QImage::Format_RGB32) { - blend_src_generic<spanMethod>(count, spans, userData); - return; - } - - CompositionFunction func = functionForMode[data->rasterBuffer->compositionMode]; - uint buffer[buffer_size]; - - int image_width = data->texture.width; - int image_height = data->texture.height; - const int scanline_offset = data->texture.bytesPerLine / 4; - - if (data->fast_matrix) { - // The increment pr x in the scanline - int fdx = (int)(data->m11 * fixed_scale); - int fdy = (int)(data->m12 * fixed_scale); - - while (count--) { - void *t = data->rasterBuffer->scanLine(spans->y); - - uint *target = ((uint *)t) + spans->x; - uint *image_bits = (uint *)data->texture.imageData; - - const qreal cx = spans->x + 0.5; - const qreal cy = spans->y + 0.5; - - int x = int((data->m21 * cy - + data->m11 * cx + data->dx) * fixed_scale) - half_point; - int y = int((data->m22 * cy - + data->m12 * cx + data->dy) * fixed_scale) - half_point; - - int length = spans->len; - const int coverage = (spans->coverage * data->texture.const_alpha) >> 8; - while (length) { - int l = qMin(length, buffer_size); - const uint *end = buffer + l; - uint *b = buffer; - while (b < end) { - int x1 = (x >> 16); - int x2 = (x1 + 1); - int y1 = (y >> 16); - int y2 = (y1 + 1); - - int distx = ((x - (x1 << 16)) >> 8); - int disty = ((y - (y1 << 16)) >> 8); - int idistx = 256 - distx; - int idisty = 256 - disty; - - x1 %= image_width; - x2 %= image_width; - y1 %= image_height; - y2 %= image_height; - - if (x1 < 0) x1 += image_width; - if (x2 < 0) x2 += image_width; - if (y1 < 0) y1 += image_height; - if (y2 < 0) y2 += image_height; - - Q_ASSERT(x1 >= 0 && x1 < image_width); - Q_ASSERT(x2 >= 0 && x2 < image_width); - Q_ASSERT(y1 >= 0 && y1 < image_height); - Q_ASSERT(y2 >= 0 && y2 < image_height); - - int y1_offset = y1 * scanline_offset; - int y2_offset = y2 * scanline_offset; - -#if defined(Q_IRIX_GCC3_3_WORKAROUND) - uint tl = gccBug(image_bits[y1_offset + x1]); - uint tr = gccBug(image_bits[y1_offset + x2]); - uint bl = gccBug(image_bits[y2_offset + x1]); - uint br = gccBug(image_bits[y2_offset + x2]); -#else - uint tl = image_bits[y1_offset + x1]; - uint tr = image_bits[y1_offset + x2]; - uint bl = image_bits[y2_offset + x1]; - uint br = image_bits[y2_offset + x2]; -#endif - - uint xtop = INTERPOLATE_PIXEL_256(tl, idistx, tr, distx); - uint xbot = INTERPOLATE_PIXEL_256(bl, idistx, br, distx); - *b = INTERPOLATE_PIXEL_256(xtop, idisty, xbot, disty); - ++b; - x += fdx; - y += fdy; - } - if (spanMethod == RegularSpans) - func(target, buffer, l, coverage); - else - drawBufferSpan(data, buffer, buffer_size, - spans->x + spans->len - length, - spans->y, l, coverage); - target += l; - length -= l; - } - ++spans; - } - } else { - const qreal fdx = data->m11; - const qreal fdy = data->m12; - const qreal fdw = data->m13; - while (count--) { - void *t = data->rasterBuffer->scanLine(spans->y); - - uint *target = ((uint *)t) + spans->x; - uint *image_bits = (uint *)data->texture.imageData; - - const qreal cx = spans->x + 0.5; - const qreal cy = spans->y + 0.5; - - qreal x = data->m21 * cy + data->m11 * cx + data->dx; - qreal y = data->m22 * cy + data->m12 * cx + data->dy; - qreal w = data->m23 * cy + data->m13 * cx + data->m33; - - int length = spans->len; - const int coverage = (spans->coverage * data->texture.const_alpha) >> 8; - while (length) { - int l = qMin(length, buffer_size); - const uint *end = buffer + l; - uint *b = buffer; - while (b < end) { - const qreal iw = w == 0 ? 1 : 1 / w; - const qreal px = x * iw - 0.5; - const qreal py = y * iw - 0.5; - - int x1 = int(px) - (px < 0); - int x2 = x1 + 1; - int y1 = int(py) - (py < 0); - int y2 = y1 + 1; - - int distx = int((px - x1) * 256); - int disty = int((py - y1) * 256); - int idistx = 256 - distx; - int idisty = 256 - disty; - - x1 %= image_width; - x2 %= image_width; - y1 %= image_height; - y2 %= image_height; - - if (x1 < 0) x1 += image_width; - if (x2 < 0) x2 += image_width; - if (y1 < 0) y1 += image_height; - if (y2 < 0) y2 += image_height; - - Q_ASSERT(x1 >= 0 && x1 < image_width); - Q_ASSERT(x2 >= 0 && x2 < image_width); - Q_ASSERT(y1 >= 0 && y1 < image_height); - Q_ASSERT(y2 >= 0 && y2 < image_height); - - int y1_offset = y1 * scanline_offset; - int y2_offset = y2 * scanline_offset; - -#if defined(Q_IRIX_GCC3_3_WORKAROUND) - uint tl = gccBug(image_bits[y1_offset + x1]); - uint tr = gccBug(image_bits[y1_offset + x2]); - uint bl = gccBug(image_bits[y2_offset + x1]); - uint br = gccBug(image_bits[y2_offset + x2]); -#else - uint tl = image_bits[y1_offset + x1]; - uint tr = image_bits[y1_offset + x2]; - uint bl = image_bits[y2_offset + x1]; - uint br = image_bits[y2_offset + x2]; -#endif - - uint xtop = INTERPOLATE_PIXEL_256(tl, idistx, tr, distx); - uint xbot = INTERPOLATE_PIXEL_256(bl, idistx, br, distx); - *b = INTERPOLATE_PIXEL_256(xtop, idisty, xbot, disty); - ++b; - x += fdx; - y += fdy; - w += fdw; - } - if (spanMethod == RegularSpans) - func(target, buffer, l, coverage); - else - drawBufferSpan(data, buffer, buffer_size, - spans->x + spans->len - length, - spans->y, l, coverage); - target += l; - length -= l; - } - ++spans; - } - } -} - -template <SpanMethod spanMethod> Q_STATIC_TEMPLATE_FUNCTION void blend_transformed_argb(int count, const QSpan *spans, void *userData) { QSpanData *data = reinterpret_cast<QSpanData *>(userData); @@ -6738,7 +6645,7 @@ static const ProcessSpans processTextureSpans[NBlendTypes][QImage::NImageFormats SPANFUNC_POINTER(blend_src_generic, RegularSpans), // Indexed8 SPANFUNC_POINTER(blend_src_generic, RegularSpans), // RGB32 SPANFUNC_POINTER(blend_src_generic, RegularSpans), // ARGB32 - SPANFUNC_POINTER(blend_transformed_bilinear_argb, RegularSpans), // ARGB32_Premultiplied + blend_transformed_bilinear_argb<RegularSpans, BlendTransformedBilinear>, // ARGB32_Premultiplied blend_transformed_bilinear_rgb565, blend_transformed_bilinear_argb8565, blend_transformed_bilinear_rgb666, @@ -6757,7 +6664,7 @@ static const ProcessSpans processTextureSpans[NBlendTypes][QImage::NImageFormats SPANFUNC_POINTER(blend_src_generic, RegularSpans), // Indexed8 SPANFUNC_POINTER(blend_src_generic, RegularSpans), // RGB32 SPANFUNC_POINTER(blend_src_generic, RegularSpans), // ARGB32 - SPANFUNC_POINTER(blend_transformed_bilinear_tiled_argb, RegularSpans), // ARGB32_Premultiplied + blend_transformed_bilinear_argb<RegularSpans, BlendTransformedBilinearTiled>, // ARGB32_Premultiplied SPANFUNC_POINTER(blend_src_generic, RegularSpans), // RGB16 SPANFUNC_POINTER(blend_src_generic, RegularSpans), // ARGB8565_Premultiplied SPANFUNC_POINTER(blend_src_generic, RegularSpans), // RGB666 @@ -6856,7 +6763,7 @@ static const ProcessSpans processTextureSpansCallback[NBlendTypes][QImage::NImag blend_src_generic<CallbackSpans>, // Indexed8 blend_src_generic<CallbackSpans>, // RGB32 blend_src_generic<CallbackSpans>, // ARGB32 - blend_transformed_bilinear_argb<CallbackSpans>, // ARGB32_Premultiplied + blend_transformed_bilinear_argb<CallbackSpans, BlendTransformedBilinear>, // ARGB32_Premultiplied blend_src_generic<CallbackSpans>, // RGB16 blend_src_generic<CallbackSpans>, // ARGB8565_Premultiplied blend_src_generic<CallbackSpans>, // RGB666 @@ -6875,7 +6782,7 @@ static const ProcessSpans processTextureSpansCallback[NBlendTypes][QImage::NImag blend_src_generic<CallbackSpans>, // Indexed8 blend_src_generic<CallbackSpans>, // RGB32 blend_src_generic<CallbackSpans>, // ARGB32 - blend_transformed_bilinear_tiled_argb<CallbackSpans>, // ARGB32_Premultiplied + blend_transformed_bilinear_argb<CallbackSpans, BlendTransformedBilinearTiled>, // ARGB32_Premultiplied blend_src_generic<CallbackSpans>, // RGB16 blend_src_generic<CallbackSpans>, // ARGB8565_Premultiplied blend_src_generic<CallbackSpans>, // RGB666 @@ -7135,6 +7042,11 @@ void qt_build_pow_tables() { int winSmooth; if (SystemParametersInfo(0x200C /* SPI_GETFONTSMOOTHINGCONTRAST */, 0, &winSmooth, 0)) smoothing = winSmooth / 1000.0; + + // Safeguard ourselves against corrupt registry values... + if (smoothing > 5 || smoothing < 1) + smoothing = 1.4; + #endif #ifdef Q_WS_X11 diff --git a/src/gui/painting/qpathclipper.cpp b/src/gui/painting/qpathclipper.cpp index 949a820..00e74ba 100644 --- a/src/gui/painting/qpathclipper.cpp +++ b/src/gui/painting/qpathclipper.cpp @@ -935,10 +935,9 @@ qreal QWingedEdge::delta(int vertex, int a, int b) const qreal result = b_angle - a_angle; - if (qFuzzyIsNull(result) || qFuzzyCompare(result, 128)) - return 0; - - if (result < 0) + if (result >= 128.) + return result - 128.; + else if (result < 0) return result + 128.; else return result; diff --git a/src/gui/painting/qtextureglyphcache.cpp b/src/gui/painting/qtextureglyphcache.cpp index 9eda0ef..631a9cf 100644 --- a/src/gui/painting/qtextureglyphcache.cpp +++ b/src/gui/painting/qtextureglyphcache.cpp @@ -79,6 +79,7 @@ void QTextureGlyphCache::populate(QFontEngine *fontEngine, int numGlyphs, const m_current_fontengine = fontEngine; const int margin = glyphMargin(); + const int paddingDoubled = glyphPadding() * 2; QHash<glyph_t, Coord> listItemCoordinates; int rowHeight = 0; @@ -124,7 +125,7 @@ void QTextureGlyphCache::populate(QFontEngine *fontEngine, int numGlyphs, const if (listItemCoordinates.isEmpty()) return; - rowHeight += margin * 2; + rowHeight += margin * 2 + paddingDoubled; if (isNull()) createCache(QT_DEFAULT_TEXTURE_GLYPH_CACHE_WIDTH, qt_next_power_of_two(rowHeight)); @@ -138,7 +139,7 @@ void QTextureGlyphCache::populate(QFontEngine *fontEngine, int numGlyphs, const if (m_cx + c.w > m_w) { // no room on the current line, start new glyph strip m_cx = 0; - m_cy += m_currentRowHeight; + m_cy += m_currentRowHeight + paddingDoubled; m_currentRowHeight = 0; // New row } if (m_cy + c.h > m_h) { @@ -156,7 +157,7 @@ void QTextureGlyphCache::populate(QFontEngine *fontEngine, int numGlyphs, const fillTexture(c, iter.key()); coords.insert(iter.key(), c); - m_cx += c.w; + m_cx += c.w + paddingDoubled; ++iter; } diff --git a/src/gui/painting/qtextureglyphcache_p.h b/src/gui/painting/qtextureglyphcache_p.h index 8c2f5b4..390fe51 100644 --- a/src/gui/painting/qtextureglyphcache_p.h +++ b/src/gui/painting/qtextureglyphcache_p.h @@ -98,6 +98,7 @@ public: virtual void createTextureData(int width, int height) = 0; virtual void resizeTextureData(int width, int height) = 0; virtual int glyphMargin() const { return 0; } + virtual int glyphPadding() const { return 0; } virtual void fillTexture(const Coord &coord, glyph_t glyph) = 0; diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp index f49acc4..28cbc45 100644 --- a/src/gui/styles/qs60style.cpp +++ b/src/gui/styles/qs60style.cpp @@ -122,6 +122,8 @@ QPalette *QS60StylePrivate::m_themePalette = 0; qint64 QS60StylePrivate::m_webPaletteKey = 0; +QPointer<QWidget> QS60StylePrivate::m_pressedWidget = 0; + const struct QS60StylePrivate::frameElementCenter QS60StylePrivate::m_frameElementsData[] = { {SE_ButtonNormal, QS60StyleEnums::SP_QsnFrButtonTbCenter}, {SE_ButtonPressed, QS60StyleEnums::SP_QsnFrButtonTbCenterPressed}, @@ -138,6 +140,8 @@ const struct QS60StylePrivate::frameElementCenter QS60StylePrivate::m_frameEleme {SE_PanelBackground, QS60StyleEnums::SP_QsnFrSetOptCenter}, {SE_ButtonInactive, QS60StyleEnums::SP_QsnFrButtonCenterInactive}, {SE_Editor, QS60StyleEnums::SP_QsnFrInputCenter}, + {SE_TableItemPressed, QS60StyleEnums::SP_QsnFrGridCenterPressed}, + {SE_ListItemPressed, QS60StyleEnums::SP_QsnFrListPressed}, }; static const int frameElementsCount = @@ -294,6 +298,12 @@ void QS60StylePrivate::drawSkinElement(SkinElements element, QPainter *painter, case SE_DropArea: drawPart(QS60StyleEnums::SP_QgnGrafOrgBgGrid, painter, rect, flags | SF_PointNorth); break; + case SE_TableItemPressed: + drawFrame(SF_TableItemPressed, painter, rect, flags | SF_PointNorth); + break; + case SE_ListItemPressed: + drawFrame(SF_ListItemPressed, painter, rect, flags | SF_PointNorth); + break; default: break; } @@ -939,6 +949,11 @@ bool QS60StylePrivate::canDrawThemeBackground(const QBrush &backgroundBrush, con backgroundBrush.style() == Qt::NoBrush) ? true : false; } +bool QS60StylePrivate::isWidgetPressed(const QWidget *widget) +{ + return (widget && widget == m_pressedWidget); +} + /*! \class QS60Style \brief The QS60Style class provides a look and feel suitable for applications on S60. @@ -1424,73 +1439,37 @@ void QS60Style::drawControl(ControlElement element, const QStyleOption *option, // draw themed background for table unless background brush has been defined. if (vopt->backgroundBrush == Qt::NoBrush) { if (itemView) { - const QModelIndex index = vopt->index; - //todo: Draw cell background only once - for the first cell. - QStyleOptionViewItemV4 voptAdj2 = voptAdj; - const QModelIndex indexFirst = itemView->model()->index(0, 0); - const QModelIndex indexLast = itemView->model()->index( - itemView->model()->rowCount() - 1, itemView->model()->columnCount() -1); - if (itemView->viewport()) - voptAdj2.rect = QRect( itemView->visualRect(indexFirst).topLeft(), - itemView->visualRect(indexLast).bottomRight()).intersect(itemView->viewport()->rect()); drawPrimitive(PE_PanelItemViewItem, &voptAdj, painter, widget); } } else { QCommonStyle::drawPrimitive(PE_PanelItemViewItem, &voptAdj, painter, widget);} - // draw the focus rect - if (isSelected || hasFocus ) { - QRect highlightRect = option->rect.adjusted(1,1,-1,-1); - QAbstractItemView::SelectionBehavior selectionBehavior = - itemView ? itemView->selectionBehavior() : QAbstractItemView::SelectItems; - if (selectionBehavior != QAbstractItemView::SelectItems) { - // set highlight rect so that it is continuous from cell to cell, yet sligthly - // smaller than cell rect - int xBeginning = 0, yBeginning = 0, xEnd = 0, yEnd = 0; - if (selectionBehavior == QAbstractItemView::SelectRows) { - yBeginning = 1; yEnd = -1; - if (vopt->viewItemPosition == QStyleOptionViewItemV4::Beginning) - xBeginning = 1; - else if (vopt->viewItemPosition == QStyleOptionViewItemV4::End) - xEnd = -1; - } else if (selectionBehavior == QAbstractItemView::SelectColumns) { - xBeginning = 1; xEnd = -1; - if (vopt->viewItemPosition == QStyleOptionViewItemV4::Beginning) - yBeginning = 1; - else if (vopt->viewItemPosition == QStyleOptionViewItemV4::End) - yEnd = -1; - } - highlightRect = option->rect.adjusted(xBeginning, yBeginning, xEnd, yEnd); - } - if (vopt->showDecorationSelected && - (vopt->palette.highlight().color() == QS60StylePrivate::themePalette()->highlight().color())) - QS60StylePrivate::drawSkinElement(QS60StylePrivate::SE_ListHighlight, painter, highlightRect, flags); - else - painter->fillRect(highlightRect, vopt->palette.highlight()); - } - // draw the icon const QIcon::Mode mode = (voptAdj.state & State_Enabled) ? QIcon::Normal : QIcon::Disabled; - const QIcon::State state = voptAdj.state & State_Open ? QIcon::On : QIcon::Off; + const QIcon::State state = (voptAdj.state & State_Open) ? QIcon::On : QIcon::Off; voptAdj.icon.paint(painter, iconRect, voptAdj.decorationAlignment, mode, state); // Draw selection check mark. Show check mark only in multi selection modes. if (itemView) { const bool singleSelection = (itemView->selectionMode() == QAbstractItemView::SingleSelection || - itemView->selectionMode() == QAbstractItemView::NoSelection); + itemView->selectionMode() == QAbstractItemView::NoSelection)|| + (itemView->selectionModel()->selectedIndexes().count() < 2 ); + + const bool selectItemsOnly = (itemView->selectionBehavior() == QAbstractItemView::SelectItems); + const QRect selectionRect = subElementRect(SE_ItemViewItemCheckIndicator, &voptAdj, widget); QStyleOptionViewItemV4 checkMarkOption(voptAdj); - // Draw selection mark. - if (voptAdj.state & State_Selected && !singleSelection) { + if (selectionRect.isValid()) checkMarkOption.rect = selectionRect; - drawPrimitive(PE_IndicatorViewItemCheck, &checkMarkOption, painter, widget); - if ( textRect.right() > selectionRect.left() ) + // Draw selection mark. + if (isSelected && !singleSelection && selectItemsOnly) { + proxy()->drawPrimitive(PE_IndicatorViewItemCheck, &checkMarkOption, painter, widget); + // @todo: this should happen in the rect retrievel i.e. subElementRect() + if (textRect.right() > selectionRect.left()) textRect.setRight(selectionRect.left()); } else if (singleSelection && - voptAdj.features & QStyleOptionViewItemV2::HasCheckIndicator && - selectionRect.isValid()) { - checkMarkOption.rect = selectionRect; + voptAdj.features & QStyleOptionViewItemV2::HasCheckIndicator) { checkMarkOption.state = checkMarkOption.state & ~State_HasFocus; switch (vopt->checkState) { @@ -2037,7 +2016,10 @@ void QS60Style::drawPrimitive(PrimitiveElement element, const QStyleOption *opti if (option->palette.highlight().color() == QS60StylePrivate::themePalette()->highlight().color()) if ((qstyleoption_cast<const QStyleOptionFocusRect *>(option) && (qobject_cast<const QRadioButton *>(widget) || qobject_cast<const QCheckBox *>(widget)))) - QS60StylePrivate::drawSkinElement(QS60StylePrivate::SE_ListHighlight, painter, option->rect, flags); + QS60StylePrivate::drawSkinElement( + QS60StylePrivate::isWidgetPressed(widget) ? + QS60StylePrivate::SE_ListItemPressed : + QS60StylePrivate::SE_ListHighlight, painter, option->rect, flags); else commonStyleDraws = true; } @@ -2257,6 +2239,57 @@ void QS60Style::drawPrimitive(PrimitiveElement element, const QStyleOption *opti break; #ifndef QT_NO_ITEMVIEWS case PE_PanelItemViewItem: + if (const QStyleOptionViewItemV4 *vopt = qstyleoption_cast<const QStyleOptionViewItemV4 *>(option)) { + const bool isSelected = (vopt->state & State_Selected); + const bool hasFocus = (vopt->state & State_HasFocus); + const bool isPressed = QS60StylePrivate::isWidgetPressed(widget); + + if (option->palette.highlight().color() == QS60StylePrivate::themePalette()->highlight().color()) { + QRect highlightRect = vopt->rect.adjusted(1,1,-1,-1); + const QAbstractItemView *itemView = qobject_cast<const QAbstractItemView *>(widget); + QAbstractItemView::SelectionBehavior selectionBehavior = + itemView ? itemView->selectionBehavior() : QAbstractItemView::SelectItems; + // Set the draw area for highlights (focus, select rect or pressed rect) + if (hasFocus || isSelected || isPressed) { + if (selectionBehavior != QAbstractItemView::SelectItems) { + // set highlight rect so that it is continuous from cell to cell, yet sligthly + // smaller than cell rect + int xBeginning = 0, yBeginning = 0, xEnd = 0, yEnd = 0; + if (selectionBehavior == QAbstractItemView::SelectRows) { + yBeginning = 1; yEnd = -1; + if (vopt->viewItemPosition == QStyleOptionViewItemV4::Beginning) + xBeginning = 1; + else if (vopt->viewItemPosition == QStyleOptionViewItemV4::End) + xEnd = -1; + } else if (selectionBehavior == QAbstractItemView::SelectColumns) { + xBeginning = 1; xEnd = -1; + if (vopt->viewItemPosition == QStyleOptionViewItemV4::Beginning) + yBeginning = 1; + else if (vopt->viewItemPosition == QStyleOptionViewItemV4::End) + yEnd = -1; + } + highlightRect = option->rect.adjusted(xBeginning, yBeginning, xEnd, yEnd); + } + } + bool tableView = false; + if (itemView && qobject_cast<const QTableView *>(widget)) + tableView = true; + + QS60StylePrivate::SkinElements element; + QRect elementRect = option->rect; + + //draw item is drawn as pressed, if it already has focus. + if (isPressed && (hasFocus || isSelected)) { + element = tableView ? QS60StylePrivate::SE_TableItemPressed : QS60StylePrivate::SE_ListItemPressed; + } else if (hasFocus || (isSelected && selectionBehavior != QAbstractItemView::SelectItems)) { + element = QS60StylePrivate::SE_ListHighlight; + elementRect = highlightRect; + } + QS60StylePrivate::drawSkinElement(element, painter, elementRect, flags); + } else { + QCommonStyle::drawPrimitive(element, option, painter, widget); + } + } break; #endif //QT_NO_ITEMVIEWS @@ -3067,8 +3100,11 @@ void QS60Style::unpolish(QWidget *widget) void QS60Style::polish(QApplication *application) { Q_D(QS60Style); + QCommonStyle::polish(qApp); d->m_originalPalette = application->palette(); d->setThemePalette(application); + if (QS60StylePrivate::isTouchSupported()) + qApp->installEventFilter(this); } /*! @@ -3077,10 +3113,14 @@ void QS60Style::polish(QApplication *application) void QS60Style::unpolish(QApplication *application) { Q_UNUSED(application) + Q_D(QS60Style); + QCommonStyle::unpolish(qApp); const QPalette newPalette = QApplication::style()->standardPalette(); QApplication::setPalette(newPalette); QApplicationPrivate::setSystemPalette(d->m_originalPalette); + if (QS60StylePrivate::isTouchSupported()) + qApp->removeEventFilter(this); } /*! @@ -3227,9 +3267,40 @@ QIcon QS60Style::standardIconImplementation(StandardPixmap standardIcon, */ bool QS60Style::eventFilter(QObject *object, QEvent *event) { + Q_D(QS60Style); + switch(event->type()) { + case QEvent::MouseButtonPress: { + QWidget *w = QApplication::widgetAt(QCursor::pos()); + if (w) { + QWidget *focusW = w->focusProxy(); + if (qobject_cast<QAbstractItemView *>(focusW) || + qobject_cast<QRadioButton *>(focusW) || + qobject_cast<QCheckBox *>(focusW)) + d->m_pressedWidget = focusW; + else if (qobject_cast<QAbstractItemView *>(w)|| + qobject_cast<QRadioButton *>(w) || + qobject_cast<QCheckBox *>(w)) + d->m_pressedWidget = w; + + if ( d->m_pressedWidget) + d->m_pressedWidget->update(); + } + break; + } + case QEvent::MouseButtonRelease: { + const QWidget *w = QApplication::widgetAt(QCursor::pos()); + if (w && d->m_pressedWidget) { + d->m_pressedWidget->update(); + d->m_pressedWidget = 0; + } + break; + } + default: + break; + } + #ifdef Q_WS_S60 #ifndef QT_NO_PROGRESSBAR - Q_D(QS60Style); switch(event->type()) { case QEvent::StyleChange: case QEvent::Show: @@ -3250,7 +3321,7 @@ bool QS60Style::eventFilter(QObject *object, QEvent *event) } #endif // QT_NO_PROGRESSBAR #endif // Q_WS_S60 - return QStyle::eventFilter(object, event); + return QCommonStyle::eventFilter(object, event); } /*! diff --git a/src/gui/styles/qs60style_p.h b/src/gui/styles/qs60style_p.h index 6ce4960..9dd3810 100644 --- a/src/gui/styles/qs60style_p.h +++ b/src/gui/styles/qs60style_p.h @@ -293,6 +293,24 @@ public: SP_QsnFrButtonSideLInactive, SP_QsnFrButtonSideRInactive, SP_QsnFrButtonCenterInactive, + SP_QsnFrGridCornerTlPressed, // Pressed table item + SP_QsnFrGridCornerTrPressed, + SP_QsnFrGridCornerBlPressed, + SP_QsnFrGridCornerBrPressed, + SP_QsnFrGridSideTPressed, + SP_QsnFrGridSideBPressed, + SP_QsnFrGridSideLPressed, + SP_QsnFrGridSideRPressed, + SP_QsnFrGridCenterPressed, + SP_QsnFrListCornerTlPressed, // Pressed list item + SP_QsnFrListCornerTrPressed, + SP_QsnFrListCornerBlPressed, + SP_QsnFrListCornerBrPressed, + SP_QsnFrListSideTPressed, + SP_QsnFrListSideBPressed, + SP_QsnFrListSideLPressed, + SP_QsnFrListSideRPressed, + SP_QsnFrListPressed, }; enum ColorLists { @@ -424,7 +442,9 @@ public: SE_ScrollBarHandlePressedVertical, SE_ButtonInactive, SE_Editor, - SE_DropArea + SE_DropArea, + SE_TableItemPressed, + SE_ListItemPressed, }; enum SkinFrameElements { @@ -442,6 +462,8 @@ public: SF_ToolBarButtonPressed, SF_PanelBackground, SF_ButtonInactive, + SF_TableItemPressed, + SF_ListItemPressed, }; enum SkinElementFlag { @@ -496,6 +518,7 @@ public: static bool isToolBarBackground(); static bool hasSliderGrooveGraphic(); static bool isSingleClickUi(); + static bool isWidgetPressed(const QWidget *widget); // calculates average color based on button skin graphics (minus borders). QColor colorFromFrameGraphics(SkinFrameElements frame) const; @@ -593,6 +616,8 @@ private: QPointer<QFocusFrame> m_focusFrame; static qint64 m_webPaletteKey; + static QPointer<QWidget> m_pressedWidget; + #ifdef Q_WS_S60 //list of progress bars having animation running QList<QProgressBar *> m_bars; diff --git a/src/gui/styles/qs60style_s60.cpp b/src/gui/styles/qs60style_s60.cpp index 6a552e0..58a7159 100644 --- a/src/gui/styles/qs60style_s60.cpp +++ b/src/gui/styles/qs60style_s60.cpp @@ -377,6 +377,27 @@ const partMapEntry QS60StyleModeSpecifics::m_partMap[] = { /* SP_QsnFrButtonSideRInactive */ {KAknsIIDQsnFrButtonTbSideR, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x21b8}, /* SP_QsnFrButtonCenterInactive */ {KAknsIIDQsnFrButtonTbCenter, EDrawIcon, ES60_3_X, EAknsMajorSkin, 0x21b9}, + // No pressed down grid in 3.1/3.2 + /* SP_QsnFrGridCornerTlPressed */ {KAknsIIDQsnFrGridCornerTl, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2681}, /*KAknsIIDQsnFrGridCornerTlPressed*/ + /* SP_QsnFrGridCornerTrPressed */ {KAknsIIDQsnFrGridCornerTr, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2682}, + /* SP_QsnFrGridCornerBlPressed */ {KAknsIIDQsnFrGridCornerBl, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2683}, + /* SP_QsnFrGridCornerBrPressed */ {KAknsIIDQsnFrGridCornerBr, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2684}, + /* SP_QsnFrGridSideTPressed */ {KAknsIIDQsnFrGridSideT, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2685}, + /* SP_QsnFrGridSideBPressed */ {KAknsIIDQsnFrGridSideB, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2686}, + /* SP_QsnFrGridSideLPressed */ {KAknsIIDQsnFrGridSideL, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2687}, + /* SP_QsnFrGridSideRPressed */ {KAknsIIDQsnFrGridSideR, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2688}, + /* SP_QsnFrGridCenterPressed */ {KAknsIIDQsnFrGridCenter, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2689}, + + // No pressed down list in 3.1/3.2 + /* SP_QsnFrListCornerTlPressed */ {KAknsIIDQsnFrListCornerTl, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x268b}, /*KAknsIIDQsnFrListCornerTlPressed*/ + /* SP_QsnFrListCornerTrPressed */ {KAknsIIDQsnFrListCornerTr, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x268c}, + /* SP_QsnFrListCornerBlPressed */ {KAknsIIDQsnFrListCornerBl, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x268d}, + /* SP_QsnFrListCornerBrPressed */ {KAknsIIDQsnFrListCornerBr, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x268e}, + /* SP_QsnFrListSideTPressed */ {KAknsIIDQsnFrListSideT, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x268f}, + /* SP_QsnFrListSideBPressed */ {KAknsIIDQsnFrListSideB, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2690}, + /* SP_QsnFrListSideLPressed */ {KAknsIIDQsnFrListSideL, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2691}, + /* SP_QsnFrListSideRPressed */ {KAknsIIDQsnFrListSideR, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2692}, + /* SP_QsnFrListPressed */ {KAknsIIDQsnFrList, ENoDraw, ES60_3_X, EAknsMajorSkin, 0x2693}, }; QPixmap QS60StyleModeSpecifics::skinnedGraphics( diff --git a/src/gui/styles/qstylesheetstyle.cpp b/src/gui/styles/qstylesheetstyle.cpp index cc0ce08..a1a98ba 100644 --- a/src/gui/styles/qstylesheetstyle.cpp +++ b/src/gui/styles/qstylesheetstyle.cpp @@ -3169,8 +3169,8 @@ void QStyleSheetStyle::drawComplexControl(ComplexControl cc, const QStyleOptionC if (subRule1.hasDrawable()) { QRect r(gr.topLeft(), slider->orientation == Qt::Horizontal - ? QPoint(hr.x()+hr.width()/2, gr.y()+gr.height()) - : QPoint(gr.x()+gr.width(), hr.y()+hr.height()/2)); + ? QPoint(hr.x()+hr.width()/2, gr.y()+gr.height() - 1) + : QPoint(gr.x()+gr.width() - 1, hr.y()+hr.height()/2)); subRule1.drawRule(p, r); } diff --git a/src/gui/text/qfont.cpp b/src/gui/text/qfont.cpp index cb16a16..24887b5 100644 --- a/src/gui/text/qfont.cpp +++ b/src/gui/text/qfont.cpp @@ -1286,9 +1286,11 @@ QFont::StyleHint QFont::styleHint() const \value PreferAntialias antialias if possible. \value OpenGLCompatible forces the use of OpenGL compatible fonts. - \value NoFontMerging If a font does not contain a character requested - to draw then Qt automatically chooses a similar looking for that contains - the character. This flag disables this feature. + \value NoFontMerging If the font selected for a certain writing system + does not contain a character requested to draw, then Qt automatically chooses a similar + looking font that contains the character. The NoFontMerging flag disables this feature. + Please note that enabling this flag will not prevent Qt from automatically picking a + suitable font when the selected font does not support the writing system of the text. Any of these may be OR-ed with one of these flags: diff --git a/src/gui/text/qfontdatabase_x11.cpp b/src/gui/text/qfontdatabase_x11.cpp index b1ab478..3b2e4e9 100644 --- a/src/gui/text/qfontdatabase_x11.cpp +++ b/src/gui/text/qfontdatabase_x11.cpp @@ -1939,8 +1939,13 @@ void QFontDatabase::load(const QFontPrivate *d, int script) fe = loadFc(d, script, req); if (fe != 0 && fe->fontDef.pixelSize != req.pixelSize) { - delete fe; - fe = loadXlfd(d->screen, script, req); + QFontEngine *xlfdFontEngine = loadXlfd(d->screen, script, req); + if (xlfdFontEngine->fontDef.family == fe->fontDef.family) { + delete fe; + fe = xlfdFontEngine; + } else { + delete xlfdFontEngine; + } } diff --git a/src/gui/util/qcompleter.cpp b/src/gui/util/qcompleter.cpp index c095b3b..8e7ec80 100644 --- a/src/gui/util/qcompleter.cpp +++ b/src/gui/util/qcompleter.cpp @@ -1689,8 +1689,10 @@ QString QCompleter::pathFromIndex(const QModelIndex& index) const QString t; if (isDirModel) t = sourceModel->data(idx, Qt::EditRole).toString(); +#ifndef QT_NO_FILESYSTEMMODEL else t = sourceModel->data(idx, QFileSystemModel::FileNameRole).toString(); +#endif list.prepend(t); QModelIndex parent = idx.parent(); idx = parent.sibling(parent.row(), index.column()); diff --git a/src/gui/widgets/qdialogbuttonbox.cpp b/src/gui/widgets/qdialogbuttonbox.cpp index cc74a53..732dbc9 100644 --- a/src/gui/widgets/qdialogbuttonbox.cpp +++ b/src/gui/widgets/qdialogbuttonbox.cpp @@ -258,6 +258,7 @@ static const int layouts[2][5][14] = } }; +#if defined(QT_SOFTKEYS_ENABLED) && !defined(QT_NO_ACTION) class QDialogButtonEnabledProxy : public QObject { public: @@ -281,7 +282,7 @@ private: QWidget *source; QAction *target; }; - +#endif class QDialogButtonBoxPrivate : public QWidgetPrivate { @@ -314,7 +315,7 @@ public: void addButtonsToLayout(const QList<QAbstractButton *> &buttonList, bool reverse); void retranslateStrings(); const char *standardButtonText(QDialogButtonBox::StandardButton sbutton) const; -#ifdef QT_SOFTKEYS_ENABLED +#if defined(QT_SOFTKEYS_ENABLED) && !defined(QT_NO_ACTION) QAction *createSoftKey(QAbstractButton *button, QDialogButtonBox::ButtonRole role); #endif }; @@ -571,7 +572,7 @@ void QDialogButtonBoxPrivate::addButton(QAbstractButton *button, QDialogButtonBo QObject::connect(button, SIGNAL(clicked()), q, SLOT(_q_handleButtonClicked())); QObject::connect(button, SIGNAL(destroyed()), q, SLOT(_q_handleButtonDestroyed())); buttonLists[role].append(button); -#ifdef QT_SOFTKEYS_ENABLED +#if defined(QT_SOFTKEYS_ENABLED) && !defined(QT_NO_ACTION) QAction *action = createSoftKey(button, role); softKeyActions.insert(button, action); new QDialogButtonEnabledProxy(action, button, action); @@ -580,7 +581,7 @@ void QDialogButtonBoxPrivate::addButton(QAbstractButton *button, QDialogButtonBo layoutButtons(); } -#ifdef QT_SOFTKEYS_ENABLED +#if defined(QT_SOFTKEYS_ENABLED) && !defined(QT_NO_ACTION) QAction* QDialogButtonBoxPrivate::createSoftKey(QAbstractButton *button, QDialogButtonBox::ButtonRole role) { Q_Q(QDialogButtonBox); @@ -718,7 +719,7 @@ void QDialogButtonBoxPrivate::retranslateStrings() if (buttonText) { QPushButton *button = it.key(); button->setText(QDialogButtonBox::tr(buttonText)); -#ifdef QT_SOFTKEYS_ENABLED +#if defined(QT_SOFTKEYS_ENABLED) && !defined(QT_NO_ACTION) QAction *action = softKeyActions.value(button, 0); if (action) action->setText(button->text()); @@ -997,7 +998,7 @@ void QDialogButtonBox::removeButton(QAbstractButton *button) } } } -#ifdef QT_SOFTKEYS_ENABLED +#if defined(QT_SOFTKEYS_ENABLED) && !defined(QT_NO_ACTION) QAction *action = d->softKeyActions.value(button, 0); if (action) { d->softKeyActions.remove(button); @@ -1243,7 +1244,7 @@ bool QDialogButtonBox::event(QEvent *event) }else if (event->type() == QEvent::LanguageChange) { d->retranslateStrings(); } -#ifdef QT_SOFTKEYS_ENABLED +#if defined(QT_SOFTKEYS_ENABLED) && !defined(QT_NO_ACTION) else if (event->type() == QEvent::ParentChange) { QWidget *dialog = 0; QWidget *p = this; diff --git a/src/gui/widgets/qframe.cpp b/src/gui/widgets/qframe.cpp index c2e4b35..f51ddfd 100644 --- a/src/gui/widgets/qframe.cpp +++ b/src/gui/widgets/qframe.cpp @@ -244,7 +244,7 @@ QFrame::~QFrame() /*! Returns the frame style. - The default value is QFrame::NoFrame. + The default value is QFrame::Plain. \sa setFrameStyle(), frameShape(), frameShadow() */ diff --git a/src/gui/widgets/qmenubar.cpp b/src/gui/widgets/qmenubar.cpp index e368d3d..a13a2fa 100644 --- a/src/gui/widgets/qmenubar.cpp +++ b/src/gui/widgets/qmenubar.cpp @@ -268,19 +268,15 @@ void QMenuBarPrivate::updateGeometries() QRect QMenuBarPrivate::actionRect(QAction *act) const { - Q_Q(const QMenuBar); const int index = actions.indexOf(act); - if (index == -1) - return QRect(); //makes sure the geometries are up-to-date const_cast<QMenuBarPrivate*>(this)->updateGeometries(); - if (index >= actionRects.count()) + if (index < 0 || index >= actionRects.count()) return QRect(); // that can happen in case of native menubar - QRect ret = actionRects.at(index); - return QStyle::visualRect(q->layoutDirection(), q->rect(), ret); + return actionRects.at(index); } void QMenuBarPrivate::focusFirstAction() @@ -505,6 +501,9 @@ void QMenuBarPrivate::calcActionRects(int max_width, int start) const //keep moving along.. x += rect.width() + itemSpacing; + + //make sure we follow the layout direction + rect = QStyle::visualRect(q->layoutDirection(), q->rect(), rect); } } diff --git a/src/imports/gestures/qdeclarativegesturearea.cpp b/src/imports/gestures/qdeclarativegesturearea.cpp index b8c8f57..615c674 100644 --- a/src/imports/gestures/qdeclarativegesturearea.cpp +++ b/src/imports/gestures/qdeclarativegesturearea.cpp @@ -82,6 +82,9 @@ public: A GestureArea is like a MouseArea, but it has signals for gesture events. + \e {Elements in the Qt.labs module are not guaranteed to remain compatible + in future versions.} + \e {This element is only functional on devices with touch input.} \qml diff --git a/src/imports/multimedia/qdeclarativeaudio.cpp b/src/imports/multimedia/qdeclarativeaudio.cpp index 8d2dc61..82d5d89 100644 --- a/src/imports/multimedia/qdeclarativeaudio.cpp +++ b/src/imports/multimedia/qdeclarativeaudio.cpp @@ -54,7 +54,7 @@ QT_BEGIN_NAMESPACE This element is part of the \bold{Qt.multimedia 4.7} module. \qml - import Qt 4.6 + import Qt 4.7 import Qt.multimedia 4.7 Audio { source: "audio/song.mp3" } diff --git a/src/imports/multimedia/qdeclarativevideo.cpp b/src/imports/multimedia/qdeclarativevideo.cpp index bf112be..c6ae272 100644 --- a/src/imports/multimedia/qdeclarativevideo.cpp +++ b/src/imports/multimedia/qdeclarativevideo.cpp @@ -76,7 +76,7 @@ void QDeclarativeVideo::_q_error(int errorCode, const QString &errorString) This element is part of the \bold{Qt.multimedia 4.7} module. \qml - import Qt 4.6 + import Qt 4.7 import Qt.multimedia 4.7 Video { source: "video/movie.mpg" } diff --git a/src/imports/particles/qdeclarativeparticles.cpp b/src/imports/particles/qdeclarativeparticles.cpp index e98a801..d17a8a1 100644 --- a/src/imports/particles/qdeclarativeparticles.cpp +++ b/src/imports/particles/qdeclarativeparticles.cpp @@ -624,6 +624,8 @@ void QDeclarativeParticlesPrivate::updateOpacity(QDeclarativeParticle &p, int ag \inherits Item Particles are available in the \bold{Qt.labs.particles 1.0} module. + \e {Elements in the Qt.labs module are not guaranteed to remain compatible + in future versions.} This element provides preliminary support for particles in QML, and may be heavily changed or removed in later versions. @@ -642,7 +644,7 @@ void QDeclarativeParticlesPrivate::updateOpacity(QDeclarativeParticle &p, int ag snow, the lower one has particles expelled up like a fountain. \qml -import Qt 4.6 +import Qt 4.7 import Qt.labs.particles 1.0 Rectangle { diff --git a/src/imports/widgets/widgets.cpp b/src/imports/widgets/widgets.cpp index f26969a..1a71a68 100644 --- a/src/imports/widgets/widgets.cpp +++ b/src/imports/widgets/widgets.cpp @@ -44,7 +44,7 @@ #include <QGraphicsWidget> #include "graphicslayouts_p.h" - +#include <private/qdeclarativegraphicswidget_p.h> QT_BEGIN_NAMESPACE class QWidgetsQmlModule : public QDeclarativeExtensionPlugin @@ -60,7 +60,6 @@ public: qmlRegisterType<QGraphicsLinearLayoutStretchItemObject>(uri,4,6,"QGraphicsLinearLayoutStretchItem"); qmlRegisterType<QGraphicsLinearLayoutObject>(uri,4,6,"QGraphicsLinearLayout"); qmlRegisterType<QGraphicsGridLayoutObject>(uri,4,6,"QGraphicsGridLayout"); - qmlRegisterType<QGraphicsWidget>(uri,4,6,"QGraphicsWidget"); } }; diff --git a/src/multimedia/effects/qsoundeffect.cpp b/src/multimedia/effects/qsoundeffect.cpp index 8a38103..d34e532 100644 --- a/src/multimedia/effects/qsoundeffect.cpp +++ b/src/multimedia/effects/qsoundeffect.cpp @@ -61,7 +61,7 @@ QT_BEGIN_NAMESPACE The following example plays a wav file on mouse click. \qml - import Qt 4.6 + import Qt 4.7 import Qt.multimedia 4.7 Item { diff --git a/src/network/access/qhttpnetworkconnectionchannel.cpp b/src/network/access/qhttpnetworkconnectionchannel.cpp index 17b864c..4a31b6f 100644 --- a/src/network/access/qhttpnetworkconnectionchannel.cpp +++ b/src/network/access/qhttpnetworkconnectionchannel.cpp @@ -691,6 +691,8 @@ void QHttpNetworkConnectionChannel::detectPipeliningSupport() && (serverHeaderField = reply->headerField("Server"), !serverHeaderField.contains("Microsoft-IIS/4.")) && (!serverHeaderField.contains("Microsoft-IIS/5.")) && (!serverHeaderField.contains("Netscape-Enterprise/3.")) + // this is adpoted from the knowledge of the Nokia 7.x browser team (DEF143319) + && (!serverHeaderField.contains("WebLogic")) ) { pipeliningSupported = QHttpNetworkConnectionChannel::PipeliningProbablySupported; } else { diff --git a/src/network/access/qnetworkaccessbackend.cpp b/src/network/access/qnetworkaccessbackend.cpp index 1fcfebb..f188bd5 100644 --- a/src/network/access/qnetworkaccessbackend.cpp +++ b/src/network/access/qnetworkaccessbackend.cpp @@ -346,6 +346,8 @@ void QNetworkAccessBackend::sslErrors(const QList<QSslError> &errors) #endif } +#ifndef QT_NO_BEARERMANAGEMENT + /*! Starts the backend. Returns true if the backend is started. Returns false if the backend could not be started due to an unopened or roaming session. The caller should recall this @@ -376,5 +378,6 @@ bool QNetworkAccessBackend::start() return false; } +#endif QT_END_NAMESPACE diff --git a/src/network/access/qnetworkaccessbackend_p.h b/src/network/access/qnetworkaccessbackend_p.h index 9bc15e5..4ce37a6 100644 --- a/src/network/access/qnetworkaccessbackend_p.h +++ b/src/network/access/qnetworkaccessbackend_p.h @@ -111,7 +111,9 @@ public: // socket). virtual void open() = 0; +#ifndef QT_NO_BEARERMANAGEMENT virtual bool start(); +#endif virtual void closeDownstreamChannel() = 0; virtual bool waitForDownstreamReadyRead(int msecs) = 0; diff --git a/src/network/access/qnetworkaccessmanager.cpp b/src/network/access/qnetworkaccessmanager.cpp index 90afd2c..feb9d99 100644 --- a/src/network/access/qnetworkaccessmanager.cpp +++ b/src/network/access/qnetworkaccessmanager.cpp @@ -742,6 +742,8 @@ QNetworkReply *QNetworkAccessManager::deleteResource(const QNetworkRequest &requ return d_func()->postProcess(createRequest(QNetworkAccessManager::DeleteOperation, request)); } +#ifndef QT_NO_BEARERMANAGEMENT + /*! \since 4.7 @@ -858,6 +860,8 @@ QNetworkAccessManager::NetworkAccessibility QNetworkAccessManager::networkAccess } } +#endif // QT_NO_BEARERMANAGEMENT + /*! \since 4.7 @@ -913,6 +917,7 @@ QNetworkReply *QNetworkAccessManager::createRequest(QNetworkAccessManager::Opera return new QFileNetworkReply(this, req, op); } +#ifndef QT_NO_BEARERMANAGEMENT // Return a disabled network reply if network access is disabled. // Except if the scheme is empty or file://. if (!d->networkAccessible && !(req.url().scheme() == QLatin1String("file") || @@ -934,6 +939,7 @@ QNetworkReply *QNetworkAccessManager::createRequest(QNetworkAccessManager::Opera if (d->networkSession) d->networkSession->setSessionProperty(QLatin1String("AutoCloseSessionTimeout"), -1); +#endif QNetworkRequest request = req; if (!request.header(QNetworkRequest::ContentLengthHeader).isValid() && @@ -951,10 +957,12 @@ QNetworkReply *QNetworkAccessManager::createRequest(QNetworkAccessManager::Opera // first step: create the reply QUrl url = request.url(); QNetworkReplyImpl *reply = new QNetworkReplyImpl(this); +#ifndef QT_NO_BEARERMANAGEMENT if (req.url().scheme() != QLatin1String("file") && !req.url().scheme().isEmpty()) { connect(this, SIGNAL(networkSessionConnected()), reply, SLOT(_q_networkSessionConnected())); } +#endif QNetworkReplyImplPrivate *priv = reply->d_func(); priv->manager = this; @@ -994,8 +1002,10 @@ void QNetworkAccessManagerPrivate::_q_replyFinished() if (reply) emit q->finished(reply); +#ifndef QT_NO_BEARERMANAGEMENT if (networkSession && q->findChildren<QNetworkReply *>().count() == 1) networkSession->setSessionProperty(QLatin1String("AutoCloseSessionTimeout"), 120000); +#endif } void QNetworkAccessManagerPrivate::_q_replySslErrors(const QList<QSslError> &errors) @@ -1248,6 +1258,7 @@ QNetworkAccessManagerPrivate::~QNetworkAccessManagerPrivate() { } +#ifndef QT_NO_BEARERMANAGEMENT void QNetworkAccessManagerPrivate::createSession(const QNetworkConfiguration &config) { Q_Q(QNetworkAccessManager); @@ -1328,6 +1339,7 @@ void QNetworkAccessManagerPrivate::_q_networkSessionStateChanged(QNetworkSession } } } +#endif // QT_NO_BEARERMANAGEMENT QT_END_NAMESPACE diff --git a/src/network/access/qnetworkaccessmanager.h b/src/network/access/qnetworkaccessmanager.h index c57c9c6..a0ffb07 100644 --- a/src/network/access/qnetworkaccessmanager.h +++ b/src/network/access/qnetworkaccessmanager.h @@ -62,7 +62,9 @@ class QNetworkReply; class QNetworkProxy; class QNetworkProxyFactory; class QSslError; +#ifndef QT_NO_BEARERMANAGEMENT class QNetworkConfiguration; +#endif class QNetworkReplyImplPrivate; class QNetworkAccessManagerPrivate; @@ -70,7 +72,9 @@ class Q_NETWORK_EXPORT QNetworkAccessManager: public QObject { Q_OBJECT +#ifndef QT_NO_BEARERMANAGEMENT Q_PROPERTY(NetworkAccessibility networkAccessible READ networkAccessible WRITE setNetworkAccessible NOTIFY networkAccessibleChanged) +#endif public: enum Operation { @@ -84,11 +88,13 @@ public: UnknownOperation = 0 }; +#ifndef QT_NO_BEARERMANAGEMENT enum NetworkAccessibility { UnknownAccessibility = -1, NotAccessible = 0, Accessible = 1 }; +#endif explicit QNetworkAccessManager(QObject *parent = 0); ~QNetworkAccessManager(); @@ -115,12 +121,14 @@ public: QNetworkReply *deleteResource(const QNetworkRequest &request); QNetworkReply *sendCustomRequest(const QNetworkRequest &request, const QByteArray &verb, QIODevice *data = 0); +#ifndef QT_NO_BEARERMANAGEMENT void setConfiguration(const QNetworkConfiguration &config); QNetworkConfiguration configuration() const; QNetworkConfiguration activeConfiguration() const; void setNetworkAccessible(NetworkAccessibility accessible); NetworkAccessibility networkAccessible() const; +#endif Q_SIGNALS: #ifndef QT_NO_NETWORKPROXY @@ -132,9 +140,11 @@ Q_SIGNALS: void sslErrors(QNetworkReply *reply, const QList<QSslError> &errors); #endif +#ifndef QT_NO_BEARERMANAGEMENT void networkSessionConnected(); void networkAccessibleChanged(QNetworkAccessManager::NetworkAccessibility accessible); +#endif protected: virtual QNetworkReply *createRequest(Operation op, const QNetworkRequest &request, @@ -145,10 +155,12 @@ private: Q_DECLARE_PRIVATE(QNetworkAccessManager) Q_PRIVATE_SLOT(d_func(), void _q_replyFinished()) Q_PRIVATE_SLOT(d_func(), void _q_replySslErrors(QList<QSslError>)) +#ifndef QT_NO_BEARERMANAGEMENT Q_PRIVATE_SLOT(d_func(), void _q_networkSessionClosed()) Q_PRIVATE_SLOT(d_func(), void _q_networkSessionNewConfigurationActivated()) Q_PRIVATE_SLOT(d_func(), void _q_networkSessionPreferredConfigurationChanged(QNetworkConfiguration,bool)) Q_PRIVATE_SLOT(d_func(), void _q_networkSessionStateChanged(QNetworkSession::State)) +#endif }; QT_END_NAMESPACE diff --git a/src/network/access/qnetworkaccessmanager_p.h b/src/network/access/qnetworkaccessmanager_p.h index 1785685..695842c 100644 --- a/src/network/access/qnetworkaccessmanager_p.h +++ b/src/network/access/qnetworkaccessmanager_p.h @@ -75,10 +75,12 @@ public: #ifndef QT_NO_NETWORKPROXY proxyFactory(0), #endif +#ifndef QT_NO_BEARERMANAGEMENT networkSession(0), networkAccessible(QNetworkAccessManager::Accessible), online(false), initializeSession(true), +#endif cookieJarCreated(false) { } ~QNetworkAccessManagerPrivate(); @@ -104,6 +106,7 @@ public: QNetworkAccessBackend *findBackend(QNetworkAccessManager::Operation op, const QNetworkRequest &request); +#ifndef QT_NO_BEARERMANAGEMENT void createSession(const QNetworkConfiguration &config); void _q_networkSessionClosed(); @@ -111,6 +114,7 @@ public: void _q_networkSessionPreferredConfigurationChanged(const QNetworkConfiguration &config, bool isSeamless); void _q_networkSessionStateChanged(QNetworkSession::State state); +#endif // this is the cache for storing downloaded files QAbstractNetworkCache *networkCache; @@ -123,11 +127,13 @@ public: QNetworkProxyFactory *proxyFactory; #endif +#ifndef QT_NO_BEARERMANAGEMENT QNetworkSession *networkSession; QString networkConfiguration; QNetworkAccessManager::NetworkAccessibility networkAccessible; bool online; bool initializeSession; +#endif bool cookieJarCreated; diff --git a/src/network/access/qnetworkreplyimpl.cpp b/src/network/access/qnetworkreplyimpl.cpp index edd6889..c3dc168 100644 --- a/src/network/access/qnetworkreplyimpl.cpp +++ b/src/network/access/qnetworkreplyimpl.cpp @@ -67,8 +67,6 @@ inline QNetworkReplyImplPrivate::QNetworkReplyImplPrivate() void QNetworkReplyImplPrivate::_q_startOperation() { - Q_Q(QNetworkReplyImpl); - // ensure this function is only being called once if (state == Working) { qDebug("QNetworkReplyImpl::_q_startOperation was called more than once"); @@ -86,6 +84,7 @@ void QNetworkReplyImplPrivate::_q_startOperation() return; } +#ifndef QT_NO_BEARERMANAGEMENT if (!backend->start()) { // backend failed to start because the session state is not Connected. // QNetworkAccessManager will call reply->backend->start() again for us when the session @@ -95,6 +94,8 @@ void QNetworkReplyImplPrivate::_q_startOperation() QNetworkSession *session = manager->d_func()->networkSession; if (session) { + Q_Q(QNetworkReplyImpl); + QObject::connect(session, SIGNAL(error(QNetworkSession::SessionError)), q, SLOT(_q_networkSessionFailed())); @@ -106,6 +107,7 @@ void QNetworkReplyImplPrivate::_q_startOperation() return; } +#endif if (state != Finished) { if (operation == QNetworkAccessManager::GetOperation) @@ -232,6 +234,7 @@ void QNetworkReplyImplPrivate::_q_bufferOutgoingData() } } +#ifndef QT_NO_BEARERMANAGEMENT void QNetworkReplyImplPrivate::_q_networkSessionConnected() { Q_Q(QNetworkReplyImpl); @@ -272,6 +275,7 @@ void QNetworkReplyImplPrivate::_q_networkSessionFailed() finished(); } } +#endif void QNetworkReplyImplPrivate::setup(QNetworkAccessManager::Operation op, const QNetworkRequest &req, QIODevice *data) @@ -581,6 +585,7 @@ void QNetworkReplyImplPrivate::finished() totalSize = totalSize.toLongLong() + preMigrationDownloaded; if (!manager.isNull()) { +#ifndef QT_NO_BEARERMANAGEMENT QNetworkSession *session = manager->d_func()->networkSession; if (session && session->state() == QNetworkSession::Roaming && state == Working && errorCode != QNetworkReply::OperationCanceledError) { @@ -600,6 +605,7 @@ void QNetworkReplyImplPrivate::finished() } } } +#endif } resumeNotificationHandling(); @@ -889,6 +895,7 @@ bool QNetworkReplyImplPrivate::migrateBackend() return true; } +#ifndef QT_NO_BEARERMANAGEMENT QDisabledNetworkReply::QDisabledNetworkReply(QObject *parent, const QNetworkRequest &req, QNetworkAccessManager::Operation op) @@ -912,6 +919,7 @@ QDisabledNetworkReply::QDisabledNetworkReply(QObject *parent, QDisabledNetworkReply::~QDisabledNetworkReply() { } +#endif QT_END_NAMESPACE diff --git a/src/network/access/qnetworkreplyimpl_p.h b/src/network/access/qnetworkreplyimpl_p.h index fcb3397..bc7e408 100644 --- a/src/network/access/qnetworkreplyimpl_p.h +++ b/src/network/access/qnetworkreplyimpl_p.h @@ -99,8 +99,10 @@ public: Q_PRIVATE_SLOT(d_func(), void _q_copyReadChannelFinished()) Q_PRIVATE_SLOT(d_func(), void _q_bufferOutgoingData()) Q_PRIVATE_SLOT(d_func(), void _q_bufferOutgoingDataFinished()) +#ifndef QT_NO_BEARERMANAGEMENT Q_PRIVATE_SLOT(d_func(), void _q_networkSessionConnected()) Q_PRIVATE_SLOT(d_func(), void _q_networkSessionFailed()) +#endif }; class QNetworkReplyImplPrivate: public QNetworkReplyPrivate @@ -133,8 +135,10 @@ public: void _q_copyReadChannelFinished(); void _q_bufferOutgoingData(); void _q_bufferOutgoingDataFinished(); +#ifndef QT_NO_BEARERMANAGEMENT void _q_networkSessionConnected(); void _q_networkSessionFailed(); +#endif void setup(QNetworkAccessManager::Operation op, const QNetworkRequest &request, QIODevice *outgoingData); @@ -196,6 +200,7 @@ public: Q_DECLARE_PUBLIC(QNetworkReplyImpl) }; +#ifndef QT_NO_BEARERMANAGEMENT class QDisabledNetworkReply : public QNetworkReply { Q_OBJECT @@ -209,6 +214,7 @@ public: protected: qint64 readData(char *, qint64) { return -1; } }; +#endif QT_END_NAMESPACE diff --git a/src/network/bearer/qbearerengine.cpp b/src/network/bearer/qbearerengine.cpp index c42e2d2..2f8624a 100644 --- a/src/network/bearer/qbearerengine.cpp +++ b/src/network/bearer/qbearerengine.cpp @@ -41,6 +41,8 @@ #include "qbearerengine_p.h" +#ifndef QT_NO_BEARERMANAGEMENT + QT_BEGIN_NAMESPACE QBearerEngine::QBearerEngine(QObject *parent) @@ -110,4 +112,6 @@ bool QBearerEngine::configurationsInUse() const #include "moc_qbearerengine_p.cpp" +#endif // QT_NO_BEARERMANAGEMENT + QT_END_NAMESPACE diff --git a/src/network/bearer/qbearerengine_p.h b/src/network/bearer/qbearerengine_p.h index fd4bf87..70aa5fa 100644 --- a/src/network/bearer/qbearerengine_p.h +++ b/src/network/bearer/qbearerengine_p.h @@ -65,6 +65,8 @@ #include <QtCore/qsharedpointer.h> #include <QtCore/qmutex.h> +#ifndef QT_NO_BEARERMANAGEMENT + QT_BEGIN_NAMESPACE class QNetworkConfiguration; @@ -110,4 +112,6 @@ protected: QT_END_NAMESPACE +#endif // QT_NO_BEARERMANAGEMENT + #endif diff --git a/src/network/bearer/qbearerplugin.cpp b/src/network/bearer/qbearerplugin.cpp index 4509fd0..a5e8918 100644 --- a/src/network/bearer/qbearerplugin.cpp +++ b/src/network/bearer/qbearerplugin.cpp @@ -43,6 +43,8 @@ #include <QtCore/qdebug.h> +#ifndef QT_NO_BEARERMANAGEMENT + QT_BEGIN_NAMESPACE QBearerEnginePlugin::QBearerEnginePlugin(QObject *parent) @@ -55,3 +57,5 @@ QBearerEnginePlugin::~QBearerEnginePlugin() } QT_END_NAMESPACE + +#endif // QT_NO_BEARERMANAGEMENT diff --git a/src/network/bearer/qbearerplugin_p.h b/src/network/bearer/qbearerplugin_p.h index 36709c2..9652f14 100644 --- a/src/network/bearer/qbearerplugin_p.h +++ b/src/network/bearer/qbearerplugin_p.h @@ -58,6 +58,8 @@ #include <QtCore/qplugin.h> #include <QtCore/qfactoryinterface.h> +#ifndef QT_NO_BEARERMANAGEMENT + QT_BEGIN_HEADER QT_BEGIN_NAMESPACE @@ -89,5 +91,6 @@ QT_END_NAMESPACE QT_END_HEADER -#endif +#endif // QT_NO_BEARERMANAGEMENT +#endif diff --git a/src/network/bearer/qnetworkconfigmanager.cpp b/src/network/bearer/qnetworkconfigmanager.cpp index 1ba5dab..102b347 100644 --- a/src/network/bearer/qnetworkconfigmanager.cpp +++ b/src/network/bearer/qnetworkconfigmanager.cpp @@ -46,6 +46,8 @@ #include <QtCore/qstringlist.h> +#ifndef QT_NO_BEARERMANAGEMENT + QT_BEGIN_NAMESPACE Q_GLOBAL_STATIC(QNetworkConfigurationManagerPrivate, connManager); @@ -278,7 +280,7 @@ bool QNetworkConfigurationManager::isOnline() const */ QNetworkConfigurationManager::Capabilities QNetworkConfigurationManager::capabilities() const { - return connManager()->capFlags; + return connManager()->capabilities(); } /*! @@ -304,3 +306,4 @@ void QNetworkConfigurationManager::updateConfigurations() QT_END_NAMESPACE +#endif // QT_NO_BEARERMANAGEMENT diff --git a/src/network/bearer/qnetworkconfigmanager.h b/src/network/bearer/qnetworkconfigmanager.h index 79bb27c..3e44be1 100644 --- a/src/network/bearer/qnetworkconfigmanager.h +++ b/src/network/bearer/qnetworkconfigmanager.h @@ -49,6 +49,8 @@ #include <QtCore/qobject.h> #include <QtNetwork/qnetworkconfiguration.h> +#ifndef QT_NO_BEARERMANAGEMENT + QT_BEGIN_HEADER #ifndef QT_MOBILITY_BEARER @@ -111,5 +113,7 @@ QTM_END_NAMESPACE QT_END_HEADER +#endif // QT_NO_BEARERMANAGEMENT + #endif //QNETWORKCONFIGURATIONMANAGER_H diff --git a/src/network/bearer/qnetworkconfigmanager_p.cpp b/src/network/bearer/qnetworkconfigmanager_p.cpp index c665fa2..a651dd1 100644 --- a/src/network/bearer/qnetworkconfigmanager_p.cpp +++ b/src/network/bearer/qnetworkconfigmanager_p.cpp @@ -50,13 +50,15 @@ #include <QtCore/qthread.h> #include <QtCore/private/qcoreapplication_p.h> +#ifndef QT_NO_BEARERMANAGEMENT + QT_BEGIN_NAMESPACE Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader, (QBearerEngineFactoryInterface_iid, QLatin1String("/bearer"))) QNetworkConfigurationManagerPrivate::QNetworkConfigurationManagerPrivate() -: capFlags(0), mutex(QMutex::Recursive), pollTimer(0), forcedPolling(0), firstUpdate(true) +: pollTimer(0), mutex(QMutex::Recursive), forcedPolling(0), firstUpdate(true) { qRegisterMetaType<QNetworkConfiguration>("QNetworkConfiguration"); @@ -265,6 +267,18 @@ bool QNetworkConfigurationManagerPrivate::isOnline() return !onlineConfigurations.isEmpty(); } +QNetworkConfigurationManager::Capabilities QNetworkConfigurationManagerPrivate::capabilities() +{ + QMutexLocker locker(&mutex); + + QNetworkConfigurationManager::Capabilities capFlags; + + foreach (QBearerEngine *engine, sessionEngines) + capFlags |= engine->capabilities(); + + return capFlags; +} + void QNetworkConfigurationManagerPrivate::configurationAdded(QNetworkConfigurationPrivatePointer ptr) { QMutexLocker locker(&mutex); @@ -367,8 +381,6 @@ void QNetworkConfigurationManagerPrivate::updateConfigurations() connect(engine, SIGNAL(configurationChanged(QNetworkConfigurationPrivatePointer)), this, SLOT(configurationChanged(QNetworkConfigurationPrivatePointer))); - capFlags |= engine->capabilities(); - QMetaObject::invokeMethod(engine, "requestUpdate"); } } @@ -493,3 +505,5 @@ void QNetworkConfigurationManagerPrivate::disablePolling() } QT_END_NAMESPACE + +#endif // QT_NO_BEARERMANAGEMENT diff --git a/src/network/bearer/qnetworkconfigmanager_p.h b/src/network/bearer/qnetworkconfigmanager_p.h index dba9d2c..0649031 100644 --- a/src/network/bearer/qnetworkconfigmanager_p.h +++ b/src/network/bearer/qnetworkconfigmanager_p.h @@ -59,6 +59,8 @@ #include <QtCore/qmutex.h> #include <QtCore/qset.h> +#ifndef QT_NO_BEARERMANAGEMENT + QT_BEGIN_NAMESPACE class QBearerEngine; @@ -78,7 +80,7 @@ public: bool isOnline(); - QNetworkConfigurationManager::Capabilities capFlags; + QNetworkConfigurationManager::Capabilities capabilities(); void performAsyncConfigurationUpdate(); @@ -102,19 +104,18 @@ Q_SIGNALS: void abort(); private: - QMutex mutex; - QTimer *pollTimer; + QMutex mutex; + QList<QBearerEngine *> sessionEngines; QSet<QString> onlineConfigurations; - QSet<int> updatingEngines; - bool updating; - QSet<int> pollingEngines; + QSet<int> updatingEngines; int forcedPolling; + bool updating; bool firstUpdate; @@ -130,4 +131,6 @@ Q_NETWORK_EXPORT QNetworkConfigurationManagerPrivate *qNetworkConfigurationManag QT_END_NAMESPACE +#endif // QT_NO_BEARERMANAGEMENT + #endif //QNETWORKCONFIGURATIONMANAGERPRIVATE_H diff --git a/src/network/bearer/qnetworkconfiguration_p.h b/src/network/bearer/qnetworkconfiguration_p.h index ccbe670..6e146e0 100644 --- a/src/network/bearer/qnetworkconfiguration_p.h +++ b/src/network/bearer/qnetworkconfiguration_p.h @@ -84,6 +84,8 @@ public: return bearer; } + QList<QNetworkConfigurationPrivatePointer> serviceNetworkMembers; + mutable QMutex mutex; QString bearer; @@ -94,8 +96,6 @@ public: QNetworkConfiguration::Type type; QNetworkConfiguration::Purpose purpose; - QList<QNetworkConfigurationPrivatePointer> serviceNetworkMembers; - bool isValid; bool roamingSupported; diff --git a/src/network/bearer/qnetworksession.cpp b/src/network/bearer/qnetworksession.cpp index 638bee7..1ed6cbb 100644 --- a/src/network/bearer/qnetworksession.cpp +++ b/src/network/bearer/qnetworksession.cpp @@ -47,6 +47,8 @@ #include "qnetworkconfigmanager_p.h" #include "qnetworksession_p.h" +#ifndef QT_NO_BEARERMANAGEMENT + QT_BEGIN_NAMESPACE /*! @@ -706,3 +708,5 @@ void QNetworkSession::disconnectNotify(const char *signal) #include "moc_qnetworksession.cpp" QT_END_NAMESPACE + +#endif // QT_NO_BEARERMANAGEMENT diff --git a/src/network/bearer/qnetworksession.h b/src/network/bearer/qnetworksession.h index 2911d0a..e7fffac 100644 --- a/src/network/bearer/qnetworksession.h +++ b/src/network/bearer/qnetworksession.h @@ -48,6 +48,8 @@ #include <QtCore/qvariant.h> #include <QtNetwork/qnetworkconfiguration.h> +#ifndef QT_NO_BEARERMANAGEMENT + #if defined(Q_OS_WIN) && defined(interface) #undef interface #endif @@ -149,4 +151,6 @@ QTM_END_NAMESPACE QT_END_HEADER +#endif // QT_NO_BEARERMANAGEMENT + #endif //QNETWORKSESSION_H diff --git a/src/network/bearer/qnetworksession_p.h b/src/network/bearer/qnetworksession_p.h index a341eaf..c7b5718 100644 --- a/src/network/bearer/qnetworksession_p.h +++ b/src/network/bearer/qnetworksession_p.h @@ -56,6 +56,8 @@ #include "qnetworksession.h" #include "qnetworkconfiguration_p.h" +#ifndef QT_NO_BEARERMANAGEMENT + QT_BEGIN_NAMESPACE class Q_NETWORK_EXPORT QNetworkSessionPrivate : public QObject @@ -126,6 +128,8 @@ Q_SIGNALS: void preferredConfigurationChanged(const QNetworkConfiguration &config, bool isSeamless); protected: + QNetworkSession *q; + // The config set on QNetworkSession. QNetworkConfiguration publicConfig; @@ -140,11 +144,11 @@ protected: QNetworkSession::State state; bool isOpen; - - QNetworkSession *q; }; QT_END_NAMESPACE +#endif // QT_NO_BEARERMANAGEMENT + #endif //QNETWORKSESSIONPRIVATE_H diff --git a/src/network/socket/qlocalserver_win.cpp b/src/network/socket/qlocalserver_win.cpp index e820f73..5d2be72 100644 --- a/src/network/socket/qlocalserver_win.cpp +++ b/src/network/socket/qlocalserver_win.cpp @@ -65,8 +65,8 @@ bool QLocalServerPrivate::addListener() listener.handle = CreateNamedPipe( (const wchar_t *)fullServerName.utf16(), // pipe name PIPE_ACCESS_DUPLEX | FILE_FLAG_OVERLAPPED, // read/write access - PIPE_TYPE_MESSAGE | // message type pipe - PIPE_READMODE_MESSAGE | // message-read mode + PIPE_TYPE_BYTE | // byte type pipe + PIPE_READMODE_BYTE | // byte-read mode PIPE_WAIT, // blocking mode PIPE_UNLIMITED_INSTANCES, // max. instances BUFSIZE, // output buffer size diff --git a/src/network/ssl/qsslsocket_openssl_symbols.cpp b/src/network/ssl/qsslsocket_openssl_symbols.cpp index d2eb6f1..09ecd4d 100644 --- a/src/network/ssl/qsslsocket_openssl_symbols.cpp +++ b/src/network/ssl/qsslsocket_openssl_symbols.cpp @@ -748,7 +748,7 @@ bool q_resolveOpenSslSymbols() bool q_resolveOpenSslSymbols() { -#ifdef QT_NO_SSL +#ifdef QT_NO_OPENSSL return false; #endif return true; diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp index 0a452f3..0cc7430 100644 --- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp +++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp @@ -217,7 +217,9 @@ void QGL2PaintEngineExPrivate::updateBrushTexture() const QPixmap& texPixmap = currentBrush.texture(); glActiveTexture(GL_TEXTURE0 + QT_BRUSH_TEXTURE_UNIT); - QGLTexture *tex = ctx->d_func()->bindTexture(texPixmap, GL_TEXTURE_2D, GL_RGBA, QGLContext::InternalBindOption); + QGLTexture *tex = ctx->d_func()->bindTexture(texPixmap, GL_TEXTURE_2D, GL_RGBA, + QGLContext::InternalBindOption | + QGLContext::CanFlipNativePixmapBindOption); updateTextureFilter(GL_TEXTURE_2D, GL_REPEAT, q->state()->renderHints & QPainter::SmoothPixmapTransform); textureInvertedY = tex->options & QGLContext::InvertedYBindOption ? -1 : 1; } @@ -1641,7 +1643,7 @@ void QGL2PaintEngineExPrivate::drawCachedGlyphs(QFontEngineGlyphCache::Type glyp glBindTexture(GL_TEXTURE_2D, cache->texture()); lastMaskTextureUsed = cache->texture(); } - updateTextureFilter(GL_TEXTURE_2D, GL_REPEAT, false); + updateTextureFilter(GL_TEXTURE_2D, GL_REPEAT, s->matrix.type() > QTransform::TxTranslate); shaderManager->currentProgram()->setUniformValue(location(QGLEngineShaderManager::MaskTexture), QT_MASK_TEXTURE_UNIT); #if defined(QT_OPENGL_DRAWCACHEDGLYPHS_INDEX_ARRAY_VBO) diff --git a/src/opengl/gl2paintengineex/qtextureglyphcache_gl.cpp b/src/opengl/gl2paintengineex/qtextureglyphcache_gl.cpp index 6cb76ee..994c1c9 100644 --- a/src/opengl/gl2paintengineex/qtextureglyphcache_gl.cpp +++ b/src/opengl/gl2paintengineex/qtextureglyphcache_gl.cpp @@ -246,4 +246,9 @@ int QGLTextureGlyphCache::glyphMargin() const #endif } +int QGLTextureGlyphCache::glyphPadding() const +{ + return 1; +} + QT_END_NAMESPACE diff --git a/src/opengl/gl2paintengineex/qtextureglyphcache_gl_p.h b/src/opengl/gl2paintengineex/qtextureglyphcache_gl_p.h index 2a8a782..04731b1 100644 --- a/src/opengl/gl2paintengineex/qtextureglyphcache_gl_p.h +++ b/src/opengl/gl2paintengineex/qtextureglyphcache_gl_p.h @@ -73,6 +73,7 @@ public: virtual void resizeTextureData(int width, int height); virtual void fillTexture(const Coord &c, glyph_t glyph); virtual int glyphMargin() const; + virtual int glyphPadding() const; inline GLuint texture() const { return m_texture; } diff --git a/src/opengl/gl2paintengineex/qtriangulatingstroker.cpp b/src/opengl/gl2paintengineex/qtriangulatingstroker.cpp index 7eae78f..f677ce1 100644 --- a/src/opengl/gl2paintengineex/qtriangulatingstroker.cpp +++ b/src/opengl/gl2paintengineex/qtriangulatingstroker.cpp @@ -111,7 +111,7 @@ void QTriangulatingStroker::process(const QVectorPath &path, const QPen &pen, co // depending on if the pen is cosmetic or not. // // The curvyness value of PI/14 was based on, - // arcLength=2*PI*r/4=PI/2 and splitting length into somewhere + // arcLength = 2*PI*r/4 = PI*r/2 and splitting length into somewhere // between 3 and 8 where 5 seemed to be give pretty good results // hence: Q_PI/14. Lower divisors will give more detail at the // direct cost of performance. @@ -495,6 +495,8 @@ void QDashedStrokeProcessor::process(const QVectorPath &path, const QPen &pen, c const QPainterPath::ElementType *types = path.elements(); int count = path.elementCount(); + bool cosmetic = pen.isCosmetic(); + m_points.reset(); m_types.reset(); @@ -503,10 +505,26 @@ void QDashedStrokeProcessor::process(const QVectorPath &path, const QPen &pen, c width = 1; m_dash_stroker.setDashPattern(pen.dashPattern()); - m_dash_stroker.setStrokeWidth(pen.isCosmetic() ? width * m_inv_scale : width); + m_dash_stroker.setStrokeWidth(cosmetic ? width * m_inv_scale : width); m_dash_stroker.setMiterLimit(pen.miterLimit()); m_dash_stroker.setClipRect(clip); - qreal curvyness = sqrt(width) * m_inv_scale / 8; + + float curvynessAdd, curvynessMul, roundness = 0; + + // simplfy pens that are thin in device size (2px wide or less) + if (width < 2.5 && (cosmetic || m_inv_scale == 1)) { + curvynessAdd = 0.5; + curvynessMul = CURVE_FLATNESS / m_inv_scale; + roundness = 1; + } else if (cosmetic) { + curvynessAdd= width / 2; + curvynessMul= CURVE_FLATNESS; + roundness = qMax<int>(4, width * CURVE_FLATNESS); + } else { + curvynessAdd = width * m_inv_scale; + curvynessMul = CURVE_FLATNESS / m_inv_scale; + roundness = qMax<int>(4, width * curvynessMul); + } if (count < 2) return; @@ -541,9 +559,11 @@ void QDashedStrokeProcessor::process(const QVectorPath &path, const QPen &pen, c *(((const QPointF *) pts) + 1), *(((const QPointF *) pts) + 2)); QRectF bounds = b.bounds(); - int threshold = qMin<float>(64, qMax(bounds.width(), bounds.height()) * curvyness); + float rad = qMax(bounds.width(), bounds.height()); + int threshold = qMin<float>(64, (rad + curvynessAdd) * curvynessMul); if (threshold < 4) threshold = 4; + qreal threshold_minus_1 = threshold - 1; for (int i=0; i<threshold; ++i) { QPointF pt = b.pointAt(i / threshold_minus_1); diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp index e56b149..5595e02 100644 --- a/src/opengl/qgl.cpp +++ b/src/opengl/qgl.cpp @@ -2442,7 +2442,8 @@ QGLTexture *QGLContextPrivate::bindTexture(const QPixmap &pixmap, GLenum target, // Try to use texture_from_pixmap const QX11Info *xinfo = qt_x11Info(paintDevice); if (pd->classId() == QPixmapData::X11Class && pd->pixelType() == QPixmapData::PixmapType - && xinfo && xinfo->screen() == pixmap.x11Info().screen()) + && xinfo && xinfo->screen() == pixmap.x11Info().screen() + && target == GL_TEXTURE_2D) { texture = bindTextureFromNativePixmap(const_cast<QPixmap*>(&pixmap), key, options); if (texture) { diff --git a/src/opengl/qgl_x11.cpp b/src/opengl/qgl_x11.cpp index e1a202f..d203646 100644 --- a/src/opengl/qgl_x11.cpp +++ b/src/opengl/qgl_x11.cpp @@ -1677,6 +1677,14 @@ QGLTexture *QGLContextPrivate::bindTextureFromNativePixmap(QPixmap *pixmap, cons #if !defined(GLX_VERSION_1_3) || defined(Q_OS_HPUX) return 0; #else + + // Check we have GLX 1.3, as it is needed for glXCreatePixmap & glXDestroyPixmap + int majorVersion = 0; + int minorVersion = 0; + glXQueryVersion(X11->display, &majorVersion, &minorVersion); + if (majorVersion < 1 || (majorVersion == 1 && minorVersion < 3)) + return 0; + Q_Q(QGLContext); QX11PixmapData *pixmapData = static_cast<QX11PixmapData*>(pixmap->data_ptr().data()); diff --git a/src/plugins/bearer/corewlan/corewlan.pro b/src/plugins/bearer/corewlan/corewlan.pro index 9786c03..922a501 100644 --- a/src/plugins/bearer/corewlan/corewlan.pro +++ b/src/plugins/bearer/corewlan/corewlan.pro @@ -1,7 +1,7 @@ TARGET = qcorewlanbearer include(../../qpluginbase.pri) -QT += network +QT = core gui network LIBS += -framework Foundation -framework SystemConfiguration contains(QT_CONFIG, corewlan) { diff --git a/src/plugins/bearer/corewlan/main.cpp b/src/plugins/bearer/corewlan/main.cpp index 5be8c0e..628ec61 100644 --- a/src/plugins/bearer/corewlan/main.cpp +++ b/src/plugins/bearer/corewlan/main.cpp @@ -45,6 +45,8 @@ #include <QtCore/qdebug.h> +#ifndef QT_NO_BEARERMANAGEMENT + QT_BEGIN_NAMESPACE class QCoreWlanEnginePlugin : public QBearerEnginePlugin @@ -82,3 +84,5 @@ Q_EXPORT_STATIC_PLUGIN(QCoreWlanEnginePlugin) Q_EXPORT_PLUGIN2(qcorewlanbearer, QCoreWlanEnginePlugin) QT_END_NAMESPACE + +#endif // QT_NO_BEARERMANAGEMENT diff --git a/src/plugins/bearer/corewlan/qcorewlanengine.h b/src/plugins/bearer/corewlan/qcorewlanengine.h index 11f5d96..5c69299 100644 --- a/src/plugins/bearer/corewlan/qcorewlanengine.h +++ b/src/plugins/bearer/corewlan/qcorewlanengine.h @@ -48,6 +48,8 @@ #include <QTimer> #include <SystemConfiguration/SystemConfiguration.h> +#ifndef QT_NO_BEARERMANAGEMENT + QT_BEGIN_NAMESPACE class QNetworkConfigurationPrivate; @@ -107,5 +109,6 @@ protected: QT_END_NAMESPACE -#endif +#endif // QT_NO_BEARERMANAGEMENT +#endif diff --git a/src/plugins/bearer/corewlan/qcorewlanengine.mm b/src/plugins/bearer/corewlan/qcorewlanengine.mm index e418432..268126a 100644 --- a/src/plugins/bearer/corewlan/qcorewlanengine.mm +++ b/src/plugins/bearer/corewlan/qcorewlanengine.mm @@ -67,6 +67,10 @@ #include <private/qt_cocoa_helpers_mac_p.h> #include "private/qcore_mac_p.h" +#ifndef QT_NO_BEARERMANAGEMENT + +QT_BEGIN_NAMESPACE + @interface QNSListener : NSObject { NSNotificationCenter *center; @@ -126,8 +130,6 @@ QNSListener *listener = 0; -QT_BEGIN_NAMESPACE - void networkChangeCallback(SCDynamicStoreRef/* store*/, CFArrayRef changedKeys, void *info) { for ( long i = 0; i < CFArrayGetCount(changedKeys); i++) { @@ -778,3 +780,5 @@ void QCoreWlanEngine::getUserConfigurations() } QT_END_NAMESPACE + +#endif // QT_NO_BEARERMANAGEMENT diff --git a/src/plugins/bearer/generic/generic.pro b/src/plugins/bearer/generic/generic.pro index 1d141fd..c967f8c 100644 --- a/src/plugins/bearer/generic/generic.pro +++ b/src/plugins/bearer/generic/generic.pro @@ -1,7 +1,7 @@ TARGET = qgenericbearer include(../../qpluginbase.pri) -QT += network +QT = core network HEADERS += qgenericengine.h \ ../qnetworksession_impl.h \ diff --git a/src/plugins/bearer/generic/main.cpp b/src/plugins/bearer/generic/main.cpp index ba85d93..ec1b689 100644 --- a/src/plugins/bearer/generic/main.cpp +++ b/src/plugins/bearer/generic/main.cpp @@ -45,6 +45,8 @@ #include <QtCore/qdebug.h> +#ifndef QT_NO_BEARERMANAGEMENT + QT_BEGIN_NAMESPACE class QGenericEnginePlugin : public QBearerEnginePlugin @@ -82,3 +84,5 @@ Q_EXPORT_STATIC_PLUGIN(QGenericEnginePlugin) Q_EXPORT_PLUGIN2(qgenericbearer, QGenericEnginePlugin) QT_END_NAMESPACE + +#endif // QT_NO_BEARERMANAGEMENT diff --git a/src/plugins/bearer/generic/qgenericengine.cpp b/src/plugins/bearer/generic/qgenericengine.cpp index d65025b..41ff3e0 100644 --- a/src/plugins/bearer/generic/qgenericengine.cpp +++ b/src/plugins/bearer/generic/qgenericengine.cpp @@ -64,6 +64,8 @@ #include <unistd.h> #endif +#ifndef QT_NO_BEARERMANAGEMENT + QT_BEGIN_NAMESPACE #ifndef QT_NO_NETWORKINTERFACE @@ -349,3 +351,4 @@ bool QGenericEngine::requiresPolling() const QT_END_NAMESPACE +#endif // QT_NO_BEARERMANAGEMENT diff --git a/src/plugins/bearer/generic/qgenericengine.h b/src/plugins/bearer/generic/qgenericengine.h index 616a3fd..82d22af 100644 --- a/src/plugins/bearer/generic/qgenericengine.h +++ b/src/plugins/bearer/generic/qgenericengine.h @@ -47,6 +47,8 @@ #include <QMap> #include <QTimer> +#ifndef QT_NO_BEARERMANAGEMENT + QT_BEGIN_NAMESPACE class QNetworkConfigurationPrivate; @@ -89,5 +91,7 @@ private: QT_END_NAMESPACE +#endif // QT_NO_BEARERMANAGEMENT + #endif diff --git a/src/plugins/bearer/icd/main.cpp b/src/plugins/bearer/icd/main.cpp index ad1a918..491112b 100644 --- a/src/plugins/bearer/icd/main.cpp +++ b/src/plugins/bearer/icd/main.cpp @@ -45,6 +45,8 @@ #include <QtCore/qdebug.h> +#ifndef QT_NO_BEARERMANAGEMENT + QT_BEGIN_NAMESPACE class QIcdEnginePlugin : public QBearerEnginePlugin @@ -82,3 +84,5 @@ Q_EXPORT_STATIC_PLUGIN(QIcdEnginePlugin) Q_EXPORT_PLUGIN2(qicdbearer, QIcdEnginePlugin) QT_END_NAMESPACE + +#endif diff --git a/src/plugins/bearer/icd/qicdengine.cpp b/src/plugins/bearer/icd/qicdengine.cpp index a6cf0c2..fc9b469 100644 --- a/src/plugins/bearer/icd/qicdengine.cpp +++ b/src/plugins/bearer/icd/qicdengine.cpp @@ -47,6 +47,8 @@ #include <iapconf.h> #include <iapmonitor.h> +#ifndef QT_NO_BEARERMANAGEMENT + QT_BEGIN_NAMESPACE IcdNetworkConfigurationPrivate::IcdNetworkConfigurationPrivate() @@ -988,3 +990,5 @@ QNetworkSessionPrivate *QIcdEngine::createSessionBackend() #include "qicdengine.moc" QT_END_NAMESPACE + +#endif // QT_NO_BEARERMANAGEMENT diff --git a/src/plugins/bearer/icd/qicdengine.h b/src/plugins/bearer/icd/qicdengine.h index a2e9a2f..841874f 100644 --- a/src/plugins/bearer/icd/qicdengine.h +++ b/src/plugins/bearer/icd/qicdengine.h @@ -67,13 +67,13 @@ public: QByteArray network_id; // typically WLAN ssid or similar QString iap_type; // is this one WLAN or GPRS - // Network attributes for this IAP, this is the value returned by icd and - // passed to it when connecting. - uint32_t network_attrs; - QString service_type; QString service_id; uint32_t service_attrs; + + // Network attributes for this IAP, this is the value returned by icd and + // passed to it when connecting. + uint32_t network_attrs; }; inline IcdNetworkConfigurationPrivate *toIcdConfig(QNetworkConfigurationPrivatePointer ptr) diff --git a/src/plugins/bearer/icd/qnetworksession_impl.cpp b/src/plugins/bearer/icd/qnetworksession_impl.cpp index 2928a31..a6acce0 100644 --- a/src/plugins/bearer/icd/qnetworksession_impl.cpp +++ b/src/plugins/bearer/icd/qnetworksession_impl.cpp @@ -52,6 +52,8 @@ #include <netinet/in.h> #include <arpa/inet.h> +#ifndef QT_NO_BEARERMANAGEMENT + QT_BEGIN_NAMESPACE QDBusArgument &operator<<(QDBusArgument &argument, @@ -1044,3 +1046,5 @@ void QNetworkSessionPrivateImpl::clearProxyInformation() } QT_END_NAMESPACE + +#endif // QT_NO_BEARERMANAGEMENT diff --git a/src/plugins/bearer/icd/qnetworksession_impl.h b/src/plugins/bearer/icd/qnetworksession_impl.h index d15f401..c43b1f0 100644 --- a/src/plugins/bearer/icd/qnetworksession_impl.h +++ b/src/plugins/bearer/icd/qnetworksession_impl.h @@ -66,6 +66,8 @@ #include <icd/dbus_api.h> +#ifndef QT_NO_BEARERMANAGEMENT + QT_BEGIN_NAMESPACE class QIcdEngine; @@ -210,5 +212,7 @@ Q_DECLARE_METATYPE(ICd2DetailsList); QT_END_NAMESPACE +#endif // QT_NO_BEARERMANAGEMENT + #endif //QNETWORKSESSIONPRIVATE_H diff --git a/src/plugins/bearer/nativewifi/main.cpp b/src/plugins/bearer/nativewifi/main.cpp index d77462e..98789aa 100644 --- a/src/plugins/bearer/nativewifi/main.cpp +++ b/src/plugins/bearer/nativewifi/main.cpp @@ -50,6 +50,8 @@ #include <QtCore/qdebug.h> +#ifndef QT_NO_BEARERMANAGEMENT + QT_BEGIN_NAMESPACE static void resolveLibrary() @@ -137,3 +139,5 @@ Q_EXPORT_STATIC_PLUGIN(QNativeWifiEnginePlugin) Q_EXPORT_PLUGIN2(qnativewifibearer, QNativeWifiEnginePlugin) QT_END_NAMESPACE + +#endif // QT_NO_BEARERMANAGEMENT diff --git a/src/plugins/bearer/nativewifi/nativewifi.pro b/src/plugins/bearer/nativewifi/nativewifi.pro index f277a04..36dd36d 100644 --- a/src/plugins/bearer/nativewifi/nativewifi.pro +++ b/src/plugins/bearer/nativewifi/nativewifi.pro @@ -1,7 +1,7 @@ TARGET = qnativewifibearer include(../../qpluginbase.pri) -QT += network +QT = core network HEADERS += qnativewifiengine.h \ platformdefs.h \ diff --git a/src/plugins/bearer/nativewifi/qnativewifiengine.cpp b/src/plugins/bearer/nativewifi/qnativewifiengine.cpp index 6c74159..e796df3 100644 --- a/src/plugins/bearer/nativewifi/qnativewifiengine.cpp +++ b/src/plugins/bearer/nativewifi/qnativewifiengine.cpp @@ -49,6 +49,8 @@ #include <QtCore/qdebug.h> +#ifndef QT_NO_BEARERMANAGEMENT + QT_BEGIN_NAMESPACE WlanOpenHandleProto local_WlanOpenHandle = 0; @@ -558,3 +560,5 @@ bool QNativeWifiEngine::requiresPolling() const } QT_END_NAMESPACE + +#endif // QT_NO_BEARERMANAGEMENT diff --git a/src/plugins/bearer/nativewifi/qnativewifiengine.h b/src/plugins/bearer/nativewifi/qnativewifiengine.h index 2005b2b..77764e4 100644 --- a/src/plugins/bearer/nativewifi/qnativewifiengine.h +++ b/src/plugins/bearer/nativewifi/qnativewifiengine.h @@ -57,6 +57,8 @@ #include <QtCore/qtimer.h> +#ifndef QT_NO_BEARERMANAGEMENT + QT_BEGIN_NAMESPACE class QNetworkConfigurationPrivate; @@ -101,4 +103,6 @@ private: QT_END_NAMESPACE +#endif // QT_NO_BEARERMANAGEMENT + #endif diff --git a/src/plugins/bearer/networkmanager/main.cpp b/src/plugins/bearer/networkmanager/main.cpp index 88068fc..9ab2c39 100644 --- a/src/plugins/bearer/networkmanager/main.cpp +++ b/src/plugins/bearer/networkmanager/main.cpp @@ -45,6 +45,7 @@ #include <QtCore/qdebug.h> +#ifndef QT_NO_BEARERMANAGEMENT #ifndef QT_NO_DBUS QT_BEGIN_NAMESPACE @@ -91,3 +92,4 @@ Q_EXPORT_PLUGIN2(qnmbearer, QNetworkManagerEnginePlugin) QT_END_NAMESPACE #endif // QT_NO_DBUS +#endif // QT_NO_BEARERMANAGEMENT diff --git a/src/plugins/bearer/networkmanager/networkmanager.pro b/src/plugins/bearer/networkmanager/networkmanager.pro index bf0d29a..e396263 100644 --- a/src/plugins/bearer/networkmanager/networkmanager.pro +++ b/src/plugins/bearer/networkmanager/networkmanager.pro @@ -1,7 +1,7 @@ TARGET = qnmbearer include(../../qpluginbase.pri) -QT += network dbus +QT = core network dbus HEADERS += qnmdbushelper.h \ qnetworkmanagerservice.h \ diff --git a/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp b/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp index 06533a1..13b2252 100644 --- a/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp +++ b/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp @@ -56,6 +56,7 @@ #include <QDBusMessage> #include <QDBusReply> +#ifndef QT_NO_BEARERMANAGEMENT #ifndef QT_NO_DBUS QT_BEGIN_NAMESPACE @@ -918,3 +919,4 @@ QNetworkConfigurationPrivatePointer QNetworkManagerEngine::defaultConfiguration( QT_END_NAMESPACE #endif // QT_NO_DBUS +#endif // QT_NO_BEARERMANAGEMENT diff --git a/src/plugins/bearer/networkmanager/qnetworkmanagerengine.h b/src/plugins/bearer/networkmanager/qnetworkmanagerengine.h index 964726e..7f8badb 100644 --- a/src/plugins/bearer/networkmanager/qnetworkmanagerengine.h +++ b/src/plugins/bearer/networkmanager/qnetworkmanagerengine.h @@ -60,6 +60,7 @@ #include <QMap> #include <QVariant> +#ifndef QT_NO_BEARERMANAGEMENT #ifndef QT_NO_DBUS QT_BEGIN_NAMESPACE @@ -140,6 +141,7 @@ private: QT_END_NAMESPACE #endif // QT_NO_DBUS +#endif // QT_NO_BEARERMANAGEMENT #endif diff --git a/src/plugins/bearer/nla/nla.pro b/src/plugins/bearer/nla/nla.pro index 5148b09..5dfb6d7 100644 --- a/src/plugins/bearer/nla/nla.pro +++ b/src/plugins/bearer/nla/nla.pro @@ -1,7 +1,7 @@ TARGET = qnlabearer include(../../qpluginbase.pri) -QT += network +QT = core network !wince* { LIBS += -lWs2_32 diff --git a/src/plugins/bearer/qbearerengine_impl.h b/src/plugins/bearer/qbearerengine_impl.h index 740def3..6c30d0f 100644 --- a/src/plugins/bearer/qbearerengine_impl.h +++ b/src/plugins/bearer/qbearerengine_impl.h @@ -44,6 +44,8 @@ #include <QtNetwork/private/qbearerengine_p.h> +#ifndef QT_NO_BEARERMANAGEMENT + QT_BEGIN_NAMESPACE class QBearerEngineImpl : public QBearerEngine @@ -78,4 +80,5 @@ Q_SIGNALS: QT_END_NAMESPACE +#endif // QT_NO_BEARERMANAGEMENT #endif diff --git a/src/plugins/bearer/qnetworksession_impl.cpp b/src/plugins/bearer/qnetworksession_impl.cpp index 33cce69..ef5f347 100644 --- a/src/plugins/bearer/qnetworksession_impl.cpp +++ b/src/plugins/bearer/qnetworksession_impl.cpp @@ -49,6 +49,8 @@ #include <QtCore/qdebug.h> #include <QtCore/qmutex.h> +#ifndef QT_NO_BEARERMANAGEMENT + QT_BEGIN_NAMESPACE static QBearerEngineImpl *getEngineFromId(const QString &id) @@ -439,3 +441,6 @@ void QNetworkSessionPrivateImpl::decrementTimeout() } QT_END_NAMESPACE + +#endif // QT_NO_BEARERMANAGEMENT + diff --git a/src/plugins/bearer/qnetworksession_impl.h b/src/plugins/bearer/qnetworksession_impl.h index 3becbf0..a4902eb 100644 --- a/src/plugins/bearer/qnetworksession_impl.h +++ b/src/plugins/bearer/qnetworksession_impl.h @@ -60,6 +60,8 @@ #include <QtCore/qdatetime.h> +#ifndef QT_NO_BEARERMANAGEMENT + QT_BEGIN_NAMESPACE class QBearerEngineImpl; @@ -116,18 +118,20 @@ private Q_SLOTS: void decrementTimeout(); private: - bool opened; - QBearerEngineImpl *engine; - QNetworkSession::SessionError lastError; - quint64 startTime; + QNetworkSession::SessionError lastError; + int sessionTimeout; + + bool opened; }; QT_END_NAMESPACE +#endif // QT_NO_BEARERMANAGEMENT + #endif //QNETWORKSESSION_IMPL_H diff --git a/src/plugins/bearer/symbian/main.cpp b/src/plugins/bearer/symbian/main.cpp index 0321451..c4f539b 100644 --- a/src/plugins/bearer/symbian/main.cpp +++ b/src/plugins/bearer/symbian/main.cpp @@ -45,6 +45,8 @@ #include <QtCore/qdebug.h> +#ifndef QT_NO_BEARERMANAGEMENT + QT_BEGIN_NAMESPACE class QSymbianEnginePlugin : public QBearerEnginePlugin @@ -82,3 +84,5 @@ Q_EXPORT_STATIC_PLUGIN(QSymbianEnginePlugin) Q_EXPORT_PLUGIN2(qsymbianbearer, QSymbianEnginePlugin) QT_END_NAMESPACE + +#endif // QT_NO_BEARERMANAGEMENT diff --git a/src/plugins/bearer/symbian/qnetworksession_impl.cpp b/src/plugins/bearer/symbian/qnetworksession_impl.cpp index 36fbc51..1b9c8cc 100644 --- a/src/plugins/bearer/symbian/qnetworksession_impl.cpp +++ b/src/plugins/bearer/symbian/qnetworksession_impl.cpp @@ -48,6 +48,8 @@ #include <stdapis/sys/socket.h> #include <stdapis/net/if.h> +#ifndef QT_NO_BEARERMANAGEMENT + QT_BEGIN_NAMESPACE QNetworkSessionPrivateImpl::QNetworkSessionPrivateImpl(SymbianEngine *engine) @@ -1367,3 +1369,6 @@ void ConnectionProgressNotifier::RunL() } QT_END_NAMESPACE + +#endif //QT_NO_BEARERMANAGEMENT + diff --git a/src/plugins/bearer/symbian/symbianengine.cpp b/src/plugins/bearer/symbian/symbianengine.cpp index 440f463..c629d02 100644 --- a/src/plugins/bearer/symbian/symbianengine.cpp +++ b/src/plugins/bearer/symbian/symbianengine.cpp @@ -69,6 +69,8 @@ #include <aputils.h> #endif +#ifndef QT_NO_BEARERMANAGEMENT + QT_BEGIN_NAMESPACE static const int KValueThatWillBeAddedToSNAPId = 1000; @@ -1130,3 +1132,5 @@ void AccessPointsAvailabilityScanner::RunL() } QT_END_NAMESPACE + +#endif // QT_NO_BEARERMANAGEMENT diff --git a/src/plugins/bearer/symbian/symbianengine.h b/src/plugins/bearer/symbian/symbianengine.h index 2e7ae60..dfd12bd 100644 --- a/src/plugins/bearer/symbian/symbianengine.h +++ b/src/plugins/bearer/symbian/symbianengine.h @@ -84,14 +84,14 @@ public: QString bearerName() const; + QNetworkConfigurationPrivatePointer serviceNetworkPtr; + + QString mappingName; + Bearer bearer; TUint32 numericId; TUint connectionId; - - QNetworkConfigurationPrivatePointer serviceNetworkPtr; - - QString mappingName; }; inline SymbianNetworkConfigurationPrivate *toSymbianConfig(QNetworkConfigurationPrivatePointer ptr) diff --git a/src/plugins/gfxdrivers/powervr/QWSWSEGL/pvrqwsdrawable.c b/src/plugins/gfxdrivers/powervr/QWSWSEGL/pvrqwsdrawable.c index e6ac418..d05dd5d 100644 --- a/src/plugins/gfxdrivers/powervr/QWSWSEGL/pvrqwsdrawable.c +++ b/src/plugins/gfxdrivers/powervr/QWSWSEGL/pvrqwsdrawable.c @@ -95,7 +95,7 @@ static int pvrQwsInitFbScreen(int screen) width = var.xres; height = var.yres; bytesPerPixel = var.bits_per_pixel / 8; - stride = var.xres * bytesPerPixel; + stride = fix.line_length; format = PVR2D_1BPP; if (var.bits_per_pixel == 16) { if (var.red.length == 5 && var.green.length == 6 && diff --git a/src/plugins/phonon/ds9/ds9.pro b/src/plugins/phonon/ds9/ds9.pro index f40c561..301808e 100644 --- a/src/plugins/phonon/ds9/ds9.pro +++ b/src/plugins/phonon/ds9/ds9.pro @@ -22,7 +22,6 @@ HEADERS += \ $$PHONON_DS9_DIR/mediaobject.h \ $$PHONON_DS9_DIR/videowidget.h \ $$PHONON_DS9_DIR/videorenderer_soft.h \ - $$PHONON_DS9_DIR/videorenderer_vmr9.h \ $$PHONON_DS9_DIR/volumeeffect.h \ $$PHONON_DS9_DIR/qbasefilter.h \ $$PHONON_DS9_DIR/qpin.h \ @@ -45,7 +44,6 @@ SOURCES += \ $$PHONON_DS9_DIR/mediaobject.cpp \ $$PHONON_DS9_DIR/videowidget.cpp \ $$PHONON_DS9_DIR/videorenderer_soft.cpp \ - $$PHONON_DS9_DIR/videorenderer_vmr9.cpp \ $$PHONON_DS9_DIR/volumeeffect.cpp \ $$PHONON_DS9_DIR/qbasefilter.cpp \ $$PHONON_DS9_DIR/qpin.cpp \ @@ -53,6 +51,15 @@ SOURCES += \ $$PHONON_DS9_DIR/qaudiocdreader.cpp \ $$PHONON_DS9_DIR/qmeminputpin.cpp +#the EVR renderer (only available on desktop) +!wince*:SOURCES += $$PHONON_DS9_DIR/videorenderer_evr.cpp \ + $$PHONON_DS9_DIR/videorenderer_vmr9.cpp +!wince*:HEADERS += $$PHONON_DS9_DIR/qevr9.h \ + $$PHONON_DS9_DIR/videorenderer_evr.h \ + $$PHONON_DS9_DIR/videorenderer_vmr9.h +wince*:SOURCES += $$PHONON_DS9_DIR/videorenderer_default.cpp +wince*:HEADERS += $$PHONON_DS9_DIR/videorenderer_default.h + target.path = $$[QT_INSTALL_PLUGINS]/phonon_backend INSTALLS += target diff --git a/src/s60installs/bwins/QtCoreu.def b/src/s60installs/bwins/QtCoreu.def index cf7fe6f..c2692f6 100644 --- a/src/s60installs/bwins/QtCoreu.def +++ b/src/s60installs/bwins/QtCoreu.def @@ -382,7 +382,7 @@ EXPORTS ??1QDateTime@@QAE@XZ @ 381 NONAME ; QDateTime::~QDateTime(void) ??1QDateTimeParser@@UAE@XZ @ 382 NONAME ; QDateTimeParser::~QDateTimeParser(void) ??1QDebug@@QAE@XZ @ 383 NONAME ; QDebug::~QDebug(void) - ??1QDeclarativeData@@UAE@XZ @ 384 NONAME ; QDeclarativeData::~QDeclarativeData(void) + ??1QDeclarativeData@@UAE@XZ @ 384 NONAME ABSENT ; QDeclarativeData::~QDeclarativeData(void) ??1QDir@@QAE@XZ @ 385 NONAME ; QDir::~QDir(void) ??1QDirIterator@@UAE@XZ @ 386 NONAME ; QDirIterator::~QDirIterator(void) ??1QDynamicPropertyChangeEvent@@UAE@XZ @ 387 NONAME ; QDynamicPropertyChangeEvent::~QDynamicPropertyChangeEvent(void) @@ -885,7 +885,7 @@ EXPORTS ??_EQCoreApplicationPrivate@@UAE@I@Z @ 884 NONAME ; QCoreApplicationPrivate::~QCoreApplicationPrivate(unsigned int) ??_EQDataStream@@UAE@I@Z @ 885 NONAME ; QDataStream::~QDataStream(unsigned int) ??_EQDateTimeParser@@UAE@I@Z @ 886 NONAME ; QDateTimeParser::~QDateTimeParser(unsigned int) - ??_EQDeclarativeData@@UAE@I@Z @ 887 NONAME ; QDeclarativeData::~QDeclarativeData(unsigned int) + ??_EQDeclarativeData@@UAE@I@Z @ 887 NONAME ABSENT ; QDeclarativeData::~QDeclarativeData(unsigned int) ??_EQDirIterator@@UAE@I@Z @ 888 NONAME ; QDirIterator::~QDirIterator(unsigned int) ??_EQDynamicPropertyChangeEvent@@UAE@I@Z @ 889 NONAME ; QDynamicPropertyChangeEvent::~QDynamicPropertyChangeEvent(unsigned int) ??_EQEvent@@UAE@I@Z @ 890 NONAME ; QEvent::~QEvent(unsigned int) @@ -4457,4 +4457,7 @@ EXPORTS ?toEasingCurve@QVariant@@QBE?AVQEasingCurve@@XZ @ 4456 NONAME ; class QEasingCurve QVariant::toEasingCurve(void) const ?toMSecsSinceEpoch@QDateTime@@QBE_JXZ @ 4457 NONAME ; long long QDateTime::toMSecsSinceEpoch(void) const ?transitions@QState@@QBE?AV?$QList@PAVQAbstractTransition@@@@XZ @ 4458 NONAME ; class QList<class QAbstractTransition *> QState::transitions(void) const + ?validCodecs@QTextCodec@@CA_NXZ @ 4459 NONAME ; bool QTextCodec::validCodecs(void) + ?destroyed@QDeclarativeData@@2P6AXPAV1@PAVQObject@@@ZA @ 4460 NONAME ; void (*QDeclarativeData::destroyed)(class QDeclarativeData *, class QObject *) + ?parentChanged@QDeclarativeData@@2P6AXPAV1@PAVQObject@@1@ZA @ 4461 NONAME ; void (*QDeclarativeData::parentChanged)(class QDeclarativeData *, class QObject *, class QObject *) diff --git a/src/s60installs/bwins/QtDeclarativeu.def b/src/s60installs/bwins/QtDeclarativeu.def index 89049a9..3eba5e7 100644 --- a/src/s60installs/bwins/QtDeclarativeu.def +++ b/src/s60installs/bwins/QtDeclarativeu.def @@ -98,7 +98,7 @@ EXPORTS ??0QDeclarativeFontLoader@@QAE@PAVQObject@@@Z @ 97 NONAME ; QDeclarativeFontLoader::QDeclarativeFontLoader(class QObject *) ??0QDeclarativeGradient@@QAE@PAVQObject@@@Z @ 98 NONAME ; QDeclarativeGradient::QDeclarativeGradient(class QObject *) ??0QDeclarativeGradientStop@@QAE@PAVQObject@@@Z @ 99 NONAME ; QDeclarativeGradientStop::QDeclarativeGradientStop(class QObject *) - ??0QDeclarativeGraphicsObjectContainer@@QAE@PAVQDeclarativeItem@@@Z @ 100 NONAME ; QDeclarativeGraphicsObjectContainer::QDeclarativeGraphicsObjectContainer(class QDeclarativeItem *) + ??0QDeclarativeGraphicsObjectContainer@@QAE@PAVQDeclarativeItem@@@Z @ 100 NONAME ABSENT ; QDeclarativeGraphicsObjectContainer::QDeclarativeGraphicsObjectContainer(class QDeclarativeItem *) ??0QDeclarativeGrid@@QAE@PAVQDeclarativeItem@@@Z @ 101 NONAME ; QDeclarativeGrid::QDeclarativeGrid(class QDeclarativeItem *) ??0QDeclarativeGridScaledImage@@QAE@ABV0@@Z @ 102 NONAME ; QDeclarativeGridScaledImage::QDeclarativeGridScaledImage(class QDeclarativeGridScaledImage const &) ??0QDeclarativeGridScaledImage@@QAE@PAVQIODevice@@@Z @ 103 NONAME ; QDeclarativeGridScaledImage::QDeclarativeGridScaledImage(class QIODevice *) @@ -268,7 +268,7 @@ EXPORTS ??1QDeclarativeFontLoader@@UAE@XZ @ 267 NONAME ; QDeclarativeFontLoader::~QDeclarativeFontLoader(void) ??1QDeclarativeGradient@@UAE@XZ @ 268 NONAME ; QDeclarativeGradient::~QDeclarativeGradient(void) ??1QDeclarativeGradientStop@@UAE@XZ @ 269 NONAME ; QDeclarativeGradientStop::~QDeclarativeGradientStop(void) - ??1QDeclarativeGraphicsObjectContainer@@UAE@XZ @ 270 NONAME ; QDeclarativeGraphicsObjectContainer::~QDeclarativeGraphicsObjectContainer(void) + ??1QDeclarativeGraphicsObjectContainer@@UAE@XZ @ 270 NONAME ABSENT ; QDeclarativeGraphicsObjectContainer::~QDeclarativeGraphicsObjectContainer(void) ??1QDeclarativeGrid@@UAE@XZ @ 271 NONAME ; QDeclarativeGrid::~QDeclarativeGrid(void) ??1QDeclarativeGridScaledImage@@QAE@XZ @ 272 NONAME ; QDeclarativeGridScaledImage::~QDeclarativeGridScaledImage(void) ??1QDeclarativeGridView@@UAE@XZ @ 273 NONAME ; QDeclarativeGridView::~QDeclarativeGridView(void) @@ -449,7 +449,7 @@ EXPORTS ??_EQDeclarativeFontLoader@@UAE@I@Z @ 448 NONAME ; QDeclarativeFontLoader::~QDeclarativeFontLoader(unsigned int) ??_EQDeclarativeGradient@@UAE@I@Z @ 449 NONAME ; QDeclarativeGradient::~QDeclarativeGradient(unsigned int) ??_EQDeclarativeGradientStop@@UAE@I@Z @ 450 NONAME ; QDeclarativeGradientStop::~QDeclarativeGradientStop(unsigned int) - ??_EQDeclarativeGraphicsObjectContainer@@UAE@I@Z @ 451 NONAME ; QDeclarativeGraphicsObjectContainer::~QDeclarativeGraphicsObjectContainer(unsigned int) + ??_EQDeclarativeGraphicsObjectContainer@@UAE@I@Z @ 451 NONAME ABSENT ; QDeclarativeGraphicsObjectContainer::~QDeclarativeGraphicsObjectContainer(unsigned int) ??_EQDeclarativeGrid@@UAE@I@Z @ 452 NONAME ; QDeclarativeGrid::~QDeclarativeGrid(unsigned int) ??_EQDeclarativeGridView@@UAE@I@Z @ 453 NONAME ; QDeclarativeGridView::~QDeclarativeGridView(unsigned int) ??_EQDeclarativeImage@@UAE@I@Z @ 454 NONAME ; QDeclarativeImage::~QDeclarativeImage(unsigned int) @@ -910,8 +910,8 @@ EXPORTS ?d_func@QDeclarativeFlow@@ABEPBVQDeclarativeFlowPrivate@@XZ @ 909 NONAME ; class QDeclarativeFlowPrivate const * QDeclarativeFlow::d_func(void) const ?d_func@QDeclarativeFontLoader@@AAEPAVQDeclarativeFontLoaderPrivate@@XZ @ 910 NONAME ; class QDeclarativeFontLoaderPrivate * QDeclarativeFontLoader::d_func(void) ?d_func@QDeclarativeFontLoader@@ABEPBVQDeclarativeFontLoaderPrivate@@XZ @ 911 NONAME ; class QDeclarativeFontLoaderPrivate const * QDeclarativeFontLoader::d_func(void) const - ?d_func@QDeclarativeGraphicsObjectContainer@@AAEPAVQDeclarativeGraphicsObjectContainerPrivate@@XZ @ 912 NONAME ; class QDeclarativeGraphicsObjectContainerPrivate * QDeclarativeGraphicsObjectContainer::d_func(void) - ?d_func@QDeclarativeGraphicsObjectContainer@@ABEPBVQDeclarativeGraphicsObjectContainerPrivate@@XZ @ 913 NONAME ; class QDeclarativeGraphicsObjectContainerPrivate const * QDeclarativeGraphicsObjectContainer::d_func(void) const + ?d_func@QDeclarativeGraphicsObjectContainer@@AAEPAVQDeclarativeGraphicsObjectContainerPrivate@@XZ @ 912 NONAME ABSENT ; class QDeclarativeGraphicsObjectContainerPrivate * QDeclarativeGraphicsObjectContainer::d_func(void) + ?d_func@QDeclarativeGraphicsObjectContainer@@ABEPBVQDeclarativeGraphicsObjectContainerPrivate@@XZ @ 913 NONAME ABSENT ; class QDeclarativeGraphicsObjectContainerPrivate const * QDeclarativeGraphicsObjectContainer::d_func(void) const ?d_func@QDeclarativeGridView@@AAEPAVQDeclarativeGridViewPrivate@@XZ @ 914 NONAME ; class QDeclarativeGridViewPrivate * QDeclarativeGridView::d_func(void) ?d_func@QDeclarativeGridView@@ABEPBVQDeclarativeGridViewPrivate@@XZ @ 915 NONAME ; class QDeclarativeGridViewPrivate const * QDeclarativeGridView::d_func(void) const ?d_func@QDeclarativeImage@@AAEPAVQDeclarativeImagePrivate@@XZ @ 916 NONAME ; class QDeclarativeImagePrivate * QDeclarativeImage::d_func(void) @@ -1096,7 +1096,7 @@ EXPORTS ?event@QDeclarativeSystemPalette@@EAE_NPAVQEvent@@@Z @ 1095 NONAME ; bool QDeclarativeSystemPalette::event(class QEvent *) ?event@QDeclarativeTextEdit@@MAE_NPAVQEvent@@@Z @ 1096 NONAME ; bool QDeclarativeTextEdit::event(class QEvent *) ?event@QDeclarativeTextInput@@MAE_NPAVQEvent@@@Z @ 1097 NONAME ; bool QDeclarativeTextInput::event(class QEvent *) - ?eventFilter@QDeclarativeGraphicsObjectContainer@@MAE_NPAVQObject@@PAVQEvent@@@Z @ 1098 NONAME ; bool QDeclarativeGraphicsObjectContainer::eventFilter(class QObject *, class QEvent *) + ?eventFilter@QDeclarativeGraphicsObjectContainer@@MAE_NPAVQObject@@PAVQEvent@@@Z @ 1098 NONAME ABSENT ; bool QDeclarativeGraphicsObjectContainer::eventFilter(class QObject *, class QEvent *) ?eventFilter@QDeclarativeLoader@@MAE_NPAVQObject@@PAVQEvent@@@Z @ 1099 NONAME ; bool QDeclarativeLoader::eventFilter(class QObject *, class QEvent *) ?eventFilter@QDeclarativeSystemPalette@@EAE_NPAVQObject@@PAVQEvent@@@Z @ 1100 NONAME ; bool QDeclarativeSystemPalette::eventFilter(class QObject *, class QEvent *) ?execute@QDeclarativeAnchorChanges@@UAEXXZ @ 1101 NONAME ; void QDeclarativeAnchorChanges::execute(void) @@ -1223,7 +1223,7 @@ EXPORTS ?getStaticMetaObject@QDeclarativeFontLoader@@SAABUQMetaObject@@XZ @ 1222 NONAME ; struct QMetaObject const & QDeclarativeFontLoader::getStaticMetaObject(void) ?getStaticMetaObject@QDeclarativeGradient@@SAABUQMetaObject@@XZ @ 1223 NONAME ; struct QMetaObject const & QDeclarativeGradient::getStaticMetaObject(void) ?getStaticMetaObject@QDeclarativeGradientStop@@SAABUQMetaObject@@XZ @ 1224 NONAME ; struct QMetaObject const & QDeclarativeGradientStop::getStaticMetaObject(void) - ?getStaticMetaObject@QDeclarativeGraphicsObjectContainer@@SAABUQMetaObject@@XZ @ 1225 NONAME ; struct QMetaObject const & QDeclarativeGraphicsObjectContainer::getStaticMetaObject(void) + ?getStaticMetaObject@QDeclarativeGraphicsObjectContainer@@SAABUQMetaObject@@XZ @ 1225 NONAME ABSENT ; struct QMetaObject const & QDeclarativeGraphicsObjectContainer::getStaticMetaObject(void) ?getStaticMetaObject@QDeclarativeGrid@@SAABUQMetaObject@@XZ @ 1226 NONAME ; struct QMetaObject const & QDeclarativeGrid::getStaticMetaObject(void) ?getStaticMetaObject@QDeclarativeGridView@@SAABUQMetaObject@@XZ @ 1227 NONAME ; struct QMetaObject const & QDeclarativeGridView::getStaticMetaObject(void) ?getStaticMetaObject@QDeclarativeImage@@SAABUQMetaObject@@XZ @ 1228 NONAME ; struct QMetaObject const & QDeclarativeImage::getStaticMetaObject(void) @@ -1282,7 +1282,7 @@ EXPORTS ?getStaticMetaObject@QPacketProtocol@@SAABUQMetaObject@@XZ @ 1281 NONAME ; struct QMetaObject const & QPacketProtocol::getStaticMetaObject(void) ?gradient@QDeclarativeGradient@@QBEPBVQGradient@@XZ @ 1282 NONAME ; class QGradient const * QDeclarativeGradient::gradient(void) const ?gradient@QDeclarativeRectangle@@QBEPAVQDeclarativeGradient@@XZ @ 1283 NONAME ; class QDeclarativeGradient * QDeclarativeRectangle::gradient(void) const - ?graphicsObject@QDeclarativeGraphicsObjectContainer@@QBEPAVQGraphicsObject@@XZ @ 1284 NONAME ; class QGraphicsObject * QDeclarativeGraphicsObjectContainer::graphicsObject(void) const + ?graphicsObject@QDeclarativeGraphicsObjectContainer@@QBEPAVQGraphicsObject@@XZ @ 1284 NONAME ABSENT ; class QGraphicsObject * QDeclarativeGraphicsObjectContainer::graphicsObject(void) const ?gridBottom@QDeclarativeGridScaledImage@@QBEHXZ @ 1285 NONAME ; int QDeclarativeGridScaledImage::gridBottom(void) const ?gridLeft@QDeclarativeGridScaledImage@@QBEHXZ @ 1286 NONAME ; int QDeclarativeGridScaledImage::gridLeft(void) const ?gridRight@QDeclarativeGridScaledImage@@QBEHXZ @ 1287 NONAME ; int QDeclarativeGridScaledImage::gridRight(void) const @@ -1350,7 +1350,7 @@ EXPORTS ?imageProvider@QDeclarativeEngine@@QBEPAVQDeclarativeImageProvider@@ABVQString@@@Z @ 1349 NONAME ; class QDeclarativeImageProvider * QDeclarativeEngine::imageProvider(class QString const &) const ?implicitHeight@QDeclarativeItem@@QBEMXZ @ 1350 NONAME ; float QDeclarativeItem::implicitHeight(void) const ?implicitWidth@QDeclarativeItem@@QBEMXZ @ 1351 NONAME ; float QDeclarativeItem::implicitWidth(void) const - ?importExtension@QDeclarativeEngine@@QAE_NABVQString@@0@Z @ 1352 NONAME ; bool QDeclarativeEngine::importExtension(class QString const &, class QString const &) + ?importExtension@QDeclarativeEngine@@QAE_NABVQString@@0@Z @ 1352 NONAME ABSENT ; bool QDeclarativeEngine::importExtension(class QString const &, class QString const &) ?imports@QDeclarativeDomDocument@@QBE?AV?$QList@VQDeclarativeDomImport@@@@XZ @ 1353 NONAME ; class QList<class QDeclarativeDomImport> QDeclarativeDomDocument::imports(void) const ?inSync@QDeclarativeSpringFollow@@QBE_NXZ @ 1354 NONAME ; bool QDeclarativeSpringFollow::inSync(void) const ?incrementCurrentIndex@QDeclarativeListView@@QAEXXZ @ 1355 NONAME ; void QDeclarativeListView::incrementCurrentIndex(void) @@ -1484,7 +1484,7 @@ EXPORTS ?item@QDeclarativeVisualDataModel@@UAEPAVQDeclarativeItem@@H_N@Z @ 1483 NONAME ; class QDeclarativeItem * QDeclarativeVisualDataModel::item(int, bool) ?item@QDeclarativeVisualItemModel@@UAEPAVQDeclarativeItem@@H_N@Z @ 1484 NONAME ; class QDeclarativeItem * QDeclarativeVisualItemModel::item(int, bool) ?itemChange@QDeclarativeBasePositioner@@MAE?AVQVariant@@W4GraphicsItemChange@QGraphicsItem@@ABV2@@Z @ 1485 NONAME ; class QVariant QDeclarativeBasePositioner::itemChange(enum QGraphicsItem::GraphicsItemChange, class QVariant const &) - ?itemChange@QDeclarativeGraphicsObjectContainer@@MAE?AVQVariant@@W4GraphicsItemChange@QGraphicsItem@@ABV2@@Z @ 1486 NONAME ; class QVariant QDeclarativeGraphicsObjectContainer::itemChange(enum QGraphicsItem::GraphicsItemChange, class QVariant const &) + ?itemChange@QDeclarativeGraphicsObjectContainer@@MAE?AVQVariant@@W4GraphicsItemChange@QGraphicsItem@@ABV2@@Z @ 1486 NONAME ABSENT ; class QVariant QDeclarativeGraphicsObjectContainer::itemChange(enum QGraphicsItem::GraphicsItemChange, class QVariant const &) ?itemChange@QDeclarativeItem@@MAE?AVQVariant@@W4GraphicsItemChange@QGraphicsItem@@ABV2@@Z @ 1487 NONAME ; class QVariant QDeclarativeItem::itemChange(enum QGraphicsItem::GraphicsItemChange, class QVariant const &) ?itemChange@QDeclarativeLoader@@MAE?AVQVariant@@W4GraphicsItemChange@QGraphicsItem@@ABV2@@Z @ 1488 NONAME ; class QVariant QDeclarativeLoader::itemChange(enum QGraphicsItem::GraphicsItemChange, class QVariant const &) ?itemChange@QDeclarativeRepeater@@MAE?AVQVariant@@W4GraphicsItemChange@QGraphicsItem@@ABV2@@Z @ 1489 NONAME ; class QVariant QDeclarativeRepeater::itemChange(enum QGraphicsItem::GraphicsItemChange, class QVariant const &) @@ -1625,7 +1625,7 @@ EXPORTS ?metaObject@QDeclarativeFontLoader@@UBEPBUQMetaObject@@XZ @ 1624 NONAME ; struct QMetaObject const * QDeclarativeFontLoader::metaObject(void) const ?metaObject@QDeclarativeGradient@@UBEPBUQMetaObject@@XZ @ 1625 NONAME ; struct QMetaObject const * QDeclarativeGradient::metaObject(void) const ?metaObject@QDeclarativeGradientStop@@UBEPBUQMetaObject@@XZ @ 1626 NONAME ; struct QMetaObject const * QDeclarativeGradientStop::metaObject(void) const - ?metaObject@QDeclarativeGraphicsObjectContainer@@UBEPBUQMetaObject@@XZ @ 1627 NONAME ; struct QMetaObject const * QDeclarativeGraphicsObjectContainer::metaObject(void) const + ?metaObject@QDeclarativeGraphicsObjectContainer@@UBEPBUQMetaObject@@XZ @ 1627 NONAME ABSENT ; struct QMetaObject const * QDeclarativeGraphicsObjectContainer::metaObject(void) const ?metaObject@QDeclarativeGrid@@UBEPBUQMetaObject@@XZ @ 1628 NONAME ; struct QMetaObject const * QDeclarativeGrid::metaObject(void) const ?metaObject@QDeclarativeGridView@@UBEPBUQMetaObject@@XZ @ 1629 NONAME ; struct QMetaObject const * QDeclarativeGridView::metaObject(void) const ?metaObject@QDeclarativeImage@@UBEPBUQMetaObject@@XZ @ 1630 NONAME ; struct QMetaObject const * QDeclarativeImage::metaObject(void) const @@ -1988,7 +1988,7 @@ EXPORTS ?qt_metacall@QDeclarativeFontLoader@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 1987 NONAME ; int QDeclarativeFontLoader::qt_metacall(enum QMetaObject::Call, int, void * *) ?qt_metacall@QDeclarativeGradient@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 1988 NONAME ; int QDeclarativeGradient::qt_metacall(enum QMetaObject::Call, int, void * *) ?qt_metacall@QDeclarativeGradientStop@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 1989 NONAME ; int QDeclarativeGradientStop::qt_metacall(enum QMetaObject::Call, int, void * *) - ?qt_metacall@QDeclarativeGraphicsObjectContainer@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 1990 NONAME ; int QDeclarativeGraphicsObjectContainer::qt_metacall(enum QMetaObject::Call, int, void * *) + ?qt_metacall@QDeclarativeGraphicsObjectContainer@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 1990 NONAME ABSENT ; int QDeclarativeGraphicsObjectContainer::qt_metacall(enum QMetaObject::Call, int, void * *) ?qt_metacall@QDeclarativeGrid@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 1991 NONAME ; int QDeclarativeGrid::qt_metacall(enum QMetaObject::Call, int, void * *) ?qt_metacall@QDeclarativeGridView@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 1992 NONAME ; int QDeclarativeGridView::qt_metacall(enum QMetaObject::Call, int, void * *) ?qt_metacall@QDeclarativeImage@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 1993 NONAME ; int QDeclarativeImage::qt_metacall(enum QMetaObject::Call, int, void * *) @@ -2083,7 +2083,7 @@ EXPORTS ?qt_metacast@QDeclarativeFontLoader@@UAEPAXPBD@Z @ 2082 NONAME ; void * QDeclarativeFontLoader::qt_metacast(char const *) ?qt_metacast@QDeclarativeGradient@@UAEPAXPBD@Z @ 2083 NONAME ; void * QDeclarativeGradient::qt_metacast(char const *) ?qt_metacast@QDeclarativeGradientStop@@UAEPAXPBD@Z @ 2084 NONAME ; void * QDeclarativeGradientStop::qt_metacast(char const *) - ?qt_metacast@QDeclarativeGraphicsObjectContainer@@UAEPAXPBD@Z @ 2085 NONAME ; void * QDeclarativeGraphicsObjectContainer::qt_metacast(char const *) + ?qt_metacast@QDeclarativeGraphicsObjectContainer@@UAEPAXPBD@Z @ 2085 NONAME ABSENT ; void * QDeclarativeGraphicsObjectContainer::qt_metacast(char const *) ?qt_metacast@QDeclarativeGrid@@UAEPAXPBD@Z @ 2086 NONAME ; void * QDeclarativeGrid::qt_metacast(char const *) ?qt_metacast@QDeclarativeGridView@@UAEPAXPBD@Z @ 2087 NONAME ; void * QDeclarativeGridView::qt_metacast(char const *) ?qt_metacast@QDeclarativeImage@@UAEPAXPBD@Z @ 2088 NONAME ; void * QDeclarativeImage::qt_metacast(char const *) @@ -2430,7 +2430,7 @@ EXPORTS ?setFromState@QDeclarativeTransition@@QAEXABVQString@@@Z @ 2429 NONAME ; void QDeclarativeTransition::setFromState(class QString const &) ?setFront@QDeclarativeFlipable@@QAEXPAVQDeclarativeItem@@@Z @ 2430 NONAME ABSENT ; void QDeclarativeFlipable::setFront(class QDeclarativeItem *) ?setGradient@QDeclarativeRectangle@@QAEXPAVQDeclarativeGradient@@@Z @ 2431 NONAME ; void QDeclarativeRectangle::setGradient(class QDeclarativeGradient *) - ?setGraphicsObject@QDeclarativeGraphicsObjectContainer@@QAEXPAVQGraphicsObject@@@Z @ 2432 NONAME ; void QDeclarativeGraphicsObjectContainer::setGraphicsObject(class QGraphicsObject *) + ?setGraphicsObject@QDeclarativeGraphicsObjectContainer@@QAEXPAVQGraphicsObject@@@Z @ 2432 NONAME ABSENT ; void QDeclarativeGraphicsObjectContainer::setGraphicsObject(class QGraphicsObject *) ?setGridScaledImage@QDeclarativeBorderImage@@AAEXABVQDeclarativeGridScaledImage@@@Z @ 2433 NONAME ; void QDeclarativeBorderImage::setGridScaledImage(class QDeclarativeGridScaledImage const &) ?setHAlign@QDeclarativeText@@QAEXW4HAlignment@1@@Z @ 2434 NONAME ; void QDeclarativeText::setHAlign(enum QDeclarativeText::HAlignment) ?setHAlign@QDeclarativeTextEdit@@QAEXW4HAlignment@1@@Z @ 2435 NONAME ; void QDeclarativeTextEdit::setHAlign(enum QDeclarativeTextEdit::HAlignment) @@ -2587,7 +2587,7 @@ EXPORTS ?setSourceComponent@QDeclarativeLoader@@QAEXPAVQDeclarativeComponent@@@Z @ 2586 NONAME ; void QDeclarativeLoader::setSourceComponent(class QDeclarativeComponent *) ?setSourceLocation@QDeclarativeExpression@@QAEXABVQString@@H@Z @ 2587 NONAME ; void QDeclarativeExpression::setSourceLocation(class QString const &, int) ?setSourceValue@QDeclarativeEaseFollow@@QAEXM@Z @ 2588 NONAME ABSENT ; void QDeclarativeEaseFollow::setSourceValue(float) - ?setSourceValue@QDeclarativeSpringFollow@@QAEXM@Z @ 2589 NONAME ; void QDeclarativeSpringFollow::setSourceValue(float) + ?setSourceValue@QDeclarativeSpringFollow@@QAEXM@Z @ 2589 NONAME ABSENT ; void QDeclarativeSpringFollow::setSourceValue(float) ?setSpacing@QDeclarativeBasePositioner@@QAEXH@Z @ 2590 NONAME ; void QDeclarativeBasePositioner::setSpacing(int) ?setSpacing@QDeclarativeListView@@QAEXM@Z @ 2591 NONAME ; void QDeclarativeListView::setSpacing(float) ?setSpring@QDeclarativeSpringFollow@@QAEXM@Z @ 2592 NONAME ; void QDeclarativeSpringFollow::setSpring(float) @@ -2605,7 +2605,7 @@ EXPORTS ?setStyle@QDeclarativeText@@QAEXW4TextStyle@1@@Z @ 2604 NONAME ; void QDeclarativeText::setStyle(enum QDeclarativeText::TextStyle) ?setStyleColor@QDeclarativeText@@QAEXABVQColor@@@Z @ 2605 NONAME ; void QDeclarativeText::setStyleColor(class QColor const &) ?setSuperClass@QMetaObjectBuilder@@QAEXPBUQMetaObject@@@Z @ 2606 NONAME ; void QMetaObjectBuilder::setSuperClass(struct QMetaObject const *) - ?setSynchronizedResizing@QDeclarativeGraphicsObjectContainer@@QAEX_N@Z @ 2607 NONAME ; void QDeclarativeGraphicsObjectContainer::setSynchronizedResizing(bool) + ?setSynchronizedResizing@QDeclarativeGraphicsObjectContainer@@QAEX_N@Z @ 2607 NONAME ABSENT ; void QDeclarativeGraphicsObjectContainer::setSynchronizedResizing(bool) ?setTag@QMetaMethodBuilder@@QAEXABVQByteArray@@@Z @ 2608 NONAME ; void QMetaMethodBuilder::setTag(class QByteArray const &) ?setTarget@QDeclarativeBehavior@@UAEXABVQDeclarativeProperty@@@Z @ 2609 NONAME ; void QDeclarativeBehavior::setTarget(class QDeclarativeProperty const &) ?setTarget@QDeclarativeConnections@@QAEXPAVQObject@@@Z @ 2610 NONAME ; void QDeclarativeConnections::setTarget(class QObject *) @@ -2703,7 +2703,7 @@ EXPORTS ?sourceComponent@QDeclarativeLoader@@QBEPAVQDeclarativeComponent@@XZ @ 2702 NONAME ; class QDeclarativeComponent * QDeclarativeLoader::sourceComponent(void) const ?sourceFile@QDeclarativeExpression@@QBE?AVQString@@XZ @ 2703 NONAME ; class QString QDeclarativeExpression::sourceFile(void) const ?sourceValue@QDeclarativeEaseFollow@@QBEMXZ @ 2704 NONAME ABSENT ; float QDeclarativeEaseFollow::sourceValue(void) const - ?sourceValue@QDeclarativeSpringFollow@@QBEMXZ @ 2705 NONAME ; float QDeclarativeSpringFollow::sourceValue(void) const + ?sourceValue@QDeclarativeSpringFollow@@QBEMXZ @ 2705 NONAME ABSENT ; float QDeclarativeSpringFollow::sourceValue(void) const ?spacing@QDeclarativeBasePositioner@@QBEHXZ @ 2706 NONAME ; int QDeclarativeBasePositioner::spacing(void) const ?spacing@QDeclarativeListView@@QBEMXZ @ 2707 NONAME ; float QDeclarativeListView::spacing(void) const ?spacingChanged@QDeclarativeBasePositioner@@IAEXXZ @ 2708 NONAME ; void QDeclarativeBasePositioner::spacingChanged(void) @@ -2756,7 +2756,7 @@ EXPORTS ?styleColorChanged@QDeclarativeText@@IAEXABVQColor@@@Z @ 2755 NONAME ; void QDeclarativeText::styleColorChanged(class QColor const &) ?superClass@QMetaObjectBuilder@@QBEPBUQMetaObject@@XZ @ 2756 NONAME ; struct QMetaObject const * QMetaObjectBuilder::superClass(void) const ?syncChanged@QDeclarativeSpringFollow@@IAEXXZ @ 2757 NONAME ; void QDeclarativeSpringFollow::syncChanged(void) - ?synchronizedResizing@QDeclarativeGraphicsObjectContainer@@QBE_NXZ @ 2758 NONAME ; bool QDeclarativeGraphicsObjectContainer::synchronizedResizing(void) const + ?synchronizedResizing@QDeclarativeGraphicsObjectContainer@@QBE_NXZ @ 2758 NONAME ABSENT ; bool QDeclarativeGraphicsObjectContainer::synchronizedResizing(void) const ?tag@QMetaMethodBuilder@@QBE?AVQByteArray@@XZ @ 2759 NONAME ; class QByteArray QMetaMethodBuilder::tag(void) const ?target@QDeclarativeConnections@@QBEPAVQObject@@XZ @ 2760 NONAME ; class QObject * QDeclarativeConnections::target(void) const ?target@QDeclarativeDrag@@QBEPAVQDeclarativeItem@@XZ @ 2761 NONAME ABSENT ; class QDeclarativeItem * QDeclarativeDrag::target(void) const @@ -2892,8 +2892,8 @@ EXPORTS ?tr@QDeclarativeGradient@@SA?AVQString@@PBD0H@Z @ 2891 NONAME ; class QString QDeclarativeGradient::tr(char const *, char const *, int) ?tr@QDeclarativeGradientStop@@SA?AVQString@@PBD0@Z @ 2892 NONAME ; class QString QDeclarativeGradientStop::tr(char const *, char const *) ?tr@QDeclarativeGradientStop@@SA?AVQString@@PBD0H@Z @ 2893 NONAME ; class QString QDeclarativeGradientStop::tr(char const *, char const *, int) - ?tr@QDeclarativeGraphicsObjectContainer@@SA?AVQString@@PBD0@Z @ 2894 NONAME ; class QString QDeclarativeGraphicsObjectContainer::tr(char const *, char const *) - ?tr@QDeclarativeGraphicsObjectContainer@@SA?AVQString@@PBD0H@Z @ 2895 NONAME ; class QString QDeclarativeGraphicsObjectContainer::tr(char const *, char const *, int) + ?tr@QDeclarativeGraphicsObjectContainer@@SA?AVQString@@PBD0@Z @ 2894 NONAME ABSENT ; class QString QDeclarativeGraphicsObjectContainer::tr(char const *, char const *) + ?tr@QDeclarativeGraphicsObjectContainer@@SA?AVQString@@PBD0H@Z @ 2895 NONAME ABSENT ; class QString QDeclarativeGraphicsObjectContainer::tr(char const *, char const *, int) ?tr@QDeclarativeGrid@@SA?AVQString@@PBD0@Z @ 2896 NONAME ; class QString QDeclarativeGrid::tr(char const *, char const *) ?tr@QDeclarativeGrid@@SA?AVQString@@PBD0H@Z @ 2897 NONAME ; class QString QDeclarativeGrid::tr(char const *, char const *, int) ?tr@QDeclarativeGridView@@SA?AVQString@@PBD0@Z @ 2898 NONAME ; class QString QDeclarativeGridView::tr(char const *, char const *) @@ -3082,8 +3082,8 @@ EXPORTS ?trUtf8@QDeclarativeGradient@@SA?AVQString@@PBD0H@Z @ 3081 NONAME ; class QString QDeclarativeGradient::trUtf8(char const *, char const *, int) ?trUtf8@QDeclarativeGradientStop@@SA?AVQString@@PBD0@Z @ 3082 NONAME ; class QString QDeclarativeGradientStop::trUtf8(char const *, char const *) ?trUtf8@QDeclarativeGradientStop@@SA?AVQString@@PBD0H@Z @ 3083 NONAME ; class QString QDeclarativeGradientStop::trUtf8(char const *, char const *, int) - ?trUtf8@QDeclarativeGraphicsObjectContainer@@SA?AVQString@@PBD0@Z @ 3084 NONAME ; class QString QDeclarativeGraphicsObjectContainer::trUtf8(char const *, char const *) - ?trUtf8@QDeclarativeGraphicsObjectContainer@@SA?AVQString@@PBD0H@Z @ 3085 NONAME ; class QString QDeclarativeGraphicsObjectContainer::trUtf8(char const *, char const *, int) + ?trUtf8@QDeclarativeGraphicsObjectContainer@@SA?AVQString@@PBD0@Z @ 3084 NONAME ABSENT ; class QString QDeclarativeGraphicsObjectContainer::trUtf8(char const *, char const *) + ?trUtf8@QDeclarativeGraphicsObjectContainer@@SA?AVQString@@PBD0H@Z @ 3085 NONAME ABSENT ; class QString QDeclarativeGraphicsObjectContainer::trUtf8(char const *, char const *, int) ?trUtf8@QDeclarativeGrid@@SA?AVQString@@PBD0@Z @ 3086 NONAME ; class QString QDeclarativeGrid::trUtf8(char const *, char const *) ?trUtf8@QDeclarativeGrid@@SA?AVQString@@PBD0H@Z @ 3087 NONAME ; class QString QDeclarativeGrid::trUtf8(char const *, char const *, int) ?trUtf8@QDeclarativeGridView@@SA?AVQString@@PBD0@Z @ 3088 NONAME ; class QString QDeclarativeGridView::trUtf8(char const *, char const *) @@ -3309,8 +3309,8 @@ EXPORTS ?windowText@QDeclarativeSystemPalette@@QBE?AVQColor@@XZ @ 3308 NONAME ; class QColor QDeclarativeSystemPalette::windowText(void) const ?wrap@QDeclarativeText@@QBE_NXZ @ 3309 NONAME ; bool QDeclarativeText::wrap(void) const ?wrap@QDeclarativeTextEdit@@QBE_NXZ @ 3310 NONAME ; bool QDeclarativeTextEdit::wrap(void) const - ?wrapChanged@QDeclarativeText@@IAEX_N@Z @ 3311 NONAME ; void QDeclarativeText::wrapChanged(bool) - ?wrapChanged@QDeclarativeTextEdit@@IAEX_N@Z @ 3312 NONAME ; void QDeclarativeTextEdit::wrapChanged(bool) + ?wrapChanged@QDeclarativeText@@IAEX_N@Z @ 3311 NONAME ABSENT ; void QDeclarativeText::wrapChanged(bool) + ?wrapChanged@QDeclarativeTextEdit@@IAEX_N@Z @ 3312 NONAME ABSENT ; void QDeclarativeTextEdit::wrapChanged(bool) ?write@QDeclarativeBehavior@@UAEXABVQVariant@@@Z @ 3313 NONAME ; void QDeclarativeBehavior::write(class QVariant const &) ?write@QDeclarativeProperty@@QBE_NABVQVariant@@@Z @ 3314 NONAME ; bool QDeclarativeProperty::write(class QVariant const &) const ?write@QDeclarativeProperty@@SA_NPAVQObject@@ABVQString@@ABVQVariant@@@Z @ 3315 NONAME ; bool QDeclarativeProperty::write(class QObject *, class QString const &, class QVariant const &) @@ -3320,7 +3320,7 @@ EXPORTS ?x@QDeclarativeParentChange@@QBEMXZ @ 3319 NONAME ; float QDeclarativeParentChange::x(void) const ?xAttractor@QDeclarativeParticleMotionGravity@@QBEMXZ @ 3320 NONAME ABSENT ; float QDeclarativeParticleMotionGravity::xAttractor(void) const ?xIsSet@QDeclarativeParentChange@@QBE_NXZ @ 3321 NONAME ; bool QDeclarativeParentChange::xIsSet(void) const - ?xToPos@QDeclarativeTextInput@@QAEHH@Z @ 3322 NONAME ; int QDeclarativeTextInput::xToPos(int) + ?xToPos@QDeclarativeTextInput@@QAEHH@Z @ 3322 NONAME ABSENT ; int QDeclarativeTextInput::xToPos(int) ?xVariance@QDeclarativeParticleMotionWander@@QBEMXZ @ 3323 NONAME ABSENT ; float QDeclarativeParticleMotionWander::xVariance(void) const ?xattractorChanged@QDeclarativeParticleMotionGravity@@IAEXXZ @ 3324 NONAME ABSENT ; void QDeclarativeParticleMotionGravity::xattractorChanged(void) ?xflick@QDeclarativeFlickable@@IBE_NXZ @ 3325 NONAME ; bool QDeclarativeFlickable::xflick(void) const @@ -3351,7 +3351,7 @@ EXPORTS ?staticMetaObject@QDeclarativeItem@@2UQMetaObject@@B @ 3350 NONAME ; struct QMetaObject const QDeclarativeItem::staticMetaObject ?staticMetaObject@QDeclarativeColumn@@2UQMetaObject@@B @ 3351 NONAME ; struct QMetaObject const QDeclarativeColumn::staticMetaObject ?staticMetaObject@QDeclarativeGradient@@2UQMetaObject@@B @ 3352 NONAME ; struct QMetaObject const QDeclarativeGradient::staticMetaObject - ?staticMetaObject@QDeclarativeGraphicsObjectContainer@@2UQMetaObject@@B @ 3353 NONAME ; struct QMetaObject const QDeclarativeGraphicsObjectContainer::staticMetaObject + ?staticMetaObject@QDeclarativeGraphicsObjectContainer@@2UQMetaObject@@B @ 3353 NONAME ABSENT ; struct QMetaObject const QDeclarativeGraphicsObjectContainer::staticMetaObject ?staticMetaObject@QDeclarativeDebugWatch@@2UQMetaObject@@B @ 3354 NONAME ; struct QMetaObject const QDeclarativeDebugWatch::staticMetaObject ?staticMetaObject@QDeclarativeStateGroup@@2UQMetaObject@@B @ 3355 NONAME ; struct QMetaObject const QDeclarativeStateGroup::staticMetaObject ?staticMetaObject@QPacketProtocol@@2UQMetaObject@@B @ 3356 NONAME ; struct QMetaObject const QPacketProtocol::staticMetaObject @@ -3749,7 +3749,7 @@ EXPORTS ?setSize@QDeclarativeItem@@QAEXABVQSizeF@@@Z @ 3748 NONAME ; void QDeclarativeItem::setSize(class QSizeF const &) ?setSnapMode@QDeclarativeGridView@@QAEXW4SnapMode@1@@Z @ 3749 NONAME ; void QDeclarativeGridView::setSnapMode(enum QDeclarativeGridView::SnapMode) ?setSource@QDeclarativeWorkerScript@@QAEXABVQUrl@@@Z @ 3750 NONAME ; void QDeclarativeWorkerScript::setSource(class QUrl const &) - ?setSourceSize@QDeclarativeImageBase@@QAEXABVQSize@@@Z @ 3751 NONAME ; void QDeclarativeImageBase::setSourceSize(class QSize const &) + ?setSourceSize@QDeclarativeImageBase@@QAEXABVQSize@@@Z @ 3751 NONAME ABSENT ; void QDeclarativeImageBase::setSourceSize(class QSize const &) ?setTarget@QDeclarativeDrag@@QAEXPAVQGraphicsObject@@@Z @ 3752 NONAME ; void QDeclarativeDrag::setTarget(class QGraphicsObject *) ?setTop@QDeclarativeAnchors@@QAEXABUQDeclarativeAnchorLine@@@Z @ 3753 NONAME ; void QDeclarativeAnchors::setTop(struct QDeclarativeAnchorLine const &) ?setVelocity@QDeclarativeSmoothedAnimation@@QAEXM@Z @ 3754 NONAME ; void QDeclarativeSmoothedAnimation::setVelocity(float) @@ -3818,4 +3818,79 @@ EXPORTS ?staticMetaObject@QDeclarativeSmoothedAnimation@@2UQMetaObject@@B @ 3817 NONAME ; struct QMetaObject const QDeclarativeSmoothedAnimation::staticMetaObject ?staticMetaObject@QDeclarativeTranslate@@2UQMetaObject@@B @ 3818 NONAME ; struct QMetaObject const QDeclarativeTranslate::staticMetaObject ?consistentTime@QDeclarativeItemPrivate@@2HA @ 3819 NONAME ; int QDeclarativeItemPrivate::consistentTime + ??0QDeclarativeAction@@QAE@PAVQObject@@ABVQString@@PAVQDeclarativeContext@@ABVQVariant@@@Z @ 3820 NONAME ; QDeclarativeAction::QDeclarativeAction(class QObject *, class QString const &, class QDeclarativeContext *, class QVariant const &) + ??0QDeclarativeSmoothedFollow@@QAE@PAVQObject@@@Z @ 3821 NONAME ; QDeclarativeSmoothedFollow::QDeclarativeSmoothedFollow(class QObject *) + ??1QDeclarativeSmoothedFollow@@UAE@XZ @ 3822 NONAME ; QDeclarativeSmoothedFollow::~QDeclarativeSmoothedFollow(void) + ??_EQDeclarativeSmoothedFollow@@UAE@I@Z @ 3823 NONAME ; QDeclarativeSmoothedFollow::~QDeclarativeSmoothedFollow(unsigned int) + ?addPluginPath@QDeclarativeEngine@@QAEXABVQString@@@Z @ 3824 NONAME ; void QDeclarativeEngine::addPluginPath(class QString const &) + ?autoScroll@QDeclarativeTextInput@@QBE_NXZ @ 3825 NONAME ; bool QDeclarativeTextInput::autoScroll(void) const + ?autoScrollChanged@QDeclarativeTextInput@@IAEX_N@Z @ 3826 NONAME ; void QDeclarativeTextInput::autoScrollChanged(bool) + ?createFunction@QDeclarativeType@@QBEP6AXPAX@ZXZ @ 3827 NONAME ; void (*)(void *) QDeclarativeType::createFunction(void) const + ?createSize@QDeclarativeType@@QBEHXZ @ 3828 NONAME ; int QDeclarativeType::createSize(void) const + ?d_func@QDeclarativeSmoothedFollow@@AAEPAVQDeclarativeSmoothedFollowPrivate@@XZ @ 3829 NONAME ; class QDeclarativeSmoothedFollowPrivate * QDeclarativeSmoothedFollow::d_func(void) + ?d_func@QDeclarativeSmoothedFollow@@ABEPBVQDeclarativeSmoothedFollowPrivate@@XZ @ 3830 NONAME ; class QDeclarativeSmoothedFollowPrivate const * QDeclarativeSmoothedFollow::d_func(void) const + ?displayText@QDeclarativeTextInput@@QBE?AVQString@@XZ @ 3831 NONAME ; class QString QDeclarativeTextInput::displayText(void) const + ?displayTextChanged@QDeclarativeTextInput@@IAEXABVQString@@@Z @ 3832 NONAME ; void QDeclarativeTextInput::displayTextChanged(class QString const &) + ?duration@QDeclarativeSmoothedFollow@@QBEHXZ @ 3833 NONAME ; int QDeclarativeSmoothedFollow::duration(void) const + ?durationChanged@QDeclarativeSmoothedFollow@@IAEXXZ @ 3834 NONAME ; void QDeclarativeSmoothedFollow::durationChanged(void) + ?enabled@QDeclarativeSmoothedFollow@@QBE_NXZ @ 3835 NONAME ; bool QDeclarativeSmoothedFollow::enabled(void) const + ?enabledChanged@QDeclarativeSmoothedFollow@@IAEXXZ @ 3836 NONAME ; void QDeclarativeSmoothedFollow::enabledChanged(void) + ?getStaticMetaObject@QDeclarativeSmoothedFollow@@SAABUQMetaObject@@XZ @ 3837 NONAME ; struct QMetaObject const & QDeclarativeSmoothedFollow::getStaticMetaObject(void) + ?highlightMoveDuration@QDeclarativeGridView@@QBEHXZ @ 3838 NONAME ; int QDeclarativeGridView::highlightMoveDuration(void) const + ?highlightMoveDuration@QDeclarativeListView@@QBEHXZ @ 3839 NONAME ; int QDeclarativeListView::highlightMoveDuration(void) const + ?highlightMoveDuration@QDeclarativePathView@@QBEHXZ @ 3840 NONAME ; int QDeclarativePathView::highlightMoveDuration(void) const + ?highlightMoveDurationChanged@QDeclarativeGridView@@IAEXXZ @ 3841 NONAME ; void QDeclarativeGridView::highlightMoveDurationChanged(void) + ?highlightMoveDurationChanged@QDeclarativeListView@@IAEXXZ @ 3842 NONAME ; void QDeclarativeListView::highlightMoveDurationChanged(void) + ?highlightMoveDurationChanged@QDeclarativePathView@@IAEXXZ @ 3843 NONAME ; void QDeclarativePathView::highlightMoveDurationChanged(void) + ?highlightResizeDuration@QDeclarativeListView@@QBEHXZ @ 3844 NONAME ; int QDeclarativeListView::highlightResizeDuration(void) const + ?highlightResizeDurationChanged@QDeclarativeListView@@IAEXXZ @ 3845 NONAME ; void QDeclarativeListView::highlightResizeDurationChanged(void) + ?importPlugin@QDeclarativeEngine@@QAE_NABVQString@@0@Z @ 3846 NONAME ; bool QDeclarativeEngine::importPlugin(class QString const &, class QString const &) + ?isExtendedType@QDeclarativeType@@QBE_NXZ @ 3847 NONAME ; bool QDeclarativeType::isExtendedType(void) const + ?maximumEasingTime@QDeclarativeSmoothedFollow@@QBEHXZ @ 3848 NONAME ; int QDeclarativeSmoothedFollow::maximumEasingTime(void) const + ?maximumEasingTimeChanged@QDeclarativeSmoothedFollow@@IAEXXZ @ 3849 NONAME ; void QDeclarativeSmoothedFollow::maximumEasingTimeChanged(void) + ?metaObject@QDeclarativeSmoothedFollow@@UBEPBUQMetaObject@@XZ @ 3850 NONAME ; struct QMetaObject const * QDeclarativeSmoothedFollow::metaObject(void) const + ?mouseMoveEvent@QDeclarativeTextInput@@MAEXPAVQGraphicsSceneMouseEvent@@@Z @ 3851 NONAME ; void QDeclarativeTextInput::mouseMoveEvent(class QGraphicsSceneMouseEvent *) + ?moveCursorSelection@QDeclarativeTextInput@@QAEXH@Z @ 3852 NONAME ; void QDeclarativeTextInput::moveCursorSelection(int) + ?passwordCharacter@QDeclarativeTextInput@@QBE?AVQString@@XZ @ 3853 NONAME ; class QString QDeclarativeTextInput::passwordCharacter(void) const + ?passwordCharacterChanged@QDeclarativeTextInput@@IAEXXZ @ 3854 NONAME ; void QDeclarativeTextInput::passwordCharacterChanged(void) + ?pluginPathList@QDeclarativeEngine@@QBE?AVQStringList@@XZ @ 3855 NONAME ; class QStringList QDeclarativeEngine::pluginPathList(void) const + ?qt_metacall@QDeclarativeSmoothedFollow@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 3856 NONAME ; int QDeclarativeSmoothedFollow::qt_metacall(enum QMetaObject::Call, int, void * *) + ?qt_metacast@QDeclarativeSmoothedFollow@@UAEPAXPBD@Z @ 3857 NONAME ; void * QDeclarativeSmoothedFollow::qt_metacast(char const *) + ?resetTarget@QDeclarativeDrag@@QAEXXZ @ 3858 NONAME ; void QDeclarativeDrag::resetTarget(void) + ?reversingMode@QDeclarativeSmoothedFollow@@QBE?AW4ReversingMode@1@XZ @ 3859 NONAME ; enum QDeclarativeSmoothedFollow::ReversingMode QDeclarativeSmoothedFollow::reversingMode(void) const + ?reversingModeChanged@QDeclarativeSmoothedFollow@@IAEXXZ @ 3860 NONAME ; void QDeclarativeSmoothedFollow::reversingModeChanged(void) + ?setAutoScroll@QDeclarativeTextInput@@QAEX_N@Z @ 3861 NONAME ; void QDeclarativeTextInput::setAutoScroll(bool) + ?setDuration@QDeclarativeSmoothedFollow@@QAEXH@Z @ 3862 NONAME ; void QDeclarativeSmoothedFollow::setDuration(int) + ?setEnabled@QDeclarativeSmoothedFollow@@QAEX_N@Z @ 3863 NONAME ; void QDeclarativeSmoothedFollow::setEnabled(bool) + ?setHighlightMoveDuration@QDeclarativeGridView@@QAEXH@Z @ 3864 NONAME ; void QDeclarativeGridView::setHighlightMoveDuration(int) + ?setHighlightMoveDuration@QDeclarativeListView@@QAEXH@Z @ 3865 NONAME ; void QDeclarativeListView::setHighlightMoveDuration(int) + ?setHighlightMoveDuration@QDeclarativePathView@@QAEXH@Z @ 3866 NONAME ; void QDeclarativePathView::setHighlightMoveDuration(int) + ?setHighlightResizeDuration@QDeclarativeListView@@QAEXH@Z @ 3867 NONAME ; void QDeclarativeListView::setHighlightResizeDuration(int) + ?setMaximumEasingTime@QDeclarativeSmoothedFollow@@QAEXH@Z @ 3868 NONAME ; void QDeclarativeSmoothedFollow::setMaximumEasingTime(int) + ?setPasswordCharacter@QDeclarativeTextInput@@QAEXABVQString@@@Z @ 3869 NONAME ; void QDeclarativeTextInput::setPasswordCharacter(class QString const &) + ?setPluginPathList@QDeclarativeEngine@@QAEXABVQStringList@@@Z @ 3870 NONAME ; void QDeclarativeEngine::setPluginPathList(class QStringList const &) + ?setReversingMode@QDeclarativeSmoothedFollow@@QAEXW4ReversingMode@1@@Z @ 3871 NONAME ; void QDeclarativeSmoothedFollow::setReversingMode(enum QDeclarativeSmoothedFollow::ReversingMode) + ?setSourceSize@QDeclarativeImageBase@@UAEXABVQSize@@@Z @ 3872 NONAME ; void QDeclarativeImageBase::setSourceSize(class QSize const &) + ?setTarget@QDeclarativeSmoothedFollow@@UAEXABVQDeclarativeProperty@@@Z @ 3873 NONAME ; void QDeclarativeSmoothedFollow::setTarget(class QDeclarativeProperty const &) + ?setTo@QDeclarativeSmoothedFollow@@QAEXM@Z @ 3874 NONAME ; void QDeclarativeSmoothedFollow::setTo(float) + ?setTo@QDeclarativeSpringFollow@@QAEXM@Z @ 3875 NONAME ; void QDeclarativeSpringFollow::setTo(float) + ?setVelocity@QDeclarativeSmoothedFollow@@QAEXM@Z @ 3876 NONAME ; void QDeclarativeSmoothedFollow::setVelocity(float) + ?setWrapMode@QDeclarativeText@@QAEXW4WrapMode@1@@Z @ 3877 NONAME ; void QDeclarativeText::setWrapMode(enum QDeclarativeText::WrapMode) + ?setWrapMode@QDeclarativeTextEdit@@QAEXW4WrapMode@1@@Z @ 3878 NONAME ; void QDeclarativeTextEdit::setWrapMode(enum QDeclarativeTextEdit::WrapMode) + ?sourceSizeChanged@QDeclarativeAnimatedImage@@IAEXXZ @ 3879 NONAME ; void QDeclarativeAnimatedImage::sourceSizeChanged(void) + ?to@QDeclarativeSmoothedFollow@@QBEMXZ @ 3880 NONAME ; float QDeclarativeSmoothedFollow::to(void) const + ?to@QDeclarativeSpringFollow@@QBEMXZ @ 3881 NONAME ; float QDeclarativeSpringFollow::to(void) const + ?tr@QDeclarativeCompiler@@AAE?AVQString@@PBD@Z @ 3882 NONAME ; class QString QDeclarativeCompiler::tr(char const *) + ?tr@QDeclarativeSmoothedFollow@@SA?AVQString@@PBD0@Z @ 3883 NONAME ; class QString QDeclarativeSmoothedFollow::tr(char const *, char const *) + ?tr@QDeclarativeSmoothedFollow@@SA?AVQString@@PBD0H@Z @ 3884 NONAME ; class QString QDeclarativeSmoothedFollow::tr(char const *, char const *, int) + ?trUtf8@QDeclarativeSmoothedFollow@@SA?AVQString@@PBD0@Z @ 3885 NONAME ; class QString QDeclarativeSmoothedFollow::trUtf8(char const *, char const *) + ?trUtf8@QDeclarativeSmoothedFollow@@SA?AVQString@@PBD0H@Z @ 3886 NONAME ; class QString QDeclarativeSmoothedFollow::trUtf8(char const *, char const *, int) + ?velocity@QDeclarativeSmoothedFollow@@QBEMXZ @ 3887 NONAME ; float QDeclarativeSmoothedFollow::velocity(void) const + ?velocityChanged@QDeclarativeSmoothedFollow@@IAEXXZ @ 3888 NONAME ; void QDeclarativeSmoothedFollow::velocityChanged(void) + ?wrapMode@QDeclarativeText@@QBE?AW4WrapMode@1@XZ @ 3889 NONAME ; enum QDeclarativeText::WrapMode QDeclarativeText::wrapMode(void) const + ?wrapMode@QDeclarativeTextEdit@@QBE?AW4WrapMode@1@XZ @ 3890 NONAME ; enum QDeclarativeTextEdit::WrapMode QDeclarativeTextEdit::wrapMode(void) const + ?wrapModeChanged@QDeclarativeText@@IAEXXZ @ 3891 NONAME ; void QDeclarativeText::wrapModeChanged(void) + ?wrapModeChanged@QDeclarativeTextEdit@@IAEXXZ @ 3892 NONAME ; void QDeclarativeTextEdit::wrapModeChanged(void) + ?xToPosition@QDeclarativeTextInput@@QAEHH@Z @ 3893 NONAME ; int QDeclarativeTextInput::xToPosition(int) + ?staticMetaObject@QDeclarativeSmoothedFollow@@2UQMetaObject@@B @ 3894 NONAME ; struct QMetaObject const QDeclarativeSmoothedFollow::staticMetaObject diff --git a/src/s60installs/bwins/QtGuiu.def b/src/s60installs/bwins/QtGuiu.def index 1c33477..c34690e 100644 --- a/src/s60installs/bwins/QtGuiu.def +++ b/src/s60installs/bwins/QtGuiu.def @@ -12724,7 +12724,7 @@ EXPORTS ?visibilityChanged@QToolBar@@IAEX_N@Z @ 12723 NONAME ; void QToolBar::visibilityChanged(bool) ??0FileInfo@QZipReader@@QAE@ABU01@@Z @ 12724 NONAME ; QZipReader::FileInfo::FileInfo(struct QZipReader::FileInfo const &) ??0QStaticText@@QAE@ABVQString@@@Z @ 12725 NONAME ; QStaticText::QStaticText(class QString const &) - ?append@QGraphicsItemPrivate@@SAXPAV?$QDeclarativeListProperty@VQGraphicsObject@@@@PAVQGraphicsObject@@@Z @ 12726 NONAME ; void QGraphicsItemPrivate::append(class QDeclarativeListProperty<class QGraphicsObject> *, class QGraphicsObject *) + ?append@QGraphicsItemPrivate@@SAXPAV?$QDeclarativeListProperty@VQGraphicsObject@@@@PAVQGraphicsObject@@@Z @ 12726 NONAME ABSENT ; void QGraphicsItemPrivate::append(class QDeclarativeListProperty<class QGraphicsObject> *, class QGraphicsObject *) ?bitPlaneCount@QImage@@QBEHXZ @ 12727 NONAME ; int QImage::bitPlaneCount(void) const ?childrenChanged@QGraphicsObject@@IAEXXZ @ 12728 NONAME ; void QGraphicsObject::childrenChanged(void) ?childrenList@QGraphicsItemPrivate@@QAE?AV?$QDeclarativeListProperty@VQGraphicsObject@@@@XZ @ 12729 NONAME ; class QDeclarativeListProperty<class QGraphicsObject> QGraphicsItemPrivate::childrenList(void) @@ -12767,4 +12767,7 @@ EXPORTS ?updateMicroFocus@QGraphicsObject@@IAEXXZ @ 12766 NONAME ; void QGraphicsObject::updateMicroFocus(void) ?width@QGraphicsItemPrivate@@UBEMXZ @ 12767 NONAME ; float QGraphicsItemPrivate::width(void) const ?widthChanged@QGraphicsObject@@IAEXXZ @ 12768 NONAME ; void QGraphicsObject::widthChanged(void) + ?children_append@QGraphicsItemPrivate@@SAXPAV?$QDeclarativeListProperty@VQGraphicsObject@@@@PAVQGraphicsObject@@@Z @ 12769 NONAME ; void QGraphicsItemPrivate::children_append(class QDeclarativeListProperty<class QGraphicsObject> *, class QGraphicsObject *) + ?children_at@QGraphicsItemPrivate@@SAPAVQGraphicsObject@@PAV?$QDeclarativeListProperty@VQGraphicsObject@@@@H@Z @ 12770 NONAME ; class QGraphicsObject * QGraphicsItemPrivate::children_at(class QDeclarativeListProperty<class QGraphicsObject> *, int) + ?children_count@QGraphicsItemPrivate@@SAHPAV?$QDeclarativeListProperty@VQGraphicsObject@@@@@Z @ 12771 NONAME ; int QGraphicsItemPrivate::children_count(class QDeclarativeListProperty<class QGraphicsObject> *) diff --git a/src/s60installs/bwins/QtMultimediau.def b/src/s60installs/bwins/QtMultimediau.def index 6c98fdf..ad33993 100644 --- a/src/s60installs/bwins/QtMultimediau.def +++ b/src/s60installs/bwins/QtMultimediau.def @@ -946,4 +946,6 @@ EXPORTS ?volume@QSoundEffect@@QBEHXZ @ 945 NONAME ; int QSoundEffect::volume(void) const ?volumeChanged@QSoundEffect@@IAEXXZ @ 946 NONAME ; void QSoundEffect::volumeChanged(void) ?staticMetaObject@QSoundEffect@@2UQMetaObject@@B @ 947 NONAME ; struct QMetaObject const QSoundEffect::staticMetaObject + ?event@QGraphicsVideoItem@@MAE_NPAVQEvent@@@Z @ 948 NONAME ; bool QGraphicsVideoItem::event(class QEvent *) + ?sceneEvent@QGraphicsVideoItem@@MAE_NPAVQEvent@@@Z @ 949 NONAME ; bool QGraphicsVideoItem::sceneEvent(class QEvent *) diff --git a/src/s60installs/eabi/QtCoreu.def b/src/s60installs/eabi/QtCoreu.def index 79fd0ce..e54e03f 100644 --- a/src/s60installs/eabi/QtCoreu.def +++ b/src/s60installs/eabi/QtCoreu.def @@ -803,9 +803,9 @@ EXPORTS _ZN16QCoreApplicationD0Ev @ 802 NONAME _ZN16QCoreApplicationD1Ev @ 803 NONAME _ZN16QCoreApplicationD2Ev @ 804 NONAME - _ZN16QDeclarativeDataD0Ev @ 805 NONAME - _ZN16QDeclarativeDataD1Ev @ 806 NONAME - _ZN16QDeclarativeDataD2Ev @ 807 NONAME + _ZN16QDeclarativeDataD0Ev @ 805 NONAME ABSENT + _ZN16QDeclarativeDataD1Ev @ 806 NONAME ABSENT + _ZN16QDeclarativeDataD2Ev @ 807 NONAME ABSENT _ZN16QEventTransition11qt_metacallEN11QMetaObject4CallEiPPv @ 808 NONAME _ZN16QEventTransition11qt_metacastEPKc @ 809 NONAME _ZN16QEventTransition12onTransitionEP6QEvent @ 810 NONAME @@ -3332,7 +3332,7 @@ EXPORTS _ZTI15QPauseAnimation @ 3331 NONAME _ZTI15QSocketNotifier @ 3332 NONAME _ZTI16QCoreApplication @ 3333 NONAME - _ZTI16QDeclarativeData @ 3334 NONAME + _ZTI16QDeclarativeData @ 3334 NONAME ABSENT _ZTI16QEventTransition @ 3335 NONAME _ZTI16QIODevicePrivate @ 3336 NONAME _ZTI16QTextCodecPlugin @ 3337 NONAME @@ -3407,7 +3407,7 @@ EXPORTS _ZTV15QPauseAnimation @ 3406 NONAME _ZTV15QSocketNotifier @ 3407 NONAME _ZTV16QCoreApplication @ 3408 NONAME - _ZTV16QDeclarativeData @ 3409 NONAME + _ZTV16QDeclarativeData @ 3409 NONAME ABSENT _ZTV16QEventTransition @ 3410 NONAME _ZTV16QIODevicePrivate @ 3411 NONAME _ZTV16QTextCodecPlugin @ 3412 NONAME @@ -3692,4 +3692,7 @@ EXPORTS _ZN9QDateTime18setMSecsSinceEpochEx @ 3691 NONAME _ZN9QDateTime19fromMSecsSinceEpochEx @ 3692 NONAME _ZNK9QDateTime17toMSecsSinceEpochEv @ 3693 NONAME + _ZN10QTextCodec11validCodecsEv @ 3694 NONAME + _ZN16QDeclarativeData13parentChangedE @ 3695 NONAME DATA 4 + _ZN16QDeclarativeData9destroyedE @ 3696 NONAME DATA 4 diff --git a/src/s60installs/eabi/QtDeclarativeu.def b/src/s60installs/eabi/QtDeclarativeu.def index 17a57d0..0f0e886 100644 --- a/src/s60installs/eabi/QtDeclarativeu.def +++ b/src/s60installs/eabi/QtDeclarativeu.def @@ -179,7 +179,7 @@ EXPORTS _ZN16QDeclarativeText11qt_metacallEN11QMetaObject4CallEiPPv @ 178 NONAME _ZN16QDeclarativeText11qt_metacastEPKc @ 179 NONAME _ZN16QDeclarativeText11textChangedERK7QString @ 180 NONAME - _ZN16QDeclarativeText11wrapChangedEb @ 181 NONAME + _ZN16QDeclarativeText11wrapChangedEb @ 181 NONAME ABSENT _ZN16QDeclarativeText12colorChangedERK6QColor @ 182 NONAME _ZN16QDeclarativeText12setElideModeENS_13TextElideModeE @ 183 NONAME _ZN16QDeclarativeText12styleChangedENS_9TextStyleE @ 184 NONAME @@ -337,7 +337,7 @@ EXPORTS _ZN18QDeclarativeEngine11qt_metacastEPKc @ 336 NONAME _ZN18QDeclarativeEngine11rootContextEv @ 337 NONAME _ZN18QDeclarativeEngine13addImportPathERK7QString @ 338 NONAME - _ZN18QDeclarativeEngine15importExtensionERK7QStringS2_ @ 339 NONAME + _ZN18QDeclarativeEngine15importExtensionERK7QStringS2_ @ 339 NONAME ABSENT _ZN18QDeclarativeEngine15objectOwnershipEP7QObject @ 340 NONAME _ZN18QDeclarativeEngine16addImageProviderERK7QStringP25QDeclarativeImageProvider @ 341 NONAME _ZN18QDeclarativeEngine16contextForObjectEPK7QObject @ 342 NONAME @@ -897,7 +897,7 @@ EXPORTS _ZN20QDeclarativeTextEdit11qt_metacastEPKc @ 896 NONAME _ZN20QDeclarativeTextEdit11setReadOnlyEb @ 897 NONAME _ZN20QDeclarativeTextEdit11textChangedERK7QString @ 898 NONAME - _ZN20QDeclarativeTextEdit11wrapChangedEb @ 899 NONAME + _ZN20QDeclarativeTextEdit11wrapChangedEb @ 899 NONAME ABSENT _ZN20QDeclarativeTextEdit12colorChangedERK6QColor @ 900 NONAME _ZN20QDeclarativeTextEdit12drawContentsEP8QPainterRK5QRect @ 901 NONAME _ZN20QDeclarativeTextEdit13keyPressEventEP9QKeyEvent @ 902 NONAME @@ -1234,7 +1234,7 @@ EXPORTS _ZN21QDeclarativeTextInput24selectedTextColorChangedERK6QColor @ 1233 NONAME _ZN21QDeclarativeTextInput26horizontalAlignmentChangedENS_10HAlignmentE @ 1234 NONAME _ZN21QDeclarativeTextInput5eventEP6QEvent @ 1235 NONAME - _ZN21QDeclarativeTextInput6xToPosEi @ 1236 NONAME + _ZN21QDeclarativeTextInput6xToPosEi @ 1236 NONAME ABSENT _ZN21QDeclarativeTextInput7setFontERK5QFont @ 1237 NONAME _ZN21QDeclarativeTextInput7setTextERK7QString @ 1238 NONAME _ZN21QDeclarativeTextInput8acceptedEv @ 1239 NONAME @@ -1652,7 +1652,7 @@ EXPORTS _ZN24QDeclarativeSpringFollow11syncChangedEv @ 1651 NONAME _ZN24QDeclarativeSpringFollow12valueChangedEf @ 1652 NONAME _ZN24QDeclarativeSpringFollow14modulusChangedEv @ 1653 NONAME - _ZN24QDeclarativeSpringFollow14setSourceValueEf @ 1654 NONAME + _ZN24QDeclarativeSpringFollow14setSourceValueEf @ 1654 NONAME ABSENT _ZN24QDeclarativeSpringFollow16staticMetaObjectE @ 1655 NONAME DATA 16 _ZN24QDeclarativeSpringFollow19getStaticMetaObjectEv @ 1656 NONAME _ZN24QDeclarativeSpringFollow7setMassEf @ 1657 NONAME @@ -2130,19 +2130,19 @@ EXPORTS _ZN34QDeclarativeDebugPropertyReferenceC2ERKS_ @ 2129 NONAME _ZN34QDeclarativeDebugPropertyReferenceC2Ev @ 2130 NONAME _ZN34QDeclarativeDebugPropertyReferenceaSERKS_ @ 2131 NONAME - _ZN35QDeclarativeGraphicsObjectContainer10itemChangeEN13QGraphicsItem18GraphicsItemChangeERK8QVariant @ 2132 NONAME - _ZN35QDeclarativeGraphicsObjectContainer11eventFilterEP7QObjectP6QEvent @ 2133 NONAME - _ZN35QDeclarativeGraphicsObjectContainer11qt_metacallEN11QMetaObject4CallEiPPv @ 2134 NONAME - _ZN35QDeclarativeGraphicsObjectContainer11qt_metacastEPKc @ 2135 NONAME - _ZN35QDeclarativeGraphicsObjectContainer16staticMetaObjectE @ 2136 NONAME DATA 16 - _ZN35QDeclarativeGraphicsObjectContainer17setGraphicsObjectEP15QGraphicsObject @ 2137 NONAME - _ZN35QDeclarativeGraphicsObjectContainer19getStaticMetaObjectEv @ 2138 NONAME - _ZN35QDeclarativeGraphicsObjectContainer23setSynchronizedResizingEb @ 2139 NONAME - _ZN35QDeclarativeGraphicsObjectContainerC1EP16QDeclarativeItem @ 2140 NONAME - _ZN35QDeclarativeGraphicsObjectContainerC2EP16QDeclarativeItem @ 2141 NONAME - _ZN35QDeclarativeGraphicsObjectContainerD0Ev @ 2142 NONAME - _ZN35QDeclarativeGraphicsObjectContainerD1Ev @ 2143 NONAME - _ZN35QDeclarativeGraphicsObjectContainerD2Ev @ 2144 NONAME + _ZN35QDeclarativeGraphicsObjectContainer10itemChangeEN13QGraphicsItem18GraphicsItemChangeERK8QVariant @ 2132 NONAME ABSENT + _ZN35QDeclarativeGraphicsObjectContainer11eventFilterEP7QObjectP6QEvent @ 2133 NONAME ABSENT + _ZN35QDeclarativeGraphicsObjectContainer11qt_metacallEN11QMetaObject4CallEiPPv @ 2134 NONAME ABSENT + _ZN35QDeclarativeGraphicsObjectContainer11qt_metacastEPKc @ 2135 NONAME ABSENT + _ZN35QDeclarativeGraphicsObjectContainer16staticMetaObjectE @ 2136 NONAME DATA 16 ABSENT + _ZN35QDeclarativeGraphicsObjectContainer17setGraphicsObjectEP15QGraphicsObject @ 2137 NONAME ABSENT + _ZN35QDeclarativeGraphicsObjectContainer19getStaticMetaObjectEv @ 2138 NONAME ABSENT + _ZN35QDeclarativeGraphicsObjectContainer23setSynchronizedResizingEb @ 2139 NONAME ABSENT + _ZN35QDeclarativeGraphicsObjectContainerC1EP16QDeclarativeItem @ 2140 NONAME ABSENT + _ZN35QDeclarativeGraphicsObjectContainerC2EP16QDeclarativeItem @ 2141 NONAME ABSENT + _ZN35QDeclarativeGraphicsObjectContainerD0Ev @ 2142 NONAME ABSENT + _ZN35QDeclarativeGraphicsObjectContainerD1Ev @ 2143 NONAME ABSENT + _ZN35QDeclarativeGraphicsObjectContainerD2Ev @ 2144 NONAME ABSENT _ZN36QDeclarativeDomValueValueInterceptorC1ERKS_ @ 2145 NONAME _ZN36QDeclarativeDomValueValueInterceptorC1Ev @ 2146 NONAME _ZN36QDeclarativeDomValueValueInterceptorC2ERKS_ @ 2147 NONAME @@ -2765,7 +2765,7 @@ EXPORTS _ZNK24QDeclarativeScriptString6scriptEv @ 2764 NONAME _ZNK24QDeclarativeScriptString7contextEv @ 2765 NONAME _ZNK24QDeclarativeSpringFollow10metaObjectEv @ 2766 NONAME - _ZNK24QDeclarativeSpringFollow11sourceValueEv @ 2767 NONAME + _ZNK24QDeclarativeSpringFollow11sourceValueEv @ 2767 NONAME ABSENT _ZNK24QDeclarativeSpringFollow4massEv @ 2768 NONAME _ZNK24QDeclarativeSpringFollow5valueEv @ 2769 NONAME _ZNK24QDeclarativeSpringFollow6inSyncEv @ 2770 NONAME @@ -2933,9 +2933,9 @@ EXPORTS _ZNK34QDeclarativeDebugPropertyReference4nameEv @ 2932 NONAME _ZNK34QDeclarativeDebugPropertyReference5valueEv @ 2933 NONAME _ZNK34QDeclarativeDebugPropertyReference7bindingEv @ 2934 NONAME - _ZNK35QDeclarativeGraphicsObjectContainer10metaObjectEv @ 2935 NONAME - _ZNK35QDeclarativeGraphicsObjectContainer14graphicsObjectEv @ 2936 NONAME - _ZNK35QDeclarativeGraphicsObjectContainer20synchronizedResizingEv @ 2937 NONAME + _ZNK35QDeclarativeGraphicsObjectContainer10metaObjectEv @ 2935 NONAME ABSENT + _ZNK35QDeclarativeGraphicsObjectContainer14graphicsObjectEv @ 2936 NONAME ABSENT + _ZNK35QDeclarativeGraphicsObjectContainer20synchronizedResizingEv @ 2937 NONAME ABSENT _ZNK36QDeclarativeDomValueValueInterceptor6objectEv @ 2938 NONAME _ZNK38QDeclarativeDebugObjectExpressionWatch10expressionEv @ 2939 NONAME _ZNK38QDeclarativeDebugObjectExpressionWatch10metaObjectEv @ 2940 NONAME @@ -3039,7 +3039,7 @@ EXPORTS _ZTI31QDeclarativePropertyValueSource @ 3038 NONAME _ZTI32QDeclarativeDebugExpressionQuery @ 3039 NONAME _ZTI33QDeclarativeDebugRootContextQuery @ 3040 NONAME - _ZTI35QDeclarativeGraphicsObjectContainer @ 3041 NONAME + _ZTI35QDeclarativeGraphicsObjectContainer @ 3041 NONAME ABSENT _ZTI36QDeclarativePropertyValueInterceptor @ 3042 NONAME _ZTI38QDeclarativeDebugObjectExpressionWatch @ 3043 NONAME _ZTI39QDeclarativeNetworkAccessManagerFactory @ 3044 NONAME @@ -3142,7 +3142,7 @@ EXPORTS _ZTV31QDeclarativePropertyValueSource @ 3141 NONAME _ZTV32QDeclarativeDebugExpressionQuery @ 3142 NONAME _ZTV33QDeclarativeDebugRootContextQuery @ 3143 NONAME - _ZTV35QDeclarativeGraphicsObjectContainer @ 3144 NONAME + _ZTV35QDeclarativeGraphicsObjectContainer @ 3144 NONAME ABSENT _ZTV36QDeclarativePropertyValueInterceptor @ 3145 NONAME _ZTV38QDeclarativeDebugObjectExpressionWatch @ 3146 NONAME _ZTV39QDeclarativeNetworkAccessManagerFactory @ 3147 NONAME @@ -3198,8 +3198,8 @@ EXPORTS _ZThn16_N26QDeclarativeBasePositioner17componentCompleteEv @ 3197 NONAME _ZThn16_N26QDeclarativeBasePositionerD0Ev @ 3198 NONAME _ZThn16_N26QDeclarativeBasePositionerD1Ev @ 3199 NONAME - _ZThn16_N35QDeclarativeGraphicsObjectContainerD0Ev @ 3200 NONAME - _ZThn16_N35QDeclarativeGraphicsObjectContainerD1Ev @ 3201 NONAME + _ZThn16_N35QDeclarativeGraphicsObjectContainerD0Ev @ 3200 NONAME ABSENT + _ZThn16_N35QDeclarativeGraphicsObjectContainerD1Ev @ 3201 NONAME ABSENT _ZThn8_N16QDeclarativeBind17componentCompleteEv @ 3202 NONAME _ZThn8_N16QDeclarativeBindD0Ev @ 3203 NONAME _ZThn8_N16QDeclarativeBindD1Ev @ 3204 NONAME @@ -3351,9 +3351,9 @@ EXPORTS _ZThn8_N29QDeclarativeStateChangeScript7executeEv @ 3350 NONAME _ZThn8_N29QDeclarativeStateChangeScriptD0Ev @ 3351 NONAME _ZThn8_N29QDeclarativeStateChangeScriptD1Ev @ 3352 NONAME - _ZThn8_N35QDeclarativeGraphicsObjectContainer10itemChangeEN13QGraphicsItem18GraphicsItemChangeERK8QVariant @ 3353 NONAME - _ZThn8_N35QDeclarativeGraphicsObjectContainerD0Ev @ 3354 NONAME - _ZThn8_N35QDeclarativeGraphicsObjectContainerD1Ev @ 3355 NONAME + _ZThn8_N35QDeclarativeGraphicsObjectContainer10itemChangeEN13QGraphicsItem18GraphicsItemChangeERK8QVariant @ 3353 NONAME ABSENT + _ZThn8_N35QDeclarativeGraphicsObjectContainerD0Ev @ 3354 NONAME ABSENT + _ZThn8_N35QDeclarativeGraphicsObjectContainerD1Ev @ 3355 NONAME ABSENT _ZThn8_NK16QDeclarativeItem12boundingRectEv @ 3356 NONAME _ZThn8_NK16QDeclarativeItem16inputMethodQueryEN2Qt16InputMethodQueryE @ 3357 NONAME _ZThn8_NK19QDeclarativeBinding10expressionEv @ 3358 NONAME @@ -3394,4 +3394,81 @@ EXPORTS _ZNK18QDeclarativeParser7Variant8asScriptEv @ 3393 NONAME _ZNK18QDeclarativeParser7Variant8asStringEv @ 3394 NONAME _ZNK18QDeclarativeParser7Variant9asBooleanEv @ 3395 NONAME + _ZN16QDeclarativeDrag11resetTargetEv @ 3396 NONAME + _ZN16QDeclarativeText11setWrapModeENS_8WrapModeE @ 3397 NONAME + _ZN16QDeclarativeText15wrapModeChangedEv @ 3398 NONAME + _ZN18QDeclarativeActionC1EP7QObjectRK7QStringP19QDeclarativeContextRK8QVariant @ 3399 NONAME + _ZN18QDeclarativeActionC2EP7QObjectRK7QStringP19QDeclarativeContextRK8QVariant @ 3400 NONAME + _ZN18QDeclarativeEngine12importPluginERK7QStringS2_ @ 3401 NONAME + _ZN18QDeclarativeEngine13addPluginPathERK7QString @ 3402 NONAME + _ZN18QDeclarativeEngine17setPluginPathListERK11QStringList @ 3403 NONAME + _ZN20QDeclarativeCompiler2trEPKc @ 3404 NONAME + _ZN20QDeclarativeGridView24setHighlightMoveDurationEi @ 3405 NONAME + _ZN20QDeclarativeGridView28highlightMoveDurationChangedEv @ 3406 NONAME + _ZN20QDeclarativeListView24setHighlightMoveDurationEi @ 3407 NONAME + _ZN20QDeclarativeListView26setHighlightResizeDurationEi @ 3408 NONAME + _ZN20QDeclarativeListView28highlightMoveDurationChangedEv @ 3409 NONAME + _ZN20QDeclarativeListView30highlightResizeDurationChangedEv @ 3410 NONAME + _ZN20QDeclarativePathView24setHighlightMoveDurationEi @ 3411 NONAME + _ZN20QDeclarativePathView28highlightMoveDurationChangedEv @ 3412 NONAME + _ZN20QDeclarativeTextEdit11setWrapModeENS_8WrapModeE @ 3413 NONAME + _ZN20QDeclarativeTextEdit15wrapModeChangedEv @ 3414 NONAME + _ZN21QDeclarativeTextInput11xToPositionEi @ 3415 NONAME + _ZN21QDeclarativeTextInput13setAutoScrollEb @ 3416 NONAME + _ZN21QDeclarativeTextInput14mouseMoveEventEP24QGraphicsSceneMouseEvent @ 3417 NONAME + _ZN21QDeclarativeTextInput17autoScrollChangedEb @ 3418 NONAME + _ZN21QDeclarativeTextInput18displayTextChangedERK7QString @ 3419 NONAME + _ZN21QDeclarativeTextInput19moveCursorSelectionEi @ 3420 NONAME + _ZN21QDeclarativeTextInput20setPasswordCharacterERK7QString @ 3421 NONAME + _ZN21QDeclarativeTextInput24passwordCharacterChangedEv @ 3422 NONAME + _ZN24QDeclarativeSpringFollow5setToEf @ 3423 NONAME + _ZN25QDeclarativeAnimatedImage17sourceSizeChangedEv @ 3424 NONAME + _ZN26QDeclarativeSmoothedFollow10setEnabledEb @ 3425 NONAME + _ZN26QDeclarativeSmoothedFollow11qt_metacallEN11QMetaObject4CallEiPPv @ 3426 NONAME + _ZN26QDeclarativeSmoothedFollow11qt_metacastEPKc @ 3427 NONAME + _ZN26QDeclarativeSmoothedFollow11setDurationEi @ 3428 NONAME + _ZN26QDeclarativeSmoothedFollow11setVelocityEf @ 3429 NONAME + _ZN26QDeclarativeSmoothedFollow14enabledChangedEv @ 3430 NONAME + _ZN26QDeclarativeSmoothedFollow15durationChangedEv @ 3431 NONAME + _ZN26QDeclarativeSmoothedFollow15velocityChangedEv @ 3432 NONAME + _ZN26QDeclarativeSmoothedFollow16setReversingModeENS_13ReversingModeE @ 3433 NONAME + _ZN26QDeclarativeSmoothedFollow16staticMetaObjectE @ 3434 NONAME DATA 16 + _ZN26QDeclarativeSmoothedFollow19getStaticMetaObjectEv @ 3435 NONAME + _ZN26QDeclarativeSmoothedFollow20reversingModeChangedEv @ 3436 NONAME + _ZN26QDeclarativeSmoothedFollow20setMaximumEasingTimeEi @ 3437 NONAME + _ZN26QDeclarativeSmoothedFollow24maximumEasingTimeChangedEv @ 3438 NONAME + _ZN26QDeclarativeSmoothedFollow5setToEf @ 3439 NONAME + _ZN26QDeclarativeSmoothedFollow9setTargetERK20QDeclarativeProperty @ 3440 NONAME + _ZN26QDeclarativeSmoothedFollowC1EP7QObject @ 3441 NONAME + _ZN26QDeclarativeSmoothedFollowC2EP7QObject @ 3442 NONAME + _ZN26QDeclarativeSmoothedFollowD0Ev @ 3443 NONAME + _ZN26QDeclarativeSmoothedFollowD1Ev @ 3444 NONAME + _ZN26QDeclarativeSmoothedFollowD2Ev @ 3445 NONAME + _ZNK16QDeclarativeText8wrapModeEv @ 3446 NONAME + _ZNK16QDeclarativeType10createSizeEv @ 3447 NONAME + _ZNK16QDeclarativeType14createFunctionEv @ 3448 NONAME + _ZNK16QDeclarativeType14isExtendedTypeEv @ 3449 NONAME + _ZNK18QDeclarativeEngine14pluginPathListEv @ 3450 NONAME + _ZNK20QDeclarativeGridView21highlightMoveDurationEv @ 3451 NONAME + _ZNK20QDeclarativeListView21highlightMoveDurationEv @ 3452 NONAME + _ZNK20QDeclarativeListView23highlightResizeDurationEv @ 3453 NONAME + _ZNK20QDeclarativePathView21highlightMoveDurationEv @ 3454 NONAME + _ZNK20QDeclarativeTextEdit8wrapModeEv @ 3455 NONAME + _ZNK21QDeclarativeTextInput10autoScrollEv @ 3456 NONAME + _ZNK21QDeclarativeTextInput11displayTextEv @ 3457 NONAME + _ZNK21QDeclarativeTextInput17passwordCharacterEv @ 3458 NONAME + _ZNK24QDeclarativeSpringFollow2toEv @ 3459 NONAME + _ZNK26QDeclarativeSmoothedFollow10metaObjectEv @ 3460 NONAME + _ZNK26QDeclarativeSmoothedFollow13reversingModeEv @ 3461 NONAME + _ZNK26QDeclarativeSmoothedFollow17maximumEasingTimeEv @ 3462 NONAME + _ZNK26QDeclarativeSmoothedFollow2toEv @ 3463 NONAME + _ZNK26QDeclarativeSmoothedFollow7enabledEv @ 3464 NONAME + _ZNK26QDeclarativeSmoothedFollow8durationEv @ 3465 NONAME + _ZNK26QDeclarativeSmoothedFollow8velocityEv @ 3466 NONAME + _ZTI26QDeclarativeSmoothedFollow @ 3467 NONAME + _ZTV26QDeclarativeSmoothedFollow @ 3468 NONAME + _ZThn8_N21QDeclarativeTextInput14mouseMoveEventEP24QGraphicsSceneMouseEvent @ 3469 NONAME + _ZThn8_N26QDeclarativeSmoothedFollow9setTargetERK20QDeclarativeProperty @ 3470 NONAME + _ZThn8_N26QDeclarativeSmoothedFollowD0Ev @ 3471 NONAME + _ZThn8_N26QDeclarativeSmoothedFollowD1Ev @ 3472 NONAME diff --git a/src/s60installs/eabi/QtGuiu.def b/src/s60installs/eabi/QtGuiu.def index 59e63ea..353603e 100644 --- a/src/s60installs/eabi/QtGuiu.def +++ b/src/s60installs/eabi/QtGuiu.def @@ -11943,7 +11943,7 @@ EXPORTS _ZN20QGraphicsItemPrivate14setFocusHelperEN2Qt11FocusReasonEbb @ 11942 NONAME _ZN20QGraphicsItemPrivate16clearFocusHelperEb @ 11943 NONAME _ZN20QGraphicsItemPrivate24prependGraphicsTransformEP18QGraphicsTransform @ 11944 NONAME - _ZN20QGraphicsItemPrivate6appendEP24QDeclarativeListPropertyI15QGraphicsObjectEPS1_ @ 11945 NONAME + _ZN20QGraphicsItemPrivate6appendEP24QDeclarativeListPropertyI15QGraphicsObjectEPS1_ @ 11945 NONAME ABSENT _ZN20QGraphicsItemPrivate8setWidthEf @ 11946 NONAME _ZN20QGraphicsItemPrivate9setHeightEf @ 11947 NONAME _ZN7QWizard11pageRemovedEi @ 11948 NONAME @@ -11970,4 +11970,7 @@ EXPORTS _ZNK12QPaintBuffer15frameStartIndexEi @ 11969 NONAME _ZNK12QPaintBuffer15processCommandsEP8QPainterii @ 11970 NONAME _ZNK12QPaintBuffer18commandDescriptionEi @ 11971 NONAME + _ZN20QGraphicsItemPrivate11children_atEP24QDeclarativeListPropertyI15QGraphicsObjectEi @ 11972 NONAME + _ZN20QGraphicsItemPrivate14children_countEP24QDeclarativeListPropertyI15QGraphicsObjectE @ 11973 NONAME + _ZN20QGraphicsItemPrivate15children_appendEP24QDeclarativeListPropertyI15QGraphicsObjectEPS1_ @ 11974 NONAME diff --git a/src/s60installs/eabi/QtMultimediau.def b/src/s60installs/eabi/QtMultimediau.def index 384796d..64a6dc6 100644 --- a/src/s60installs/eabi/QtMultimediau.def +++ b/src/s60installs/eabi/QtMultimediau.def @@ -972,4 +972,7 @@ EXPORTS _ZNK12QSoundEffect7isMutedEv @ 971 NONAME _ZTI12QSoundEffect @ 972 NONAME _ZTV12QSoundEffect @ 973 NONAME + _ZN18QGraphicsVideoItem10sceneEventEP6QEvent @ 974 NONAME + _ZN18QGraphicsVideoItem5eventEP6QEvent @ 975 NONAME + _ZThn8_N18QGraphicsVideoItem10sceneEventEP6QEvent @ 976 NONAME diff --git a/src/script/api/qscriptengine.cpp b/src/script/api/qscriptengine.cpp index 2417d80..58c8d83 100644 --- a/src/script/api/qscriptengine.cpp +++ b/src/script/api/qscriptengine.cpp @@ -42,6 +42,7 @@ #include <math.h> +#include "CodeBlock.h" #include "Error.h" #include "JSLock.h" #include "Interpreter.h" @@ -792,9 +793,18 @@ JSC::JSValue JSC_HOST_CALL functionQsTr(JSC::ExecState *exec, JSC::JSObject*, JS return JSC::throwError(exec, JSC::GeneralError, "qsTranslate(): third argument (n) must be a number"); #ifndef QT_NO_QOBJECT JSC::UString context; - QScriptContext *ctx = QScriptEnginePrivate::contextForFrame(exec); - if (ctx && ctx->parentContext()) - context = QFileInfo(QScriptContextInfo(ctx->parentContext()).fileName()).baseName(); + // The first non-empty source URL in the call stack determines the translation context. + { + JSC::ExecState *frame = exec->removeHostCallFrameFlag(); + while (frame) { + if (frame->codeBlock() && frame->codeBlock()->source() + && !frame->codeBlock()->source()->url().isEmpty()) { + context = QFileInfo(frame->codeBlock()->source()->url()).baseName(); + break; + } + frame = frame->callerFrame()->removeHostCallFrameFlag(); + } + } #endif JSC::UString text = args.at(0).toString(exec); #ifndef QT_NO_QOBJECT diff --git a/tests/auto/declarative/examples/examples.pro b/tests/auto/declarative/examples/examples.pro index 85d2a73..b316cb9 100644 --- a/tests/auto/declarative/examples/examples.pro +++ b/tests/auto/declarative/examples/examples.pro @@ -5,3 +5,6 @@ macx:CONFIG -= app_bundle SOURCES += tst_examples.cpp DEFINES += SRCDIR=\\\"$$PWD\\\" + +CONFIG += parallel_test + diff --git a/tests/auto/declarative/examples/tst_examples.cpp b/tests/auto/declarative/examples/tst_examples.cpp index 3d717bc..e62aad2 100644 --- a/tests/auto/declarative/examples/tst_examples.cpp +++ b/tests/auto/declarative/examples/tst_examples.cpp @@ -43,6 +43,8 @@ #include <QDir> #include <QProcess> #include <QDebug> +#include <QFutureSynchronizer> +#include <QtConcurrentRun> class tst_examples : public QObject { @@ -51,7 +53,6 @@ public: tst_examples(); private slots: - void examples_data(); void examples(); void namingConvention(); @@ -81,6 +82,15 @@ tst_examples::tst_examples() excludedDirs << "examples/declarative/plugins"; excludedDirs << "examples/declarative/proxywidgets"; excludedDirs << "examples/declarative/gestures"; + + excludedDirs << "examples/declarative/imageprovider"; + excludedDirs << "demos/declarative/minehunt"; + +#ifdef QT_NO_WEBKIT + excludedDirs << "examples/declarative/webview"; + excludedDirs << "demos/declarative/webbrowser"; +#endif + #ifdef QT_NO_XMLPATTERNS excludedDirs << "examples/declarative/xmldata"; excludedDirs << "demos/declarative/twitter"; @@ -101,19 +111,19 @@ void tst_examples::namingConvention(const QDir &d) return; } - QStringList files = d.entryList(QStringList() << QLatin1String("*.qml"), + QStringList files = d.entryList(QStringList() << QLatin1String("*.qml"), QDir::Files); bool seenQml = !files.isEmpty(); bool seenLowercase = false; foreach (const QString &file, files) { - if (file.at(0).isLower()) + if (file.at(0).isLower()) seenLowercase = true; } if (!seenQml) { - QStringList dirs = d.entryList(QDir::Dirs | QDir::NoDotAndDotDot | + QStringList dirs = d.entryList(QDir::Dirs | QDir::NoDotAndDotDot | QDir::NoSymLinks); foreach (const QString &dir, dirs) { QDir sub = d; @@ -144,7 +154,7 @@ QStringList tst_examples::findQmlFiles(const QDir &d) QStringList rv; - QStringList files = d.entryList(QStringList() << QLatin1String("*.qml"), + QStringList files = d.entryList(QStringList() << QLatin1String("*.qml"), QDir::Files); foreach (const QString &file, files) { if (file.at(0).isLower()) { @@ -152,7 +162,7 @@ QStringList tst_examples::findQmlFiles(const QDir &d) } } - QStringList dirs = d.entryList(QDir::Dirs | QDir::NoDotAndDotDot | + QStringList dirs = d.entryList(QDir::Dirs | QDir::NoDotAndDotDot | QDir::NoSymLinks); foreach (const QString &dir, dirs) { QDir sub = d; @@ -163,41 +173,38 @@ QStringList tst_examples::findQmlFiles(const QDir &d) return rv; } + + /* -This test runs all the examples in the declarative UI source tree and ensures +This test runs all the examples in the declarative UI source tree and ensures that they start and exit cleanly. Examples are any .qml files under the examples/ or demos/ directory that start -with a lower case letter. +with a lower case letter. */ -void tst_examples::examples_data() -{ - QTest::addColumn<QString>("file"); +#define THREADS 5 - QString examples = QLibraryInfo::location(QLibraryInfo::ExamplesPath); - QString demos = QLibraryInfo::location(QLibraryInfo::DemosPath); - QString snippets = QLatin1String(SRCDIR) + "/../../../../doc/src/snippets/"; +struct Example { +public: + Example() : result(Unknown) {} - QStringList files; - files << findQmlFiles(QDir(examples)); - files << findQmlFiles(QDir(demos)); - files << findQmlFiles(QDir(snippets)); + enum Result { Pass, Unknown, Fail }; + Result result; + QString file; + QString qmlruntime; - foreach (const QString &file, files) - QTest::newRow(file.toLatin1().constData()) << file; -} + void run(); +}; -void tst_examples::examples() +void Example::run() { - QFETCH(QString, file); - QFileInfo fi(file); QFileInfo dir(fi.path()); QString script = SRCDIR "/data/"+dir.baseName()+"/"+fi.baseName(); QFileInfo testdata(script+".qml"); QStringList arguments; arguments << "-script" << (testdata.exists() ? script : QLatin1String(SRCDIR "/data/dummytest")) - << "-scriptopts" << "play,testerror,exitoncomplete,exitonfailure" + << "-scriptopts" << "play,testerror,exitoncomplete,exitonfailure" << file; #ifdef Q_WS_QWS arguments << "-qws"; @@ -205,11 +212,69 @@ void tst_examples::examples() QProcess p; p.start(qmlruntime, arguments); - QVERIFY(p.waitForFinished()); + if (!p.waitForFinished()) { + result = Fail; + return; + } + if (p.exitStatus() != QProcess::NormalExit || p.exitCode() != 0) qWarning() << p.readAllStandardOutput() << p.readAllStandardError(); - QCOMPARE(p.exitStatus(), QProcess::NormalExit); - QCOMPARE(p.exitCode(), 0); + + if (p.exitStatus() != QProcess::NormalExit || + p.exitCode() != 0) { + result = Fail; + return; + } else { + result = Pass; + return; + } +} + +void tst_examples::examples() +{ + QThreadPool::globalInstance()->setMaxThreadCount(5); + + QString examples = QLatin1String(SRCDIR) + "/../../../../demos/declarative/"; + QString demos = QLatin1String(SRCDIR) + "/../../../../examples/declarative/"; + QString snippets = QLatin1String(SRCDIR) + "/../../../../doc/src/snippets/"; + + QStringList files; + files << findQmlFiles(QDir(examples)); + files << findQmlFiles(QDir(demos)); + files << findQmlFiles(QDir(snippets)); + + QList<Example> tests; + + for (int ii = 0; ii < files.count(); ++ii) { + Example e; + e.file = files.at(ii); + e.qmlruntime = qmlruntime; + tests << e; + } + + QFutureSynchronizer<void> sync; + + for (int ii = 0; ii < tests.count(); ++ii) { + Example *e = &tests[ii]; + QFuture<void> r = QtConcurrent::run(e, &Example::run); + sync.addFuture(r); + } + + sync.waitForFinished(); + + QStringList failures; + for (int ii = 0; ii < tests.count(); ++ii) { + if (tests.at(ii).result != Example::Pass) + failures << QDir::cleanPath(tests.at(ii).file); + } + + if (failures.count()) { + QString error("Failed examples: "); + error += failures.join(", "); + + QFAIL(qPrintable(error)); + } + } QTEST_MAIN(tst_examples) diff --git a/tests/auto/declarative/graphicswidgets/graphicswidgets.pro b/tests/auto/declarative/graphicswidgets/graphicswidgets.pro index 712c34c..b77b430 100644 --- a/tests/auto/declarative/graphicswidgets/graphicswidgets.pro +++ b/tests/auto/declarative/graphicswidgets/graphicswidgets.pro @@ -6,3 +6,5 @@ SOURCES += tst_graphicswidgets.cpp # Define SRCDIR equal to test's source directory DEFINES += SRCDIR=\\\"$$PWD\\\" + +CONFIG += parallel_test diff --git a/tests/auto/declarative/parserstress/parserstress.pro b/tests/auto/declarative/parserstress/parserstress.pro index 48f147a..8830511 100644 --- a/tests/auto/declarative/parserstress/parserstress.pro +++ b/tests/auto/declarative/parserstress/parserstress.pro @@ -5,3 +5,6 @@ macx:CONFIG -= app_bundle SOURCES += tst_parserstress.cpp DEFINES += SRCDIR=\\\"$$PWD\\\" + +CONFIG += parallel_test + diff --git a/tests/auto/declarative/parserstress/tst_parserstress.cpp b/tests/auto/declarative/parserstress/tst_parserstress.cpp index ee246fa..41c0a1b 100644 --- a/tests/auto/declarative/parserstress/tst_parserstress.cpp +++ b/tests/auto/declarative/parserstress/tst_parserstress.cpp @@ -113,7 +113,7 @@ void tst_parserstress::ecmascript() QString dataStr = QString::fromUtf8(data); - QString qml = "import Qt 4.6\n"; + QString qml = "import Qt 4.7\n"; qml+= "\n"; qml+= "QtObject {\n"; qml+= " property int test\n"; diff --git a/tests/auto/declarative/qdeclarativeanchors/data/anchorsqgraphicswidget.qml b/tests/auto/declarative/qdeclarativeanchors/data/anchorsqgraphicswidget.qml new file mode 100644 index 0000000..ba424b9 --- /dev/null +++ b/tests/auto/declarative/qdeclarativeanchors/data/anchorsqgraphicswidget.qml @@ -0,0 +1,163 @@ +import Qt 4.6 +import Qt.widgets 4.7 + +Rectangle { + color: "white" + width: 240 + height: 320 + Rectangle { id: masterRect; objectName: "masterRect"; x: 26; width: 96; height: 20; color: "red" } + QGraphicsWidget { + id: rect1; objectName: "rect1" + y: 20; width: 10; height: 10 + anchors.left: masterRect.left + } + QGraphicsWidget { + id: rect2; objectName: "rect2" + y: 20; width: 10; height: 10 + anchors.left: masterRect.right + } + QGraphicsWidget { + id: rect3; objectName: "rect3" + y: 20; width: 10; height: 10 + anchors.left: masterRect.horizontalCenter + } + QGraphicsWidget { + id: rect4; objectName: "rect4" + y: 30; width: 10; height: 10 + anchors.right: masterRect.left + } + QGraphicsWidget { + id: rect5; objectName: "rect5" + y: 30; width: 10; height: 10 + anchors.right: masterRect.right + } + QGraphicsWidget { + id: rect6; objectName: "rect6" + y: 30; width: 10; height: 10 + anchors.right: masterRect.horizontalCenter + } + QGraphicsWidget { + id: rect7; objectName: "rect7" + y: 50; width: 10; height: 10 + anchors.left: parent.left + } + QGraphicsWidget { + id: rect8; objectName: "rect8" + y: 50; width: 10; height: 10 + anchors.left: parent.right + } + QGraphicsWidget { + id: rect9; objectName: "rect9" + y: 50; width: 10; height: 10 + anchors.left: parent.horizontalCenter + } + QGraphicsWidget { + id: rect10; objectName: "rect10" + y: 60; width: 10; height: 10 + anchors.right: parent.left + } + QGraphicsWidget { + id: rect11; objectName: "rect11" + y: 60; width: 10; height: 10 + anchors.right: parent.right + } + QGraphicsWidget { + id: rect12; objectName: "rect12" + y: 60; width: 10; height: 10 + anchors.right: parent.horizontalCenter + } + QGraphicsWidget { + id: rect13; objectName: "rect13" + x: 200; width: 10; height: 10 + anchors.top: masterRect.bottom + } + QGraphicsWidget { + id: rect14; objectName: "rect14" + width: 10; height: 10; + anchors.verticalCenter: parent.verticalCenter + } + QGraphicsWidget { + id: rect15; objectName: "rect15" + y: 200; height: 10 + anchors.left: masterRect.left + anchors.right: masterRect.right + } + QGraphicsWidget { + id: rect16; objectName: "rect16" + y: 220; height: 10 + anchors.left: masterRect.left + anchors.horizontalCenter: masterRect.right + } + QGraphicsWidget { + id: rect17; objectName: "rect17" + y: 240; height: 10 + anchors.right: masterRect.right + anchors.horizontalCenter: masterRect.left + } + QGraphicsWidget { + id: rect18; objectName: "rect18" + x: 180; width: 10 + anchors.top: masterRect.bottom + anchors.bottom: rect12.top + } + QGraphicsWidget { + id: rect19; objectName: "rect19" + y: 70; width: 10; height: 10 + anchors.horizontalCenter: parent.horizontalCenter + } + QGraphicsWidget { + id: rect20; objectName: "rect20" + y: 70; width: 10; height: 10 + anchors.horizontalCenter: parent.right + } + QGraphicsWidget { + id: rect21; objectName: "rect21" + y: 70; width: 10; height: 10 + anchors.horizontalCenter: parent.left + } + QGraphicsWidget { + id: rect22; objectName: "rect22" + width: 10; height: 10 + anchors.centerIn: masterRect + } + QGraphicsWidget { + id: rect23; objectName: "rect23" + anchors.left: masterRect.left + anchors.leftMargin: 5 + anchors.right: masterRect.right + anchors.rightMargin: 5 + anchors.top: masterRect.top + anchors.topMargin: 5 + anchors.bottom: masterRect.bottom + anchors.bottomMargin: 5 + } + QGraphicsWidget { + id: rect24; objectName: "rect24" + width: 10; height: 10 + anchors.horizontalCenter: masterRect.left + anchors.horizontalCenterOffset: width/2 + } + QGraphicsWidget { + id: rect25; objectName: "rect25" + width: 10; height: 10 + anchors.verticalCenter: rect12.top + anchors.verticalCenterOffset: height/2 + } + Rectangle { + id: rect26; objectName: "rect26" + width: 10; height: 10 + anchors.baseline: masterRect.top + anchors.baselineOffset: height/2 + } + Text { + id: text1; objectName: "text1" + y: 200; + text: "Hello" + } + Text { + id: text2; objectName: "text2" + anchors.baseline: text1.baseline + anchors.left: text1.right + text: "World" + } +} diff --git a/tests/auto/declarative/qdeclarativeanchors/qdeclarativeanchors.pro b/tests/auto/declarative/qdeclarativeanchors/qdeclarativeanchors.pro index ca2f68f..a2403f2 100644 --- a/tests/auto/declarative/qdeclarativeanchors/qdeclarativeanchors.pro +++ b/tests/auto/declarative/qdeclarativeanchors/qdeclarativeanchors.pro @@ -4,3 +4,6 @@ SOURCES += tst_qdeclarativeanchors.cpp macx:CONFIG -= app_bundle DEFINES += SRCDIR=\\\"$$PWD\\\" + +CONFIG += parallel_test + diff --git a/tests/auto/declarative/qdeclarativeanchors/tst_qdeclarativeanchors.cpp b/tests/auto/declarative/qdeclarativeanchors/tst_qdeclarativeanchors.cpp index 9eaa400..01b5bc5 100644 --- a/tests/auto/declarative/qdeclarativeanchors/tst_qdeclarativeanchors.cpp +++ b/tests/auto/declarative/qdeclarativeanchors/tst_qdeclarativeanchors.cpp @@ -40,6 +40,8 @@ ****************************************************************************/ #include <qtest.h> #include <QSignalSpy> +#include <QtGui/QGraphicsWidget> +#include <private/qgraphicsitem_p.h> #include <QtDeclarative/qdeclarativeengine.h> #include <QtDeclarative/qdeclarativecomponent.h> #include <QtDeclarative/qdeclarativeview.h> @@ -59,9 +61,11 @@ public: template<typename T> T *findItem(QGraphicsObject *parent, const QString &id); + QGraphicsObject *findObject(QGraphicsObject *parent, const QString &objectName); private slots: void basicAnchors(); + void basicAnchorsQGraphicsWidget(); void loops(); void illegalSets(); void illegalSets_data(); @@ -99,6 +103,25 @@ T *tst_qdeclarativeanchors::findItem(QGraphicsObject *parent, const QString &obj return 0; } +QGraphicsObject *tst_qdeclarativeanchors::findObject(QGraphicsObject *parent, const QString &objectName) +{ + QList<QGraphicsItem *> children = parent->childItems(); + for (int i = 0; i < children.count(); ++i) { + QGraphicsObject *item = children.at(i)->toGraphicsObject(); + if (item) { + if (objectName.isEmpty() || item->objectName() == objectName) { + return item; + } + item = findObject(item, objectName); + if (item) + return item; + } + } + + return 0; +} + + void tst_qdeclarativeanchors::basicAnchors() { QDeclarativeView *view = new QDeclarativeView; @@ -166,6 +189,73 @@ void tst_qdeclarativeanchors::basicAnchors() delete view; } +void tst_qdeclarativeanchors::basicAnchorsQGraphicsWidget() +{ + QDeclarativeView *view = new QDeclarativeView; + view->setSource(QUrl::fromLocalFile(SRCDIR "/data/anchorsqgraphicswidget.qml")); + + qApp->processEvents(); + + //sibling horizontal + QCOMPARE(findObject(view->rootObject(), QLatin1String("rect1"))->x(), 26.0); + QCOMPARE(findObject(view->rootObject(), QLatin1String("rect2"))->x(), 122.0); + QCOMPARE(findObject(view->rootObject(), QLatin1String("rect3"))->x(), 74.0); + QCOMPARE(findObject(view->rootObject(), QLatin1String("rect4"))->x(), 16.0); + QCOMPARE(findObject(view->rootObject(), QLatin1String("rect5"))->x(), 112.0); + QCOMPARE(findObject(view->rootObject(), QLatin1String("rect6"))->x(), 64.0); + + //parent horizontal + QCOMPARE(findObject(view->rootObject(), QLatin1String("rect7"))->x(), 0.0); + QCOMPARE(findObject(view->rootObject(), QLatin1String("rect8"))->x(), 240.0); + QCOMPARE(findObject(view->rootObject(), QLatin1String("rect9"))->x(), 120.0); + QCOMPARE(findObject(view->rootObject(), QLatin1String("rect10"))->x(), -10.0); + QCOMPARE(findObject(view->rootObject(), QLatin1String("rect11"))->x(), 230.0); + QCOMPARE(findObject(view->rootObject(), QLatin1String("rect12"))->x(), 110.0); + + //vertical + QCOMPARE(findObject(view->rootObject(), QLatin1String("rect13"))->y(), 20.0); + QCOMPARE(findObject(view->rootObject(), QLatin1String("rect14"))->y(), 155.0); + + //stretch + QCOMPARE(findObject(view->rootObject(), QLatin1String("rect15"))->x(), 26.0); + QCOMPARE(findObject(view->rootObject(), QLatin1String("rect15"))->property("width").toReal(), 96.0); + QCOMPARE(findObject(view->rootObject(), QLatin1String("rect16"))->x(), 26.0); + QCOMPARE(findObject(view->rootObject(), QLatin1String("rect16"))->property("width").toReal(), 192.0); + QCOMPARE(findObject(view->rootObject(), QLatin1String("rect17"))->x(), -70.0); + QCOMPARE(findObject(view->rootObject(), QLatin1String("rect17"))->property("width").toReal(), 192.0); + + //vertical stretch + QCOMPARE(findObject(view->rootObject(), QLatin1String("rect18"))->y(), 20.0); + QCOMPARE(findObject(view->rootObject(), QLatin1String("rect18"))->property("height").toReal(), 40.0); + + //more parent horizontal + QCOMPARE(findObject(view->rootObject(), QLatin1String("rect19"))->x(), 115.0); + QCOMPARE(findObject(view->rootObject(), QLatin1String("rect20"))->x(), 235.0); + QCOMPARE(findObject(view->rootObject(), QLatin1String("rect21"))->x(), -5.0); + + //centerIn + QCOMPARE(findObject(view->rootObject(), QLatin1String("rect22"))->x(), 69.0); + QCOMPARE(findObject(view->rootObject(), QLatin1String("rect22"))->y(), 5.0); + + //margins + QCOMPARE(findObject(view->rootObject(), QLatin1String("rect23"))->x(), 31.0); + QCOMPARE(findObject(view->rootObject(), QLatin1String("rect23"))->y(), 5.0); + QCOMPARE(findObject(view->rootObject(), QLatin1String("rect23"))->property("width").toReal(), 86.0); + QCOMPARE(findObject(view->rootObject(), QLatin1String("rect23"))->property("height").toReal(), 10.0); + + // offsets + QCOMPARE(findObject(view->rootObject(), QLatin1String("rect24"))->x(), 26.0); + QCOMPARE(findObject(view->rootObject(), QLatin1String("rect25"))->y(), 60.0); + QCOMPARE(findObject(view->rootObject(), QLatin1String("rect26"))->y(), 5.0); + + //baseline + QDeclarativeText *text1 = findItem<QDeclarativeText>(view->rootObject(), QLatin1String("text1")); + QDeclarativeText *text2 = findItem<QDeclarativeText>(view->rootObject(), QLatin1String("text2")); + QCOMPARE(text1->y(), text2->y()); + + delete view; +} + // mostly testing that we don't crash void tst_qdeclarativeanchors::loops() { @@ -207,7 +297,7 @@ void tst_qdeclarativeanchors::illegalSets() QDeclarativeEngine engine; QDeclarativeComponent component(&engine); - component.setData(QByteArray("import Qt 4.6\n" + qml.toUtf8()), QUrl::fromLocalFile("")); + component.setData(QByteArray("import Qt 4.7\n" + qml.toUtf8()), QUrl::fromLocalFile("")); if (!component.isReady()) qWarning() << "Test errors:" << component.errors(); QVERIFY(component.isReady()); diff --git a/tests/auto/declarative/qdeclarativeanimatedimage/data/qmldir b/tests/auto/declarative/qdeclarativeanimatedimage/data/qmldir new file mode 100644 index 0000000..ef7c1f4 --- /dev/null +++ b/tests/auto/declarative/qdeclarativeanimatedimage/data/qmldir @@ -0,0 +1 @@ +# No local types diff --git a/tests/auto/declarative/qdeclarativeanimatedimage/qdeclarativeanimatedimage.pro b/tests/auto/declarative/qdeclarativeanimatedimage/qdeclarativeanimatedimage.pro index 2904986..74f9be0 100644 --- a/tests/auto/declarative/qdeclarativeanimatedimage/qdeclarativeanimatedimage.pro +++ b/tests/auto/declarative/qdeclarativeanimatedimage/qdeclarativeanimatedimage.pro @@ -5,3 +5,6 @@ SOURCES += tst_qdeclarativeanimatedimage.cpp ../shared/testhttpserver.cpp macx:CONFIG -= app_bundle DEFINES += SRCDIR=\\\"$$PWD\\\" + +CONFIG += parallel_test + diff --git a/tests/auto/declarative/qdeclarativeanimatedimage/tst_qdeclarativeanimatedimage.cpp b/tests/auto/declarative/qdeclarativeanimatedimage/tst_qdeclarativeanimatedimage.cpp index 39ce9eb..0fb080c 100644 --- a/tests/auto/declarative/qdeclarativeanimatedimage/tst_qdeclarativeanimatedimage.cpp +++ b/tests/auto/declarative/qdeclarativeanimatedimage/tst_qdeclarativeanimatedimage.cpp @@ -141,12 +141,12 @@ void tst_qdeclarativeanimatedimage::remote() QFETCH(QString, fileName); QFETCH(bool, paused); - TestHTTPServer server(14445); + TestHTTPServer server(14449); QVERIFY(server.isValid()); server.serveDirectory(SRCDIR "/data"); QDeclarativeEngine engine; - QDeclarativeComponent component(&engine, QUrl("http://127.0.0.1:14445/" + fileName)); + QDeclarativeComponent component(&engine, QUrl("http://127.0.0.1:14449/" + fileName)); TRY_WAIT(component.isReady()); QDeclarativeAnimatedImage *anim = qobject_cast<QDeclarativeAnimatedImage *>(component.create()); @@ -196,7 +196,7 @@ void tst_qdeclarativeanimatedimage::invalidSource() { QDeclarativeEngine engine; QDeclarativeComponent component(&engine); - component.setData("import Qt 4.6\n AnimatedImage { source: \"no-such-file.gif\" }", QUrl::fromLocalFile("")); + component.setData("import Qt 4.7\n AnimatedImage { source: \"no-such-file.gif\" }", QUrl::fromLocalFile("")); QVERIFY(component.isReady()); QTest::ignoreMessage(QtWarningMsg, "Error Reading Animated Image File QUrl( \"file:no-such-file.gif\" ) "); diff --git a/tests/auto/declarative/qdeclarativeanimations/qdeclarativeanimations.pro b/tests/auto/declarative/qdeclarativeanimations/qdeclarativeanimations.pro index 8eac75f..ce38eeb 100644 --- a/tests/auto/declarative/qdeclarativeanimations/qdeclarativeanimations.pro +++ b/tests/auto/declarative/qdeclarativeanimations/qdeclarativeanimations.pro @@ -4,3 +4,6 @@ SOURCES += tst_qdeclarativeanimations.cpp macx:CONFIG -= app_bundle DEFINES += SRCDIR=\\\"$$PWD\\\" + +CONFIG += parallel_test + diff --git a/tests/auto/declarative/qdeclarativeanimations/tst_qdeclarativeanimations.cpp b/tests/auto/declarative/qdeclarativeanimations/tst_qdeclarativeanimations.cpp index f018ce1..959cc19 100644 --- a/tests/auto/declarative/qdeclarativeanimations/tst_qdeclarativeanimations.cpp +++ b/tests/auto/declarative/qdeclarativeanimations/tst_qdeclarativeanimations.cpp @@ -648,7 +648,7 @@ void tst_qdeclarativeanimations::easingProperties() { { QDeclarativeEngine engine; - QString componentStr = "import Qt 4.6\nNumberAnimation { easing.type: \"InOutQuad\" }"; + QString componentStr = "import Qt 4.7\nNumberAnimation { easing.type: \"InOutQuad\" }"; QDeclarativeComponent animationComponent(&engine); animationComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativePropertyAnimation *animObject = qobject_cast<QDeclarativePropertyAnimation*>(animationComponent.create()); @@ -659,7 +659,7 @@ void tst_qdeclarativeanimations::easingProperties() { QDeclarativeEngine engine; - QString componentStr = "import Qt 4.6\nPropertyAnimation { easing.type: \"OutBounce\"; easing.amplitude: 5.0 }"; + QString componentStr = "import Qt 4.7\nPropertyAnimation { easing.type: \"OutBounce\"; easing.amplitude: 5.0 }"; QDeclarativeComponent animationComponent(&engine); animationComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativePropertyAnimation *animObject = qobject_cast<QDeclarativePropertyAnimation*>(animationComponent.create()); @@ -671,7 +671,7 @@ void tst_qdeclarativeanimations::easingProperties() { QDeclarativeEngine engine; - QString componentStr = "import Qt 4.6\nPropertyAnimation { easing.type: \"OutElastic\"; easing.amplitude: 5.0; easing.period: 3.0}"; + QString componentStr = "import Qt 4.7\nPropertyAnimation { easing.type: \"OutElastic\"; easing.amplitude: 5.0; easing.period: 3.0}"; QDeclarativeComponent animationComponent(&engine); animationComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativePropertyAnimation *animObject = qobject_cast<QDeclarativePropertyAnimation*>(animationComponent.create()); @@ -684,7 +684,7 @@ void tst_qdeclarativeanimations::easingProperties() { QDeclarativeEngine engine; - QString componentStr = "import Qt 4.6\nPropertyAnimation { easing.type: \"InOutBack\"; easing.overshoot: 2 }"; + QString componentStr = "import Qt 4.7\nPropertyAnimation { easing.type: \"InOutBack\"; easing.overshoot: 2 }"; QDeclarativeComponent animationComponent(&engine); animationComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativePropertyAnimation *animObject = qobject_cast<QDeclarativePropertyAnimation*>(animationComponent.create()); diff --git a/tests/auto/declarative/qdeclarativebehaviors/data/binding.qml b/tests/auto/declarative/qdeclarativebehaviors/data/binding.qml index e982f21..e9fb286 100644 --- a/tests/auto/declarative/qdeclarativebehaviors/data/binding.qml +++ b/tests/auto/declarative/qdeclarativebehaviors/data/binding.qml @@ -9,7 +9,7 @@ Rectangle { objectName: "MyRect" width: 100; height: 100; color: "green" x: basex - Behavior on x { NumberAnimation { duration: 500; } } + Behavior on x { NumberAnimation { duration: 800; } } } MouseArea { id: clicker diff --git a/tests/auto/declarative/qdeclarativebehaviors/data/scripttrigger.qml b/tests/auto/declarative/qdeclarativebehaviors/data/scripttrigger.qml index b22441a..795b309 100644 --- a/tests/auto/declarative/qdeclarativebehaviors/data/scripttrigger.qml +++ b/tests/auto/declarative/qdeclarativebehaviors/data/scripttrigger.qml @@ -11,6 +11,6 @@ Rectangle { id: rect objectName: "MyRect" width: 100; height: 100; color: "green" - Behavior on x { NumberAnimation { duration: 500; } } + Behavior on x { NumberAnimation { duration: 800; } } } } diff --git a/tests/auto/declarative/qdeclarativebehaviors/qdeclarativebehaviors.pro b/tests/auto/declarative/qdeclarativebehaviors/qdeclarativebehaviors.pro index a1dac32..c2781b8 100644 --- a/tests/auto/declarative/qdeclarativebehaviors/qdeclarativebehaviors.pro +++ b/tests/auto/declarative/qdeclarativebehaviors/qdeclarativebehaviors.pro @@ -4,3 +4,6 @@ SOURCES += tst_qdeclarativebehaviors.cpp macx:CONFIG -= app_bundle DEFINES += SRCDIR=\\\"$$PWD\\\" + +CONFIG += parallel_test + diff --git a/tests/auto/declarative/qdeclarativebehaviors/tst_qdeclarativebehaviors.cpp b/tests/auto/declarative/qdeclarativebehaviors/tst_qdeclarativebehaviors.cpp index 4c9c9ca..3bff2f5 100644 --- a/tests/auto/declarative/qdeclarativebehaviors/tst_qdeclarativebehaviors.cpp +++ b/tests/auto/declarative/qdeclarativebehaviors/tst_qdeclarativebehaviors.cpp @@ -45,6 +45,7 @@ #include <private/qdeclarativerectangle_p.h> #include <private/qdeclarativebehavior_p.h> #include <private/qdeclarativeanimation_p.h> +#include "../../../shared/util.h" class tst_qdeclarativebehaviors : public QObject { @@ -76,13 +77,13 @@ void tst_qdeclarativebehaviors::simpleBehavior() QDeclarativeEngine engine; QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/simple.qml")); QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle*>(c.create()); - QVERIFY(rect); - QVERIFY(qobject_cast<QDeclarativeBehavior*>(rect->findChild<QDeclarativeBehavior*>("MyBehavior"))->animation()); + QTRY_VERIFY(rect); + QTRY_VERIFY(qobject_cast<QDeclarativeBehavior*>(rect->findChild<QDeclarativeBehavior*>("MyBehavior"))->animation()); rect->setState("moved"); - QTest::qWait(200); - qreal x = qobject_cast<QDeclarativeRectangle*>(rect->findChild<QDeclarativeRectangle*>("MyRect"))->x(); - QVERIFY(x > 0 && x < 200); //i.e. the behavior has been triggered + QTRY_VERIFY(qobject_cast<QDeclarativeRectangle*>(rect->findChild<QDeclarativeRectangle*>("MyRect"))->x() > 0); + QTRY_VERIFY(qobject_cast<QDeclarativeRectangle*>(rect->findChild<QDeclarativeRectangle*>("MyRect"))->x() < 200); + //i.e. the behavior has been triggered delete rect; } @@ -92,12 +93,12 @@ void tst_qdeclarativebehaviors::scriptTriggered() QDeclarativeEngine engine; QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/scripttrigger.qml")); QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle*>(c.create()); - QVERIFY(rect); + QTRY_VERIFY(rect); rect->setColor(QColor("red")); - QTest::qWait(200); - qreal x = qobject_cast<QDeclarativeRectangle*>(rect->findChild<QDeclarativeRectangle*>("MyRect"))->x(); - QVERIFY(x > 0 && x < 200); //i.e. the behavior has been triggered + QTRY_VERIFY(qobject_cast<QDeclarativeRectangle*>(rect->findChild<QDeclarativeRectangle*>("MyRect"))->x() > 0); + QTRY_VERIFY(qobject_cast<QDeclarativeRectangle*>(rect->findChild<QDeclarativeRectangle*>("MyRect"))->x() < 200); + //i.e. the behavior has been triggered delete rect; } @@ -107,15 +108,14 @@ void tst_qdeclarativebehaviors::cppTriggered() QDeclarativeEngine engine; QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/cpptrigger.qml")); QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle*>(c.create()); - QVERIFY(rect); + QTRY_VERIFY(rect); QDeclarativeRectangle *innerRect = qobject_cast<QDeclarativeRectangle*>(rect->findChild<QDeclarativeRectangle*>("MyRect")); - QVERIFY(innerRect); + QTRY_VERIFY(innerRect); innerRect->setProperty("x", 200); - QTest::qWait(200); - qreal x = innerRect->x(); - QVERIFY(x > 0 && x < 200); //i.e. the behavior has been triggered + QTRY_VERIFY(innerRect->x() > 0); + QTRY_VERIFY(innerRect->x() < 200); //i.e. the behavior has been triggered delete rect; } @@ -125,7 +125,7 @@ void tst_qdeclarativebehaviors::loop() QDeclarativeEngine engine; QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/loop.qml")); QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle*>(c.create()); - QVERIFY(rect); + QTRY_VERIFY(rect); //don't crash rect->setState("moved"); @@ -138,12 +138,12 @@ void tst_qdeclarativebehaviors::colorBehavior() QDeclarativeEngine engine; QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/color.qml")); QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle*>(c.create()); - QVERIFY(rect); + QTRY_VERIFY(rect); rect->setState("red"); - QTest::qWait(200); - QColor color = qobject_cast<QDeclarativeRectangle*>(rect->findChild<QDeclarativeRectangle*>("MyRect"))->color(); - QVERIFY(color != QColor("red") && color != QColor("green")); //i.e. the behavior has been triggered + QTRY_VERIFY(qobject_cast<QDeclarativeRectangle*>(rect->findChild<QDeclarativeRectangle*>("MyRect"))->color() != QColor("red")); + QTRY_VERIFY(qobject_cast<QDeclarativeRectangle*>(rect->findChild<QDeclarativeRectangle*>("MyRect"))->color() != QColor("green")); + //i.e. the behavior has been triggered delete rect; } @@ -153,16 +153,11 @@ void tst_qdeclarativebehaviors::parentBehavior() QDeclarativeEngine engine; QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/parent.qml")); QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle*>(c.create()); - QVERIFY(rect); + QTRY_VERIFY(rect); rect->setState("reparented"); - QTest::qWait(200); - QDeclarativeItem *newParent = rect->findChild<QDeclarativeItem*>("NewParent"); - QDeclarativeItem *parent = rect->findChild<QDeclarativeRectangle*>("MyRect")->parentItem(); - QVERIFY(parent != newParent); - QTest::qWait(600); - parent = rect->findChild<QDeclarativeRectangle*>("MyRect")->parentItem(); - QVERIFY(parent == newParent); + QTRY_VERIFY(rect->findChild<QDeclarativeRectangle*>("MyRect")->parentItem() != rect->findChild<QDeclarativeItem*>("NewParent")); + QTRY_VERIFY(rect->findChild<QDeclarativeRectangle*>("MyRect")->parentItem() == rect->findChild<QDeclarativeItem*>("NewParent")); delete rect; } @@ -172,33 +167,28 @@ void tst_qdeclarativebehaviors::replaceBinding() QDeclarativeEngine engine; QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/binding.qml")); QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle*>(c.create()); - QVERIFY(rect); + QTRY_VERIFY(rect); rect->setState("moved"); - QTest::qWait(200); QDeclarativeRectangle *innerRect = qobject_cast<QDeclarativeRectangle*>(rect->findChild<QDeclarativeRectangle*>("MyRect")); - QVERIFY(innerRect); - qreal x = innerRect->x(); - QVERIFY(x > 0 && x < 200); //i.e. the behavior has been triggered - QTest::qWait(600); - QCOMPARE(innerRect->x(), (qreal)200); + QTRY_VERIFY(innerRect); + QTRY_VERIFY(innerRect->x() > 0); + QTRY_VERIFY(innerRect->x() < 200); + //i.e. the behavior has been triggered + QTRY_COMPARE(innerRect->x(), (qreal)200); rect->setProperty("basex", 10); - QCOMPARE(innerRect->x(), (qreal)200); + QTRY_COMPARE(innerRect->x(), (qreal)200); rect->setProperty("movedx", 210); - QTest::qWait(600); - QCOMPARE(innerRect->x(), (qreal)210); + QTRY_COMPARE(innerRect->x(), (qreal)210); rect->setState(""); - QTest::qWait(200); - x = innerRect->x(); - QVERIFY(x > 10 && x < 210); //i.e. the behavior has been triggered - QTest::qWait(600); - QCOMPARE(innerRect->x(), (qreal)10); + QTRY_VERIFY(innerRect->x() > 10); + QTRY_VERIFY(innerRect->x() < 210); //i.e. the behavior has been triggered + QTRY_COMPARE(innerRect->x(), (qreal)10); rect->setProperty("movedx", 200); - QCOMPARE(innerRect->x(), (qreal)10); + QTRY_COMPARE(innerRect->x(), (qreal)10); rect->setProperty("basex", 20); - QTest::qWait(600); - QCOMPARE(innerRect->x(), (qreal)20); + QTRY_COMPARE(innerRect->x(), (qreal)20); delete rect; } @@ -209,12 +199,13 @@ void tst_qdeclarativebehaviors::group() QDeclarativeEngine engine; QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/groupProperty.qml")); QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle*>(c.create()); - QVERIFY(rect); + QTRY_VERIFY(rect); rect->setState("moved"); - QTest::qWait(200); - qreal x = qobject_cast<QDeclarativeRectangle*>(rect->findChild<QDeclarativeRectangle*>("MyRect"))->x(); - QVERIFY(x > 0 && x < 200); //i.e. the behavior has been triggered + //QTest::qWait(200); + QTRY_VERIFY(qobject_cast<QDeclarativeRectangle*>(rect->findChild<QDeclarativeRectangle*>("MyRect"))->x() > 0); + QTRY_VERIFY(qobject_cast<QDeclarativeRectangle*>(rect->findChild<QDeclarativeRectangle*>("MyRect"))->x() < 200); + //i.e. the behavior has been triggered delete rect; } @@ -223,12 +214,12 @@ void tst_qdeclarativebehaviors::group() QDeclarativeEngine engine; QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/groupProperty2.qml")); QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle*>(c.create()); - QVERIFY(rect); + QTRY_VERIFY(rect); rect->setState("moved"); - QTest::qWait(200); - qreal x = qobject_cast<QDeclarativeRectangle*>(rect->findChild<QDeclarativeRectangle*>("MyRect"))->x(); - QVERIFY(x > 0 && x < 200); //i.e. the behavior has been triggered + QTRY_VERIFY(qobject_cast<QDeclarativeRectangle*>(rect->findChild<QDeclarativeRectangle*>("MyRect"))->x() > 0); + QTRY_VERIFY(qobject_cast<QDeclarativeRectangle*>(rect->findChild<QDeclarativeRectangle*>("MyRect"))->x() < 200); + //i.e. the behavior has been triggered delete rect; } @@ -239,46 +230,42 @@ void tst_qdeclarativebehaviors::emptyBehavior() QDeclarativeEngine engine; QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/empty.qml")); QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle*>(c.create()); - QVERIFY(rect); + QTRY_VERIFY(rect); rect->setState("moved"); qreal x = qobject_cast<QDeclarativeRectangle*>(rect->findChild<QDeclarativeRectangle*>("MyRect"))->x(); - QCOMPARE(x, qreal(200)); //should change immediately + QTRY_COMPARE(x, qreal(200)); //should change immediately delete rect; } void tst_qdeclarativebehaviors::explicitSelection() { - { - QDeclarativeEngine engine; - QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/explicit.qml")); - QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle*>(c.create()); - QVERIFY(rect); + QDeclarativeEngine engine; + QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/explicit.qml")); + QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle*>(c.create()); + QTRY_VERIFY(rect); - rect->setState("moved"); - QTest::qWait(200); - qreal x = qobject_cast<QDeclarativeRectangle*>(rect->findChild<QDeclarativeRectangle*>("MyRect"))->x(); - QVERIFY(x > 0 && x < 200); //i.e. the behavior has been triggered + rect->setState("moved"); + QTRY_VERIFY(qobject_cast<QDeclarativeRectangle*>(rect->findChild<QDeclarativeRectangle*>("MyRect"))->x() > 0); + QTRY_VERIFY(qobject_cast<QDeclarativeRectangle*>(rect->findChild<QDeclarativeRectangle*>("MyRect"))->x() < 200); + //i.e. the behavior has been triggered - delete rect; - } + delete rect; } void tst_qdeclarativebehaviors::nonSelectingBehavior() { - { - QDeclarativeEngine engine; - QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/nonSelecting2.qml")); - QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle*>(c.create()); - QVERIFY(rect); + QDeclarativeEngine engine; + QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/nonSelecting2.qml")); + QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle*>(c.create()); + QTRY_VERIFY(rect); - rect->setState("moved"); - qreal x = qobject_cast<QDeclarativeRectangle*>(rect->findChild<QDeclarativeRectangle*>("MyRect"))->x(); - QCOMPARE(x, qreal(200)); //should change immediately + rect->setState("moved"); + qreal x = qobject_cast<QDeclarativeRectangle*>(rect->findChild<QDeclarativeRectangle*>("MyRect"))->x(); + QTRY_COMPARE(x, qreal(200)); //should change immediately - delete rect; - } + delete rect; } void tst_qdeclarativebehaviors::reassignedAnimation() @@ -287,8 +274,8 @@ void tst_qdeclarativebehaviors::reassignedAnimation() QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/reassignedAnimation.qml")); QTest::ignoreMessage(QtWarningMsg, QString("QML Behavior (" + QUrl::fromLocalFile(SRCDIR "/data/reassignedAnimation.qml").toString() + ":9:9) Cannot change the animation assigned to a Behavior.").toUtf8().constData()); QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle*>(c.create()); - QVERIFY(rect); - QCOMPARE(qobject_cast<QDeclarativeNumberAnimation*>( + QTRY_VERIFY(rect); + QTRY_COMPARE(qobject_cast<QDeclarativeNumberAnimation*>( qobject_cast<QDeclarativeBehavior*>( rect->findChild<QDeclarativeBehavior*>("MyBehavior"))->animation())->duration(), 200); @@ -300,12 +287,12 @@ void tst_qdeclarativebehaviors::disabled() QDeclarativeEngine engine; QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/disabled.qml")); QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle*>(c.create()); - QVERIFY(rect); - QCOMPARE(rect->findChild<QDeclarativeBehavior*>("MyBehavior")->enabled(), false); + QTRY_VERIFY(rect); + QTRY_COMPARE(rect->findChild<QDeclarativeBehavior*>("MyBehavior")->enabled(), false); rect->setState("moved"); qreal x = qobject_cast<QDeclarativeRectangle*>(rect->findChild<QDeclarativeRectangle*>("MyRect"))->x(); - QCOMPARE(x, qreal(200)); //should change immediately + QTRY_COMPARE(x, qreal(200)); //should change immediately delete rect; } @@ -318,11 +305,11 @@ void tst_qdeclarativebehaviors::dontStart() QTest::ignoreMessage(QtWarningMsg, "QDeclarativeAbstractAnimation: setRunning() cannot be used on non-root animation nodes"); QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle*>(c.create()); - QVERIFY(rect); + QTRY_VERIFY(rect); QDeclarativeAbstractAnimation *myAnim = rect->findChild<QDeclarativeAbstractAnimation*>("MyAnim"); - QVERIFY(myAnim && myAnim->qtAnimation()); - QVERIFY(myAnim->qtAnimation()->state() == QAbstractAnimation::Stopped); + QTRY_VERIFY(myAnim && myAnim->qtAnimation()); + QTRY_VERIFY(myAnim->qtAnimation()->state() == QAbstractAnimation::Stopped); delete rect; } @@ -332,12 +319,12 @@ void tst_qdeclarativebehaviors::startup() QDeclarativeEngine engine; QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/startup.qml")); QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle*>(c.create()); - QVERIFY(rect); + QTRY_VERIFY(rect); QDeclarativeRectangle *innerRect = rect->findChild<QDeclarativeRectangle*>("innerRect"); - QVERIFY(innerRect); + QTRY_VERIFY(innerRect); - QCOMPARE(innerRect->x(), qreal(100)); //should be set immediately + QTRY_COMPARE(innerRect->x(), qreal(100)); //should be set immediately delete rect; } diff --git a/tests/auto/declarative/qdeclarativebinding/qdeclarativebinding.pro b/tests/auto/declarative/qdeclarativebinding/qdeclarativebinding.pro index 7879976..04dd6f5 100644 --- a/tests/auto/declarative/qdeclarativebinding/qdeclarativebinding.pro +++ b/tests/auto/declarative/qdeclarativebinding/qdeclarativebinding.pro @@ -6,3 +6,6 @@ SOURCES += tst_qdeclarativebinding.cpp # Define SRCDIR equal to test's source directory DEFINES += SRCDIR=\\\"$$PWD\\\" + +CONFIG += parallel_test + diff --git a/tests/auto/declarative/qdeclarativeborderimage/qdeclarativeborderimage.pro b/tests/auto/declarative/qdeclarativeborderimage/qdeclarativeborderimage.pro index 0574ddb..e754923 100644 --- a/tests/auto/declarative/qdeclarativeborderimage/qdeclarativeborderimage.pro +++ b/tests/auto/declarative/qdeclarativeborderimage/qdeclarativeborderimage.pro @@ -7,3 +7,6 @@ SOURCES += tst_qdeclarativeborderimage.cpp ../shared/testhttpserver.cpp # Define SRCDIR equal to test's source directory DEFINES += SRCDIR=\\\"$$PWD\\\" + +CONFIG += parallel_test + diff --git a/tests/auto/declarative/qdeclarativeborderimage/tst_qdeclarativeborderimage.cpp b/tests/auto/declarative/qdeclarativeborderimage/tst_qdeclarativeborderimage.cpp index 8aeba6d..0f03527 100644 --- a/tests/auto/declarative/qdeclarativeborderimage/tst_qdeclarativeborderimage.cpp +++ b/tests/auto/declarative/qdeclarativeborderimage/tst_qdeclarativeborderimage.cpp @@ -55,8 +55,8 @@ #include "../shared/testhttpserver.h" -#define SERVER_PORT 14445 -#define SERVER_ADDR "http://127.0.0.1:14445" +#define SERVER_PORT 14446 +#define SERVER_ADDR "http://127.0.0.1:14446" #define TRY_WAIT(expr) \ do { \ @@ -99,7 +99,7 @@ tst_qdeclarativeborderimage::tst_qdeclarativeborderimage() void tst_qdeclarativeborderimage::noSource() { - QString componentStr = "import Qt 4.6\nBorderImage { source: \"\" }"; + QString componentStr = "import Qt 4.7\nBorderImage { source: \"\" }"; QDeclarativeComponent component(&engine); component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeBorderImage *obj = qobject_cast<QDeclarativeBorderImage*>(component.create()); @@ -143,12 +143,12 @@ void tst_qdeclarativeborderimage::imageSource() if (!error.isEmpty()) QTest::ignoreMessage(QtWarningMsg, error.toUtf8()); - QString componentStr = "import Qt 4.6\nBorderImage { source: \"" + source + "\" }"; + QString componentStr = "import Qt 4.7\nBorderImage { source: \"" + source + "\" }"; QDeclarativeComponent component(&engine); component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeBorderImage *obj = qobject_cast<QDeclarativeBorderImage*>(component.create()); QVERIFY(obj != 0); - + if (remote) TRY_WAIT(obj->status() == QDeclarativeBorderImage::Loading); @@ -170,7 +170,7 @@ void tst_qdeclarativeborderimage::imageSource() void tst_qdeclarativeborderimage::clearSource() { - QString componentStr = "import Qt 4.6\nBorderImage { source: srcImage }"; + QString componentStr = "import Qt 4.7\nBorderImage { source: srcImage }"; QDeclarativeContext *ctxt = engine.rootContext(); ctxt->setContextProperty("srcImage", QUrl::fromLocalFile(SRCDIR "/data/colors.png")); QDeclarativeComponent component(&engine); @@ -190,7 +190,7 @@ void tst_qdeclarativeborderimage::clearSource() void tst_qdeclarativeborderimage::resized() { - QString componentStr = "import Qt 4.6\nBorderImage { source: \"" + QUrl::fromLocalFile(SRCDIR "/data/colors.png").toString() + "\"; width: 300; height: 300 }"; + QString componentStr = "import Qt 4.7\nBorderImage { source: \"" + QUrl::fromLocalFile(SRCDIR "/data/colors.png").toString() + "\"; width: 300; height: 300 }"; QDeclarativeComponent component(&engine); component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeBorderImage *obj = qobject_cast<QDeclarativeBorderImage*>(component.create()); @@ -205,7 +205,7 @@ void tst_qdeclarativeborderimage::resized() void tst_qdeclarativeborderimage::smooth() { - QString componentStr = "import Qt 4.6\nBorderImage { source: \"" SRCDIR "/data/colors.png\"; smooth: true; width: 300; height: 300 }"; + QString componentStr = "import Qt 4.7\nBorderImage { source: \"" SRCDIR "/data/colors.png\"; smooth: true; width: 300; height: 300 }"; QDeclarativeComponent component(&engine); component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeBorderImage *obj = qobject_cast<QDeclarativeBorderImage*>(component.create()); @@ -222,7 +222,7 @@ void tst_qdeclarativeborderimage::smooth() void tst_qdeclarativeborderimage::tileModes() { { - QString componentStr = "import Qt 4.6\nBorderImage { source: \"" SRCDIR "/data/colors.png\"; width: 100; height: 300; horizontalTileMode: BorderImage.Repeat; verticalTileMode: BorderImage.Repeat }"; + QString componentStr = "import Qt 4.7\nBorderImage { source: \"" SRCDIR "/data/colors.png\"; width: 100; height: 300; horizontalTileMode: BorderImage.Repeat; verticalTileMode: BorderImage.Repeat }"; QDeclarativeComponent component(&engine); component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeBorderImage *obj = qobject_cast<QDeclarativeBorderImage*>(component.create()); @@ -235,7 +235,7 @@ void tst_qdeclarativeborderimage::tileModes() delete obj; } { - QString componentStr = "import Qt 4.6\nBorderImage { source: \"" SRCDIR "/data/colors.png\"; width: 300; height: 150; horizontalTileMode: BorderImage.Round; verticalTileMode: BorderImage.Round }"; + QString componentStr = "import Qt 4.7\nBorderImage { source: \"" SRCDIR "/data/colors.png\"; width: 300; height: 150; horizontalTileMode: BorderImage.Round; verticalTileMode: BorderImage.Round }"; QDeclarativeComponent component(&engine); component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeBorderImage *obj = qobject_cast<QDeclarativeBorderImage*>(component.create()); @@ -262,19 +262,19 @@ void tst_qdeclarativeborderimage::sciSource() server->serveDirectory(SRCDIR "/data"); } - QString componentStr = "import Qt 4.6\nBorderImage { source: \"" + source + "\"; width: 300; height: 300 }"; + QString componentStr = "import Qt 4.7\nBorderImage { source: \"" + source + "\"; width: 300; height: 300 }"; QDeclarativeComponent component(&engine); component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeBorderImage *obj = qobject_cast<QDeclarativeBorderImage*>(component.create()); QVERIFY(obj != 0); - + if (remote) TRY_WAIT(obj->status() == QDeclarativeBorderImage::Loading); - + QCOMPARE(obj->source(), remote ? source : QUrl(source)); QCOMPARE(obj->width(), 300.); QCOMPARE(obj->height(), 300.); - + if (valid) { TRY_WAIT(obj->status() == QDeclarativeBorderImage::Ready); QCOMPARE(obj->border()->left(), 10); @@ -307,7 +307,7 @@ void tst_qdeclarativeborderimage::invalidSciFile() QTest::ignoreMessage(QtWarningMsg, "Unknown tile rule specified. Using Stretch "); // for "Roun" QTest::ignoreMessage(QtWarningMsg, "Unknown tile rule specified. Using Stretch "); // for "Repea" - QString componentStr = "import Qt 4.6\nBorderImage { source: \"" + QUrl::fromLocalFile(SRCDIR "/data/invalid.sci").toString() +"\"; width: 300; height: 300 }"; + QString componentStr = "import Qt 4.7\nBorderImage { source: \"" + QUrl::fromLocalFile(SRCDIR "/data/invalid.sci").toString() +"\"; width: 300; height: 300 }"; QDeclarativeComponent component(&engine); component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeBorderImage *obj = qobject_cast<QDeclarativeBorderImage*>(component.create()); @@ -325,7 +325,7 @@ void tst_qdeclarativeborderimage::pendingRemoteRequest() { QFETCH(QString, source); - QString componentStr = "import Qt 4.6\nBorderImage { source: \"" + source + "\" }"; + QString componentStr = "import Qt 4.7\nBorderImage { source: \"" + source + "\" }"; QDeclarativeComponent component(&engine); component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeBorderImage *obj = qobject_cast<QDeclarativeBorderImage*>(component.create()); @@ -342,8 +342,8 @@ void tst_qdeclarativeborderimage::pendingRemoteRequest_data() { QTest::addColumn<QString>("source"); - QTest::newRow("png file") << "http://no-such-qt-server-like-this/none.png"; - QTest::newRow("sci file") << "http://no-such-qt-server-like-this/none.sci"; + QTest::newRow("png file") << "http://localhost/none.png"; + QTest::newRow("sci file") << "http://localhost/none.sci"; } QTEST_MAIN(tst_qdeclarativeborderimage) diff --git a/tests/auto/declarative/qdeclarativecomponent/qdeclarativecomponent.pro b/tests/auto/declarative/qdeclarativecomponent/qdeclarativecomponent.pro index c7affb7..e58c798 100644 --- a/tests/auto/declarative/qdeclarativecomponent/qdeclarativecomponent.pro +++ b/tests/auto/declarative/qdeclarativecomponent/qdeclarativecomponent.pro @@ -6,3 +6,6 @@ macx:CONFIG -= app_bundle SOURCES += tst_qdeclarativecomponent.cpp DEFINES += SRCDIR=\\\"$$PWD\\\" + +CONFIG += parallel_test + diff --git a/tests/auto/declarative/qdeclarativeconnection/qdeclarativeconnection.pro b/tests/auto/declarative/qdeclarativeconnection/qdeclarativeconnection.pro index a6adfa4..959354d 100644 --- a/tests/auto/declarative/qdeclarativeconnection/qdeclarativeconnection.pro +++ b/tests/auto/declarative/qdeclarativeconnection/qdeclarativeconnection.pro @@ -6,3 +6,6 @@ SOURCES += tst_qdeclarativeconnection.cpp # Define SRCDIR equal to test's source directory DEFINES += SRCDIR=\\\"$$PWD\\\" + +CONFIG += parallel_test + diff --git a/tests/auto/declarative/qdeclarativecontext/qdeclarativecontext.pro b/tests/auto/declarative/qdeclarativecontext/qdeclarativecontext.pro index adace70..5db9a9e 100644 --- a/tests/auto/declarative/qdeclarativecontext/qdeclarativecontext.pro +++ b/tests/auto/declarative/qdeclarativecontext/qdeclarativecontext.pro @@ -4,3 +4,6 @@ SOURCES += tst_qdeclarativecontext.cpp macx:CONFIG -= app_bundle DEFINES += SRCDIR=\\\"$$PWD\\\" + +CONFIG += parallel_test + diff --git a/tests/auto/declarative/qdeclarativecontext/tst_qdeclarativecontext.cpp b/tests/auto/declarative/qdeclarativecontext/tst_qdeclarativecontext.cpp index ae62363..35cffdc 100644 --- a/tests/auto/declarative/qdeclarativecontext/tst_qdeclarativecontext.cpp +++ b/tests/auto/declarative/qdeclarativecontext/tst_qdeclarativecontext.cpp @@ -228,7 +228,7 @@ private: #define TEST_CONTEXT_PROPERTY(ctxt, name, value) \ { \ QDeclarativeComponent component(&engine); \ - component.setData("import Qt 4.6; QtObject { property variant test: " #name " }", QUrl()); \ + component.setData("import Qt 4.7; QtObject { property variant test: " #name " }", QUrl()); \ \ QObject *obj = component.create(ctxt); \ \ @@ -278,7 +278,7 @@ void tst_qdeclarativecontext::setContextProperty() // Changes in context properties { QDeclarativeComponent component(&engine); - component.setData("import Qt 4.6; QtObject { property variant test: a }", QUrl()); + component.setData("import Qt 4.7; QtObject { property variant test: a }", QUrl()); QObject *obj = component.create(&ctxt2); @@ -290,7 +290,7 @@ void tst_qdeclarativecontext::setContextProperty() } { QDeclarativeComponent component(&engine); - component.setData("import Qt 4.6; QtObject { property variant test: b }", QUrl()); + component.setData("import Qt 4.7; QtObject { property variant test: b }", QUrl()); QObject *obj = component.create(&ctxt2); @@ -304,7 +304,7 @@ void tst_qdeclarativecontext::setContextProperty() } { QDeclarativeComponent component(&engine); - component.setData("import Qt 4.6; QtObject { property variant test: e.a }", QUrl()); + component.setData("import Qt 4.7; QtObject { property variant test: e.a }", QUrl()); QObject *obj = component.create(&ctxt2); @@ -318,7 +318,7 @@ void tst_qdeclarativecontext::setContextProperty() // New context properties { QDeclarativeComponent component(&engine); - component.setData("import Qt 4.6; QtObject { property variant test: a }", QUrl()); + component.setData("import Qt 4.7; QtObject { property variant test: a }", QUrl()); QObject *obj = component.create(&ctxt2); @@ -332,7 +332,7 @@ void tst_qdeclarativecontext::setContextProperty() // Setting an object-variant context property { QDeclarativeComponent component(&engine); - component.setData("import Qt 4.6; QtObject { id: root; property int a: 10; property int test: ctxtProp.a; property variant obj: root; }", QUrl()); + component.setData("import Qt 4.7; QtObject { id: root; property int a: 10; property int test: ctxtProp.a; property variant obj: root; }", QUrl()); QDeclarativeContext ctxt(engine.rootContext()); ctxt.setContextProperty("ctxtProp", QVariant()); @@ -380,7 +380,7 @@ void tst_qdeclarativecontext::setContextObject() // Changes in context properties { QDeclarativeComponent component(&engine); - component.setData("import Qt 4.6; QtObject { property variant test: a }", QUrl()); + component.setData("import Qt 4.7; QtObject { property variant test: a }", QUrl()); QObject *obj = component.create(&ctxt); @@ -412,7 +412,7 @@ void tst_qdeclarativecontext::destruction() void tst_qdeclarativecontext::idAsContextProperty() { QDeclarativeComponent component(&engine); - component.setData("import Qt 4.6; QtObject { property variant a; a: QtObject { id: myObject } }", QUrl()); + component.setData("import Qt 4.7; QtObject { property variant a; a: QtObject { id: myObject } }", QUrl()); QObject *obj = component.create(); QVERIFY(obj); @@ -432,7 +432,7 @@ void tst_qdeclarativecontext::idAsContextProperty() void tst_qdeclarativecontext::readOnlyContexts() { QDeclarativeComponent component(&engine); - component.setData("import Qt 4.6; QtObject { id: me }", QUrl()); + component.setData("import Qt 4.7; QtObject { id: me }", QUrl()); QObject *obj = component.create(); QVERIFY(obj); diff --git a/tests/auto/declarative/qdeclarativedebug/qdeclarativedebug.pro b/tests/auto/declarative/qdeclarativedebug/qdeclarativedebug.pro index ff1d0d4..1214fcf 100644 --- a/tests/auto/declarative/qdeclarativedebug/qdeclarativedebug.pro +++ b/tests/auto/declarative/qdeclarativedebug/qdeclarativedebug.pro @@ -5,3 +5,6 @@ macx:CONFIG -= app_bundle HEADERS += ../shared/debugutil_p.h SOURCES += tst_qdeclarativedebug.cpp \ ../shared/debugutil.cpp + +CONFIG += parallel_test + diff --git a/tests/auto/declarative/qdeclarativedebug/tst_qdeclarativedebug.cpp b/tests/auto/declarative/qdeclarativedebug/tst_qdeclarativedebug.cpp index d0eb90e..133dcb8 100644 --- a/tests/auto/declarative/qdeclarativedebug/tst_qdeclarativedebug.cpp +++ b/tests/auto/declarative/qdeclarativedebug/tst_qdeclarativedebug.cpp @@ -822,7 +822,7 @@ int main(int argc, char *argv[]) QApplication app(argc, argv); QList<QByteArray> qml; - qml << "import Qt 4.6\n" + qml << "import Qt 4.7\n" "Item {" "width: 10; height: 20; scale: blueRect.scale;" "Rectangle { id: blueRect; width: 500; height: 600; color: \"blue\"; }" @@ -832,7 +832,7 @@ int main(int argc, char *argv[]) "}" "}"; // add second component to test multiple root contexts - qml << "import Qt 4.6\n" + qml << "import Qt 4.7\n" "Item {}"; tst_QDeclarativeDebug_Factory factory; return QDeclarativeDebugTest::runTests(&factory, qml); diff --git a/tests/auto/declarative/qdeclarativedebugservice/qdeclarativedebugservice.pro b/tests/auto/declarative/qdeclarativedebugservice/qdeclarativedebugservice.pro index e375889..a62e148 100644 --- a/tests/auto/declarative/qdeclarativedebugservice/qdeclarativedebugservice.pro +++ b/tests/auto/declarative/qdeclarativedebugservice/qdeclarativedebugservice.pro @@ -5,3 +5,6 @@ macx:CONFIG -= app_bundle HEADERS += ../shared/debugutil_p.h SOURCES += tst_qdeclarativedebugservice.cpp \ ../shared/debugutil.cpp + +CONFIG += parallel_test + diff --git a/tests/auto/declarative/qdeclarativedom/qdeclarativedom.pro b/tests/auto/declarative/qdeclarativedom/qdeclarativedom.pro index 35df26e..466c563 100644 --- a/tests/auto/declarative/qdeclarativedom/qdeclarativedom.pro +++ b/tests/auto/declarative/qdeclarativedom/qdeclarativedom.pro @@ -5,3 +5,6 @@ macx:CONFIG -= app_bundle SOURCES += tst_qdeclarativedom.cpp DEFINES += SRCDIR=\\\"$$PWD\\\" + +CONFIG += parallel_test + diff --git a/tests/auto/declarative/qdeclarativedom/tst_qdeclarativedom.cpp b/tests/auto/declarative/qdeclarativedom/tst_qdeclarativedom.cpp index d391941..1f0c47c 100644 --- a/tests/auto/declarative/qdeclarativedom/tst_qdeclarativedom.cpp +++ b/tests/auto/declarative/qdeclarativedom/tst_qdeclarativedom.cpp @@ -81,7 +81,7 @@ private: void tst_qdeclarativedom::loadSimple() { - QByteArray qml = "import Qt 4.6\n" + QByteArray qml = "import Qt 4.7\n" "Item {}"; QDeclarativeDomDocument document; @@ -94,13 +94,13 @@ void tst_qdeclarativedom::loadSimple() QVERIFY(!rootObject.isCustomType()); QVERIFY(rootObject.objectType() == "Qt/Item"); QVERIFY(rootObject.objectTypeMajorVersion() == 4); - QVERIFY(rootObject.objectTypeMinorVersion() == 6); + QVERIFY(rootObject.objectTypeMinorVersion() == 7); } // Test regular properties void tst_qdeclarativedom::loadProperties() { - QByteArray qml = "import Qt 4.6\n" + QByteArray qml = "import Qt 4.7\n" "Item { id : item; x : 300; visible : true }"; QDeclarativeDomDocument document; @@ -134,7 +134,7 @@ void tst_qdeclarativedom::loadProperties() void tst_qdeclarativedom::loadGroupedProperties() { { - QByteArray qml = "import Qt 4.6\n" + QByteArray qml = "import Qt 4.7\n" "Item { anchors.left: parent.left; anchors.right: parent.right }"; QDeclarativeDomDocument document; @@ -177,7 +177,7 @@ void tst_qdeclarativedom::loadGroupedProperties() } { - QByteArray qml = "import Qt 4.6\n" + QByteArray qml = "import Qt 4.7\n" "Item { \n" " anchors {\n" " left: parent.left\n" @@ -228,7 +228,7 @@ void tst_qdeclarativedom::loadGroupedProperties() void tst_qdeclarativedom::loadChildObject() { - QByteArray qml = "import Qt 4.6\n" + QByteArray qml = "import Qt 4.7\n" "Item { Item {} }"; QDeclarativeDomDocument document; @@ -273,7 +273,7 @@ void tst_qdeclarativedom::loadComposite() void tst_qdeclarativedom::testValueSource() { - QByteArray qml = "import Qt 4.6\n" + QByteArray qml = "import Qt 4.7\n" "Rectangle { SpringFollow on height { spring: 1.4; damping: .15; to: Math.min(Math.max(-130, value*2.2 - 130), 133); }}"; QDeclarativeEngine freshEngine; @@ -291,7 +291,7 @@ void tst_qdeclarativedom::testValueSource() QVERIFY(valueSourceObject.isValid()); QVERIFY(valueSourceObject.objectType() == "Qt/SpringFollow"); - + const QDeclarativeDomValue springValue = valueSourceObject.property("spring").value(); QVERIFY(!springValue.isInvalid()); QVERIFY(springValue.isLiteral()); @@ -305,7 +305,7 @@ void tst_qdeclarativedom::testValueSource() void tst_qdeclarativedom::testValueInterceptor() { - QByteArray qml = "import Qt 4.6\n" + QByteArray qml = "import Qt 4.7\n" "Rectangle { Behavior on height { NumberAnimation { duration: 100 } } }"; QDeclarativeEngine freshEngine; @@ -332,7 +332,7 @@ void tst_qdeclarativedom::testValueInterceptor() // Test QDeclarativeDomDocument::imports() void tst_qdeclarativedom::loadImports() { - QByteArray qml = "import Qt 4.6\n" + QByteArray qml = "import Qt 4.7\n" "import importlib.sublib 1.1\n" "import importlib.sublib 1.0 as NewFoo\n" "import 'import'\n" @@ -350,7 +350,7 @@ void tst_qdeclarativedom::loadImports() QCOMPARE(import.type(), QDeclarativeDomImport::Library); QCOMPARE(import.uri(), QLatin1String("Qt")); QCOMPARE(import.qualifier(), QString()); - QCOMPARE(import.version(), QLatin1String("4.6")); + QCOMPARE(import.version(), QLatin1String("4.7")); import = document.imports().at(1); QCOMPARE(import.type(), QDeclarativeDomImport::Library); @@ -380,7 +380,7 @@ void tst_qdeclarativedom::loadImports() // Test loading a file with errors void tst_qdeclarativedom::loadErrors() { - QByteArray qml = "import Qt 4.6\n" + QByteArray qml = "import Qt 4.7\n" "Item {\n" " foo: 12\n" "}"; @@ -400,7 +400,7 @@ void tst_qdeclarativedom::loadErrors() // Test loading a file with syntax errors void tst_qdeclarativedom::loadSyntaxErrors() { - QByteArray qml = "import Qt 4.6\n" + QByteArray qml = "import Qt 4.7\n" "asdf"; QDeclarativeDomDocument document; @@ -415,10 +415,10 @@ void tst_qdeclarativedom::loadSyntaxErrors() QCOMPARE(error.description(), QString("Syntax error")); } -// Test attempting to load a file with remote references +// Test attempting to load a file with remote references void tst_qdeclarativedom::loadRemoteErrors() { - QByteArray qml = "import Qt 4.6\n" + QByteArray qml = "import Qt 4.7\n" "Item {\n" " Script {\n" " source: \"http://localhost/exampleQmlScript.js\"" @@ -440,7 +440,7 @@ void tst_qdeclarativedom::loadRemoteErrors() void tst_qdeclarativedom::loadDynamicProperty() { { - QByteArray qml = "import Qt 4.6\n" + QByteArray qml = "import Qt 4.7\n" "Item {\n" " property int a\n" " property bool b\n" @@ -488,7 +488,7 @@ void tst_qdeclarativedom::loadDynamicProperty() } { - QByteArray qml = "import Qt 4.6\n" + QByteArray qml = "import Qt 4.7\n" "Item {\n" " property int a: 12\n" " property int b: a + 6\n" @@ -502,7 +502,7 @@ void tst_qdeclarativedom::loadDynamicProperty() QVERIFY(rootObject.isValid()); QCOMPARE(rootObject.dynamicProperties().count(), 3); - + { QDeclarativeDomDynamicProperty d = rootObject.dynamicProperties().at(0); QVERIFY(d.isDefaultProperty() == false); @@ -532,7 +532,7 @@ void tst_qdeclarativedom::loadComponent() { // Explicit component { - QByteArray qml = "import Qt 4.6\n" + QByteArray qml = "import Qt 4.7\n" "Item {\n" " Component {\n" " id: myComponent\n" @@ -563,7 +563,7 @@ void tst_qdeclarativedom::loadComponent() QVERIFY(component.isValid()); QVERIFY(component.objectType() == "Qt/Component"); QVERIFY(component.objectTypeMajorVersion() == 4); - QVERIFY(component.objectTypeMinorVersion() == 6); + QVERIFY(component.objectTypeMinorVersion() == 7); QVERIFY(component.objectClassName() == "Component"); QVERIFY(component.objectId() == "myComponent"); QVERIFY(component.properties().isEmpty()); @@ -580,7 +580,7 @@ void tst_qdeclarativedom::loadComponent() // Implicit component { - QByteArray qml = "import Qt 4.6\n" + QByteArray qml = "import Qt 4.7\n" "ListView {\n" " delegate: Item {}\n" "}"; @@ -630,7 +630,7 @@ void tst_qdeclarativedom::object_dynamicProperty() // Valid object, no dynamic properties { - QByteArray qml = "import Qt 4.6\n" + QByteArray qml = "import Qt 4.7\n" "Item {}"; QDeclarativeDomDocument document; @@ -645,7 +645,7 @@ void tst_qdeclarativedom::object_dynamicProperty() // Valid object, dynamic properties { - QByteArray qml = "import Qt 4.6\n" + QByteArray qml = "import Qt 4.7\n" "Item {\n" " property int a\n" "}"; @@ -683,7 +683,7 @@ void tst_qdeclarativedom::object_property() // Valid object - no default { - QByteArray qml = "import Qt 4.6\n" + QByteArray qml = "import Qt 4.7\n" "Item {\n" " x: 10\n" " y: 12\n" @@ -723,7 +723,7 @@ void tst_qdeclarativedom::object_property() // Valid object - with default { - QByteArray qml = "import Qt 4.6\n" + QByteArray qml = "import Qt 4.7\n" "Item {\n" " x: 10\n" " y: 12\n" @@ -760,7 +760,7 @@ void tst_qdeclarativedom::object_property() QVERIFY(y.value().toLiteral().literal() == "12"); QCOMPARE(y.position(), 35); QCOMPARE(y.length(), 1); - + QDeclarativeDomProperty data = rootObject.property("data"); QVERIFY(data.isValid()); QVERIFY(data.propertyName() == "data"); @@ -782,9 +782,9 @@ void tst_qdeclarativedom::object_url() QCOMPARE(object.url(), QUrl()); } - // Valid builtin object + // Valid builtin object { - QByteArray qml = "import Qt 4.6\n" + QByteArray qml = "import Qt 4.7\n" "Item {}"; QDeclarativeDomDocument document; @@ -797,7 +797,7 @@ void tst_qdeclarativedom::object_url() // Valid composite object { - QByteArray qml = "import Qt 4.6\n" + QByteArray qml = "import Qt 4.7\n" "MyItem {}"; QUrl myUrl = QUrl::fromLocalFile(SRCDIR "/data/main.qml"); @@ -815,7 +815,7 @@ void tst_qdeclarativedom::object_url() // Test copy constructors and operators void tst_qdeclarativedom::copy() { - QByteArray qml = "import Qt 4.6\n" + QByteArray qml = "import Qt 4.7\n" "MyItem {\n" " id: myItem\n" " property int a: 10\n" @@ -1029,7 +1029,7 @@ void tst_qdeclarativedom::copy() QDeclarativeDomObject object = document.rootObject(); QDeclarativeDomProperty property = object.property("data"); QCOMPARE(property.value().toList().values().count(), 1); - QDeclarativeDomComponent component = + QDeclarativeDomComponent component = property.value().toList().values().at(0).toObject().toComponent(); QCOMPARE(component.componentRoot().objectClassName(), QByteArray("Item")); @@ -1190,7 +1190,7 @@ void tst_qdeclarativedom::copy() // Tests the position/length of various elements void tst_qdeclarativedom::position() { - QByteArray qml = "import Qt 4.6\n" + QByteArray qml = "import Qt 4.7\n" "Item {\n" " id: myItem\n" " property int a: 10\n" diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/SpuriousWarning.qml b/tests/auto/declarative/qdeclarativeecmascript/data/SpuriousWarning.qml new file mode 100644 index 0000000..86c312c --- /dev/null +++ b/tests/auto/declarative/qdeclarativeecmascript/data/SpuriousWarning.qml @@ -0,0 +1,5 @@ +import Qt 4.6 + +Item { + property int children: root.children.length +} diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/noSpuriousWarningsAtShutdown.2.qml b/tests/auto/declarative/qdeclarativeecmascript/data/noSpuriousWarningsAtShutdown.2.qml new file mode 100644 index 0000000..a762d6d --- /dev/null +++ b/tests/auto/declarative/qdeclarativeecmascript/data/noSpuriousWarningsAtShutdown.2.qml @@ -0,0 +1,10 @@ +import Qt 4.6 + +Item { + id: root + + Item {} + + SpuriousWarning {} +} + diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/noSpuriousWarningsAtShutdown.qml b/tests/auto/declarative/qdeclarativeecmascript/data/noSpuriousWarningsAtShutdown.qml new file mode 100644 index 0000000..a52c772 --- /dev/null +++ b/tests/auto/declarative/qdeclarativeecmascript/data/noSpuriousWarningsAtShutdown.qml @@ -0,0 +1,9 @@ +import Qt 4.6 + +Item { + id: root + + property int childrenCount: root.children.length + + Item {} +} diff --git a/tests/auto/declarative/qdeclarativeecmascript/data/qtbug_9792.qml b/tests/auto/declarative/qdeclarativeecmascript/data/qtbug_9792.qml new file mode 100644 index 0000000..9ac4430 --- /dev/null +++ b/tests/auto/declarative/qdeclarativeecmascript/data/qtbug_9792.qml @@ -0,0 +1,5 @@ +import Qt.test 1.0 + +MyQmlObject { + onBasicSignal: print("Hello world!"); +} diff --git a/tests/auto/declarative/qdeclarativeecmascript/qdeclarativeecmascript.pro b/tests/auto/declarative/qdeclarativeecmascript/qdeclarativeecmascript.pro index 0e21cb2..eabed26 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/qdeclarativeecmascript.pro +++ b/tests/auto/declarative/qdeclarativeecmascript/qdeclarativeecmascript.pro @@ -8,3 +8,6 @@ HEADERS += testtypes.h # QMAKE_CXXFLAGS = -fprofile-arcs -ftest-coverage # LIBS += -lgcov + +CONFIG += parallel_test + diff --git a/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp index c9fb116..35b4d99 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp +++ b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp @@ -141,6 +141,8 @@ private slots: void deletedEngine(); void libraryScriptAssert(); void variantsAssignedUndefined(); + void qtbug_9792(); + void noSpuriousWarningsAtShutdown(); void callQtInvokables(); private: @@ -2211,6 +2213,67 @@ void tst_qdeclarativeecmascript::variantsAssignedUndefined() delete object; } +void tst_qdeclarativeecmascript::qtbug_9792() +{ + QDeclarativeComponent component(&engine, TEST_FILE("qtbug_9792.qml")); + + QDeclarativeContext *context = new QDeclarativeContext(engine.rootContext()); + + MyQmlObject *object = qobject_cast<MyQmlObject*>(component.create(context)); + QVERIFY(object != 0); + + QTest::ignoreMessage(QtDebugMsg, "Hello world!"); + object->basicSignal(); + + delete context; + + transientErrorsMsgCount = 0; + QtMsgHandler old = qInstallMsgHandler(transientErrorsMsgHandler); + + object->basicSignal(); + + qInstallMsgHandler(old); + + QCOMPARE(transientErrorsMsgCount, 0); + + delete object; +} + +// Test that we shut down without stupid warnings +void tst_qdeclarativeecmascript::noSpuriousWarningsAtShutdown() +{ + { + QDeclarativeComponent component(&engine, TEST_FILE("noSpuriousWarningsAtShutdown.qml")); + + QObject *o = component.create(); + + transientErrorsMsgCount = 0; + QtMsgHandler old = qInstallMsgHandler(transientErrorsMsgHandler); + + delete o; + + qInstallMsgHandler(old); + + QCOMPARE(transientErrorsMsgCount, 0); + } + + + { + QDeclarativeComponent component(&engine, TEST_FILE("noSpuriousWarningsAtShutdown.2.qml")); + + QObject *o = component.create(); + + transientErrorsMsgCount = 0; + QtMsgHandler old = qInstallMsgHandler(transientErrorsMsgHandler); + + delete o; + + qInstallMsgHandler(old); + + QCOMPARE(transientErrorsMsgCount, 0); + } +} + QTEST_MAIN(tst_qdeclarativeecmascript) #include "tst_qdeclarativeecmascript.moc" diff --git a/tests/auto/declarative/qdeclarativeengine/qdeclarativeengine.pro b/tests/auto/declarative/qdeclarativeengine/qdeclarativeengine.pro index 5b6530d..e0ea2e5 100644 --- a/tests/auto/declarative/qdeclarativeengine/qdeclarativeengine.pro +++ b/tests/auto/declarative/qdeclarativeengine/qdeclarativeengine.pro @@ -6,3 +6,6 @@ SOURCES += tst_qdeclarativeengine.cpp # Define SRCDIR equal to test's source directory DEFINES += SRCDIR=\\\"$$PWD\\\" + +CONFIG += parallel_test + diff --git a/tests/auto/declarative/qdeclarativeengine/tst_qdeclarativeengine.cpp b/tests/auto/declarative/qdeclarativeengine/tst_qdeclarativeengine.cpp index 5dc5f19..5d8a52d 100644 --- a/tests/auto/declarative/qdeclarativeengine/tst_qdeclarativeengine.cpp +++ b/tests/auto/declarative/qdeclarativeengine/tst_qdeclarativeengine.cpp @@ -192,7 +192,7 @@ void tst_qdeclarativeengine::clearComponentCache() { QFile file("temp.qml"); QVERIFY(file.open(QIODevice::WriteOnly)); - file.write("import Qt 4.6\nQtObject {\nproperty int test: 10\n}\n"); + file.write("import Qt 4.7\nQtObject {\nproperty int test: 10\n}\n"); file.close(); } @@ -209,7 +209,7 @@ void tst_qdeclarativeengine::clearComponentCache() { QFile file("temp.qml"); QVERIFY(file.open(QIODevice::WriteOnly)); - file.write("import Qt 4.6\nQtObject {\nproperty int test: 11\n}\n"); + file.write("import Qt 4.7\nQtObject {\nproperty int test: 11\n}\n"); file.close(); } diff --git a/tests/auto/declarative/qdeclarativeerror/qdeclarativeerror.pro b/tests/auto/declarative/qdeclarativeerror/qdeclarativeerror.pro index 6591406..501f32c 100644 --- a/tests/auto/declarative/qdeclarativeerror/qdeclarativeerror.pro +++ b/tests/auto/declarative/qdeclarativeerror/qdeclarativeerror.pro @@ -4,3 +4,6 @@ SOURCES += tst_qdeclarativeerror.cpp macx:CONFIG -= app_bundle DEFINES += SRCDIR=\\\"$$PWD\\\" + +CONFIG += parallel_test + diff --git a/tests/auto/declarative/qdeclarativeflickable/qdeclarativeflickable.pro b/tests/auto/declarative/qdeclarativeflickable/qdeclarativeflickable.pro index 4b71381..07637c9 100644 --- a/tests/auto/declarative/qdeclarativeflickable/qdeclarativeflickable.pro +++ b/tests/auto/declarative/qdeclarativeflickable/qdeclarativeflickable.pro @@ -6,3 +6,6 @@ SOURCES += tst_qdeclarativeflickable.cpp # Define SRCDIR equal to test's source directory DEFINES += SRCDIR=\\\"$$PWD\\\" + +CONFIG += parallel_test + diff --git a/tests/auto/declarative/qdeclarativeflickable/tst_qdeclarativeflickable.cpp b/tests/auto/declarative/qdeclarativeflickable/tst_qdeclarativeflickable.cpp index cb87977..a345a60 100644 --- a/tests/auto/declarative/qdeclarativeflickable/tst_qdeclarativeflickable.cpp +++ b/tests/auto/declarative/qdeclarativeflickable/tst_qdeclarativeflickable.cpp @@ -147,7 +147,7 @@ void tst_qdeclarativeflickable::properties() void tst_qdeclarativeflickable::overShoot() { QDeclarativeComponent component(&engine); - component.setData("import Qt 4.6; Flickable { overShoot: false; }", QUrl::fromLocalFile("")); + component.setData("import Qt 4.7; Flickable { overShoot: false; }", QUrl::fromLocalFile("")); QDeclarativeFlickable *flickable = qobject_cast<QDeclarativeFlickable*>(component.create()); QSignalSpy spy(flickable, SIGNAL(overShootChanged())); @@ -170,7 +170,7 @@ void tst_qdeclarativeflickable::overShoot() void tst_qdeclarativeflickable::maximumFlickVelocity() { QDeclarativeComponent component(&engine); - component.setData("import Qt 4.6; Flickable { maximumFlickVelocity: 1.0; }", QUrl::fromLocalFile("")); + component.setData("import Qt 4.7; Flickable { maximumFlickVelocity: 1.0; }", QUrl::fromLocalFile("")); QDeclarativeFlickable *flickable = qobject_cast<QDeclarativeFlickable*>(component.create()); QSignalSpy spy(flickable, SIGNAL(maximumFlickVelocityChanged())); @@ -187,7 +187,7 @@ void tst_qdeclarativeflickable::maximumFlickVelocity() void tst_qdeclarativeflickable::flickDeceleration() { QDeclarativeComponent component(&engine); - component.setData("import Qt 4.6; Flickable { flickDeceleration: 1.0; }", QUrl::fromLocalFile("")); + component.setData("import Qt 4.7; Flickable { flickDeceleration: 1.0; }", QUrl::fromLocalFile("")); QDeclarativeFlickable *flickable = qobject_cast<QDeclarativeFlickable*>(component.create()); QSignalSpy spy(flickable, SIGNAL(flickDecelerationChanged())); @@ -204,7 +204,7 @@ void tst_qdeclarativeflickable::flickDeceleration() void tst_qdeclarativeflickable::pressDelay() { QDeclarativeComponent component(&engine); - component.setData("import Qt 4.6; Flickable { pressDelay: 100; }", QUrl::fromLocalFile("")); + component.setData("import Qt 4.7; Flickable { pressDelay: 100; }", QUrl::fromLocalFile("")); QDeclarativeFlickable *flickable = qobject_cast<QDeclarativeFlickable*>(component.create()); QSignalSpy spy(flickable, SIGNAL(pressDelayChanged())); diff --git a/tests/auto/declarative/qdeclarativeflipable/qdeclarativeflipable.pro b/tests/auto/declarative/qdeclarativeflipable/qdeclarativeflipable.pro index e29d324..9830b55 100644 --- a/tests/auto/declarative/qdeclarativeflipable/qdeclarativeflipable.pro +++ b/tests/auto/declarative/qdeclarativeflipable/qdeclarativeflipable.pro @@ -6,3 +6,6 @@ SOURCES += tst_qdeclarativeflipable.cpp # Define SRCDIR equal to test's source directory DEFINES += SRCDIR=\\\"$$PWD\\\" + +CONFIG += parallel_test + diff --git a/tests/auto/declarative/qdeclarativefocusscope/qdeclarativefocusscope.pro b/tests/auto/declarative/qdeclarativefocusscope/qdeclarativefocusscope.pro index 4d7a9b3..687c80c 100644 --- a/tests/auto/declarative/qdeclarativefocusscope/qdeclarativefocusscope.pro +++ b/tests/auto/declarative/qdeclarativefocusscope/qdeclarativefocusscope.pro @@ -4,3 +4,4 @@ SOURCES += tst_qdeclarativefocusscope.cpp macx:CONFIG -= app_bundle DEFINES += SRCDIR=\\\"$$PWD\\\" + diff --git a/tests/auto/declarative/qdeclarativefontloader/qdeclarativefontloader.pro b/tests/auto/declarative/qdeclarativefontloader/qdeclarativefontloader.pro index 3ba50be..9a8a3ff 100644 --- a/tests/auto/declarative/qdeclarativefontloader/qdeclarativefontloader.pro +++ b/tests/auto/declarative/qdeclarativefontloader/qdeclarativefontloader.pro @@ -7,3 +7,6 @@ SOURCES += tst_qdeclarativefontloader.cpp ../shared/testhttpserver.cpp # Define SRCDIR equal to test's source directory DEFINES += SRCDIR=\\\"$$PWD\\\" + +CONFIG += parallel_test + diff --git a/tests/auto/declarative/qdeclarativefontloader/tst_qdeclarativefontloader.cpp b/tests/auto/declarative/qdeclarativefontloader/tst_qdeclarativefontloader.cpp index 375e801..5cdc96c 100644 --- a/tests/auto/declarative/qdeclarativefontloader/tst_qdeclarativefontloader.cpp +++ b/tests/auto/declarative/qdeclarativefontloader/tst_qdeclarativefontloader.cpp @@ -45,7 +45,7 @@ #include "../../../shared/util.h" #include "../shared/testhttpserver.h" -#define SERVER_PORT 14445 +#define SERVER_PORT 14448 class tst_qdeclarativefontloader : public QObject @@ -79,7 +79,7 @@ tst_qdeclarativefontloader::tst_qdeclarativefontloader() : void tst_qdeclarativefontloader::noFont() { - QString componentStr = "import Qt 4.6\nFontLoader { }"; + QString componentStr = "import Qt 4.7\nFontLoader { }"; QDeclarativeComponent component(&engine); component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeFontLoader *fontObject = qobject_cast<QDeclarativeFontLoader*>(component.create()); @@ -94,7 +94,7 @@ void tst_qdeclarativefontloader::noFont() void tst_qdeclarativefontloader::namedFont() { - QString componentStr = "import Qt 4.6\nFontLoader { name: \"Helvetica\" }"; + QString componentStr = "import Qt 4.7\nFontLoader { name: \"Helvetica\" }"; QDeclarativeComponent component(&engine); component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeFontLoader *fontObject = qobject_cast<QDeclarativeFontLoader*>(component.create()); @@ -107,7 +107,7 @@ void tst_qdeclarativefontloader::namedFont() void tst_qdeclarativefontloader::localFont() { - QString componentStr = "import Qt 4.6\nFontLoader { source: \"" SRCDIR "/data/tarzeau_ocr_a.ttf\" }"; + QString componentStr = "import Qt 4.7\nFontLoader { source: \"" SRCDIR "/data/tarzeau_ocr_a.ttf\" }"; QDeclarativeComponent component(&engine); component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeFontLoader *fontObject = qobject_cast<QDeclarativeFontLoader*>(component.create()); @@ -120,7 +120,7 @@ void tst_qdeclarativefontloader::localFont() void tst_qdeclarativefontloader::failLocalFont() { - QString componentStr = "import Qt 4.6\nFontLoader { source: \"" + QUrl::fromLocalFile(SRCDIR "/data/dummy.ttf").toString() + "\" }"; + QString componentStr = "import Qt 4.7\nFontLoader { source: \"" + QUrl::fromLocalFile(SRCDIR "/data/dummy.ttf").toString() + "\" }"; QTest::ignoreMessage(QtWarningMsg, QString("Cannot load font: QUrl( \"" + QUrl::fromLocalFile(SRCDIR "/data/dummy.ttf").toString() + "\" ) ").toUtf8().constData()); QDeclarativeComponent component(&engine); component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); @@ -134,7 +134,7 @@ void tst_qdeclarativefontloader::failLocalFont() void tst_qdeclarativefontloader::webFont() { - QString componentStr = "import Qt 4.6\nFontLoader { source: \"http://localhost:14445/tarzeau_ocr_a.ttf\" }"; + QString componentStr = "import Qt 4.7\nFontLoader { source: \"http://localhost:14448/tarzeau_ocr_a.ttf\" }"; QDeclarativeComponent component(&engine); component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); @@ -150,7 +150,7 @@ void tst_qdeclarativefontloader::redirWebFont() { server.addRedirect("olddir/oldname.ttf","../tarzeau_ocr_a.ttf"); - QString componentStr = "import Qt 4.6\nFontLoader { source: \"http://localhost:14445/olddir/oldname.ttf\" }"; + QString componentStr = "import Qt 4.7\nFontLoader { source: \"http://localhost:14448/olddir/oldname.ttf\" }"; QDeclarativeComponent component(&engine); component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); @@ -164,8 +164,8 @@ void tst_qdeclarativefontloader::redirWebFont() void tst_qdeclarativefontloader::failWebFont() { - QString componentStr = "import Qt 4.6\nFontLoader { source: \"http://localhost:14445/nonexist.ttf\" }"; - QTest::ignoreMessage(QtWarningMsg, "Cannot load font: QUrl( \"http://localhost:14445/nonexist.ttf\" ) "); + QString componentStr = "import Qt 4.7\nFontLoader { source: \"http://localhost:14448/nonexist.ttf\" }"; + QTest::ignoreMessage(QtWarningMsg, "Cannot load font: QUrl( \"http://localhost:14448/nonexist.ttf\" ) "); QDeclarativeComponent component(&engine); component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeFontLoader *fontObject = qobject_cast<QDeclarativeFontLoader*>(component.create()); diff --git a/tests/auto/declarative/qdeclarativegridview/qdeclarativegridview.pro b/tests/auto/declarative/qdeclarativegridview/qdeclarativegridview.pro index af206d7..b069260 100644 --- a/tests/auto/declarative/qdeclarativegridview/qdeclarativegridview.pro +++ b/tests/auto/declarative/qdeclarativegridview/qdeclarativegridview.pro @@ -6,3 +6,6 @@ SOURCES += tst_qdeclarativegridview.cpp # Define SRCDIR equal to test's source directory DEFINES += SRCDIR=\\\"$$PWD\\\" + +CONFIG += parallel_test + diff --git a/tests/auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp b/tests/auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp index 7add9c6..89be151 100644 --- a/tests/auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp +++ b/tests/auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp @@ -50,6 +50,7 @@ #include <QtDeclarative/private/qdeclarativegridview_p.h> #include <QtDeclarative/private/qdeclarativetext_p.h> #include <QtDeclarative/private/qdeclarativelistmodel_p.h> +#include "../../../shared/util.h" class tst_QDeclarativeGridView : public QObject { @@ -169,21 +170,21 @@ void tst_QDeclarativeGridView::items() qApp->processEvents(); QDeclarativeGridView *gridview = findItem<QDeclarativeGridView>(canvas->rootObject(), "grid"); - QVERIFY(gridview != 0); + QTRY_VERIFY(gridview != 0); QDeclarativeItem *viewport = gridview->viewport(); - QVERIFY(viewport != 0); + QTRY_VERIFY(viewport != 0); - QCOMPARE(gridview->count(), model.count()); - QCOMPARE(viewport->childItems().count(), model.count()+1); // assumes all are visible, +1 for the (default) highlight item + QTRY_COMPARE(gridview->count(), model.count()); + QTRY_COMPARE(viewport->childItems().count(), model.count()+1); // assumes all are visible, +1 for the (default) highlight item for (int i = 0; i < model.count(); ++i) { QDeclarativeText *name = findItem<QDeclarativeText>(viewport, "textName", i); - QVERIFY(name != 0); - QCOMPARE(name->text(), model.name(i)); + QTRY_VERIFY(name != 0); + QTRY_COMPARE(name->text(), model.name(i)); QDeclarativeText *number = findItem<QDeclarativeText>(viewport, "textNumber", i); - QVERIFY(number != 0); - QCOMPARE(number->text(), model.number(i)); + QTRY_VERIFY(number != 0); + QTRY_COMPARE(number->text(), model.number(i)); } // set an empty model and confirm that items are destroyed @@ -191,7 +192,7 @@ void tst_QDeclarativeGridView::items() ctxt->setContextProperty("testModel", &model2); int itemCount = findItems<QDeclarativeItem>(viewport, "wrapper").count(); - QVERIFY(itemCount == 0); + QTRY_VERIFY(itemCount == 0); delete canvas; } @@ -217,18 +218,18 @@ void tst_QDeclarativeGridView::changed() qApp->processEvents(); QDeclarativeFlickable *gridview = findItem<QDeclarativeFlickable>(canvas->rootObject(), "grid"); - QVERIFY(gridview != 0); + QTRY_VERIFY(gridview != 0); QDeclarativeItem *viewport = gridview->viewport(); - QVERIFY(viewport != 0); + QTRY_VERIFY(viewport != 0); model.modifyItem(1, "Will", "9876"); QDeclarativeText *name = findItem<QDeclarativeText>(viewport, "textName", 1); - QVERIFY(name != 0); - QCOMPARE(name->text(), model.name(1)); + QTRY_VERIFY(name != 0); + QTRY_COMPARE(name->text(), model.name(1)); QDeclarativeText *number = findItem<QDeclarativeText>(viewport, "textNumber", 1); - QVERIFY(number != 0); - QCOMPARE(number->text(), model.number(1)); + QTRY_VERIFY(number != 0); + QTRY_COMPARE(number->text(), model.number(1)); delete canvas; } @@ -250,71 +251,62 @@ void tst_QDeclarativeGridView::inserted() qApp->processEvents(); QDeclarativeGridView *gridview = findItem<QDeclarativeGridView>(canvas->rootObject(), "grid"); - QVERIFY(gridview != 0); + QTRY_VERIFY(gridview != 0); QDeclarativeItem *viewport = gridview->viewport(); - QVERIFY(viewport != 0); + QTRY_VERIFY(viewport != 0); model.insertItem(1, "Will", "9876"); - // let transitions settle. - QTest::qWait(100); - - QCOMPARE(viewport->childItems().count(), model.count()+1); // assumes all are visible, +1 for the (default) highlight item + QTRY_COMPARE(viewport->childItems().count(), model.count()+1); // assumes all are visible, +1 for the (default) highlight item QDeclarativeText *name = findItem<QDeclarativeText>(viewport, "textName", 1); - QVERIFY(name != 0); - QCOMPARE(name->text(), model.name(1)); + QTRY_VERIFY(name != 0); + QTRY_COMPARE(name->text(), model.name(1)); QDeclarativeText *number = findItem<QDeclarativeText>(viewport, "textNumber", 1); - QVERIFY(number != 0); - QCOMPARE(number->text(), model.number(1)); + QTRY_VERIFY(number != 0); + QTRY_COMPARE(number->text(), model.number(1)); // Checks that onAdd is called int added = canvas->rootObject()->property("added").toInt(); - QCOMPARE(added, 1); + QTRY_COMPARE(added, 1); // Confirm items positioned correctly for (int i = 0; i < model.count(); ++i) { QDeclarativeItem *item = findItem<QDeclarativeItem>(viewport, "wrapper", i); - QCOMPARE(item->x(), (i%3)*80.0); - QCOMPARE(item->y(), (i/3)*60.0); + QTRY_COMPARE(item->x(), (i%3)*80.0); + QTRY_COMPARE(item->y(), (i/3)*60.0); } model.insertItem(0, "Foo", "1111"); // zero index, and current item - // let transitions settle. - QTest::qWait(100); - - QCOMPARE(viewport->childItems().count(), model.count()+1); // assumes all are visible, +1 for the (default) highlight item + QTRY_COMPARE(viewport->childItems().count(), model.count()+1); // assumes all are visible, +1 for the (default) highlight item name = findItem<QDeclarativeText>(viewport, "textName", 0); - QVERIFY(name != 0); - QCOMPARE(name->text(), model.name(0)); + QTRY_VERIFY(name != 0); + QTRY_COMPARE(name->text(), model.name(0)); number = findItem<QDeclarativeText>(viewport, "textNumber", 0); - QVERIFY(number != 0); - QCOMPARE(number->text(), model.number(0)); + QTRY_VERIFY(number != 0); + QTRY_COMPARE(number->text(), model.number(0)); - QCOMPARE(gridview->currentIndex(), 1); + QTRY_COMPARE(gridview->currentIndex(), 1); // Confirm items positioned correctly for (int i = 0; i < model.count(); ++i) { QDeclarativeItem *item = findItem<QDeclarativeItem>(viewport, "wrapper", i); - QVERIFY(item->x() == (i%3)*80); - QVERIFY(item->y() == (i/3)*60); + QTRY_VERIFY(item->x() == (i%3)*80); + QTRY_VERIFY(item->y() == (i/3)*60); } for (int i = model.count(); i < 30; ++i) model.insertItem(i, "Hello", QString::number(i)); - QTest::qWait(100); gridview->setContentY(120); - QTest::qWait(100); // Insert item outside visible area model.insertItem(1, "Hello", "1324"); - QTest::qWait(100); - QVERIFY(gridview->contentY() == 120); + QTRY_VERIFY(gridview->contentY() == 120); delete canvas; } @@ -335,107 +327,91 @@ void tst_QDeclarativeGridView::removed() qApp->processEvents(); QDeclarativeGridView *gridview = findItem<QDeclarativeGridView>(canvas->rootObject(), "grid"); - QVERIFY(gridview != 0); + QTRY_VERIFY(gridview != 0); QDeclarativeItem *viewport = gridview->viewport(); - QVERIFY(viewport != 0); + QTRY_VERIFY(viewport != 0); model.removeItem(1); - // let transitions settle. - QTest::qWait(100); - QDeclarativeText *name = findItem<QDeclarativeText>(viewport, "textName", 1); - QVERIFY(name != 0); - QCOMPARE(name->text(), model.name(1)); + QTRY_VERIFY(name != 0); + QTRY_COMPARE(name->text(), model.name(1)); QDeclarativeText *number = findItem<QDeclarativeText>(viewport, "textNumber", 1); - QVERIFY(number != 0); - QCOMPARE(number->text(), model.number(1)); + QTRY_VERIFY(number != 0); + QTRY_COMPARE(number->text(), model.number(1)); // Checks that onRemove is called QString removed = canvas->rootObject()->property("removed").toString(); - QCOMPARE(removed, QString("Item1")); + QTRY_COMPARE(removed, QString("Item1")); // Confirm items positioned correctly int itemCount = findItems<QDeclarativeItem>(viewport, "wrapper").count(); for (int i = 0; i < model.count() && i < itemCount; ++i) { QDeclarativeItem *item = findItem<QDeclarativeItem>(viewport, "wrapper", i); if (!item) qWarning() << "Item" << i << "not found"; - QVERIFY(item); - QVERIFY(item->x() == (i%3)*80); - QVERIFY(item->y() == (i/3)*60); + QTRY_VERIFY(item); + QTRY_VERIFY(item->x() == (i%3)*80); + QTRY_VERIFY(item->y() == (i/3)*60); } // Remove first item (which is the current item); model.removeItem(0); - // let transitions settle. - QTest::qWait(100); - name = findItem<QDeclarativeText>(viewport, "textName", 0); - QVERIFY(name != 0); - QCOMPARE(name->text(), model.name(0)); + QTRY_VERIFY(name != 0); + QTRY_COMPARE(name->text(), model.name(0)); number = findItem<QDeclarativeText>(viewport, "textNumber", 0); - QVERIFY(number != 0); - QCOMPARE(number->text(), model.number(0)); + QTRY_VERIFY(number != 0); + QTRY_COMPARE(number->text(), model.number(0)); // Confirm items positioned correctly itemCount = findItems<QDeclarativeItem>(viewport, "wrapper").count(); for (int i = 0; i < model.count() && i < itemCount; ++i) { QDeclarativeItem *item = findItem<QDeclarativeItem>(viewport, "wrapper", i); if (!item) qWarning() << "Item" << i << "not found"; - QVERIFY(item); - QVERIFY(item->x() == (i%3)*80); - QVERIFY(item->y() == (i/3)*60); + QTRY_VERIFY(item); + QTRY_VERIFY(item->x() == (i%3)*80); + QTRY_VERIFY(item->y() == (i/3)*60); } // Remove items not visible model.removeItem(25); - // let transitions settle. - QTest::qWait(100); // Confirm items positioned correctly itemCount = findItems<QDeclarativeItem>(viewport, "wrapper").count(); for (int i = 0; i < model.count() && i < itemCount; ++i) { QDeclarativeItem *item = findItem<QDeclarativeItem>(viewport, "wrapper", i); if (!item) qWarning() << "Item" << i << "not found"; - QVERIFY(item); - QVERIFY(item->x() == (i%3)*80); - QVERIFY(item->y() == (i/3)*60); + QTRY_VERIFY(item); + QTRY_VERIFY(item->x() == (i%3)*80); + QTRY_VERIFY(item->y() == (i/3)*60); } // Remove items before visible gridview->setContentY(120); - QTest::qWait(100); gridview->setCurrentIndex(10); - // let transitions settle. - QTest::qWait(100); - // Setting currentIndex above shouldn't cause view to scroll - QCOMPARE(gridview->contentY(), 120.0); + QTRY_COMPARE(gridview->contentY(), 120.0); model.removeItem(1); - // let transitions settle. - QTest::qWait(100); - // Confirm items positioned correctly for (int i = 6; i < 18; ++i) { QDeclarativeItem *item = findItem<QDeclarativeItem>(viewport, "wrapper", i); if (!item) qWarning() << "Item" << i << "not found"; - QVERIFY(item); - QVERIFY(item->x() == (i%3)*80); - QVERIFY(item->y() == (i/3)*60); + QTRY_VERIFY(item); + QTRY_VERIFY(item->x() == (i%3)*80); + QTRY_VERIFY(item->y() == (i/3)*60); } // Remove currentIndex QDeclarativeItem *oldCurrent = gridview->currentItem(); model.removeItem(9); - QTest::qWait(100); - QCOMPARE(gridview->currentIndex(), 9); - QVERIFY(gridview->currentItem() != oldCurrent); + QTRY_COMPARE(gridview->currentIndex(), 9); + QTRY_VERIFY(gridview->currentItem() != oldCurrent); gridview->setContentY(0); // let transitions settle. @@ -446,39 +422,34 @@ void tst_QDeclarativeGridView::removed() for (int i = 0; i < model.count() && i < itemCount; ++i) { QDeclarativeItem *item = findItem<QDeclarativeItem>(viewport, "wrapper", i); if (!item) qWarning() << "Item" << i << "not found"; - QVERIFY(item); - QVERIFY(item->x() == (i%3)*80); - QVERIFY(item->y() == (i/3)*60); + QTRY_VERIFY(item); + QTRY_VERIFY(item->x() == (i%3)*80); + QTRY_VERIFY(item->y() == (i/3)*60); } // remove item outside current view. gridview->setCurrentIndex(32); - QTest::qWait(100); gridview->setContentY(240); model.removeItem(30); - QVERIFY(gridview->currentIndex() == 31); + QTRY_VERIFY(gridview->currentIndex() == 31); // remove current item beyond visible items. gridview->setCurrentIndex(20); - QTest::qWait(100); gridview->setContentY(0); model.removeItem(20); - QTest::qWait(100); - QCOMPARE(gridview->currentIndex(), 20); - QVERIFY(gridview->currentItem() != 0); + QTRY_COMPARE(gridview->currentIndex(), 20); + QTRY_VERIFY(gridview->currentItem() != 0); // remove item before current, but visible gridview->setCurrentIndex(8); - QTest::qWait(100); gridview->setContentY(240); oldCurrent = gridview->currentItem(); model.removeItem(6); - QTest::qWait(100); - QCOMPARE(gridview->currentIndex(), 7); - QVERIFY(gridview->currentItem() == oldCurrent); + QTRY_COMPARE(gridview->currentIndex(), 7); + QTRY_VERIFY(gridview->currentItem() == oldCurrent); delete canvas; } @@ -499,38 +470,35 @@ void tst_QDeclarativeGridView::moved() qApp->processEvents(); QDeclarativeGridView *gridview = findItem<QDeclarativeGridView>(canvas->rootObject(), "grid"); - QVERIFY(gridview != 0); + QTRY_VERIFY(gridview != 0); QDeclarativeItem *viewport = gridview->viewport(); - QVERIFY(viewport != 0); + QTRY_VERIFY(viewport != 0); model.moveItem(1, 8); - // let transitions settle. - QTest::qWait(100); - QDeclarativeText *name = findItem<QDeclarativeText>(viewport, "textName", 1); - QVERIFY(name != 0); - QCOMPARE(name->text(), model.name(1)); + QTRY_VERIFY(name != 0); + QTRY_COMPARE(name->text(), model.name(1)); QDeclarativeText *number = findItem<QDeclarativeText>(viewport, "textNumber", 1); - QVERIFY(number != 0); - QCOMPARE(number->text(), model.number(1)); + QTRY_VERIFY(number != 0); + QTRY_COMPARE(number->text(), model.number(1)); name = findItem<QDeclarativeText>(viewport, "textName", 8); - QVERIFY(name != 0); - QCOMPARE(name->text(), model.name(8)); + QTRY_VERIFY(name != 0); + QTRY_COMPARE(name->text(), model.name(8)); number = findItem<QDeclarativeText>(viewport, "textNumber", 8); - QVERIFY(number != 0); - QCOMPARE(number->text(), model.number(8)); + QTRY_VERIFY(number != 0); + QTRY_COMPARE(number->text(), model.number(8)); // Confirm items positioned correctly int itemCount = findItems<QDeclarativeItem>(viewport, "wrapper").count(); for (int i = 0; i < model.count() && i < itemCount; ++i) { QDeclarativeItem *item = findItem<QDeclarativeItem>(viewport, "wrapper", i); if (!item) qWarning() << "Item" << i << "not found"; - QVERIFY(item); - QVERIFY(item->x() == (i%3)*80); - QVERIFY(item->y() == (i/3)*60); + QTRY_VERIFY(item); + QTRY_VERIFY(item->x() == (i%3)*80); + QTRY_VERIFY(item->y() == (i/3)*60); } gridview->setContentY(120); @@ -538,50 +506,44 @@ void tst_QDeclarativeGridView::moved() // move outside visible area model.moveItem(1, 25); - // let transitions settle. - QTest::qWait(100); - // Confirm items positioned correctly and indexes correct itemCount = findItems<QDeclarativeItem>(viewport, "wrapper").count()-1; for (int i = 6; i < model.count()-6 && i < itemCount+6; ++i) { QDeclarativeItem *item = findItem<QDeclarativeItem>(viewport, "wrapper", i); if (!item) qWarning() << "Item" << i << "not found"; - QVERIFY(item); - QCOMPARE(item->x(), qreal((i%3)*80)); - QCOMPARE(item->y(), qreal((i/3)*60)); + QTRY_VERIFY(item); + QTRY_COMPARE(item->x(), qreal((i%3)*80)); + QTRY_COMPARE(item->y(), qreal((i/3)*60)); name = findItem<QDeclarativeText>(viewport, "textName", i); - QVERIFY(name != 0); - QCOMPARE(name->text(), model.name(i)); + QTRY_VERIFY(name != 0); + QTRY_COMPARE(name->text(), model.name(i)); number = findItem<QDeclarativeText>(viewport, "textNumber", i); - QVERIFY(number != 0); - QCOMPARE(number->text(), model.number(i)); + QTRY_VERIFY(number != 0); + QTRY_COMPARE(number->text(), model.number(i)); } // move from outside visible into visible model.moveItem(28, 8); - // let transitions settle. - QTest::qWait(100); - // Confirm items positioned correctly and indexes correct for (int i = 6; i < model.count()-6 && i < itemCount+6; ++i) { QDeclarativeItem *item = findItem<QDeclarativeItem>(viewport, "wrapper", i); if (!item) qWarning() << "Item" << i << "not found"; - QVERIFY(item); - QVERIFY(item->x() == (i%3)*80); - QVERIFY(item->y() == (i/3)*60); + QTRY_VERIFY(item); + QTRY_VERIFY(item->x() == (i%3)*80); + QTRY_VERIFY(item->y() == (i/3)*60); name = findItem<QDeclarativeText>(viewport, "textName", i); - QVERIFY(name != 0); - QCOMPARE(name->text(), model.name(i)); + QTRY_VERIFY(name != 0); + QTRY_COMPARE(name->text(), model.name(i)); number = findItem<QDeclarativeText>(viewport, "textNumber", i); - QVERIFY(number != 0); - QCOMPARE(number->text(), model.number(i)); + QTRY_VERIFY(number != 0); + QTRY_COMPARE(number->text(), model.number(i)); } // ensure content position is stable gridview->setContentY(0); model.moveItem(10, 0); - QVERIFY(gridview->contentY() == 0); + QTRY_VERIFY(gridview->contentY() == 0); delete canvas; } @@ -604,65 +566,59 @@ void tst_QDeclarativeGridView::currentIndex() qApp->processEvents(); QDeclarativeGridView *gridview = findItem<QDeclarativeGridView>(canvas->rootObject(), "grid"); - QVERIFY(gridview != 0); + QTRY_VERIFY(gridview != 0); QDeclarativeItem *viewport = gridview->viewport(); - QVERIFY(viewport != 0); - - QTest::qWait(300); + QTRY_VERIFY(viewport != 0); // current item should be third item - QCOMPARE(gridview->currentIndex(), 5); - QCOMPARE(gridview->currentItem(), findItem<QDeclarativeItem>(viewport, "wrapper", 5)); - QCOMPARE(gridview->currentItem()->y(), gridview->highlightItem()->y()); + QTRY_COMPARE(gridview->currentIndex(), 5); + QTRY_COMPARE(gridview->currentItem(), findItem<QDeclarativeItem>(viewport, "wrapper", 5)); + QTRY_COMPARE(gridview->currentItem()->y(), gridview->highlightItem()->y()); gridview->moveCurrentIndexRight(); - QCOMPARE(gridview->currentIndex(), 6); + QTRY_COMPARE(gridview->currentIndex(), 6); gridview->moveCurrentIndexDown(); - QCOMPARE(gridview->currentIndex(), 9); + QTRY_COMPARE(gridview->currentIndex(), 9); gridview->moveCurrentIndexUp(); - QCOMPARE(gridview->currentIndex(), 6); + QTRY_COMPARE(gridview->currentIndex(), 6); gridview->moveCurrentIndexLeft(); - QCOMPARE(gridview->currentIndex(), 5); + QTRY_COMPARE(gridview->currentIndex(), 5); // no wrap gridview->setCurrentIndex(0); - QCOMPARE(gridview->currentIndex(), 0); + QTRY_COMPARE(gridview->currentIndex(), 0); gridview->moveCurrentIndexUp(); - QCOMPARE(gridview->currentIndex(), 0); + QTRY_COMPARE(gridview->currentIndex(), 0); gridview->moveCurrentIndexLeft(); - QCOMPARE(gridview->currentIndex(), 0); + QTRY_COMPARE(gridview->currentIndex(), 0); gridview->setCurrentIndex(model.count()-1); - QTest::qWait(100); - QCOMPARE(gridview->currentIndex(), model.count()-1); + QTRY_COMPARE(gridview->currentIndex(), model.count()-1); gridview->moveCurrentIndexRight(); - QCOMPARE(gridview->currentIndex(), model.count()-1); + QTRY_COMPARE(gridview->currentIndex(), model.count()-1); gridview->moveCurrentIndexDown(); - QCOMPARE(gridview->currentIndex(), model.count()-1); + QTRY_COMPARE(gridview->currentIndex(), model.count()-1); // with wrap gridview->setWrapEnabled(true); gridview->setCurrentIndex(0); - QCOMPARE(gridview->currentIndex(), 0); - QTest::qWait(500); + QTRY_COMPARE(gridview->currentIndex(), 0); gridview->moveCurrentIndexLeft(); - QCOMPARE(gridview->currentIndex(), model.count()-1); + QTRY_COMPARE(gridview->currentIndex(), model.count()-1); - QTest::qWait(500); - QCOMPARE(gridview->contentY(), 279.0); + QTRY_COMPARE(gridview->contentY(), 279.0); gridview->moveCurrentIndexRight(); - QCOMPARE(gridview->currentIndex(), 0); + QTRY_COMPARE(gridview->currentIndex(), 0); - QTest::qWait(500); - QCOMPARE(gridview->contentY(), 0.0); + QTRY_COMPARE(gridview->contentY(), 0.0); // Test keys canvas->show(); @@ -671,47 +627,46 @@ void tst_QDeclarativeGridView::currentIndex() // to be safe and avoid failing setFocus with window managers qt_x11_wait_for_window_manager(canvas); #endif - QVERIFY(canvas->hasFocus()); - QVERIFY(canvas->scene()->hasFocus()); + QTRY_VERIFY(canvas->hasFocus()); + QTRY_VERIFY(canvas->scene()->hasFocus()); qApp->processEvents(); QTest::keyClick(canvas, Qt::Key_Down); - QCOMPARE(gridview->currentIndex(), 3); + QTRY_COMPARE(gridview->currentIndex(), 3); QTest::keyClick(canvas, Qt::Key_Up); - QCOMPARE(gridview->currentIndex(), 0); + QTRY_COMPARE(gridview->currentIndex(), 0); gridview->setFlow(QDeclarativeGridView::TopToBottom); QTest::keyClick(canvas, Qt::Key_Right); - QCOMPARE(gridview->currentIndex(), 5); + QTRY_COMPARE(gridview->currentIndex(), 5); QTest::keyClick(canvas, Qt::Key_Left); - QCOMPARE(gridview->currentIndex(), 0); + QTRY_COMPARE(gridview->currentIndex(), 0); QTest::keyClick(canvas, Qt::Key_Down); - QCOMPARE(gridview->currentIndex(), 1); + QTRY_COMPARE(gridview->currentIndex(), 1); QTest::keyClick(canvas, Qt::Key_Up); - QCOMPARE(gridview->currentIndex(), 0); + QTRY_COMPARE(gridview->currentIndex(), 0); // turn off auto highlight gridview->setHighlightFollowsCurrentItem(false); - QVERIFY(gridview->highlightFollowsCurrentItem() == false); - QVERIFY(gridview->highlightItem()); + QTRY_VERIFY(gridview->highlightFollowsCurrentItem() == false); + QTRY_VERIFY(gridview->highlightItem()); qreal hlPosX = gridview->highlightItem()->x(); qreal hlPosY = gridview->highlightItem()->y(); gridview->setCurrentIndex(5); - QTest::qWait(500); - QCOMPARE(gridview->highlightItem()->x(), hlPosX); - QCOMPARE(gridview->highlightItem()->y(), hlPosY); + QTRY_COMPARE(gridview->highlightItem()->x(), hlPosX); + QTRY_COMPARE(gridview->highlightItem()->y(), hlPosY); // insert item before currentIndex gridview->setCurrentIndex(28); model.insertItem(0, "Foo", "1111"); - QCOMPARE(canvas->rootObject()->property("current").toInt(), 29); + QTRY_COMPARE(canvas->rootObject()->property("current").toInt(), 29); delete canvas; } @@ -732,44 +687,43 @@ void tst_QDeclarativeGridView::changeFlow() qApp->processEvents(); QDeclarativeGridView *gridview = findItem<QDeclarativeGridView>(canvas->rootObject(), "grid"); - QVERIFY(gridview != 0); + QTRY_VERIFY(gridview != 0); QDeclarativeItem *viewport = gridview->viewport(); - QVERIFY(viewport != 0); + QTRY_VERIFY(viewport != 0); // Confirm items positioned correctly and indexes correct int itemCount = findItems<QDeclarativeItem>(viewport, "wrapper").count(); for (int i = 0; i < model.count() && i < itemCount; ++i) { QDeclarativeItem *item = findItem<QDeclarativeItem>(viewport, "wrapper", i); if (!item) qWarning() << "Item" << i << "not found"; - QVERIFY(item); - QCOMPARE(item->x(), qreal((i%3)*80)); - QCOMPARE(item->y(), qreal((i/3)*60)); + QTRY_VERIFY(item); + QTRY_COMPARE(item->x(), qreal((i%3)*80)); + QTRY_COMPARE(item->y(), qreal((i/3)*60)); QDeclarativeText *name = findItem<QDeclarativeText>(viewport, "textName", i); - QVERIFY(name != 0); - QCOMPARE(name->text(), model.name(i)); + QTRY_VERIFY(name != 0); + QTRY_COMPARE(name->text(), model.name(i)); QDeclarativeText *number = findItem<QDeclarativeText>(viewport, "textNumber", i); - QVERIFY(number != 0); - QCOMPARE(number->text(), model.number(i)); + QTRY_VERIFY(number != 0); + QTRY_COMPARE(number->text(), model.number(i)); } ctxt->setContextProperty("testTopToBottom", QVariant(true)); - QTest::qWait(100); // Confirm items positioned correctly and indexes correct itemCount = findItems<QDeclarativeItem>(viewport, "wrapper").count(); for (int i = 0; i < model.count() && i < itemCount; ++i) { QDeclarativeItem *item = findItem<QDeclarativeItem>(viewport, "wrapper", i); if (!item) qWarning() << "Item" << i << "not found"; - QVERIFY(item); - QCOMPARE(item->x(), qreal((i/5)*80)); - QCOMPARE(item->y(), qreal((i%5)*60)); + QTRY_VERIFY(item); + QTRY_COMPARE(item->x(), qreal((i/5)*80)); + QTRY_COMPARE(item->y(), qreal((i%5)*60)); QDeclarativeText *name = findItem<QDeclarativeText>(viewport, "textName", i); - QVERIFY(name != 0); - QCOMPARE(name->text(), model.name(i)); + QTRY_VERIFY(name != 0); + QTRY_COMPARE(name->text(), model.name(i)); QDeclarativeText *number = findItem<QDeclarativeText>(viewport, "textNumber", i); - QVERIFY(number != 0); - QCOMPARE(number->text(), model.number(i)); + QTRY_VERIFY(number != 0); + QTRY_COMPARE(number->text(), model.number(i)); } delete canvas; @@ -781,20 +735,20 @@ void tst_QDeclarativeGridView::defaultValues() QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/gridview3.qml")); QDeclarativeGridView *obj = qobject_cast<QDeclarativeGridView*>(c.create()); - QVERIFY(obj != 0); - QVERIFY(obj->model() == QVariant()); - QVERIFY(obj->delegate() == 0); - QCOMPARE(obj->currentIndex(), -1); - QVERIFY(obj->currentItem() == 0); - QCOMPARE(obj->count(), 0); - QVERIFY(obj->highlight() == 0); - QVERIFY(obj->highlightItem() == 0); - QCOMPARE(obj->highlightFollowsCurrentItem(), true); - QVERIFY(obj->flow() == 0); - QCOMPARE(obj->isWrapEnabled(), false); - QCOMPARE(obj->cacheBuffer(), 0); - QCOMPARE(obj->cellWidth(), 100); //### Should 100 be the default? - QCOMPARE(obj->cellHeight(), 100); + QTRY_VERIFY(obj != 0); + QTRY_VERIFY(obj->model() == QVariant()); + QTRY_VERIFY(obj->delegate() == 0); + QTRY_COMPARE(obj->currentIndex(), -1); + QTRY_VERIFY(obj->currentItem() == 0); + QTRY_COMPARE(obj->count(), 0); + QTRY_VERIFY(obj->highlight() == 0); + QTRY_VERIFY(obj->highlightItem() == 0); + QTRY_COMPARE(obj->highlightFollowsCurrentItem(), true); + QTRY_VERIFY(obj->flow() == 0); + QTRY_COMPARE(obj->isWrapEnabled(), false); + QTRY_COMPARE(obj->cacheBuffer(), 0); + QTRY_COMPARE(obj->cellWidth(), 100); //### Should 100 be the default? + QTRY_COMPARE(obj->cellHeight(), 100); delete obj; } @@ -804,59 +758,59 @@ void tst_QDeclarativeGridView::properties() QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/gridview2.qml")); QDeclarativeGridView *obj = qobject_cast<QDeclarativeGridView*>(c.create()); - QVERIFY(obj != 0); - QVERIFY(obj->model() != QVariant()); - QVERIFY(obj->delegate() != 0); - QCOMPARE(obj->currentIndex(), 0); - QVERIFY(obj->currentItem() != 0); - QCOMPARE(obj->count(), 4); - QVERIFY(obj->highlight() != 0); - QVERIFY(obj->highlightItem() != 0); - QCOMPARE(obj->highlightFollowsCurrentItem(), false); - QVERIFY(obj->flow() == 0); - QCOMPARE(obj->isWrapEnabled(), true); - QCOMPARE(obj->cacheBuffer(), 200); - QCOMPARE(obj->cellWidth(), 100); - QCOMPARE(obj->cellHeight(), 100); + QTRY_VERIFY(obj != 0); + QTRY_VERIFY(obj->model() != QVariant()); + QTRY_VERIFY(obj->delegate() != 0); + QTRY_COMPARE(obj->currentIndex(), 0); + QTRY_VERIFY(obj->currentItem() != 0); + QTRY_COMPARE(obj->count(), 4); + QTRY_VERIFY(obj->highlight() != 0); + QTRY_VERIFY(obj->highlightItem() != 0); + QTRY_COMPARE(obj->highlightFollowsCurrentItem(), false); + QTRY_VERIFY(obj->flow() == 0); + QTRY_COMPARE(obj->isWrapEnabled(), true); + QTRY_COMPARE(obj->cacheBuffer(), 200); + QTRY_COMPARE(obj->cellWidth(), 100); + QTRY_COMPARE(obj->cellHeight(), 100); delete obj; } void tst_QDeclarativeGridView::propertyChanges() { QDeclarativeView *canvas = createView(); - QVERIFY(canvas); + QTRY_VERIFY(canvas); canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/propertychangestest.qml")); QDeclarativeGridView *gridView = canvas->rootObject()->findChild<QDeclarativeGridView*>("gridView"); - QVERIFY(gridView); + QTRY_VERIFY(gridView); QSignalSpy keyNavigationWrapsSpy(gridView, SIGNAL(keyNavigationWrapsChanged())); QSignalSpy cacheBufferSpy(gridView, SIGNAL(cacheBufferChanged())); QSignalSpy flowSpy(gridView, SIGNAL(flowChanged())); - QCOMPARE(gridView->isWrapEnabled(), true); - QCOMPARE(gridView->cacheBuffer(), 10); - QCOMPARE(gridView->flow(), QDeclarativeGridView::LeftToRight); + QTRY_COMPARE(gridView->isWrapEnabled(), true); + QTRY_COMPARE(gridView->cacheBuffer(), 10); + QTRY_COMPARE(gridView->flow(), QDeclarativeGridView::LeftToRight); gridView->setWrapEnabled(false); gridView->setCacheBuffer(3); gridView->setFlow(QDeclarativeGridView::TopToBottom); - QCOMPARE(gridView->isWrapEnabled(), false); - QCOMPARE(gridView->cacheBuffer(), 3); - QCOMPARE(gridView->flow(), QDeclarativeGridView::TopToBottom); + QTRY_COMPARE(gridView->isWrapEnabled(), false); + QTRY_COMPARE(gridView->cacheBuffer(), 3); + QTRY_COMPARE(gridView->flow(), QDeclarativeGridView::TopToBottom); - QCOMPARE(keyNavigationWrapsSpy.count(),1); - QCOMPARE(cacheBufferSpy.count(),1); - QCOMPARE(flowSpy.count(),1); + QTRY_COMPARE(keyNavigationWrapsSpy.count(),1); + QTRY_COMPARE(cacheBufferSpy.count(),1); + QTRY_COMPARE(flowSpy.count(),1); gridView->setWrapEnabled(false); gridView->setCacheBuffer(3); gridView->setFlow(QDeclarativeGridView::TopToBottom); - QCOMPARE(keyNavigationWrapsSpy.count(),1); - QCOMPARE(cacheBufferSpy.count(),1); - QCOMPARE(flowSpy.count(),1); + QTRY_COMPARE(keyNavigationWrapsSpy.count(),1); + QTRY_COMPARE(cacheBufferSpy.count(),1); + QTRY_COMPARE(flowSpy.count(),1); delete canvas; } @@ -864,17 +818,17 @@ void tst_QDeclarativeGridView::propertyChanges() void tst_QDeclarativeGridView::componentChanges() { QDeclarativeView *canvas = createView(); - QVERIFY(canvas); + QTRY_VERIFY(canvas); canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/propertychangestest.qml")); QDeclarativeGridView *gridView = canvas->rootObject()->findChild<QDeclarativeGridView*>("gridView"); - QVERIFY(gridView); + QTRY_VERIFY(gridView); QDeclarativeComponent component(canvas->engine()); - component.setData("import Qt 4.6; Rectangle { color: \"blue\"; }", QUrl::fromLocalFile("")); + component.setData("import Qt 4.7; Rectangle { color: \"blue\"; }", QUrl::fromLocalFile("")); QDeclarativeComponent delegateComponent(canvas->engine()); - delegateComponent.setData("import Qt 4.6; Text { text: '<b>Name:</b> ' + name }", QUrl::fromLocalFile("")); + delegateComponent.setData("import Qt 4.7; Text { text: '<b>Name:</b> ' + name }", QUrl::fromLocalFile("")); QSignalSpy highlightSpy(gridView, SIGNAL(highlightChanged())); QSignalSpy delegateSpy(gridView, SIGNAL(delegateChanged())); @@ -882,43 +836,43 @@ void tst_QDeclarativeGridView::componentChanges() gridView->setHighlight(&component); gridView->setDelegate(&delegateComponent); - QCOMPARE(gridView->highlight(), &component); - QCOMPARE(gridView->delegate(), &delegateComponent); + QTRY_COMPARE(gridView->highlight(), &component); + QTRY_COMPARE(gridView->delegate(), &delegateComponent); - QCOMPARE(highlightSpy.count(),1); - QCOMPARE(delegateSpy.count(),1); + QTRY_COMPARE(highlightSpy.count(),1); + QTRY_COMPARE(delegateSpy.count(),1); gridView->setHighlight(&component); gridView->setDelegate(&delegateComponent); - QCOMPARE(highlightSpy.count(),1); - QCOMPARE(delegateSpy.count(),1); + QTRY_COMPARE(highlightSpy.count(),1); + QTRY_COMPARE(delegateSpy.count(),1); delete canvas; } void tst_QDeclarativeGridView::modelChanges() { QDeclarativeView *canvas = createView(); - QVERIFY(canvas); + QTRY_VERIFY(canvas); canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/propertychangestest.qml")); QDeclarativeGridView *gridView = canvas->rootObject()->findChild<QDeclarativeGridView*>("gridView"); - QVERIFY(gridView); + QTRY_VERIFY(gridView); QDeclarativeListModel *alternateModel = canvas->rootObject()->findChild<QDeclarativeListModel*>("alternateModel"); - QVERIFY(alternateModel); + QTRY_VERIFY(alternateModel); QVariant modelVariant = QVariant::fromValue(alternateModel); QSignalSpy modelSpy(gridView, SIGNAL(modelChanged())); gridView->setModel(modelVariant); - QCOMPARE(gridView->model(), modelVariant); - QCOMPARE(modelSpy.count(),1); + QTRY_COMPARE(gridView->model(), modelVariant); + QTRY_COMPARE(modelSpy.count(),1); gridView->setModel(modelVariant); - QCOMPARE(modelSpy.count(),1); + QTRY_COMPARE(modelSpy.count(),1); gridView->setModel(QVariant()); - QCOMPARE(modelSpy.count(),2); + QTRY_COMPARE(modelSpy.count(),2); delete canvas; } @@ -938,117 +892,117 @@ void tst_QDeclarativeGridView::positionViewAtIndex() qApp->processEvents(); QDeclarativeGridView *gridview = findItem<QDeclarativeGridView>(canvas->rootObject(), "grid"); - QVERIFY(gridview != 0); + QTRY_VERIFY(gridview != 0); QDeclarativeItem *viewport = gridview->viewport(); - QVERIFY(viewport != 0); + QTRY_VERIFY(viewport != 0); // Confirm items positioned correctly int itemCount = findItems<QDeclarativeItem>(viewport, "wrapper").count(); for (int i = 0; i < model.count() && i < itemCount-1; ++i) { QDeclarativeItem *item = findItem<QDeclarativeItem>(viewport, "wrapper", i); if (!item) qWarning() << "Item" << i << "not found"; - QVERIFY(item); - QCOMPARE(item->x(), (i%3)*80.); - QCOMPARE(item->y(), (i/3)*60.); + QTRY_VERIFY(item); + QTRY_COMPARE(item->x(), (i%3)*80.); + QTRY_COMPARE(item->y(), (i/3)*60.); } // Position on a currently visible item gridview->positionViewAtIndex(4, QDeclarativeGridView::Beginning); - QCOMPARE(gridview->contentY(), 60.); + QTRY_COMPARE(gridview->contentY(), 60.); // Confirm items positioned correctly itemCount = findItems<QDeclarativeItem>(viewport, "wrapper").count(); for (int i = 3; i < model.count() && i < itemCount-3-1; ++i) { QDeclarativeItem *item = findItem<QDeclarativeItem>(viewport, "wrapper", i); if (!item) qWarning() << "Item" << i << "not found"; - QVERIFY(item); - QCOMPARE(item->x(), (i%3)*80.); - QCOMPARE(item->y(), (i/3)*60.); + QTRY_VERIFY(item); + QTRY_COMPARE(item->x(), (i%3)*80.); + QTRY_COMPARE(item->y(), (i/3)*60.); } // Position on an item beyond the visible items gridview->positionViewAtIndex(21, QDeclarativeGridView::Beginning); - QCOMPARE(gridview->contentY(), 420.); + QTRY_COMPARE(gridview->contentY(), 420.); // Confirm items positioned correctly itemCount = findItems<QDeclarativeItem>(viewport, "wrapper").count(); for (int i = 22; i < model.count() && i < itemCount-22-1; ++i) { QDeclarativeItem *item = findItem<QDeclarativeItem>(viewport, "wrapper", i); if (!item) qWarning() << "Item" << i << "not found"; - QVERIFY(item); - QCOMPARE(item->x(), (i%3)*80.); - QCOMPARE(item->y(), (i/3)*60.); + QTRY_VERIFY(item); + QTRY_COMPARE(item->x(), (i%3)*80.); + QTRY_COMPARE(item->y(), (i/3)*60.); } // Position on an item that would leave empty space if positioned at the top gridview->positionViewAtIndex(31, QDeclarativeGridView::Beginning); - QCOMPARE(gridview->contentY(), 520.); + QTRY_COMPARE(gridview->contentY(), 520.); // Confirm items positioned correctly itemCount = findItems<QDeclarativeItem>(viewport, "wrapper").count(); for (int i = 24; i < model.count() && i < itemCount-24-1; ++i) { QDeclarativeItem *item = findItem<QDeclarativeItem>(viewport, "wrapper", i); if (!item) qWarning() << "Item" << i << "not found"; - QVERIFY(item); - QCOMPARE(item->x(), (i%3)*80.); - QCOMPARE(item->y(), (i/3)*60.); + QTRY_VERIFY(item); + QTRY_COMPARE(item->x(), (i%3)*80.); + QTRY_COMPARE(item->y(), (i/3)*60.); } // Position at the beginning again gridview->positionViewAtIndex(0, QDeclarativeGridView::Beginning); - QCOMPARE(gridview->contentY(), 0.); + QTRY_COMPARE(gridview->contentY(), 0.); // Confirm items positioned correctly itemCount = findItems<QDeclarativeItem>(viewport, "wrapper").count(); for (int i = 0; i < model.count() && i < itemCount-1; ++i) { QDeclarativeItem *item = findItem<QDeclarativeItem>(viewport, "wrapper", i); if (!item) qWarning() << "Item" << i << "not found"; - QVERIFY(item); - QCOMPARE(item->x(), (i%3)*80.); - QCOMPARE(item->y(), (i/3)*60.); + QTRY_VERIFY(item); + QTRY_COMPARE(item->x(), (i%3)*80.); + QTRY_COMPARE(item->y(), (i/3)*60.); } // Position at End gridview->positionViewAtIndex(30, QDeclarativeGridView::End); - QCOMPARE(gridview->contentY(), 340.); + QTRY_COMPARE(gridview->contentY(), 340.); // Position in Center gridview->positionViewAtIndex(15, QDeclarativeGridView::Center); - QCOMPARE(gridview->contentY(), 170.); + QTRY_COMPARE(gridview->contentY(), 170.); // Ensure at least partially visible gridview->positionViewAtIndex(15, QDeclarativeGridView::Visible); - QCOMPARE(gridview->contentY(), 170.); + QTRY_COMPARE(gridview->contentY(), 170.); gridview->setContentY(302); gridview->positionViewAtIndex(15, QDeclarativeGridView::Visible); - QCOMPARE(gridview->contentY(), 302.); + QTRY_COMPARE(gridview->contentY(), 302.); gridview->setContentY(360); gridview->positionViewAtIndex(15, QDeclarativeGridView::Visible); - QCOMPARE(gridview->contentY(), 300.); + QTRY_COMPARE(gridview->contentY(), 300.); gridview->setContentY(60); gridview->positionViewAtIndex(20, QDeclarativeGridView::Visible); - QCOMPARE(gridview->contentY(), 60.); + QTRY_COMPARE(gridview->contentY(), 60.); gridview->setContentY(20); gridview->positionViewAtIndex(20, QDeclarativeGridView::Visible); - QCOMPARE(gridview->contentY(), 100.); + QTRY_COMPARE(gridview->contentY(), 100.); // Ensure completely visible gridview->setContentY(120); gridview->positionViewAtIndex(20, QDeclarativeGridView::Contain); - QCOMPARE(gridview->contentY(), 120.); + QTRY_COMPARE(gridview->contentY(), 120.); gridview->setContentY(302); gridview->positionViewAtIndex(15, QDeclarativeGridView::Contain); - QCOMPARE(gridview->contentY(), 300.); + QTRY_COMPARE(gridview->contentY(), 300.); gridview->setContentY(60); gridview->positionViewAtIndex(20, QDeclarativeGridView::Contain); - QCOMPARE(gridview->contentY(), 100.); + QTRY_COMPARE(gridview->contentY(), 100.); delete canvas; } @@ -1068,29 +1022,29 @@ void tst_QDeclarativeGridView::resetModel() qApp->processEvents(); QDeclarativeGridView *gridview = findItem<QDeclarativeGridView>(canvas->rootObject(), "grid"); - QVERIFY(gridview != 0); + QTRY_VERIFY(gridview != 0); QDeclarativeItem *viewport = gridview->viewport(); - QVERIFY(viewport != 0); + QTRY_VERIFY(viewport != 0); - QCOMPARE(gridview->count(), model.rowCount()); + QTRY_COMPARE(gridview->count(), model.rowCount()); for (int i = 0; i < model.rowCount(); ++i) { QDeclarativeText *display = findItem<QDeclarativeText>(viewport, "displayText", i); - QVERIFY(display != 0); - QCOMPARE(display->text(), strings.at(i)); + QTRY_VERIFY(display != 0); + QTRY_COMPARE(display->text(), strings.at(i)); } strings.clear(); strings << "four" << "five" << "six" << "seven"; model.setStringList(strings); - QCOMPARE(gridview->count(), model.rowCount()); + QTRY_COMPARE(gridview->count(), model.rowCount()); for (int i = 0; i < model.rowCount(); ++i) { QDeclarativeText *display = findItem<QDeclarativeText>(viewport, "displayText", i); - QVERIFY(display != 0); - QCOMPARE(display->text(), strings.at(i)); + QTRY_VERIFY(display != 0); + QTRY_COMPARE(display->text(), strings.at(i)); } } @@ -1109,34 +1063,33 @@ void tst_QDeclarativeGridView::enforceRange() qApp->processEvents(); QDeclarativeGridView *gridview = findItem<QDeclarativeGridView>(canvas->rootObject(), "grid"); - QVERIFY(gridview != 0); + QTRY_VERIFY(gridview != 0); - QCOMPARE(gridview->preferredHighlightBegin(), 100.0); - QCOMPARE(gridview->preferredHighlightEnd(), 100.0); - QCOMPARE(gridview->highlightRangeMode(), QDeclarativeGridView::StrictlyEnforceRange); + QTRY_COMPARE(gridview->preferredHighlightBegin(), 100.0); + QTRY_COMPARE(gridview->preferredHighlightEnd(), 100.0); + QTRY_COMPARE(gridview->highlightRangeMode(), QDeclarativeGridView::StrictlyEnforceRange); QDeclarativeItem *viewport = gridview->viewport(); - QVERIFY(viewport != 0); + QTRY_VERIFY(viewport != 0); // view should be positioned at the top of the range. QDeclarativeItem *item = findItem<QDeclarativeItem>(viewport, "wrapper", 0); - QVERIFY(item); - QCOMPARE(gridview->contentY(), -100.0); + QTRY_VERIFY(item); + QTRY_COMPARE(gridview->contentY(), -100.0); QDeclarativeText *name = findItem<QDeclarativeText>(viewport, "textName", 0); - QVERIFY(name != 0); - QCOMPARE(name->text(), model.name(0)); + QTRY_VERIFY(name != 0); + QTRY_COMPARE(name->text(), model.name(0)); QDeclarativeText *number = findItem<QDeclarativeText>(viewport, "textNumber", 0); - QVERIFY(number != 0); - QCOMPARE(number->text(), model.number(0)); + QTRY_VERIFY(number != 0); + QTRY_COMPARE(number->text(), model.number(0)); // Check currentIndex is updated when viewport moves gridview->setContentY(0); - QCOMPARE(gridview->currentIndex(), 2); + QTRY_COMPARE(gridview->currentIndex(), 2); gridview->setCurrentIndex(5); - QTest::qWait(500); - QCOMPARE(gridview->contentY(), 100.); + QTRY_COMPARE(gridview->contentY(), 100.); delete canvas; } @@ -1149,9 +1102,9 @@ void tst_QDeclarativeGridView::QTBUG_8456() qApp->processEvents(); QDeclarativeGridView *gridview = findItem<QDeclarativeGridView>(canvas->rootObject(), "grid"); - QVERIFY(gridview != 0); + QTRY_VERIFY(gridview != 0); - QCOMPARE(gridview->currentIndex(), 0); + QTRY_COMPARE(gridview->currentIndex(), 0); } QDeclarativeView *tst_QDeclarativeGridView::createView() diff --git a/tests/auto/declarative/qdeclarativeimage/data/aspectratio.qml b/tests/auto/declarative/qdeclarativeimage/data/aspectratio.qml new file mode 100644 index 0000000..402d33e --- /dev/null +++ b/tests/auto/declarative/qdeclarativeimage/data/aspectratio.qml @@ -0,0 +1,6 @@ +import Qt 4.7 + +Image { + source: "heart.png" + fillMode: Image.PreserveAspectFit; +} diff --git a/tests/auto/declarative/qdeclarativeimage/qdeclarativeimage.pro b/tests/auto/declarative/qdeclarativeimage/qdeclarativeimage.pro index 7634c12..ff365ee 100644 --- a/tests/auto/declarative/qdeclarativeimage/qdeclarativeimage.pro +++ b/tests/auto/declarative/qdeclarativeimage/qdeclarativeimage.pro @@ -7,3 +7,6 @@ SOURCES += tst_qdeclarativeimage.cpp ../shared/testhttpserver.cpp # Define SRCDIR equal to test's source directory DEFINES += SRCDIR=\\\"$$PWD\\\" + +CONFIG += parallel_test + diff --git a/tests/auto/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp b/tests/auto/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp index ec9f4ec..53c208e 100644 --- a/tests/auto/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp +++ b/tests/auto/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp @@ -46,6 +46,7 @@ #include <QtDeclarative/qdeclarativeengine.h> #include <QtDeclarative/qdeclarativecomponent.h> +#include <QtDeclarative/qdeclarativeview.h> #include <private/qdeclarativeimage_p.h> #include <private/qdeclarativeimagebase_p.h> #include <private/qdeclarativeloader_p.h> @@ -54,8 +55,8 @@ #include "../shared/testhttpserver.h" -#define SERVER_PORT 14445 -#define SERVER_ADDR "http://127.0.0.1:14445" +#define SERVER_PORT 14451 +#define SERVER_ADDR "http://127.0.0.1:14451" #define TRY_WAIT(expr) \ do { \ @@ -80,6 +81,7 @@ private slots: void imageSource_data(); void clearSource(); void resized(); + void preserveAspectRatio(); void smooth(); void pixmap(); void svg(); @@ -95,7 +97,7 @@ tst_qdeclarativeimage::tst_qdeclarativeimage() void tst_qdeclarativeimage::noSource() { - QString componentStr = "import Qt 4.6\nImage { source: \"\" }"; + QString componentStr = "import Qt 4.7\nImage { source: \"\" }"; QDeclarativeComponent component(&engine); component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeImage *obj = qobject_cast<QDeclarativeImage*>(component.create()); @@ -149,7 +151,7 @@ void tst_qdeclarativeimage::imageSource() if (!error.isEmpty()) QTest::ignoreMessage(QtWarningMsg, error.toUtf8()); - QString componentStr = "import Qt 4.6\nImage { source: \"" + source + "\"; asynchronous: " + QString componentStr = "import Qt 4.7\nImage { source: \"" + source + "\"; asynchronous: " + (async ? QLatin1String("true") : QLatin1String("false")) + " }"; QDeclarativeComponent component(&engine); component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); @@ -179,7 +181,7 @@ void tst_qdeclarativeimage::imageSource() void tst_qdeclarativeimage::clearSource() { - QString componentStr = "import Qt 4.6\nImage { source: srcImage }"; + QString componentStr = "import Qt 4.7\nImage { source: srcImage }"; QDeclarativeContext *ctxt = engine.rootContext(); ctxt->setContextProperty("srcImage", QUrl::fromLocalFile(SRCDIR "/data/colors.png")); QDeclarativeComponent component(&engine); @@ -201,7 +203,7 @@ void tst_qdeclarativeimage::clearSource() void tst_qdeclarativeimage::resized() { - QString componentStr = "import Qt 4.6\nImage { source: \"" SRCDIR "/data/colors.png\"; width: 300; height: 300 }"; + QString componentStr = "import Qt 4.7\nImage { source: \"" SRCDIR "/data/colors.png\"; width: 300; height: 300 }"; QDeclarativeComponent component(&engine); component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeImage *obj = qobject_cast<QDeclarativeImage*>(component.create()); @@ -209,13 +211,34 @@ void tst_qdeclarativeimage::resized() QCOMPARE(obj->width(), 300.); QCOMPARE(obj->height(), 300.); QCOMPARE(obj->fillMode(), QDeclarativeImage::Stretch); - delete obj; } + +void tst_qdeclarativeimage::preserveAspectRatio() +{ + QDeclarativeView *canvas = new QDeclarativeView(0); + canvas->show(); + + canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/aspectratio.qml")); + QDeclarativeImage *image = qobject_cast<QDeclarativeImage*>(canvas->rootObject()); + QVERIFY(image != 0); + image->setWidth(80.0); + QCOMPARE(image->width(), 80.); + QCOMPARE(image->height(), 80.); + + canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/aspectratio.qml")); + image = qobject_cast<QDeclarativeImage*>(canvas->rootObject()); + image->setHeight(60.0); + QVERIFY(image != 0); + QCOMPARE(image->height(), 60.); + QCOMPARE(image->width(), 60.); + delete canvas; +} + void tst_qdeclarativeimage::smooth() { - QString componentStr = "import Qt 4.6\nImage { source: \"" SRCDIR "/data/colors.png\"; smooth: true; width: 300; height: 300 }"; + QString componentStr = "import Qt 4.7\nImage { source: \"" SRCDIR "/data/colors.png\"; smooth: true; width: 300; height: 300 }"; QDeclarativeComponent component(&engine); component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeImage *obj = qobject_cast<QDeclarativeImage*>(component.create()); @@ -230,7 +253,7 @@ void tst_qdeclarativeimage::smooth() void tst_qdeclarativeimage::pixmap() { - QString componentStr = "import Qt 4.6\nImage { pixmap: testPixmap }"; + QString componentStr = "import Qt 4.7\nImage { pixmap: testPixmap }"; QPixmap pixmap; QDeclarativeContext *ctxt = engine.rootContext(); @@ -261,7 +284,7 @@ void tst_qdeclarativeimage::pixmap() void tst_qdeclarativeimage::svg() { QString src = QUrl::fromLocalFile(SRCDIR "/data/heart.svg").toString(); - QString componentStr = "import Qt 4.6\nImage { source: \"" + src + "\"; sourceSize.width: 300; sourceSize.height: 300 }"; + QString componentStr = "import Qt 4.7\nImage { source: \"" + src + "\"; sourceSize.width: 300; sourceSize.height: 300 }"; QDeclarativeComponent component(&engine); component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeImage *obj = qobject_cast<QDeclarativeImage*>(component.create()); @@ -300,7 +323,7 @@ void tst_qdeclarativeimage::big() // have to build a 400 MB image. That would be a bug in the JPEG loader. QString src = QUrl::fromLocalFile(SRCDIR "/data/big.jpeg").toString(); - QString componentStr = "import Qt 4.6\nImage { source: \"" + src + "\"; sourceSize.width: 256; sourceSize.height: 256 }"; + QString componentStr = "import Qt 4.7\nImage { source: \"" + src + "\"; sourceSize.width: 256; sourceSize.height: 256 }"; QDeclarativeComponent component(&engine); component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); diff --git a/tests/auto/declarative/qdeclarativeimageprovider/qdeclarativeimageprovider.pro b/tests/auto/declarative/qdeclarativeimageprovider/qdeclarativeimageprovider.pro index a4d3eb2..22be991 100644 --- a/tests/auto/declarative/qdeclarativeimageprovider/qdeclarativeimageprovider.pro +++ b/tests/auto/declarative/qdeclarativeimageprovider/qdeclarativeimageprovider.pro @@ -10,3 +10,6 @@ SOURCES += tst_qdeclarativeimageprovider.cpp # Define SRCDIR equal to test's source directory DEFINES += SRCDIR=\\\"$$PWD\\\" + +CONFIG += parallel_test + diff --git a/tests/auto/declarative/qdeclarativeimageprovider/tst_qdeclarativeimageprovider.cpp b/tests/auto/declarative/qdeclarativeimageprovider/tst_qdeclarativeimageprovider.cpp index fe5f5a2..162c266 100644 --- a/tests/auto/declarative/qdeclarativeimageprovider/tst_qdeclarativeimageprovider.cpp +++ b/tests/auto/declarative/qdeclarativeimageprovider/tst_qdeclarativeimageprovider.cpp @@ -114,7 +114,7 @@ void tst_qdeclarativeimageprovider::imageSource() engine.addImageProvider("test", new TestProvider); QVERIFY(engine.imageProvider("test") != 0); - QString componentStr = "import Qt 4.6\nImage { source: \"" + source + "\"; " + properties + " }"; + QString componentStr = "import Qt 4.7\nImage { source: \"" + source + "\"; " + properties + " }"; QDeclarativeComponent component(&engine); component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeImage *obj = qobject_cast<QDeclarativeImage*>(component.create()); @@ -145,7 +145,7 @@ void tst_qdeclarativeimageprovider::removeProvider() QVERIFY(engine.imageProvider("test2") != 0); // add provider, confirm it works - QString componentStr = "import Qt 4.6\nImage { source: \"image://test2/exists1.png\" }"; + QString componentStr = "import Qt 4.7\nImage { source: \"image://test2/exists1.png\" }"; QDeclarativeComponent component(&engine); component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeImage *obj = qobject_cast<QDeclarativeImage*>(component.create()); diff --git a/tests/auto/declarative/qdeclarativeinfo/qdeclarativeinfo.pro b/tests/auto/declarative/qdeclarativeinfo/qdeclarativeinfo.pro index 015c094..bb54d6c 100644 --- a/tests/auto/declarative/qdeclarativeinfo/qdeclarativeinfo.pro +++ b/tests/auto/declarative/qdeclarativeinfo/qdeclarativeinfo.pro @@ -5,3 +5,6 @@ macx:CONFIG -= app_bundle SOURCES += tst_qdeclarativeinfo.cpp DEFINES += SRCDIR=\\\"$$PWD\\\" + +CONFIG += parallel_test + diff --git a/tests/auto/declarative/qdeclarativeinstruction/qdeclarativeinstruction.pro b/tests/auto/declarative/qdeclarativeinstruction/qdeclarativeinstruction.pro index b8f7d27..0daa9e5 100644 --- a/tests/auto/declarative/qdeclarativeinstruction/qdeclarativeinstruction.pro +++ b/tests/auto/declarative/qdeclarativeinstruction/qdeclarativeinstruction.pro @@ -4,3 +4,6 @@ SOURCES += tst_qdeclarativeinstruction.cpp macx:CONFIG -= app_bundle DEFINES += SRCDIR=\\\"$$PWD\\\" + +CONFIG += parallel_test + diff --git a/tests/auto/declarative/qdeclarativeitem/qdeclarativeitem.pro b/tests/auto/declarative/qdeclarativeitem/qdeclarativeitem.pro index 0eb2141..e834a4e 100644 --- a/tests/auto/declarative/qdeclarativeitem/qdeclarativeitem.pro +++ b/tests/auto/declarative/qdeclarativeitem/qdeclarativeitem.pro @@ -5,3 +5,6 @@ macx:CONFIG -= app_bundle SOURCES += tst_qdeclarativeitem.cpp DEFINES += SRCDIR=\\\"$$PWD\\\" + +CONFIG += parallel_test + diff --git a/tests/auto/declarative/qdeclarativeitem/tst_qdeclarativeitem.cpp b/tests/auto/declarative/qdeclarativeitem/tst_qdeclarativeitem.cpp index a6171ae..4400116 100644 --- a/tests/auto/declarative/qdeclarativeitem/tst_qdeclarativeitem.cpp +++ b/tests/auto/declarative/qdeclarativeitem/tst_qdeclarativeitem.cpp @@ -293,7 +293,7 @@ void tst_QDeclarativeItem::keyNavigation() void tst_QDeclarativeItem::smooth() { QDeclarativeComponent component(&engine); - component.setData("import Qt 4.6; Item { smooth: false; }", QUrl::fromLocalFile("")); + component.setData("import Qt 4.7; Item { smooth: false; }", QUrl::fromLocalFile("")); QDeclarativeItem *item = qobject_cast<QDeclarativeItem*>(component.create()); QSignalSpy spy(item, SIGNAL(smoothChanged(bool))); @@ -322,7 +322,7 @@ void tst_QDeclarativeItem::smooth() void tst_QDeclarativeItem::clip() { QDeclarativeComponent component(&engine); - component.setData("import Qt 4.6\nItem { clip: false\n }", QUrl::fromLocalFile("")); + component.setData("import Qt 4.7\nItem { clip: false\n }", QUrl::fromLocalFile("")); QDeclarativeItem *item = qobject_cast<QDeclarativeItem*>(component.create()); QSignalSpy spy(item, SIGNAL(clipChanged(bool))); @@ -426,7 +426,7 @@ void tst_QDeclarativeItem::transforms() QFETCH(QByteArray, qml); QFETCH(QMatrix, matrix); QDeclarativeComponent component(&engine); - component.setData("import Qt 4.6\nItem { transform: "+qml+"}", QUrl::fromLocalFile("")); + component.setData("import Qt 4.7\nItem { transform: "+qml+"}", QUrl::fromLocalFile("")); QDeclarativeItem *item = qobject_cast<QDeclarativeItem*>(component.create()); QVERIFY(item); QCOMPARE(item->sceneMatrix(), matrix); diff --git a/tests/auto/declarative/qdeclarativelanguage/qdeclarativelanguage.pro b/tests/auto/declarative/qdeclarativelanguage/qdeclarativelanguage.pro index d7c1def..5771469 100644 --- a/tests/auto/declarative/qdeclarativelanguage/qdeclarativelanguage.pro +++ b/tests/auto/declarative/qdeclarativelanguage/qdeclarativelanguage.pro @@ -12,3 +12,5 @@ HEADERS += ../shared/testhttpserver.h SOURCES += ../shared/testhttpserver.cpp DEFINES += SRCDIR=\\\"$$PWD\\\" + +CONFIG += parallel_test diff --git a/tests/auto/declarative/qdeclarativelanguage/qtest/declarative/qmllanguage/TestNamed.qml b/tests/auto/declarative/qdeclarativelanguage/qtest/declarative/qmllanguage/TestNamed.qml new file mode 100644 index 0000000..672cb8f --- /dev/null +++ b/tests/auto/declarative/qdeclarativelanguage/qtest/declarative/qmllanguage/TestNamed.qml @@ -0,0 +1 @@ +NamedLocal { } diff --git a/tests/auto/declarative/qdeclarativelanguage/qtest/declarative/qmllanguage/qmldir b/tests/auto/declarative/qdeclarativelanguage/qtest/declarative/qmllanguage/qmldir index da10ba9..60150f8 100644 --- a/tests/auto/declarative/qdeclarativelanguage/qtest/declarative/qmllanguage/qmldir +++ b/tests/auto/declarative/qdeclarativelanguage/qtest/declarative/qmllanguage/qmldir @@ -1,4 +1,5 @@ Test Test.qml TestSubDir TestSubDir.qml TestLocal TestLocal.qml +NamedLocal LocalInternal.qml internal LocalInternal LocalInternal.qml diff --git a/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp b/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp index bfb56ba..7c327c2 100644 --- a/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp +++ b/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp @@ -52,6 +52,7 @@ #include "testtypes.h" #include "../../../shared/util.h" +#include "testhttpserver.h" /* This test case covers QML language issues. This covers everything that does not @@ -116,6 +117,8 @@ private slots: void defaultPropertyListOrder(); void declaredPropertyValues(); + void basicRemote_data(); + void basicRemote(); void importsBuiltin_data(); void importsBuiltin(); void importsLocal_data(); @@ -1254,12 +1257,12 @@ void tst_qdeclarativelanguage::importsLocal_data() << "QDeclarativeRectangle" << ""; QTest::newRow("local import second") - << "import Qt 4.6\nimport \"subdir\"\n" + << "import Qt 4.7\nimport \"subdir\"\n" "Test {}" << "QDeclarativeRectangle" << ""; QTest::newRow("local import subsubdir") - << "import Qt 4.6\nimport \"subdir/subsubdir\"\n" + << "import Qt 4.7\nimport \"subdir/subsubdir\"\n" "SubTest {}" << "QDeclarativeRectangle" << ""; @@ -1298,13 +1301,47 @@ void tst_qdeclarativelanguage::importsLocal() testType(qml,type,error); } +void tst_qdeclarativelanguage::basicRemote_data() +{ + QTest::addColumn<QUrl>("url"); + QTest::addColumn<QString>("type"); + QTest::addColumn<QString>("error"); + + QString serverdir = "http://127.0.0.1:14447/qtest/declarative/qmllanguage/"; + + QTest::newRow("no need for qmldir") << QUrl(serverdir+"Test.qml") << "" << ""; + QTest::newRow("need qmldir") << QUrl(serverdir+"TestLocal.qml") << "" << ""; +} + +void tst_qdeclarativelanguage::basicRemote() +{ + QFETCH(QUrl, url); + QFETCH(QString, type); + QFETCH(QString, error); + + TestHTTPServer server(14447); + server.serveDirectory(SRCDIR); + + QDeclarativeComponent component(&engine, url); + + QTRY_VERIFY(!component.isLoading()); + + if (error.isEmpty()) { + if (component.isError()) + qDebug() << component.errors(); + QVERIFY(!component.isError()); + } else { + QVERIFY(component.isError()); + } +} + void tst_qdeclarativelanguage::importsRemote_data() { QTest::addColumn<QString>("qml"); QTest::addColumn<QString>("type"); QTest::addColumn<QString>("error"); - QString serverdir = "http://127.0.0.1:14445/qtest/declarative/qmllanguage"; + QString serverdir = "http://127.0.0.1:14447/qtest/declarative/qmllanguage"; QTest::newRow("remote import") << "import \""+serverdir+"\"\nTest {}" << "QDeclarativeRectangle" << ""; @@ -1320,15 +1357,13 @@ void tst_qdeclarativelanguage::importsRemote_data() << "UndeclaredLocal is not a type"; } -#include "testhttpserver.h" - void tst_qdeclarativelanguage::importsRemote() { QFETCH(QString, qml); QFETCH(QString, type); QFETCH(QString, error); - TestHTTPServer server(14445); + TestHTTPServer server(14447); server.serveDirectory(SRCDIR); testType(qml,type,error); @@ -1430,24 +1465,24 @@ void tst_qdeclarativelanguage::importsOrder_data() QTest::newRow("installed import versus builtin 1") << "import com.nokia.installedtest 1.5\n" - "import Qt 4.6\n" + "import Qt 4.7\n" "Rectangle {}" << "QDeclarativeRectangle" << ""; QTest::newRow("installed import versus builtin 2") << - "import Qt 4.6\n" + "import Qt 4.7\n" "import com.nokia.installedtest 1.5\n" "Rectangle {}" << "QDeclarativeText" << ""; QTest::newRow("namespaces cannot be overridden by types 1") << - "import Qt 4.6 as Rectangle\n" + "import Qt 4.7 as Rectangle\n" "import com.nokia.installedtest 1.5\n" "Rectangle {}" << "" << "Namespace Rectangle cannot be used as a type"; QTest::newRow("namespaces cannot be overridden by types 2") << - "import Qt 4.6 as Rectangle\n" + "import Qt 4.7 as Rectangle\n" "import com.nokia.installedtest 1.5\n" "Rectangle.Image {}" << "QDeclarativeImage" @@ -1502,7 +1537,7 @@ void tst_qdeclarativelanguage::qmlAttachedPropertiesObjectMethod() void tst_qdeclarativelanguage::crash1() { QDeclarativeComponent component(&engine); - component.setData("import Qt 4.6\nComponent {}", QUrl()); + component.setData("import Qt 4.7\nComponent {}", QUrl()); } void tst_qdeclarativelanguage::crash2() diff --git a/tests/auto/declarative/qdeclarativelayouts/qdeclarativelayouts.pro b/tests/auto/declarative/qdeclarativelayouts/qdeclarativelayouts.pro index 7276162..a2065f4 100644 --- a/tests/auto/declarative/qdeclarativelayouts/qdeclarativelayouts.pro +++ b/tests/auto/declarative/qdeclarativelayouts/qdeclarativelayouts.pro @@ -5,3 +5,6 @@ macx:CONFIG -= app_bundle # Define SRCDIR equal to test's source directory DEFINES += SRCDIR=\\\"$$PWD\\\" + +CONFIG += parallel_test + diff --git a/tests/auto/declarative/qdeclarativelistmodel/qdeclarativelistmodel.pro b/tests/auto/declarative/qdeclarativelistmodel/qdeclarativelistmodel.pro index 8813242..9f1e146 100644 --- a/tests/auto/declarative/qdeclarativelistmodel/qdeclarativelistmodel.pro +++ b/tests/auto/declarative/qdeclarativelistmodel/qdeclarativelistmodel.pro @@ -7,3 +7,6 @@ SOURCES += tst_qdeclarativelistmodel.cpp # Define SRCDIR equal to test's source directory DEFINES += SRCDIR=\\\"$$PWD\\\" + +CONFIG += parallel_test + diff --git a/tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp b/tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp index 5962a42..9d61ad0 100644 --- a/tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp +++ b/tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp @@ -118,7 +118,7 @@ void tst_QDeclarativeListModel::waitForWorker(QDeclarativeItem *item) void tst_QDeclarativeListModel::static_i18n() { QString expect = QString::fromUtf8("na\303\257ve"); - QString componentStr = "import Qt 4.6\nListModel { ListElement { prop1: \""+expect+"\" } }"; + QString componentStr = "import Qt 4.7\nListModel { ListElement { prop1: \""+expect+"\" } }"; QDeclarativeEngine engine; QDeclarativeComponent component(&engine); component.setData(componentStr.toUtf8(), QUrl::fromLocalFile("")); @@ -139,7 +139,7 @@ void tst_QDeclarativeListModel::static_nestedElements() QString elementsStr = elements.join(",\n") + "\n"; QString componentStr = - "import Qt 4.6\n" + "import Qt 4.7\n" "ListModel {\n" " ListElement {\n" " attributes: [\n"; @@ -468,7 +468,7 @@ void tst_QDeclarativeListModel::static_types() QFETCH(QString, qml); QFETCH(QVariant, value); - qml = "import Qt 4.6\nListModel { " + qml + " }"; + qml = "import Qt 4.7\nListModel { " + qml + " }"; QDeclarativeEngine engine; QDeclarativeComponent component(&engine); @@ -500,35 +500,35 @@ void tst_QDeclarativeListModel::error_data() QTest::addColumn<QString>("error"); QTest::newRow("id not allowed in ListElement") - << "import Qt 4.6\nListModel { ListElement { id: fred } }" + << "import Qt 4.7\nListModel { ListElement { id: fred } }" << "ListElement: cannot use reserved \"id\" property"; QTest::newRow("id allowed in ListModel") - << "import Qt 4.6\nListModel { id:model }" + << "import Qt 4.7\nListModel { id:model }" << ""; QTest::newRow("random properties not allowed in ListModel") - << "import Qt 4.6\nListModel { foo:123 }" + << "import Qt 4.7\nListModel { foo:123 }" << "ListModel: undefined property 'foo'"; QTest::newRow("random properties allowed in ListElement") - << "import Qt 4.6\nListModel { ListElement { foo:123 } }" + << "import Qt 4.7\nListModel { ListElement { foo:123 } }" << ""; QTest::newRow("bindings not allowed in ListElement") - << "import Qt 4.6\nRectangle { id: rect; ListModel { ListElement { foo: rect.color } } }" + << "import Qt 4.7\nRectangle { id: rect; ListModel { ListElement { foo: rect.color } } }" << "ListElement: cannot use script for property value"; QTest::newRow("random object list properties allowed in ListElement") - << "import Qt 4.6\nListModel { ListElement { foo: [ ListElement { bar: 123 } ] } }" + << "import Qt 4.7\nListModel { ListElement { foo: [ ListElement { bar: 123 } ] } }" << ""; QTest::newRow("default properties not allowed in ListElement") - << "import Qt 4.6\nListModel { ListElement { Item { } } }" + << "import Qt 4.7\nListModel { ListElement { Item { } } }" << "ListElement: cannot contain nested elements"; QTest::newRow("QML elements not allowed in ListElement") - << "import Qt 4.6\nListModel { ListElement { a: Item { } } }" + << "import Qt 4.7\nListModel { ListElement { a: Item { } } }" << "ListElement: cannot contain nested elements"; } diff --git a/tests/auto/declarative/qdeclarativelistreference/qdeclarativelistreference.pro b/tests/auto/declarative/qdeclarativelistreference/qdeclarativelistreference.pro index 0c9b2d9..f3e6f52 100644 --- a/tests/auto/declarative/qdeclarativelistreference/qdeclarativelistreference.pro +++ b/tests/auto/declarative/qdeclarativelistreference/qdeclarativelistreference.pro @@ -3,3 +3,6 @@ contains(QT_CONFIG,declarative): QT += declarative macx:CONFIG -= app_bundle SOURCES += tst_qdeclarativelistreference.cpp + +CONFIG += parallel_test + diff --git a/tests/auto/declarative/qdeclarativelistview/data/strictlyenforcerange.qml b/tests/auto/declarative/qdeclarativelistview/data/strictlyenforcerange.qml new file mode 100644 index 0000000..6fc41fa --- /dev/null +++ b/tests/auto/declarative/qdeclarativelistview/data/strictlyenforcerange.qml @@ -0,0 +1,29 @@ +import Qt 4.7 + +ListView { + id: list + objectName: "list" + width: 320 + height: 480 + + function fillModel() { + list.model.append({"col": "red"}); + list.currentIndex = list.count-1 + list.model.append({"col": "blue"}); + list.currentIndex = list.count-1 + list.model.append({"col": "green"}); + list.currentIndex = list.count-1 + } + + model: ListModel { id: listModel } // empty model + delegate: Rectangle { id: wrapper; objectName: "wrapper"; color: col; width: 300; height: 400 } + orientation: "Horizontal" + snapMode: "SnapToItem" + cacheBuffer: 1000 + + preferredHighlightBegin: 10 + preferredHighlightEnd: 10 + + highlightRangeMode: "StrictlyEnforceRange" + focus: true +} diff --git a/tests/auto/declarative/qdeclarativelistview/qdeclarativelistview.pro b/tests/auto/declarative/qdeclarativelistview/qdeclarativelistview.pro index 3a076f8..5d962c0 100644 --- a/tests/auto/declarative/qdeclarativelistview/qdeclarativelistview.pro +++ b/tests/auto/declarative/qdeclarativelistview/qdeclarativelistview.pro @@ -6,3 +6,5 @@ SOURCES += tst_qdeclarativelistview.cpp # Define SRCDIR equal to test's source directory DEFINES += SRCDIR=\\\"$$PWD\\\" + +CONFIG += parallel_test diff --git a/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp b/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp index 8d94804..6b7a361 100644 --- a/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp +++ b/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp @@ -50,6 +50,7 @@ #include <QtDeclarative/private/qdeclarativevisualitemmodel_p.h> #include <QtDeclarative/private/qdeclarativelistmodel_p.h> #include <QtDeclarative/private/qlistmodelinterface_p.h> +#include "../../../shared/util.h" class tst_QDeclarativeListView : public QObject { @@ -88,6 +89,7 @@ private slots: void propertyChanges(); void componentChanges(); void modelChanges(); + void QTBUG_9791(); private: template <class T> void items(); @@ -325,62 +327,59 @@ void tst_QDeclarativeListView::items() qApp->processEvents(); QDeclarativeListView *listview = findItem<QDeclarativeListView>(canvas->rootObject(), "list"); - QVERIFY(listview != 0); + QTRY_VERIFY(listview != 0); QDeclarativeItem *viewport = listview->viewport(); - QVERIFY(viewport != 0); + QTRY_VERIFY(viewport != 0); QMetaObject::invokeMethod(canvas->rootObject(), "checkProperties"); - QVERIFY(testObject->error() == false); + QTRY_VERIFY(testObject->error() == false); - QVERIFY(listview->highlightItem() != 0); - QCOMPARE(listview->count(), model.count()); - QCOMPARE(viewport->childItems().count(), model.count()+1); // assumes all are visible, +1 for the (default) highlight item + QTRY_VERIFY(listview->highlightItem() != 0); + QTRY_COMPARE(listview->count(), model.count()); + QTRY_COMPARE(viewport->childItems().count(), model.count()+1); // assumes all are visible, +1 for the (default) highlight item // current item should be first item - QCOMPARE(listview->currentItem(), findItem<QDeclarativeItem>(viewport, "wrapper", 0)); + QTRY_COMPARE(listview->currentItem(), findItem<QDeclarativeItem>(viewport, "wrapper", 0)); for (int i = 0; i < model.count(); ++i) { QDeclarativeText *name = findItem<QDeclarativeText>(viewport, "textName", i); - QVERIFY(name != 0); - QCOMPARE(name->text(), model.name(i)); + QTRY_VERIFY(name != 0); + QTRY_COMPARE(name->text(), model.name(i)); QDeclarativeText *number = findItem<QDeclarativeText>(viewport, "textNumber", i); - QVERIFY(number != 0); - QCOMPARE(number->text(), model.number(i)); + QTRY_VERIFY(number != 0); + QTRY_COMPARE(number->text(), model.number(i)); } // switch to other delegate testObject->setAnimate(true); QMetaObject::invokeMethod(canvas->rootObject(), "checkProperties"); - QVERIFY(testObject->error() == false); - QVERIFY(listview->currentItem()); + QTRY_VERIFY(testObject->error() == false); + QTRY_VERIFY(listview->currentItem()); // set invalid highlight testObject->setInvalidHighlight(true); QMetaObject::invokeMethod(canvas->rootObject(), "checkProperties"); - QVERIFY(testObject->error() == false); - QVERIFY(listview->currentItem()); - QVERIFY(listview->highlightItem() == 0); + QTRY_VERIFY(testObject->error() == false); + QTRY_VERIFY(listview->currentItem()); + QTRY_VERIFY(listview->highlightItem() == 0); // back to normal highlight testObject->setInvalidHighlight(false); QMetaObject::invokeMethod(canvas->rootObject(), "checkProperties"); - QVERIFY(testObject->error() == false); - QVERIFY(listview->currentItem()); - QVERIFY(listview->highlightItem() != 0); + QTRY_VERIFY(testObject->error() == false); + QTRY_VERIFY(listview->currentItem()); + QTRY_VERIFY(listview->highlightItem() != 0); // set an empty model and confirm that items are destroyed T model2; ctxt->setContextProperty("testModel", &model2); - // Allow deleteLaters to process - QTest::qWait(500); - int itemCount = findItems<QDeclarativeItem>(viewport, "wrapper").count(); - QVERIFY(itemCount == 0); + QTRY_VERIFY(itemCount == 0); - QCOMPARE(listview->highlightResizeSpeed(), 1000.0); - QCOMPARE(listview->highlightMoveSpeed(), 1000.0); + QTRY_COMPARE(listview->highlightResizeSpeed(), 1000.0); + QTRY_COMPARE(listview->highlightMoveSpeed(), 1000.0); delete canvas; } @@ -406,18 +405,18 @@ void tst_QDeclarativeListView::changed() qApp->processEvents(); QDeclarativeFlickable *listview = findItem<QDeclarativeFlickable>(canvas->rootObject(), "list"); - QVERIFY(listview != 0); + QTRY_VERIFY(listview != 0); QDeclarativeItem *viewport = listview->viewport(); - QVERIFY(viewport != 0); + QTRY_VERIFY(viewport != 0); model.modifyItem(1, "Will", "9876"); QDeclarativeText *name = findItem<QDeclarativeText>(viewport, "textName", 1); - QVERIFY(name != 0); - QCOMPARE(name->text(), model.name(1)); + QTRY_VERIFY(name != 0); + QTRY_COMPARE(name->text(), model.name(1)); QDeclarativeText *number = findItem<QDeclarativeText>(viewport, "textNumber", 1); - QVERIFY(number != 0); - QCOMPARE(number->text(), model.number(1)); + QTRY_VERIFY(number != 0); + QTRY_COMPARE(number->text(), model.number(1)); delete canvas; } @@ -442,75 +441,66 @@ void tst_QDeclarativeListView::inserted() qApp->processEvents(); QDeclarativeListView *listview = findItem<QDeclarativeListView>(canvas->rootObject(), "list"); - QVERIFY(listview != 0); + QTRY_VERIFY(listview != 0); QDeclarativeItem *viewport = listview->viewport(); - QVERIFY(viewport != 0); + QTRY_VERIFY(viewport != 0); model.insertItem(1, "Will", "9876"); - // let transitions settle. - QTest::qWait(300); - - QCOMPARE(viewport->childItems().count(), model.count()+1); // assumes all are visible, +1 for the (default) highlight item + QTRY_COMPARE(viewport->childItems().count(), model.count()+1); // assumes all are visible, +1 for the (default) highlight item QDeclarativeText *name = findItem<QDeclarativeText>(viewport, "textName", 1); - QVERIFY(name != 0); - QCOMPARE(name->text(), model.name(1)); + QTRY_VERIFY(name != 0); + QTRY_COMPARE(name->text(), model.name(1)); QDeclarativeText *number = findItem<QDeclarativeText>(viewport, "textNumber", 1); - QVERIFY(number != 0); - QCOMPARE(number->text(), model.number(1)); + QTRY_VERIFY(number != 0); + QTRY_COMPARE(number->text(), model.number(1)); // Confirm items positioned correctly for (int i = 0; i < model.count(); ++i) { QDeclarativeItem *item = findItem<QDeclarativeItem>(viewport, "wrapper", i); - QCOMPARE(item->y(), i*20.0); + QTRY_COMPARE(item->y(), i*20.0); } model.insertItem(0, "Foo", "1111"); // zero index, and current item - // let transitions settle. - QTest::qWait(300); - - QCOMPARE(viewport->childItems().count(), model.count()+1); // assumes all are visible, +1 for the (default) highlight item + QTRY_COMPARE(viewport->childItems().count(), model.count()+1); // assumes all are visible, +1 for the (default) highlight item name = findItem<QDeclarativeText>(viewport, "textName", 0); - QVERIFY(name != 0); - QCOMPARE(name->text(), model.name(0)); + QTRY_VERIFY(name != 0); + QTRY_COMPARE(name->text(), model.name(0)); number = findItem<QDeclarativeText>(viewport, "textNumber", 0); - QVERIFY(number != 0); - QCOMPARE(number->text(), model.number(0)); + QTRY_VERIFY(number != 0); + QTRY_COMPARE(number->text(), model.number(0)); - QCOMPARE(listview->currentIndex(), 1); + QTRY_COMPARE(listview->currentIndex(), 1); // Confirm items positioned correctly for (int i = 0; i < model.count(); ++i) { QDeclarativeItem *item = findItem<QDeclarativeItem>(viewport, "wrapper", i); - QCOMPARE(item->y(), i*20.0); + QTRY_COMPARE(item->y(), i*20.0); } for (int i = model.count(); i < 30; ++i) model.insertItem(i, "Hello", QString::number(i)); - QTest::qWait(300); listview->setContentY(80); - QTest::qWait(300); // Insert item outside visible area model.insertItem(1, "Hello", "1324"); - QTest::qWait(300); - QVERIFY(listview->contentY() == 80); + QTRY_VERIFY(listview->contentY() == 80); // Confirm items positioned correctly for (int i = 5; i < 5+15; ++i) { QDeclarativeItem *item = findItem<QDeclarativeItem>(viewport, "wrapper", i); if (!item) qWarning() << "Item" << i << "not found"; - QVERIFY(item); - QCOMPARE(item->y(), i*20.0 - 20.0); + QTRY_VERIFY(item); + QTRY_COMPARE(item->y(), i*20.0 - 20.0); } -// QCOMPARE(listview->viewportHeight(), model.count() * 20.0); +// QTRY_COMPARE(listview->viewportHeight(), model.count() * 20.0); delete canvas; } @@ -535,66 +525,60 @@ void tst_QDeclarativeListView::removed(bool animated) qApp->processEvents(); QDeclarativeListView *listview = findItem<QDeclarativeListView>(canvas->rootObject(), "list"); - QVERIFY(listview != 0); + QTRY_VERIFY(listview != 0); QDeclarativeItem *viewport = listview->viewport(); - QVERIFY(viewport != 0); + QTRY_VERIFY(viewport != 0); model.removeItem(1); - // let transitions settle. - QTest::qWait(300); - QDeclarativeText *name = findItem<QDeclarativeText>(viewport, "textName", 1); - QVERIFY(name != 0); - QCOMPARE(name->text(), model.name(1)); + QTRY_VERIFY(name != 0); + QTRY_COMPARE(name->text(), model.name(1)); QDeclarativeText *number = findItem<QDeclarativeText>(viewport, "textNumber", 1); - QVERIFY(number != 0); - QCOMPARE(number->text(), model.number(1)); + QTRY_VERIFY(number != 0); + QTRY_COMPARE(number->text(), model.number(1)); // Confirm items positioned correctly int itemCount = findItems<QDeclarativeItem>(viewport, "wrapper").count(); for (int i = 0; i < model.count() && i < itemCount; ++i) { QDeclarativeItem *item = findItem<QDeclarativeItem>(viewport, "wrapper", i); if (!item) qWarning() << "Item" << i << "not found"; - QVERIFY(item); - QVERIFY(item->y() == i*20); + QTRY_VERIFY(item); + QTRY_VERIFY(item->y() == i*20); } // Remove first item (which is the current item); model.removeItem(0); // post: top item starts at 20 - // let transitions settle. QTest::qWait(300); name = findItem<QDeclarativeText>(viewport, "textName", 0); - QVERIFY(name != 0); - QCOMPARE(name->text(), model.name(0)); + QTRY_VERIFY(name != 0); + QTRY_COMPARE(name->text(), model.name(0)); number = findItem<QDeclarativeText>(viewport, "textNumber", 0); - QVERIFY(number != 0); - QCOMPARE(number->text(), model.number(0)); + QTRY_VERIFY(number != 0); + QTRY_COMPARE(number->text(), model.number(0)); // Confirm items positioned correctly itemCount = findItems<QDeclarativeItem>(viewport, "wrapper").count(); for (int i = 0; i < model.count() && i < itemCount; ++i) { QDeclarativeItem *item = findItem<QDeclarativeItem>(viewport, "wrapper", i); if (!item) qWarning() << "Item" << i << "not found"; - QVERIFY(item); - QCOMPARE(item->y(),i*20.0 + 20.0); + QTRY_VERIFY(item); + QTRY_COMPARE(item->y(),i*20.0 + 20.0); } // Remove items not visible model.removeItem(18); - // let transitions settle. - QTest::qWait(300); // Confirm items positioned correctly itemCount = findItems<QDeclarativeItem>(viewport, "wrapper").count(); for (int i = 0; i < model.count() && i < itemCount; ++i) { QDeclarativeItem *item = findItem<QDeclarativeItem>(viewport, "wrapper", i); if (!item) qWarning() << "Item" << i << "not found"; - QVERIFY(item); - QCOMPARE(item->y(),i*20.0+20.0); + QTRY_VERIFY(item); + QTRY_COMPARE(item->y(),i*20.0+20.0); } // Remove items before visible @@ -602,25 +586,22 @@ void tst_QDeclarativeListView::removed(bool animated) listview->setCurrentIndex(10); model.removeItem(1); // post: top item will be at 40 - // let transitions settle. - QTest::qWait(300); // Confirm items positioned correctly for (int i = 2; i < 18; ++i) { QDeclarativeItem *item = findItem<QDeclarativeItem>(viewport, "wrapper", i); if (!item) qWarning() << "Item" << i << "not found"; - QVERIFY(item); - QCOMPARE(item->y(),40+i*20.0); + QTRY_VERIFY(item); + QTRY_COMPARE(item->y(),40+i*20.0); } // Remove current index - QVERIFY(listview->currentIndex() == 9); + QTRY_VERIFY(listview->currentIndex() == 9); QDeclarativeItem *oldCurrent = listview->currentItem(); model.removeItem(9); - QTest::qWait(300); - QCOMPARE(listview->currentIndex(), 9); - QVERIFY(listview->currentItem() != oldCurrent); + QTRY_COMPARE(listview->currentIndex(), 9); + QTRY_VERIFY(listview->currentItem() != oldCurrent); listview->setContentY(40); // That's the top now // let transitions settle. @@ -631,29 +612,25 @@ void tst_QDeclarativeListView::removed(bool animated) for (int i = 0; i < model.count() && i < itemCount; ++i) { QDeclarativeItem *item = findItem<QDeclarativeItem>(viewport, "wrapper", i); if (!item) qWarning() << "Item" << i << "not found"; - QVERIFY(item); - QCOMPARE(item->y(),40+i*20.0); + QTRY_VERIFY(item); + QTRY_COMPARE(item->y(),40+i*20.0); } // remove current item beyond visible items. listview->setCurrentIndex(20); - QTest::qWait(300); listview->setContentY(40); model.removeItem(20); - QTest::qWait(300); - QCOMPARE(listview->currentIndex(), 20); - QVERIFY(listview->currentItem() != 0); + QTRY_COMPARE(listview->currentIndex(), 20); + QTRY_VERIFY(listview->currentItem() != 0); // remove item before current, but visible listview->setCurrentIndex(8); - QTest::qWait(300); oldCurrent = listview->currentItem(); model.removeItem(6); - QTest::qWait(300); - QCOMPARE(listview->currentIndex(), 7); - QVERIFY(listview->currentItem() == oldCurrent); + QTRY_COMPARE(listview->currentIndex(), 7); + QTRY_VERIFY(listview->currentItem() == oldCurrent); delete canvas; } @@ -677,19 +654,16 @@ void tst_QDeclarativeListView::clear() qApp->processEvents(); QDeclarativeListView *listview = findItem<QDeclarativeListView>(canvas->rootObject(), "list"); - QVERIFY(listview != 0); + QTRY_VERIFY(listview != 0); QDeclarativeItem *viewport = listview->viewport(); - QVERIFY(viewport != 0); + QTRY_VERIFY(viewport != 0); model.clear(); - // let transitions settle. - QTest::qWait(500); - - QVERIFY(listview->count() == 0); - QVERIFY(listview->currentItem() == 0); - QVERIFY(listview->contentY() == 0); + QTRY_VERIFY(listview->count() == 0); + QTRY_VERIFY(listview->currentItem() == 0); + QTRY_VERIFY(listview->contentY() == 0); delete canvas; } @@ -714,37 +688,34 @@ void tst_QDeclarativeListView::moved() qApp->processEvents(); QDeclarativeListView *listview = findItem<QDeclarativeListView>(canvas->rootObject(), "list"); - QVERIFY(listview != 0); + QTRY_VERIFY(listview != 0); QDeclarativeItem *viewport = listview->viewport(); - QVERIFY(viewport != 0); + QTRY_VERIFY(viewport != 0); model.moveItem(1, 4); - // let transitions settle. - QTest::qWait(500); - QDeclarativeText *name = findItem<QDeclarativeText>(viewport, "textName", 1); - QVERIFY(name != 0); - QCOMPARE(name->text(), model.name(1)); + QTRY_VERIFY(name != 0); + QTRY_COMPARE(name->text(), model.name(1)); QDeclarativeText *number = findItem<QDeclarativeText>(viewport, "textNumber", 1); - QVERIFY(number != 0); - QCOMPARE(number->text(), model.number(1)); + QTRY_VERIFY(number != 0); + QTRY_COMPARE(number->text(), model.number(1)); name = findItem<QDeclarativeText>(viewport, "textName", 4); - QVERIFY(name != 0); - QCOMPARE(name->text(), model.name(4)); + QTRY_VERIFY(name != 0); + QTRY_COMPARE(name->text(), model.name(4)); number = findItem<QDeclarativeText>(viewport, "textNumber", 4); - QVERIFY(number != 0); - QCOMPARE(number->text(), model.number(4)); + QTRY_VERIFY(number != 0); + QTRY_COMPARE(number->text(), model.number(4)); // Confirm items positioned correctly int itemCount = findItems<QDeclarativeItem>(viewport, "wrapper").count(); for (int i = 0; i < model.count() && i < itemCount; ++i) { QDeclarativeItem *item = findItem<QDeclarativeItem>(viewport, "wrapper", i); if (!item) qWarning() << "Item" << i << "not found"; - QVERIFY(item); - QVERIFY(item->y() == i*20); + QTRY_VERIFY(item); + QTRY_VERIFY(item->y() == i*20); } listview->setContentY(80); @@ -752,41 +723,35 @@ void tst_QDeclarativeListView::moved() // move outside visible area model.moveItem(1, 18); - // let transitions settle. - QTest::qWait(500); - // Confirm items positioned correctly and indexes correct for (int i = 3; i < model.count() && i < itemCount; ++i) { QDeclarativeItem *item = findItem<QDeclarativeItem>(viewport, "wrapper", i); if (!item) qWarning() << "Item" << i << "not found"; - QVERIFY(item); - QCOMPARE(item->y(), i*20.0 + 20); + QTRY_VERIFY(item); + QTRY_COMPARE(item->y(), i*20.0 + 20); name = findItem<QDeclarativeText>(viewport, "textName", i); - QVERIFY(name != 0); - QCOMPARE(name->text(), model.name(i)); + QTRY_VERIFY(name != 0); + QTRY_COMPARE(name->text(), model.name(i)); number = findItem<QDeclarativeText>(viewport, "textNumber", i); - QVERIFY(number != 0); - QCOMPARE(number->text(), model.number(i)); + QTRY_VERIFY(number != 0); + QTRY_COMPARE(number->text(), model.number(i)); } // move from outside visible into visible model.moveItem(20, 4); - // let transitions settle. - QTest::qWait(500); - // Confirm items positioned correctly and indexes correct for (int i = 3; i < model.count() && i < itemCount; ++i) { QDeclarativeItem *item = findItem<QDeclarativeItem>(viewport, "wrapper", i); if (!item) qWarning() << "Item" << i << "not found"; - QVERIFY(item); - QCOMPARE(item->y(), i*20.0 + 20); + QTRY_VERIFY(item); + QTRY_COMPARE(item->y(), i*20.0 + 20); name = findItem<QDeclarativeText>(viewport, "textName", i); - QVERIFY(name != 0); - QCOMPARE(name->text(), model.name(i)); + QTRY_VERIFY(name != 0); + QTRY_COMPARE(name->text(), model.name(i)); number = findItem<QDeclarativeText>(viewport, "textNumber", i); - QVERIFY(number != 0); - QCOMPARE(number->text(), model.number(i)); + QTRY_VERIFY(number != 0); + QTRY_COMPARE(number->text(), model.number(i)); } delete canvas; @@ -807,32 +772,31 @@ void tst_QDeclarativeListView::enforceRange() qApp->processEvents(); QDeclarativeListView *listview = findItem<QDeclarativeListView>(canvas->rootObject(), "list"); - QVERIFY(listview != 0); + QTRY_VERIFY(listview != 0); - QCOMPARE(listview->preferredHighlightBegin(), 100.0); - QCOMPARE(listview->preferredHighlightEnd(), 100.0); - QCOMPARE(listview->highlightRangeMode(), QDeclarativeListView::StrictlyEnforceRange); + QTRY_COMPARE(listview->preferredHighlightBegin(), 100.0); + QTRY_COMPARE(listview->preferredHighlightEnd(), 100.0); + QTRY_COMPARE(listview->highlightRangeMode(), QDeclarativeListView::StrictlyEnforceRange); QDeclarativeItem *viewport = listview->viewport(); - QVERIFY(viewport != 0); + QTRY_VERIFY(viewport != 0); // view should be positioned at the top of the range. QDeclarativeItem *item = findItem<QDeclarativeItem>(viewport, "wrapper", 0); - QVERIFY(item); - QCOMPARE(listview->contentY(), -100.0); + QTRY_VERIFY(item); + QTRY_COMPARE(listview->contentY(), -100.0); QDeclarativeText *name = findItem<QDeclarativeText>(viewport, "textName", 0); - QVERIFY(name != 0); - QCOMPARE(name->text(), model.name(0)); + QTRY_VERIFY(name != 0); + QTRY_COMPARE(name->text(), model.name(0)); QDeclarativeText *number = findItem<QDeclarativeText>(viewport, "textNumber", 0); - QVERIFY(number != 0); - QCOMPARE(number->text(), model.number(0)); + QTRY_VERIFY(number != 0); + QTRY_COMPARE(number->text(), model.number(0)); // Check currentIndex is updated when viewport moves listview->setContentY(20); - QTest::qWait(500); - QCOMPARE(listview->currentIndex(), 6); + QTRY_COMPARE(listview->currentIndex(), 6); delete canvas; } @@ -855,30 +819,30 @@ void tst_QDeclarativeListView::spacing() qApp->processEvents(); QDeclarativeListView *listview = findItem<QDeclarativeListView>(canvas->rootObject(), "list"); - QVERIFY(listview != 0); + QTRY_VERIFY(listview != 0); QDeclarativeItem *viewport = listview->viewport(); - QVERIFY(viewport != 0); + QTRY_VERIFY(viewport != 0); // Confirm items positioned correctly int itemCount = findItems<QDeclarativeItem>(viewport, "wrapper").count(); for (int i = 0; i < model.count() && i < itemCount; ++i) { QDeclarativeItem *item = findItem<QDeclarativeItem>(viewport, "wrapper", i); if (!item) qWarning() << "Item" << i << "not found"; - QVERIFY(item); - QVERIFY(item->y() == i*20); + QTRY_VERIFY(item); + QTRY_VERIFY(item->y() == i*20); } listview->setSpacing(10); - QVERIFY(listview->spacing() == 10); + QTRY_VERIFY(listview->spacing() == 10); // Confirm items positioned correctly itemCount = findItems<QDeclarativeItem>(viewport, "wrapper").count(); for (int i = 0; i < model.count() && i < itemCount; ++i) { QDeclarativeItem *item = findItem<QDeclarativeItem>(viewport, "wrapper", i); if (!item) qWarning() << "Item" << i << "not found"; - QVERIFY(item); - QVERIFY(item->y() == i*30); + QTRY_VERIFY(item); + QTRY_VERIFY(item->y() == i*30); } listview->setSpacing(0); @@ -888,8 +852,8 @@ void tst_QDeclarativeListView::spacing() for (int i = 0; i < model.count() && i < itemCount; ++i) { QDeclarativeItem *item = findItem<QDeclarativeItem>(viewport, "wrapper", i); if (!item) qWarning() << "Item" << i << "not found"; - QVERIFY(item); - QCOMPARE(item->y(), i*20.0); + QTRY_VERIFY(item); + QTRY_COMPARE(item->y(), i*20.0); } delete canvas; @@ -910,63 +874,60 @@ void tst_QDeclarativeListView::sections() qApp->processEvents(); QDeclarativeListView *listview = findItem<QDeclarativeListView>(canvas->rootObject(), "list"); - QVERIFY(listview != 0); + QTRY_VERIFY(listview != 0); QDeclarativeItem *viewport = listview->viewport(); - QVERIFY(viewport != 0); + QTRY_VERIFY(viewport != 0); // Confirm items positioned correctly int itemCount = findItems<QDeclarativeItem>(viewport, "wrapper").count(); for (int i = 0; i < model.count() && i < itemCount; ++i) { QDeclarativeItem *item = findItem<QDeclarativeItem>(viewport, "wrapper", i); - QVERIFY(item); - QCOMPARE(item->y(), qreal(i*20 + ((i+4)/5) * 20)); + QTRY_VERIFY(item); + QTRY_COMPARE(item->y(), qreal(i*20 + ((i+4)/5) * 20)); } // Remove section boundary model.removeItem(5); - QTest::qWait(100); // New section header created QDeclarativeItem *item = findItem<QDeclarativeItem>(viewport, "wrapper", 5); - QVERIFY(item); - QCOMPARE(item->height(), 40.0); + QTRY_VERIFY(item); + QTRY_COMPARE(item->height(), 40.0); model.insertItem(3, "New Item", "0"); - QTest::qWait(100); // Section header moved item = findItem<QDeclarativeItem>(viewport, "wrapper", 5); - QVERIFY(item); - QCOMPARE(item->height(), 20.0); + QTRY_VERIFY(item); + QTRY_COMPARE(item->height(), 20.0); item = findItem<QDeclarativeItem>(viewport, "wrapper", 6); - QVERIFY(item); - QCOMPARE(item->height(), 40.0); + QTRY_VERIFY(item); + QTRY_COMPARE(item->height(), 40.0); // insert item which will become a section header model.insertItem(6, "Replace header", "1"); - QTest::qWait(100); item = findItem<QDeclarativeItem>(viewport, "wrapper", 6); - QVERIFY(item); - QCOMPARE(item->height(), 40.0); + QTRY_VERIFY(item); + QTRY_COMPARE(item->height(), 40.0); item = findItem<QDeclarativeItem>(viewport, "wrapper", 7); - QVERIFY(item); - QCOMPARE(item->height(), 20.0); + QTRY_VERIFY(item); + QTRY_COMPARE(item->height(), 20.0); - QCOMPARE(listview->currentSection(), QString("0")); + QTRY_COMPARE(listview->currentSection(), QString("0")); listview->setContentY(140); - QCOMPARE(listview->currentSection(), QString("1")); + QTRY_COMPARE(listview->currentSection(), QString("1")); listview->setContentY(20); - QCOMPARE(listview->currentSection(), QString("0")); + QTRY_COMPARE(listview->currentSection(), QString("0")); item = findItem<QDeclarativeItem>(viewport, "wrapper", 1); - QVERIFY(item); - QCOMPARE(item->height(), 20.0); + QTRY_VERIFY(item); + QTRY_COMPARE(item->height(), 20.0); delete canvas; } @@ -990,45 +951,41 @@ void tst_QDeclarativeListView::currentIndex() qApp->processEvents(); QDeclarativeListView *listview = findItem<QDeclarativeListView>(canvas->rootObject(), "list"); - QVERIFY(listview != 0); + QTRY_VERIFY(listview != 0); QDeclarativeItem *viewport = listview->viewport(); - QVERIFY(viewport != 0); - - QTest::qWait(500); + QTRY_VERIFY(viewport != 0); // current item should be third item - QCOMPARE(listview->currentIndex(), 3); - QCOMPARE(listview->currentItem(), findItem<QDeclarativeItem>(viewport, "wrapper", 3)); - QCOMPARE(listview->highlightItem()->y(), listview->currentItem()->y()); + QTRY_COMPARE(listview->currentIndex(), 3); + QTRY_COMPARE(listview->currentItem(), findItem<QDeclarativeItem>(viewport, "wrapper", 3)); + QTRY_COMPARE(listview->highlightItem()->y(), listview->currentItem()->y()); // no wrap listview->setCurrentIndex(0); - QCOMPARE(listview->currentIndex(), 0); + QTRY_COMPARE(listview->currentIndex(), 0); listview->incrementCurrentIndex(); - QCOMPARE(listview->currentIndex(), 1); + QTRY_COMPARE(listview->currentIndex(), 1); listview->decrementCurrentIndex(); - QCOMPARE(listview->currentIndex(), 0); + QTRY_COMPARE(listview->currentIndex(), 0); listview->decrementCurrentIndex(); - QCOMPARE(listview->currentIndex(), 0); + QTRY_COMPARE(listview->currentIndex(), 0); // with wrap ctxt->setContextProperty("testWrap", QVariant(true)); - QVERIFY(listview->isWrapEnabled()); + QTRY_VERIFY(listview->isWrapEnabled()); listview->decrementCurrentIndex(); - QCOMPARE(listview->currentIndex(), model.count()-1); + QTRY_COMPARE(listview->currentIndex(), model.count()-1); - QTest::qWait(1000); - QCOMPARE(listview->contentY(), 279.0); + QTRY_COMPARE(listview->contentY(), 279.0); listview->incrementCurrentIndex(); - QCOMPARE(listview->currentIndex(), 0); + QTRY_COMPARE(listview->currentIndex(), 0); - QTest::qWait(1000); - QCOMPARE(listview->contentY(), 0.0); + QTRY_COMPARE(listview->contentY(), 0.0); // Test keys canvas->show(); @@ -1037,32 +994,30 @@ void tst_QDeclarativeListView::currentIndex() // to be safe and avoid failing setFocus with window managers qt_x11_wait_for_window_manager(canvas); #endif - QVERIFY(canvas->hasFocus()); - QVERIFY(canvas->scene()->hasFocus()); + QTRY_VERIFY(canvas->hasFocus()); + QTRY_VERIFY(canvas->scene()->hasFocus()); qApp->processEvents(); QTest::keyClick(canvas, Qt::Key_Down); - QCOMPARE(listview->currentIndex(), 1); + QTRY_COMPARE(listview->currentIndex(), 1); QTest::keyClick(canvas, Qt::Key_Up); - QCOMPARE(listview->currentIndex(), 0); + QTRY_COMPARE(listview->currentIndex(), 0); // turn off auto highlight listview->setHighlightFollowsCurrentItem(false); - QVERIFY(listview->highlightFollowsCurrentItem() == false); + QTRY_VERIFY(listview->highlightFollowsCurrentItem() == false); - QTest::qWait(500); - QVERIFY(listview->highlightItem()); + QTRY_VERIFY(listview->highlightItem()); qreal hlPos = listview->highlightItem()->y(); listview->setCurrentIndex(4); - QTest::qWait(500); - QCOMPARE(listview->highlightItem()->y(), hlPos); + QTRY_COMPARE(listview->highlightItem()->y(), hlPos); // insert item before currentIndex listview->setCurrentIndex(28); model.insertItem(0, "Foo", "1111"); - QCOMPARE(canvas->rootObject()->property("current").toInt(), 29); + QTRY_COMPARE(canvas->rootObject()->property("current").toInt(), 29); delete canvas; } @@ -1075,35 +1030,34 @@ void tst_QDeclarativeListView::itemList() qApp->processEvents(); QDeclarativeListView *listview = findItem<QDeclarativeListView>(canvas->rootObject(), "view"); - QVERIFY(listview != 0); + QTRY_VERIFY(listview != 0); QDeclarativeItem *viewport = listview->viewport(); - QVERIFY(viewport != 0); + QTRY_VERIFY(viewport != 0); QDeclarativeVisualItemModel *model = canvas->rootObject()->findChild<QDeclarativeVisualItemModel*>("itemModel"); - QVERIFY(model != 0); + QTRY_VERIFY(model != 0); - QVERIFY(model->count() == 3); - QCOMPARE(listview->currentIndex(), 0); + QTRY_VERIFY(model->count() == 3); + QTRY_COMPARE(listview->currentIndex(), 0); QDeclarativeItem *item = findItem<QDeclarativeItem>(viewport, "item1"); - QVERIFY(item); - QCOMPARE(item->x(), 0.0); + QTRY_VERIFY(item); + QTRY_COMPARE(item->x(), 0.0); QDeclarativeText *text = findItem<QDeclarativeText>(viewport, "text1"); - QVERIFY(text); - QCOMPARE(text->text(), QLatin1String("index: 0")); + QTRY_VERIFY(text); + QTRY_COMPARE(text->text(), QLatin1String("index: 0")); listview->setCurrentIndex(2); - QTest::qWait(1000); item = findItem<QDeclarativeItem>(viewport, "item3"); - QVERIFY(item); - QCOMPARE(item->x(), 480.0); + QTRY_VERIFY(item); + QTRY_COMPARE(item->x(), 480.0); text = findItem<QDeclarativeText>(viewport, "text3"); - QVERIFY(text); - QCOMPARE(text->text(), QLatin1String("index: 2")); + QTRY_VERIFY(text); + QTRY_COMPARE(text->text(), QLatin1String("index: 2")); delete canvas; } @@ -1126,35 +1080,35 @@ void tst_QDeclarativeListView::cacheBuffer() qApp->processEvents(); QDeclarativeListView *listview = findItem<QDeclarativeListView>(canvas->rootObject(), "list"); - QVERIFY(listview != 0); + QTRY_VERIFY(listview != 0); QDeclarativeItem *viewport = listview->viewport(); - QVERIFY(viewport != 0); - QVERIFY(listview->delegate() != 0); - QVERIFY(listview->model() != 0); - QVERIFY(listview->highlight() != 0); + QTRY_VERIFY(viewport != 0); + QTRY_VERIFY(listview->delegate() != 0); + QTRY_VERIFY(listview->model() != 0); + QTRY_VERIFY(listview->highlight() != 0); // Confirm items positioned correctly int itemCount = findItems<QDeclarativeItem>(viewport, "wrapper").count(); for (int i = 0; i < model.count() && i < itemCount; ++i) { QDeclarativeItem *item = findItem<QDeclarativeItem>(viewport, "wrapper", i); if (!item) qWarning() << "Item" << i << "not found"; - QVERIFY(item); - QVERIFY(item->y() == i*20); + QTRY_VERIFY(item); + QTRY_VERIFY(item->y() == i*20); } testObject->setCacheBuffer(400); - QVERIFY(listview->cacheBuffer() == 400); + QTRY_VERIFY(listview->cacheBuffer() == 400); int newItemCount = findItems<QDeclarativeItem>(viewport, "wrapper").count(); - QVERIFY(newItemCount > itemCount); + QTRY_VERIFY(newItemCount > itemCount); // Confirm items positioned correctly for (int i = 0; i < model.count() && i < newItemCount; ++i) { QDeclarativeItem *item = findItem<QDeclarativeItem>(viewport, "wrapper", i); if (!item) qWarning() << "Item" << i << "not found"; - QVERIFY(item); - QVERIFY(item->y() == i*20); + QTRY_VERIFY(item); + QTRY_VERIFY(item->y() == i*20); } delete canvas; @@ -1178,112 +1132,112 @@ void tst_QDeclarativeListView::positionViewAtIndex() qApp->processEvents(); QDeclarativeListView *listview = findItem<QDeclarativeListView>(canvas->rootObject(), "list"); - QVERIFY(listview != 0); + QTRY_VERIFY(listview != 0); QDeclarativeItem *viewport = listview->viewport(); - QVERIFY(viewport != 0); + QTRY_VERIFY(viewport != 0); // Confirm items positioned correctly int itemCount = findItems<QDeclarativeItem>(viewport, "wrapper").count(); for (int i = 0; i < model.count() && i < itemCount; ++i) { QDeclarativeItem *item = findItem<QDeclarativeItem>(viewport, "wrapper", i); if (!item) qWarning() << "Item" << i << "not found"; - QVERIFY(item); - QCOMPARE(item->y(), i*20.); + QTRY_VERIFY(item); + QTRY_COMPARE(item->y(), i*20.); } // Position on a currently visible item listview->positionViewAtIndex(3, QDeclarativeListView::Beginning); - QCOMPARE(listview->contentY(), 60.); + QTRY_COMPARE(listview->contentY(), 60.); // Confirm items positioned correctly itemCount = findItems<QDeclarativeItem>(viewport, "wrapper").count(); for (int i = 3; i < model.count() && i < itemCount-3-1; ++i) { QDeclarativeItem *item = findItem<QDeclarativeItem>(viewport, "wrapper", i); if (!item) qWarning() << "Item" << i << "not found"; - QVERIFY(item); - QCOMPARE(item->y(), i*20.); + QTRY_VERIFY(item); + QTRY_COMPARE(item->y(), i*20.); } // Position on an item beyond the visible items listview->positionViewAtIndex(22, QDeclarativeListView::Beginning); - QCOMPARE(listview->contentY(), 440.); + QTRY_COMPARE(listview->contentY(), 440.); // Confirm items positioned correctly itemCount = findItems<QDeclarativeItem>(viewport, "wrapper").count(); for (int i = 22; i < model.count() && i < itemCount-22-1; ++i) { QDeclarativeItem *item = findItem<QDeclarativeItem>(viewport, "wrapper", i); if (!item) qWarning() << "Item" << i << "not found"; - QVERIFY(item); - QCOMPARE(item->y(), i*20.); + QTRY_VERIFY(item); + QTRY_COMPARE(item->y(), i*20.); } // Position on an item that would leave empty space if positioned at the top listview->positionViewAtIndex(28, QDeclarativeListView::Beginning); - QCOMPARE(listview->contentY(), 480.); + QTRY_COMPARE(listview->contentY(), 480.); // Confirm items positioned correctly itemCount = findItems<QDeclarativeItem>(viewport, "wrapper").count(); for (int i = 24; i < model.count() && i < itemCount-24-1; ++i) { QDeclarativeItem *item = findItem<QDeclarativeItem>(viewport, "wrapper", i); if (!item) qWarning() << "Item" << i << "not found"; - QVERIFY(item); - QCOMPARE(item->y(), i*20.); + QTRY_VERIFY(item); + QTRY_COMPARE(item->y(), i*20.); } // Position at the beginning again listview->positionViewAtIndex(0, QDeclarativeListView::Beginning); - QCOMPARE(listview->contentY(), 0.); + QTRY_COMPARE(listview->contentY(), 0.); // Confirm items positioned correctly itemCount = findItems<QDeclarativeItem>(viewport, "wrapper").count(); for (int i = 0; i < model.count() && i < itemCount-1; ++i) { QDeclarativeItem *item = findItem<QDeclarativeItem>(viewport, "wrapper", i); if (!item) qWarning() << "Item" << i << "not found"; - QVERIFY(item); - QCOMPARE(item->y(), i*20.); + QTRY_VERIFY(item); + QTRY_COMPARE(item->y(), i*20.); } // Position at End listview->positionViewAtIndex(20, QDeclarativeListView::End); - QCOMPARE(listview->contentY(), 100.); + QTRY_COMPARE(listview->contentY(), 100.); // Position in Center listview->positionViewAtIndex(15, QDeclarativeListView::Center); - QCOMPARE(listview->contentY(), 150.); + QTRY_COMPARE(listview->contentY(), 150.); // Ensure at least partially visible listview->positionViewAtIndex(15, QDeclarativeListView::Visible); - QCOMPARE(listview->contentY(), 150.); + QTRY_COMPARE(listview->contentY(), 150.); listview->setContentY(302); listview->positionViewAtIndex(15, QDeclarativeListView::Visible); - QCOMPARE(listview->contentY(), 302.); + QTRY_COMPARE(listview->contentY(), 302.); listview->setContentY(320); listview->positionViewAtIndex(15, QDeclarativeListView::Visible); - QCOMPARE(listview->contentY(), 300.); + QTRY_COMPARE(listview->contentY(), 300.); listview->setContentY(85); listview->positionViewAtIndex(20, QDeclarativeListView::Visible); - QCOMPARE(listview->contentY(), 85.); + QTRY_COMPARE(listview->contentY(), 85.); listview->setContentY(75); listview->positionViewAtIndex(20, QDeclarativeListView::Visible); - QCOMPARE(listview->contentY(), 100.); + QTRY_COMPARE(listview->contentY(), 100.); // Ensure completely visible listview->setContentY(120); listview->positionViewAtIndex(20, QDeclarativeListView::Contain); - QCOMPARE(listview->contentY(), 120.); + QTRY_COMPARE(listview->contentY(), 120.); listview->setContentY(302); listview->positionViewAtIndex(15, QDeclarativeListView::Contain); - QCOMPARE(listview->contentY(), 300.); + QTRY_COMPARE(listview->contentY(), 300.); listview->setContentY(85); listview->positionViewAtIndex(20, QDeclarativeListView::Contain); - QCOMPARE(listview->contentY(), 100.); + QTRY_COMPARE(listview->contentY(), 100.); delete canvas; } @@ -1303,40 +1257,40 @@ void tst_QDeclarativeListView::resetModel() qApp->processEvents(); QDeclarativeListView *listview = findItem<QDeclarativeListView>(canvas->rootObject(), "list"); - QVERIFY(listview != 0); + QTRY_VERIFY(listview != 0); QDeclarativeItem *viewport = listview->viewport(); - QVERIFY(viewport != 0); + QTRY_VERIFY(viewport != 0); - QCOMPARE(listview->count(), model.rowCount()); + QTRY_COMPARE(listview->count(), model.rowCount()); for (int i = 0; i < model.rowCount(); ++i) { QDeclarativeText *display = findItem<QDeclarativeText>(viewport, "displayText", i); - QVERIFY(display != 0); - QCOMPARE(display->text(), strings.at(i)); + QTRY_VERIFY(display != 0); + QTRY_COMPARE(display->text(), strings.at(i)); } strings.clear(); strings << "four" << "five" << "six" << "seven"; model.setStringList(strings); - QCOMPARE(listview->count(), model.rowCount()); + QTRY_COMPARE(listview->count(), model.rowCount()); for (int i = 0; i < model.rowCount(); ++i) { QDeclarativeText *display = findItem<QDeclarativeText>(viewport, "displayText", i); - QVERIFY(display != 0); - QCOMPARE(display->text(), strings.at(i)); + QTRY_VERIFY(display != 0); + QTRY_COMPARE(display->text(), strings.at(i)); } } void tst_QDeclarativeListView::propertyChanges() { QDeclarativeView *canvas = createView(); - QVERIFY(canvas); + QTRY_VERIFY(canvas); canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/propertychangestest.qml")); QDeclarativeListView *listView = canvas->rootObject()->findChild<QDeclarativeListView*>("listView"); - QVERIFY(listView); + QTRY_VERIFY(listView); QSignalSpy highlightFollowsCurrentItemSpy(listView, SIGNAL(highlightFollowsCurrentItemChanged())); QSignalSpy preferredHighlightBeginSpy(listView, SIGNAL(preferredHighlightBeginChanged())); @@ -1346,13 +1300,13 @@ void tst_QDeclarativeListView::propertyChanges() QSignalSpy cacheBufferSpy(listView, SIGNAL(cacheBufferChanged())); QSignalSpy snapModeSpy(listView, SIGNAL(snapModeChanged())); - QCOMPARE(listView->highlightFollowsCurrentItem(), true); - QCOMPARE(listView->preferredHighlightBegin(), 0.0); - QCOMPARE(listView->preferredHighlightEnd(), 0.0); - QCOMPARE(listView->highlightRangeMode(), QDeclarativeListView::ApplyRange); - QCOMPARE(listView->isWrapEnabled(), true); - QCOMPARE(listView->cacheBuffer(), 10); - QCOMPARE(listView->snapMode(), QDeclarativeListView::SnapToItem); + QTRY_COMPARE(listView->highlightFollowsCurrentItem(), true); + QTRY_COMPARE(listView->preferredHighlightBegin(), 0.0); + QTRY_COMPARE(listView->preferredHighlightEnd(), 0.0); + QTRY_COMPARE(listView->highlightRangeMode(), QDeclarativeListView::ApplyRange); + QTRY_COMPARE(listView->isWrapEnabled(), true); + QTRY_COMPARE(listView->cacheBuffer(), 10); + QTRY_COMPARE(listView->snapMode(), QDeclarativeListView::SnapToItem); listView->setHighlightFollowsCurrentItem(false); listView->setPreferredHighlightBegin(1.0); @@ -1362,21 +1316,21 @@ void tst_QDeclarativeListView::propertyChanges() listView->setCacheBuffer(3); listView->setSnapMode(QDeclarativeListView::SnapOneItem); - QCOMPARE(listView->highlightFollowsCurrentItem(), false); - QCOMPARE(listView->preferredHighlightBegin(), 1.0); - QCOMPARE(listView->preferredHighlightEnd(), 1.0); - QCOMPARE(listView->highlightRangeMode(), QDeclarativeListView::StrictlyEnforceRange); - QCOMPARE(listView->isWrapEnabled(), false); - QCOMPARE(listView->cacheBuffer(), 3); - QCOMPARE(listView->snapMode(), QDeclarativeListView::SnapOneItem); - - QCOMPARE(highlightFollowsCurrentItemSpy.count(),1); - QCOMPARE(preferredHighlightBeginSpy.count(),1); - QCOMPARE(preferredHighlightEndSpy.count(),1); - QCOMPARE(highlightRangeModeSpy.count(),1); - QCOMPARE(keyNavigationWrapsSpy.count(),1); - QCOMPARE(cacheBufferSpy.count(),1); - QCOMPARE(snapModeSpy.count(),1); + QTRY_COMPARE(listView->highlightFollowsCurrentItem(), false); + QTRY_COMPARE(listView->preferredHighlightBegin(), 1.0); + QTRY_COMPARE(listView->preferredHighlightEnd(), 1.0); + QTRY_COMPARE(listView->highlightRangeMode(), QDeclarativeListView::StrictlyEnforceRange); + QTRY_COMPARE(listView->isWrapEnabled(), false); + QTRY_COMPARE(listView->cacheBuffer(), 3); + QTRY_COMPARE(listView->snapMode(), QDeclarativeListView::SnapOneItem); + + QTRY_COMPARE(highlightFollowsCurrentItemSpy.count(),1); + QTRY_COMPARE(preferredHighlightBeginSpy.count(),1); + QTRY_COMPARE(preferredHighlightEndSpy.count(),1); + QTRY_COMPARE(highlightRangeModeSpy.count(),1); + QTRY_COMPARE(keyNavigationWrapsSpy.count(),1); + QTRY_COMPARE(cacheBufferSpy.count(),1); + QTRY_COMPARE(snapModeSpy.count(),1); listView->setHighlightFollowsCurrentItem(false); listView->setPreferredHighlightBegin(1.0); @@ -1386,13 +1340,13 @@ void tst_QDeclarativeListView::propertyChanges() listView->setCacheBuffer(3); listView->setSnapMode(QDeclarativeListView::SnapOneItem); - QCOMPARE(highlightFollowsCurrentItemSpy.count(),1); - QCOMPARE(preferredHighlightBeginSpy.count(),1); - QCOMPARE(preferredHighlightEndSpy.count(),1); - QCOMPARE(highlightRangeModeSpy.count(),1); - QCOMPARE(keyNavigationWrapsSpy.count(),1); - QCOMPARE(cacheBufferSpy.count(),1); - QCOMPARE(snapModeSpy.count(),1); + QTRY_COMPARE(highlightFollowsCurrentItemSpy.count(),1); + QTRY_COMPARE(preferredHighlightBeginSpy.count(),1); + QTRY_COMPARE(preferredHighlightEndSpy.count(),1); + QTRY_COMPARE(highlightRangeModeSpy.count(),1); + QTRY_COMPARE(keyNavigationWrapsSpy.count(),1); + QTRY_COMPARE(cacheBufferSpy.count(),1); + QTRY_COMPARE(snapModeSpy.count(),1); delete canvas; } @@ -1400,17 +1354,17 @@ void tst_QDeclarativeListView::propertyChanges() void tst_QDeclarativeListView::componentChanges() { QDeclarativeView *canvas = createView(); - QVERIFY(canvas); + QTRY_VERIFY(canvas); canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/propertychangestest.qml")); QDeclarativeListView *listView = canvas->rootObject()->findChild<QDeclarativeListView*>("listView"); - QVERIFY(listView); + QTRY_VERIFY(listView); QDeclarativeComponent component(canvas->engine()); - component.setData("import Qt 4.6; Rectangle { color: \"blue\"; }", QUrl::fromLocalFile("")); + component.setData("import Qt 4.7; Rectangle { color: \"blue\"; }", QUrl::fromLocalFile("")); QDeclarativeComponent delegateComponent(canvas->engine()); - delegateComponent.setData("import Qt 4.6; Text { text: '<b>Name:</b> ' + name }", QUrl::fromLocalFile("")); + delegateComponent.setData("import Qt 4.7; Text { text: '<b>Name:</b> ' + name }", QUrl::fromLocalFile("")); QSignalSpy highlightSpy(listView, SIGNAL(highlightChanged())); QSignalSpy delegateSpy(listView, SIGNAL(delegateChanged())); @@ -1422,25 +1376,25 @@ void tst_QDeclarativeListView::componentChanges() listView->setFooter(&component); listView->setDelegate(&delegateComponent); - QCOMPARE(listView->highlight(), &component); - QCOMPARE(listView->header(), &component); - QCOMPARE(listView->footer(), &component); - QCOMPARE(listView->delegate(), &delegateComponent); + QTRY_COMPARE(listView->highlight(), &component); + QTRY_COMPARE(listView->header(), &component); + QTRY_COMPARE(listView->footer(), &component); + QTRY_COMPARE(listView->delegate(), &delegateComponent); - QCOMPARE(highlightSpy.count(),1); - QCOMPARE(delegateSpy.count(),1); - QCOMPARE(headerSpy.count(),1); - QCOMPARE(footerSpy.count(),1); + QTRY_COMPARE(highlightSpy.count(),1); + QTRY_COMPARE(delegateSpy.count(),1); + QTRY_COMPARE(headerSpy.count(),1); + QTRY_COMPARE(footerSpy.count(),1); listView->setHighlight(&component); listView->setHeader(&component); listView->setFooter(&component); listView->setDelegate(&delegateComponent); - QCOMPARE(highlightSpy.count(),1); - QCOMPARE(delegateSpy.count(),1); - QCOMPARE(headerSpy.count(),1); - QCOMPARE(footerSpy.count(),1); + QTRY_COMPARE(highlightSpy.count(),1); + QTRY_COMPARE(delegateSpy.count(),1); + QTRY_COMPARE(headerSpy.count(),1); + QTRY_COMPARE(footerSpy.count(),1); delete canvas; } @@ -1448,30 +1402,68 @@ void tst_QDeclarativeListView::componentChanges() void tst_QDeclarativeListView::modelChanges() { QDeclarativeView *canvas = createView(); - QVERIFY(canvas); + QTRY_VERIFY(canvas); canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/propertychangestest.qml")); QDeclarativeListView *listView = canvas->rootObject()->findChild<QDeclarativeListView*>("listView"); - QVERIFY(listView); + QTRY_VERIFY(listView); QDeclarativeListModel *alternateModel = canvas->rootObject()->findChild<QDeclarativeListModel*>("alternateModel"); - QVERIFY(alternateModel); + QTRY_VERIFY(alternateModel); QVariant modelVariant = QVariant::fromValue(alternateModel); QSignalSpy modelSpy(listView, SIGNAL(modelChanged())); listView->setModel(modelVariant); - QCOMPARE(listView->model(), modelVariant); - QCOMPARE(modelSpy.count(),1); + QTRY_COMPARE(listView->model(), modelVariant); + QTRY_COMPARE(modelSpy.count(),1); listView->setModel(modelVariant); - QCOMPARE(modelSpy.count(),1); + QTRY_COMPARE(modelSpy.count(),1); listView->setModel(QVariant()); - QCOMPARE(modelSpy.count(),2); + QTRY_COMPARE(modelSpy.count(),2); + + delete canvas; +} + +void tst_QDeclarativeListView::QTBUG_9791() +{ + QDeclarativeView *canvas = createView(); + + QDeclarativeContext *ctxt = canvas->rootContext(); + + canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/strictlyenforcerange.qml")); + qApp->processEvents(); + + QDeclarativeListView *listview = qobject_cast<QDeclarativeListView*>(canvas->rootObject()); + QTRY_VERIFY(listview != 0); - delete canvas; + QDeclarativeItem *viewport = listview->viewport(); + QTRY_VERIFY(viewport != 0); + QTRY_VERIFY(listview->delegate() != 0); + QTRY_VERIFY(listview->model() != 0); + + QMetaObject::invokeMethod(listview, "fillModel"); + qApp->processEvents(); + + // Confirm items positioned correctly + int itemCount = findItems<QDeclarativeItem>(viewport, "wrapper").count(); + QVERIFY(itemCount == 3); + + for (int i = 0; i < itemCount; ++i) { + QDeclarativeItem *item = findItem<QDeclarativeItem>(viewport, "wrapper", i); + if (!item) qWarning() << "Item" << i << "not found"; + QTRY_VERIFY(item); + QTRY_COMPARE(item->x(), i*300.0); + } + + // check that view is positioned correctly + QTRY_COMPARE(listview->contentX(), 590.0); + + delete canvas; } + void tst_QDeclarativeListView::qListModelInterface_items() { items<TestModel>(); diff --git a/tests/auto/declarative/qdeclarativeloader/data/qmldir b/tests/auto/declarative/qdeclarativeloader/data/qmldir new file mode 100644 index 0000000..bf42b50 --- /dev/null +++ b/tests/auto/declarative/qdeclarativeloader/data/qmldir @@ -0,0 +1 @@ +# For tst_QDeclarativeLoader::networkRequestUrl; no types needed though. diff --git a/tests/auto/declarative/qdeclarativeloader/qdeclarativeloader.pro b/tests/auto/declarative/qdeclarativeloader/qdeclarativeloader.pro index 8ff2be4..96fea5b 100644 --- a/tests/auto/declarative/qdeclarativeloader/qdeclarativeloader.pro +++ b/tests/auto/declarative/qdeclarativeloader/qdeclarativeloader.pro @@ -9,3 +9,5 @@ SOURCES += tst_qdeclarativeloader.cpp \ DEFINES += SRCDIR=\\\"$$PWD\\\" +CONFIG += parallel_test + diff --git a/tests/auto/declarative/qdeclarativeloader/tst_qdeclarativeloader.cpp b/tests/auto/declarative/qdeclarativeloader/tst_qdeclarativeloader.cpp index abdd210..4a82b50 100644 --- a/tests/auto/declarative/qdeclarativeloader/tst_qdeclarativeloader.cpp +++ b/tests/auto/declarative/qdeclarativeloader/tst_qdeclarativeloader.cpp @@ -48,7 +48,7 @@ #include <private/qdeclarativeloader_p.h> #include "testhttpserver.h" -#define SERVER_PORT 14445 +#define SERVER_PORT 14450 inline QUrl TEST_FILE(const QString &filename) { @@ -104,7 +104,7 @@ tst_QDeclarativeLoader::tst_QDeclarativeLoader() void tst_QDeclarativeLoader::url() { QDeclarativeComponent component(&engine); - component.setData(QByteArray("import Qt 4.6\nLoader { source: \"Rect120x60.qml\" }"), TEST_FILE("")); + component.setData(QByteArray("import Qt 4.7\nLoader { source: \"Rect120x60.qml\" }"), TEST_FILE("")); QDeclarativeLoader *loader = qobject_cast<QDeclarativeLoader*>(component.create()); QVERIFY(loader != 0); QVERIFY(loader->item()); @@ -141,7 +141,7 @@ void tst_QDeclarativeLoader::invalidUrl() QTest::ignoreMessage(QtWarningMsg, QString("(:-1: File error for URL " + QUrl::fromLocalFile(SRCDIR "/data/IDontExist.qml").toString() + ") ").toUtf8().constData()); QDeclarativeComponent component(&engine); - component.setData(QByteArray("import Qt 4.6\nLoader { source: \"IDontExist.qml\" }"), TEST_FILE("")); + component.setData(QByteArray("import Qt 4.7\nLoader { source: \"IDontExist.qml\" }"), TEST_FILE("")); QDeclarativeLoader *loader = qobject_cast<QDeclarativeLoader*>(component.create()); QVERIFY(loader != 0); QVERIFY(loader->item() == 0); @@ -157,7 +157,7 @@ void tst_QDeclarativeLoader::clear() { QDeclarativeComponent component(&engine); component.setData(QByteArray( - "import Qt 4.6\n" + "import Qt 4.7\n" " Loader { id: loader\n" " source: 'Rect120x60.qml'\n" " Timer { interval: 200; running: true; onTriggered: loader.source = '' }\n" @@ -203,7 +203,7 @@ void tst_QDeclarativeLoader::clear() void tst_QDeclarativeLoader::urlToComponent() { QDeclarativeComponent component(&engine); - component.setData(QByteArray("import Qt 4.6\n" + component.setData(QByteArray("import Qt 4.7\n" "Loader {\n" " id: loader\n" " Component { id: myComp; Rectangle { width: 10; height: 10 } }\n" @@ -412,7 +412,9 @@ void tst_QDeclarativeLoader::networkRequestUrl() server.serveDirectory(SRCDIR "/data"); QDeclarativeComponent component(&engine); - component.setData(QByteArray("import Qt 4.6\nLoader { source: \"http://127.0.0.1:14445/Rect120x60.qml\" }"), QUrl("http://127.0.0.1:14445/dummy.qml")); + component.setData(QByteArray("import Qt 4.7\nLoader { source: \"http://127.0.0.1:14450/Rect120x60.qml\" }"), QUrl::fromLocalFile(SRCDIR "/dummy.qml")); + if (component.isError()) + qDebug() << component.errors(); QDeclarativeLoader *loader = qobject_cast<QDeclarativeLoader*>(component.create()); QVERIFY(loader != 0); @@ -434,8 +436,8 @@ void tst_QDeclarativeLoader::networkComponent() QDeclarativeComponent component(&engine); component.setData(QByteArray( - "import Qt 4.6\n" - "import \"http://127.0.0.1:14445/\" as NW\n" + "import Qt 4.7\n" + "import \"http://127.0.0.1:14450/\" as NW\n" "Item {\n" " Component { id: comp; NW.SlowRect {} }\n" " Loader { sourceComponent: comp } }") @@ -463,10 +465,10 @@ void tst_QDeclarativeLoader::failNetworkRequest() QVERIFY(server.isValid()); server.serveDirectory(SRCDIR "/data"); - QTest::ignoreMessage(QtWarningMsg, "(:-1: Network error for URL http://127.0.0.1:14445/IDontExist.qml) "); + QTest::ignoreMessage(QtWarningMsg, "(:-1: Network error for URL http://127.0.0.1:14450/IDontExist.qml) "); QDeclarativeComponent component(&engine); - component.setData(QByteArray("import Qt 4.6\nLoader { source: \"http://127.0.0.1:14445/IDontExist.qml\" }"), QUrl("http://127.0.0.1:14445/dummy.qml")); + component.setData(QByteArray("import Qt 4.7\nLoader { source: \"http://127.0.0.1:14450/IDontExist.qml\" }"), QUrl::fromLocalFile("http://127.0.0.1:14450/dummy.qml")); QDeclarativeLoader *loader = qobject_cast<QDeclarativeLoader*>(component.create()); QVERIFY(loader != 0); @@ -516,8 +518,9 @@ void tst_QDeclarativeLoader::nonItem() void tst_QDeclarativeLoader::vmeErrors() { QDeclarativeComponent component(&engine, TEST_FILE("vmeErrors.qml")); - QString err = QString("(") + QUrl::fromLocalFile(SRCDIR).toString() + QString("/data/VmeError.qml:6: Cannot assign object type QObject with no default method\n onSomethingHappened: QtObject {}) "); - QTest::ignoreMessage(QtWarningMsg, err.toLatin1().constData()); + //ignore message for now + //QString err = QUrl::fromLocalFile(SRCDIR "/data/VmeError.qml:6: Cannot assign object type QObject with no default method\n onSomethingHappened: QtObject {}) "); + //QTest::ignoreMessage(QtWarningMsg, err.toLatin1().constData()); QDeclarativeLoader *loader = qobject_cast<QDeclarativeLoader*>(component.create()); QVERIFY(loader); QVERIFY(loader->item() == 0); diff --git a/tests/auto/declarative/qdeclarativemetatype/qdeclarativemetatype.pro b/tests/auto/declarative/qdeclarativemetatype/qdeclarativemetatype.pro index 2f7ff82..cf3fa65 100644 --- a/tests/auto/declarative/qdeclarativemetatype/qdeclarativemetatype.pro +++ b/tests/auto/declarative/qdeclarativemetatype/qdeclarativemetatype.pro @@ -4,3 +4,6 @@ SOURCES += tst_qdeclarativemetatype.cpp macx:CONFIG -= app_bundle DEFINES += SRCDIR=\\\"$$PWD\\\" + +CONFIG += parallel_test + diff --git a/tests/auto/declarative/qdeclarativemoduleplugin/qdeclarativemoduleplugin.pro b/tests/auto/declarative/qdeclarativemoduleplugin/qdeclarativemoduleplugin.pro index 96f4454..824b402 100644 --- a/tests/auto/declarative/qdeclarativemoduleplugin/qdeclarativemoduleplugin.pro +++ b/tests/auto/declarative/qdeclarativemoduleplugin/qdeclarativemoduleplugin.pro @@ -4,4 +4,5 @@ SUBDIRS = plugin tst_qdeclarativemoduleplugin_pro.depends += plugin SUBDIRS += tst_qdeclarativemoduleplugin.pro +CONFIG += parallel_test diff --git a/tests/auto/declarative/qdeclarativemousearea/qdeclarativemousearea.pro b/tests/auto/declarative/qdeclarativemousearea/qdeclarativemousearea.pro index d01955b..48fe025 100644 --- a/tests/auto/declarative/qdeclarativemousearea/qdeclarativemousearea.pro +++ b/tests/auto/declarative/qdeclarativemousearea/qdeclarativemousearea.pro @@ -7,3 +7,6 @@ SOURCES += tst_qdeclarativemousearea.cpp ../shared/testhttpserver.cpp # Define SRCDIR equal to test's source directory DEFINES += SRCDIR=\\\"$$PWD\\\" + +CONFIG += parallel_test + diff --git a/tests/auto/declarative/qdeclarativeparticles/qdeclarativeparticles.pro b/tests/auto/declarative/qdeclarativeparticles/qdeclarativeparticles.pro index 043bb85..8a061c3 100644 --- a/tests/auto/declarative/qdeclarativeparticles/qdeclarativeparticles.pro +++ b/tests/auto/declarative/qdeclarativeparticles/qdeclarativeparticles.pro @@ -6,3 +6,6 @@ SOURCES += tst_qdeclarativeparticles.cpp # Define SRCDIR equal to test's source directory DEFINES += SRCDIR=\\\"$$PWD\\\" + +CONFIG += parallel_test + diff --git a/tests/auto/declarative/qdeclarativepathview/qdeclarativepathview.pro b/tests/auto/declarative/qdeclarativepathview/qdeclarativepathview.pro index 2f6ae32..3c327d5 100644 --- a/tests/auto/declarative/qdeclarativepathview/qdeclarativepathview.pro +++ b/tests/auto/declarative/qdeclarativepathview/qdeclarativepathview.pro @@ -6,3 +6,6 @@ SOURCES += tst_qdeclarativepathview.cpp # Define SRCDIR equal to test's source directory DEFINES += SRCDIR=\\\"$$PWD\\\" + +CONFIG += parallel_test + diff --git a/tests/auto/declarative/qdeclarativepathview/tst_qdeclarativepathview.cpp b/tests/auto/declarative/qdeclarativepathview/tst_qdeclarativepathview.cpp index 4d43c68..df7c511 100644 --- a/tests/auto/declarative/qdeclarativepathview/tst_qdeclarativepathview.cpp +++ b/tests/auto/declarative/qdeclarativepathview/tst_qdeclarativepathview.cpp @@ -632,7 +632,7 @@ void tst_QDeclarativePathView::componentChanges() QVERIFY(pathView); QDeclarativeComponent delegateComponent(canvas->engine()); - delegateComponent.setData("import Qt 4.6; Text { text: '<b>Name:</b> ' + name }", QUrl::fromLocalFile("")); + delegateComponent.setData("import Qt 4.7; Text { text: '<b>Name:</b> ' + name }", QUrl::fromLocalFile("")); QSignalSpy delegateSpy(pathView, SIGNAL(delegateChanged())); diff --git a/tests/auto/declarative/qdeclarativepixmapcache/data/http/exists.png b/tests/auto/declarative/qdeclarativepixmapcache/data/http/exists.png Binary files differnew file mode 100644 index 0000000..399bd0b --- /dev/null +++ b/tests/auto/declarative/qdeclarativepixmapcache/data/http/exists.png diff --git a/tests/auto/declarative/qdeclarativepixmapcache/data/http/exists1.png b/tests/auto/declarative/qdeclarativepixmapcache/data/http/exists1.png Binary files differnew file mode 100644 index 0000000..399bd0b --- /dev/null +++ b/tests/auto/declarative/qdeclarativepixmapcache/data/http/exists1.png diff --git a/tests/auto/declarative/qdeclarativepixmapcache/data/http/exists2.png b/tests/auto/declarative/qdeclarativepixmapcache/data/http/exists2.png Binary files differnew file mode 100644 index 0000000..399bd0b --- /dev/null +++ b/tests/auto/declarative/qdeclarativepixmapcache/data/http/exists2.png diff --git a/tests/auto/declarative/qdeclarativepixmapcache/data/http/exists3.png b/tests/auto/declarative/qdeclarativepixmapcache/data/http/exists3.png Binary files differnew file mode 100644 index 0000000..399bd0b --- /dev/null +++ b/tests/auto/declarative/qdeclarativepixmapcache/data/http/exists3.png diff --git a/tests/auto/declarative/qdeclarativepixmapcache/data/http/exists4.png b/tests/auto/declarative/qdeclarativepixmapcache/data/http/exists4.png Binary files differnew file mode 100644 index 0000000..399bd0b --- /dev/null +++ b/tests/auto/declarative/qdeclarativepixmapcache/data/http/exists4.png diff --git a/tests/auto/declarative/qdeclarativepixmapcache/data/http/exists5.png b/tests/auto/declarative/qdeclarativepixmapcache/data/http/exists5.png Binary files differnew file mode 100644 index 0000000..399bd0b --- /dev/null +++ b/tests/auto/declarative/qdeclarativepixmapcache/data/http/exists5.png diff --git a/tests/auto/declarative/qdeclarativepixmapcache/qdeclarativepixmapcache.pro b/tests/auto/declarative/qdeclarativepixmapcache/qdeclarativepixmapcache.pro index 899c43f..4b247fc 100644 --- a/tests/auto/declarative/qdeclarativepixmapcache/qdeclarativepixmapcache.pro +++ b/tests/auto/declarative/qdeclarativepixmapcache/qdeclarativepixmapcache.pro @@ -5,5 +5,14 @@ macx:CONFIG -= app_bundle SOURCES += tst_qdeclarativepixmapcache.cpp +INCLUDEPATH += ../shared/ +HEADERS += ../shared/testhttpserver.h +SOURCES += ../shared/testhttpserver.cpp + +DEFINES += SRCDIR=\\\"$$PWD\\\" + # QMAKE_CXXFLAGS = -fprofile-arcs -ftest-coverage # LIBS += -lgcov + +CONFIG += parallel_test + diff --git a/tests/auto/declarative/qdeclarativepixmapcache/tst_qdeclarativepixmapcache.cpp b/tests/auto/declarative/qdeclarativepixmapcache/tst_qdeclarativepixmapcache.cpp index 223f54f..f2ccf80 100644 --- a/tests/auto/declarative/qdeclarativepixmapcache/tst_qdeclarativepixmapcache.cpp +++ b/tests/auto/declarative/qdeclarativepixmapcache/tst_qdeclarativepixmapcache.cpp @@ -43,6 +43,8 @@ #include <private/qdeclarativepixmapcache_p.h> #include <QtDeclarative/qdeclarativeengine.h> #include <QNetworkReply> +#include "testhttpserver.h" +#include "../../../shared/util.h" // These don't let normal people run tests! //#include "../network-settings.h" @@ -52,8 +54,10 @@ class tst_qdeclarativepixmapcache : public QObject Q_OBJECT public: tst_qdeclarativepixmapcache() : - thisfile(QUrl::fromLocalFile(__FILE__)) + thisfile(QUrl::fromLocalFile(__FILE__)), + server(14452) { + server.serveDirectory(SRCDIR "/data/http"); } private slots: @@ -65,6 +69,7 @@ private slots: private: QDeclarativeEngine engine; QUrl thisfile; + TestHTTPServer server; }; @@ -110,8 +115,8 @@ void tst_qdeclarativepixmapcache::single_data() // File URLs are optimized QTest::newRow("local") << thisfile.resolved(QUrl("data/exists.png")) << localfile_optimized << true << false; QTest::newRow("local") << thisfile.resolved(QUrl("data/notexists.png")) << localfile_optimized << false << false; - QTest::newRow("remote") << QUrl("http://qt.nokia.com/logo.png") << false << true << false; - QTest::newRow("remote") << QUrl("http://qt.nokia.com/thereisnologo.png") << false << false << true; + QTest::newRow("remote") << QUrl("http://127.0.0.1:14452/exists.png") << false << true << false; + QTest::newRow("remote") << QUrl("http://127.0.0.1:14452/notexists.png") << false << false << true; } void tst_qdeclarativepixmapcache::single() @@ -122,7 +127,7 @@ void tst_qdeclarativepixmapcache::single() QFETCH(bool, neterror); if (neterror) { - QString expected = "\"Error downloading " + target.toString() + " - server replied: Not Found\" "; + QString expected = "\"Error downloading " + target.toString() + " - server replied: Not found\" "; QTest::ignoreMessage(QtWarningMsg, expected.toLatin1()); } else if (!exists) { QString expected = "Cannot open QUrl( \"" + target.toString() + "\" ) "; @@ -183,32 +188,32 @@ void tst_qdeclarativepixmapcache::parallel_data() ; QTest::newRow("remote") - << QUrl("http://qt.nokia.com/images/template/checkbox-on.png") - << QUrl("http://qt.nokia.com/images/products/qt-logo/image_tile") + << QUrl("http://127.0.0.1:14452/exists2.png") + << QUrl("http://127.0.0.1:14452/exists3.png") << 0 << -1 << 2 ; QTest::newRow("remoteagain") - << QUrl("http://qt.nokia.com/images/template/checkbox-on.png") - << QUrl("http://qt.nokia.com/images/products/qt-logo/image_tile") + << QUrl("http://127.0.0.1:14452/exists2.png") + << QUrl("http://127.0.0.1:14452/exists3.png") << 2 << -1 << 0 ; QTest::newRow("remotecopy") - << QUrl("http://qt.nokia.com/images/template/checkbox-off.png") - << QUrl("http://qt.nokia.com/images/template/checkbox-off.png") + << QUrl("http://127.0.0.1:14452/exists4.png") + << QUrl("http://127.0.0.1:14452/exists4.png") << 0 << -1 << 1 ; QTest::newRow("remotecopycancel") - << QUrl("http://qt.nokia.com/rounded_block_bg.png") - << QUrl("http://qt.nokia.com/rounded_block_bg.png") + << QUrl("http://127.0.0.1:14452/exists5.png") + << QUrl("http://127.0.0.1:14452/exists5.png") << 0 << 0 << 1 @@ -233,6 +238,7 @@ void tst_qdeclarativepixmapcache::parallel() QPixmap pixmap; QDeclarativePixmapReply::Status status = QDeclarativePixmapCache::get(target, &pixmap); QDeclarativePixmapReply *reply = 0; + QVERIFY(status != QDeclarativePixmapReply::Error); if (status != QDeclarativePixmapReply::Error && status != QDeclarativePixmapReply::Ready) reply = QDeclarativePixmapCache::request(&engine, target); replies.append(reply); diff --git a/tests/auto/declarative/qdeclarativepositioners/data/gridzerocolumns.qml b/tests/auto/declarative/qdeclarativepositioners/data/gridzerocolumns.qml new file mode 100644 index 0000000..052d96b --- /dev/null +++ b/tests/auto/declarative/qdeclarativepositioners/data/gridzerocolumns.qml @@ -0,0 +1,40 @@ +import Qt 4.6 + +Item { + width: 640 + height: 480 + Grid { + objectName: "grid" + columns: 0 + Rectangle { + objectName: "one" + color: "red" + width: 50 + height: 50 + } + Rectangle { + objectName: "two" + color: "green" + width: 20 + height: 50 + } + Rectangle { + objectName: "three" + color: "blue" + width: 50 + height: 20 + } + Rectangle { + objectName: "four" + color: "cyan" + width: 50 + height: 50 + } + Rectangle { + objectName: "five" + color: "magenta" + width: 10 + height: 10 + } + } +} diff --git a/tests/auto/declarative/qdeclarativepositioners/qdeclarativepositioners.pro b/tests/auto/declarative/qdeclarativepositioners/qdeclarativepositioners.pro index 5edfa55..dbe2cbee 100644 --- a/tests/auto/declarative/qdeclarativepositioners/qdeclarativepositioners.pro +++ b/tests/auto/declarative/qdeclarativepositioners/qdeclarativepositioners.pro @@ -5,3 +5,6 @@ macx:CONFIG -= app_bundle # Define SRCDIR equal to test's source directory DEFINES += SRCDIR=\\\"$$PWD\\\" + +CONFIG += parallel_test + diff --git a/tests/auto/declarative/qdeclarativepositioners/tst_qdeclarativepositioners.cpp b/tests/auto/declarative/qdeclarativepositioners/tst_qdeclarativepositioners.cpp index 08eac0a..8692596 100644 --- a/tests/auto/declarative/qdeclarativepositioners/tst_qdeclarativepositioners.cpp +++ b/tests/auto/declarative/qdeclarativepositioners/tst_qdeclarativepositioners.cpp @@ -63,6 +63,7 @@ private slots: void test_grid(); void test_grid_spacing(); void test_grid_animated(); + void test_grid_zero_columns(); void test_propertychanges(); void test_repeater(); void test_flow(); @@ -414,6 +415,38 @@ void tst_QDeclarativePositioners::test_grid_animated() QTRY_COMPARE(five->y(), 50.0); } + +void tst_QDeclarativePositioners::test_grid_zero_columns() +{ + QDeclarativeView *canvas = createView(SRCDIR "/data/gridzerocolumns.qml"); + + QDeclarativeRectangle *one = canvas->rootObject()->findChild<QDeclarativeRectangle*>("one"); + QVERIFY(one != 0); + QDeclarativeRectangle *two = canvas->rootObject()->findChild<QDeclarativeRectangle*>("two"); + QVERIFY(two != 0); + QDeclarativeRectangle *three = canvas->rootObject()->findChild<QDeclarativeRectangle*>("three"); + QVERIFY(three != 0); + QDeclarativeRectangle *four = canvas->rootObject()->findChild<QDeclarativeRectangle*>("four"); + QVERIFY(four != 0); + QDeclarativeRectangle *five = canvas->rootObject()->findChild<QDeclarativeRectangle*>("five"); + QVERIFY(five != 0); + + QCOMPARE(one->x(), 0.0); + QCOMPARE(one->y(), 0.0); + QCOMPARE(two->x(), 50.0); + QCOMPARE(two->y(), 0.0); + QCOMPARE(three->x(), 70.0); + QCOMPARE(three->y(), 0.0); + QCOMPARE(four->x(), 120.0); + QCOMPARE(four->y(), 0.0); + QCOMPARE(five->x(), 0.0); + QCOMPARE(five->y(), 50.0); + + QDeclarativeItem *grid = canvas->rootObject()->findChild<QDeclarativeItem*>("grid"); + QCOMPARE(grid->width(), 170.0); + QCOMPARE(grid->height(), 60.0); +} + void tst_QDeclarativePositioners::test_propertychanges() { QDeclarativeView *canvas = createView(SRCDIR "/data/propertychangestest.qml"); diff --git a/tests/auto/declarative/qdeclarativeproperty/qdeclarativeproperty.pro b/tests/auto/declarative/qdeclarativeproperty/qdeclarativeproperty.pro index af1e1b6..6910ccc 100644 --- a/tests/auto/declarative/qdeclarativeproperty/qdeclarativeproperty.pro +++ b/tests/auto/declarative/qdeclarativeproperty/qdeclarativeproperty.pro @@ -5,3 +5,6 @@ macx:CONFIG -= app_bundle SOURCES += tst_qdeclarativeproperty.cpp DEFINES += SRCDIR=\\\"$$PWD\\\" + +CONFIG += parallel_test + diff --git a/tests/auto/declarative/qdeclarativepropertymap/qdeclarativepropertymap.pro b/tests/auto/declarative/qdeclarativepropertymap/qdeclarativepropertymap.pro index aeccf9b..3c0f7b3 100644 --- a/tests/auto/declarative/qdeclarativepropertymap/qdeclarativepropertymap.pro +++ b/tests/auto/declarative/qdeclarativepropertymap/qdeclarativepropertymap.pro @@ -3,3 +3,6 @@ contains(QT_CONFIG,declarative): QT += declarative macx:CONFIG -= app_bundle SOURCES += tst_qdeclarativepropertymap.cpp + +CONFIG += parallel_test + diff --git a/tests/auto/declarative/qdeclarativepropertymap/tst_qdeclarativepropertymap.cpp b/tests/auto/declarative/qdeclarativepropertymap/tst_qdeclarativepropertymap.cpp index c996a14..f1d3bf0 100644 --- a/tests/auto/declarative/qdeclarativepropertymap/tst_qdeclarativepropertymap.cpp +++ b/tests/auto/declarative/qdeclarativepropertymap/tst_qdeclarativepropertymap.cpp @@ -138,7 +138,7 @@ void tst_QDeclarativePropertyMap::changed() QDeclarativeContext *ctxt = engine.rootContext(); ctxt->setContextProperty(QLatin1String("testdata"), &map); QDeclarativeComponent component(&engine); - component.setData("import Qt 4.6\nText { text: { testdata.key1 = 'Hello World'; 'X' } }", + component.setData("import Qt 4.7\nText { text: { testdata.key1 = 'Hello World'; 'X' } }", QUrl::fromLocalFile("")); QVERIFY(component.isReady()); QDeclarativeText *txt = qobject_cast<QDeclarativeText*>(component.create()); @@ -179,7 +179,7 @@ void tst_QDeclarativePropertyMap::crashBug() context.setContextProperty("map", &map); QDeclarativeComponent c(&engine); - c.setData("import Qt 4.6\nBinding { target: map; property: \"myProp\"; value: 10 + 23 }",QUrl()); + c.setData("import Qt 4.7\nBinding { target: map; property: \"myProp\"; value: 10 + 23 }",QUrl()); QObject *obj = c.create(&context); delete obj; } diff --git a/tests/auto/declarative/qdeclarativeqt/qdeclarativeqt.pro b/tests/auto/declarative/qdeclarativeqt/qdeclarativeqt.pro index aff00ad..10e10a3 100644 --- a/tests/auto/declarative/qdeclarativeqt/qdeclarativeqt.pro +++ b/tests/auto/declarative/qdeclarativeqt/qdeclarativeqt.pro @@ -7,3 +7,6 @@ DEFINES += SRCDIR=\\\"$$PWD\\\" # QMAKE_CXXFLAGS = -fprofile-arcs -ftest-coverage # LIBS += -lgcov + +CONFIG += parallel_test + diff --git a/tests/auto/declarative/qdeclarativerepeater/qdeclarativerepeater.pro b/tests/auto/declarative/qdeclarativerepeater/qdeclarativerepeater.pro index 132123a..abd36e0 100644 --- a/tests/auto/declarative/qdeclarativerepeater/qdeclarativerepeater.pro +++ b/tests/auto/declarative/qdeclarativerepeater/qdeclarativerepeater.pro @@ -6,3 +6,5 @@ SOURCES += tst_qdeclarativerepeater.cpp # Define SRCDIR equal to test's source directory DEFINES += SRCDIR=\\\"$$PWD\\\" + +CONFIG += parallel_test diff --git a/tests/auto/declarative/qdeclarativerepeater/tst_qdeclarativerepeater.cpp b/tests/auto/declarative/qdeclarativerepeater/tst_qdeclarativerepeater.cpp index 419f5ea..8be7d80 100644 --- a/tests/auto/declarative/qdeclarativerepeater/tst_qdeclarativerepeater.cpp +++ b/tests/auto/declarative/qdeclarativerepeater/tst_qdeclarativerepeater.cpp @@ -354,7 +354,7 @@ void tst_QDeclarativeRepeater::properties() QSignalSpy delegateSpy(repeater, SIGNAL(delegateChanged())); QDeclarativeComponent rectComponent(&engine); - rectComponent.setData("import Qt 4.6; Rectangle {}", QUrl::fromLocalFile("")); + rectComponent.setData("import Qt 4.7; Rectangle {}", QUrl::fromLocalFile("")); repeater->setDelegate(&rectComponent); QCOMPARE(delegateSpy.count(),1); diff --git a/tests/auto/declarative/qdeclarativesmoothedanimation/qdeclarativesmoothedanimation.pro b/tests/auto/declarative/qdeclarativesmoothedanimation/qdeclarativesmoothedanimation.pro index b41b23a..80b757d 100644 --- a/tests/auto/declarative/qdeclarativesmoothedanimation/qdeclarativesmoothedanimation.pro +++ b/tests/auto/declarative/qdeclarativesmoothedanimation/qdeclarativesmoothedanimation.pro @@ -6,3 +6,6 @@ SOURCES += tst_qdeclarativesmoothedanimation.cpp # Define SRCDIR equal to test's source directory DEFINES += SRCDIR=\\\"$$PWD\\\" + +CONFIG += parallel_test + diff --git a/tests/auto/declarative/qdeclarativesmoothedfollow/qdeclarativesmoothedfollow.pro b/tests/auto/declarative/qdeclarativesmoothedfollow/qdeclarativesmoothedfollow.pro index f8e97a0..7f737c2 100644 --- a/tests/auto/declarative/qdeclarativesmoothedfollow/qdeclarativesmoothedfollow.pro +++ b/tests/auto/declarative/qdeclarativesmoothedfollow/qdeclarativesmoothedfollow.pro @@ -6,3 +6,6 @@ SOURCES += tst_qdeclarativesmoothedfollow.cpp # Define SRCDIR equal to test's source directory DEFINES += SRCDIR=\\\"$$PWD\\\" + +CONFIG += parallel_test + diff --git a/tests/auto/declarative/qdeclarativespringfollow/qdeclarativespringfollow.pro b/tests/auto/declarative/qdeclarativespringfollow/qdeclarativespringfollow.pro index 61aad0f..6f400a3 100644 --- a/tests/auto/declarative/qdeclarativespringfollow/qdeclarativespringfollow.pro +++ b/tests/auto/declarative/qdeclarativespringfollow/qdeclarativespringfollow.pro @@ -6,3 +6,6 @@ SOURCES += tst_qdeclarativespringfollow.cpp # Define SRCDIR equal to test's source directory DEFINES += SRCDIR=\\\"$$PWD\\\" + +CONFIG += parallel_test + diff --git a/tests/auto/declarative/qdeclarativestates/qdeclarativestates.pro b/tests/auto/declarative/qdeclarativestates/qdeclarativestates.pro index f874803..706d045 100644 --- a/tests/auto/declarative/qdeclarativestates/qdeclarativestates.pro +++ b/tests/auto/declarative/qdeclarativestates/qdeclarativestates.pro @@ -6,3 +6,5 @@ SOURCES += tst_qdeclarativestates.cpp # Define SRCDIR equal to test's source directory DEFINES += SRCDIR=\\\"$$PWD\\\" + +CONFIG += parallel_test diff --git a/tests/auto/declarative/qdeclarativestyledtext/qdeclarativestyledtext.pro b/tests/auto/declarative/qdeclarativestyledtext/qdeclarativestyledtext.pro index bd4d829..87d0e5b 100644 --- a/tests/auto/declarative/qdeclarativestyledtext/qdeclarativestyledtext.pro +++ b/tests/auto/declarative/qdeclarativestyledtext/qdeclarativestyledtext.pro @@ -7,3 +7,5 @@ SOURCES += tst_qdeclarativestyledtext.cpp # QMAKE_CXXFLAGS = -fprofile-arcs -ftest-coverage # LIBS += -lgcov + +CONFIG += parallel_test diff --git a/tests/auto/declarative/qdeclarativesystempalette/qdeclarativesystempalette.pro b/tests/auto/declarative/qdeclarativesystempalette/qdeclarativesystempalette.pro index 0781774..b2705fa 100644 --- a/tests/auto/declarative/qdeclarativesystempalette/qdeclarativesystempalette.pro +++ b/tests/auto/declarative/qdeclarativesystempalette/qdeclarativesystempalette.pro @@ -3,3 +3,6 @@ contains(QT_CONFIG,declarative): QT += declarative gui macx:CONFIG -= app_bundle SOURCES += tst_qdeclarativesystempalette.cpp + +CONFIG += parallel_test + diff --git a/tests/auto/declarative/qdeclarativesystempalette/tst_qdeclarativesystempalette.cpp b/tests/auto/declarative/qdeclarativesystempalette/tst_qdeclarativesystempalette.cpp index 5c93952..7927d97 100644 --- a/tests/auto/declarative/qdeclarativesystempalette/tst_qdeclarativesystempalette.cpp +++ b/tests/auto/declarative/qdeclarativesystempalette/tst_qdeclarativesystempalette.cpp @@ -70,7 +70,7 @@ tst_qdeclarativesystempalette::tst_qdeclarativesystempalette() void tst_qdeclarativesystempalette::activePalette() { - QString componentStr = "import Qt 4.6\nSystemPalette { }"; + QString componentStr = "import Qt 4.7\nSystemPalette { }"; QDeclarativeComponent component(&engine); component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeSystemPalette *object = qobject_cast<QDeclarativeSystemPalette*>(component.create()); @@ -99,7 +99,7 @@ void tst_qdeclarativesystempalette::activePalette() void tst_qdeclarativesystempalette::inactivePalette() { - QString componentStr = "import Qt 4.6\nSystemPalette { colorGroup: SystemPalette.Inactive }"; + QString componentStr = "import Qt 4.7\nSystemPalette { colorGroup: SystemPalette.Inactive }"; QDeclarativeComponent component(&engine); component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeSystemPalette *object = qobject_cast<QDeclarativeSystemPalette*>(component.create()); @@ -129,7 +129,7 @@ void tst_qdeclarativesystempalette::inactivePalette() void tst_qdeclarativesystempalette::disabledPalette() { - QString componentStr = "import Qt 4.6\nSystemPalette { colorGroup: SystemPalette.Disabled }"; + QString componentStr = "import Qt 4.7\nSystemPalette { colorGroup: SystemPalette.Disabled }"; QDeclarativeComponent component(&engine); component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeSystemPalette *object = qobject_cast<QDeclarativeSystemPalette*>(component.create()); @@ -159,7 +159,7 @@ void tst_qdeclarativesystempalette::disabledPalette() void tst_qdeclarativesystempalette::paletteChanged() { - QString componentStr = "import Qt 4.6\nSystemPalette { }"; + QString componentStr = "import Qt 4.7\nSystemPalette { }"; QDeclarativeComponent component(&engine); component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeSystemPalette *object = qobject_cast<QDeclarativeSystemPalette*>(component.create()); diff --git a/tests/auto/declarative/qdeclarativetext/qdeclarativetext.pro b/tests/auto/declarative/qdeclarativetext/qdeclarativetext.pro index 8b4b4d1..73c05b5 100644 --- a/tests/auto/declarative/qdeclarativetext/qdeclarativetext.pro +++ b/tests/auto/declarative/qdeclarativetext/qdeclarativetext.pro @@ -3,3 +3,6 @@ contains(QT_CONFIG,declarative): QT += declarative gui macx:CONFIG -= app_bundle SOURCES += tst_qdeclarativetext.cpp + +CONFIG += parallel_test + diff --git a/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp b/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp index bf7d110..2d10756 100644 --- a/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp +++ b/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp @@ -156,7 +156,7 @@ void tst_qdeclarativetext::text() { { QDeclarativeComponent textComponent(&engine); - textComponent.setData("import Qt 4.6\nText { text: \"\" }", QUrl::fromLocalFile("")); + textComponent.setData("import Qt 4.7\nText { text: \"\" }", QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast<QDeclarativeText*>(textComponent.create()); QVERIFY(textObject != 0); @@ -168,7 +168,7 @@ void tst_qdeclarativetext::text() for (int i = 0; i < standard.size(); i++) { - QString componentStr = "import Qt 4.6\nText { text: \"" + standard.at(i) + "\" }"; + QString componentStr = "import Qt 4.7\nText { text: \"" + standard.at(i) + "\" }"; QDeclarativeComponent textComponent(&engine); textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); @@ -181,7 +181,7 @@ void tst_qdeclarativetext::text() for (int i = 0; i < richText.size(); i++) { - QString componentStr = "import Qt 4.6\nText { text: \"" + richText.at(i) + "\" }"; + QString componentStr = "import Qt 4.7\nText { text: \"" + richText.at(i) + "\" }"; QDeclarativeComponent textComponent(&engine); textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast<QDeclarativeText*>(textComponent.create()); @@ -198,7 +198,7 @@ void tst_qdeclarativetext::width() // uses Font metrics to find the width for standard and document to find the width for rich { QDeclarativeComponent textComponent(&engine); - textComponent.setData("import Qt 4.6\nText { text: \"\" }", QUrl::fromLocalFile("")); + textComponent.setData("import Qt 4.7\nText { text: \"\" }", QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast<QDeclarativeText*>(textComponent.create()); QVERIFY(textObject != 0); @@ -214,7 +214,7 @@ void tst_qdeclarativetext::width() qreal metricWidth = fm.size(Qt::TextExpandTabs && Qt::TextShowMnemonic, standard.at(i)).width(); metricWidth = qCeil(metricWidth); - QString componentStr = "import Qt 4.6\nText { text: \"" + standard.at(i) + "\" }"; + QString componentStr = "import Qt 4.7\nText { text: \"" + standard.at(i) + "\" }"; QDeclarativeComponent textComponent(&engine); textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast<QDeclarativeText*>(textComponent.create()); @@ -234,7 +234,7 @@ void tst_qdeclarativetext::width() int documentWidth = document.idealWidth(); - QString componentStr = "import Qt 4.6\nText { text: \"" + richText.at(i) + "\" }"; + QString componentStr = "import Qt 4.7\nText { text: \"" + richText.at(i) + "\" }"; QDeclarativeComponent textComponent(&engine); textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast<QDeclarativeText*>(textComponent.create()); @@ -251,7 +251,7 @@ void tst_qdeclarativetext::wrap() // for specified width and wrap set true { QDeclarativeComponent textComponent(&engine); - textComponent.setData("import Qt 4.6\nText { text: \"Hello\"; wrapMode: Text.WordWrap; width: 300 }", QUrl::fromLocalFile("")); + textComponent.setData("import Qt 4.7\nText { text: \"Hello\"; wrapMode: Text.WordWrap; width: 300 }", QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast<QDeclarativeText*>(textComponent.create()); textHeight = textObject->height(); @@ -262,7 +262,7 @@ void tst_qdeclarativetext::wrap() for (int i = 0; i < standard.size(); i++) { - QString componentStr = "import Qt 4.6\nText { wrapMode: Text.WordWrap; width: 30; text: \"" + standard.at(i) + "\" }"; + QString componentStr = "import Qt 4.7\nText { wrapMode: Text.WordWrap; width: 30; text: \"" + standard.at(i) + "\" }"; QDeclarativeComponent textComponent(&engine); textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast<QDeclarativeText*>(textComponent.create()); @@ -278,7 +278,7 @@ void tst_qdeclarativetext::wrap() for (int i = 0; i < richText.size(); i++) { - QString componentStr = "import Qt 4.6\nText { wrapMode: Text.WordWrap; width: 30; text: \"" + richText.at(i) + "\" }"; + QString componentStr = "import Qt 4.7\nText { wrapMode: Text.WordWrap; width: 30; text: \"" + richText.at(i) + "\" }"; QDeclarativeComponent textComponent(&engine); textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast<QDeclarativeText*>(textComponent.create()); @@ -300,7 +300,7 @@ void tst_qdeclarativetext::elide() { QDeclarativeComponent textComponent(&engine); - textComponent.setData(("import Qt 4.6\nText { text: \"\"; "+elide+" width: 100 }").toLatin1(), QUrl::fromLocalFile("")); + textComponent.setData(("import Qt 4.7\nText { text: \"\"; "+elide+" width: 100 }").toLatin1(), QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast<QDeclarativeText*>(textComponent.create()); QCOMPARE(textObject->elideMode(), m); @@ -309,7 +309,7 @@ void tst_qdeclarativetext::elide() for (int i = 0; i < standard.size(); i++) { - QString componentStr = "import Qt 4.6\nText { "+elide+" width: 100; text: \"" + standard.at(i) + "\" }"; + QString componentStr = "import Qt 4.7\nText { "+elide+" width: 100; text: \"" + standard.at(i) + "\" }"; QDeclarativeComponent textComponent(&engine); textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast<QDeclarativeText*>(textComponent.create()); @@ -321,7 +321,7 @@ void tst_qdeclarativetext::elide() // richtext - does nothing for (int i = 0; i < richText.size(); i++) { - QString componentStr = "import Qt 4.6\nText { "+elide+" width: 100; text: \"" + richText.at(i) + "\" }"; + QString componentStr = "import Qt 4.7\nText { "+elide+" width: 100; text: \"" + richText.at(i) + "\" }"; QDeclarativeComponent textComponent(&engine); textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast<QDeclarativeText*>(textComponent.create()); @@ -336,7 +336,7 @@ void tst_qdeclarativetext::textFormat() { { QDeclarativeComponent textComponent(&engine); - textComponent.setData("import Qt 4.6\nText { text: \"Hello\"; textFormat: Text.RichText }", QUrl::fromLocalFile("")); + textComponent.setData("import Qt 4.7\nText { text: \"Hello\"; textFormat: Text.RichText }", QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast<QDeclarativeText*>(textComponent.create()); QVERIFY(textObject != 0); @@ -344,7 +344,7 @@ void tst_qdeclarativetext::textFormat() } { QDeclarativeComponent textComponent(&engine); - textComponent.setData("import Qt 4.6\nText { text: \"<b>Hello</b>\"; textFormat: Text.PlainText }", QUrl::fromLocalFile("")); + textComponent.setData("import Qt 4.7\nText { text: \"<b>Hello</b>\"; textFormat: Text.PlainText }", QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast<QDeclarativeText*>(textComponent.create()); QVERIFY(textObject != 0); @@ -361,7 +361,7 @@ void tst_qdeclarativetext::horizontalAlignment() { for (int j=0; j < horizontalAlignmentmentStrings.size(); j++) { - QString componentStr = "import Qt 4.6\nText { horizontalAlignment: \"" + horizontalAlignmentmentStrings.at(j) + "\"; text: \"" + standard.at(i) + "\" }"; + QString componentStr = "import Qt 4.7\nText { horizontalAlignment: \"" + horizontalAlignmentmentStrings.at(j) + "\"; text: \"" + standard.at(i) + "\" }"; QDeclarativeComponent textComponent(&engine); textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast<QDeclarativeText*>(textComponent.create()); @@ -374,7 +374,7 @@ void tst_qdeclarativetext::horizontalAlignment() { for (int j=0; j < horizontalAlignmentmentStrings.size(); j++) { - QString componentStr = "import Qt 4.6\nText { horizontalAlignment: \"" + horizontalAlignmentmentStrings.at(j) + "\"; text: \"" + richText.at(i) + "\" }"; + QString componentStr = "import Qt 4.7\nText { horizontalAlignment: \"" + horizontalAlignmentmentStrings.at(j) + "\"; text: \"" + richText.at(i) + "\" }"; QDeclarativeComponent textComponent(&engine); textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast<QDeclarativeText*>(textComponent.create()); @@ -393,7 +393,7 @@ void tst_qdeclarativetext::verticalAlignment() { for (int j=0; j < verticalAlignmentmentStrings.size(); j++) { - QString componentStr = "import Qt 4.6\nText { verticalAlignment: \"" + verticalAlignmentmentStrings.at(j) + "\"; text: \"" + standard.at(i) + "\" }"; + QString componentStr = "import Qt 4.7\nText { verticalAlignment: \"" + verticalAlignmentmentStrings.at(j) + "\"; text: \"" + standard.at(i) + "\" }"; QDeclarativeComponent textComponent(&engine); textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast<QDeclarativeText*>(textComponent.create()); @@ -407,7 +407,7 @@ void tst_qdeclarativetext::verticalAlignment() { for (int j=0; j < verticalAlignmentmentStrings.size(); j++) { - QString componentStr = "import Qt 4.6\nText { verticalAlignment: \"" + verticalAlignmentmentStrings.at(j) + "\"; text: \"" + richText.at(i) + "\" }"; + QString componentStr = "import Qt 4.7\nText { verticalAlignment: \"" + verticalAlignmentmentStrings.at(j) + "\"; text: \"" + richText.at(i) + "\" }"; QDeclarativeComponent textComponent(&engine); textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast<QDeclarativeText*>(textComponent.create()); @@ -423,7 +423,7 @@ void tst_qdeclarativetext::font() { //test size, then bold, then italic, then family { - QString componentStr = "import Qt 4.6\nText { font.pointSize: 40; text: \"Hello World\" }"; + QString componentStr = "import Qt 4.7\nText { font.pointSize: 40; text: \"Hello World\" }"; QDeclarativeComponent textComponent(&engine); textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast<QDeclarativeText*>(textComponent.create()); @@ -434,7 +434,7 @@ void tst_qdeclarativetext::font() } { - QString componentStr = "import Qt 4.6\nText { font.pixelSize: 40; text: \"Hello World\" }"; + QString componentStr = "import Qt 4.7\nText { font.pixelSize: 40; text: \"Hello World\" }"; QDeclarativeComponent textComponent(&engine); textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast<QDeclarativeText*>(textComponent.create()); @@ -445,7 +445,7 @@ void tst_qdeclarativetext::font() } { - QString componentStr = "import Qt 4.6\nText { font.bold: true; text: \"Hello World\" }"; + QString componentStr = "import Qt 4.7\nText { font.bold: true; text: \"Hello World\" }"; QDeclarativeComponent textComponent(&engine); textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast<QDeclarativeText*>(textComponent.create()); @@ -455,7 +455,7 @@ void tst_qdeclarativetext::font() } { - QString componentStr = "import Qt 4.6\nText { font.italic: true; text: \"Hello World\" }"; + QString componentStr = "import Qt 4.7\nText { font.italic: true; text: \"Hello World\" }"; QDeclarativeComponent textComponent(&engine); textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast<QDeclarativeText*>(textComponent.create()); @@ -465,7 +465,7 @@ void tst_qdeclarativetext::font() } { - QString componentStr = "import Qt 4.6\nText { font.family: \"Helvetica\"; text: \"Hello World\" }"; + QString componentStr = "import Qt 4.7\nText { font.family: \"Helvetica\"; text: \"Hello World\" }"; QDeclarativeComponent textComponent(&engine); textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast<QDeclarativeText*>(textComponent.create()); @@ -476,7 +476,7 @@ void tst_qdeclarativetext::font() } { - QString componentStr = "import Qt 4.6\nText { font.family: \"\"; text: \"Hello World\" }"; + QString componentStr = "import Qt 4.7\nText { font.family: \"\"; text: \"Hello World\" }"; QDeclarativeComponent textComponent(&engine); textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast<QDeclarativeText*>(textComponent.create()); @@ -490,7 +490,7 @@ void tst_qdeclarativetext::style() //test style for (int i = 0; i < styles.size(); i++) { - QString componentStr = "import Qt 4.6\nText { style: \"" + styleStrings.at(i) + "\"; styleColor: \"white\"; text: \"Hello World\" }"; + QString componentStr = "import Qt 4.7\nText { style: \"" + styleStrings.at(i) + "\"; styleColor: \"white\"; text: \"Hello World\" }"; QDeclarativeComponent textComponent(&engine); textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast<QDeclarativeText*>(textComponent.create()); @@ -505,7 +505,7 @@ void tst_qdeclarativetext::color() //test style for (int i = 0; i < colorStrings.size(); i++) { - QString componentStr = "import Qt 4.6\nText { color: \"" + colorStrings.at(i) + "\"; text: \"Hello World\" }"; + QString componentStr = "import Qt 4.7\nText { color: \"" + colorStrings.at(i) + "\"; text: \"Hello World\" }"; QDeclarativeComponent textComponent(&engine); textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast<QDeclarativeText*>(textComponent.create()); @@ -516,7 +516,7 @@ void tst_qdeclarativetext::color() for (int i = 0; i < colorStrings.size(); i++) { - QString componentStr = "import Qt 4.6\nText { styleColor: \"" + colorStrings.at(i) + "\"; text: \"Hello World\" }"; + QString componentStr = "import Qt 4.7\nText { styleColor: \"" + colorStrings.at(i) + "\"; text: \"Hello World\" }"; QDeclarativeComponent textComponent(&engine); textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast<QDeclarativeText*>(textComponent.create()); @@ -530,7 +530,7 @@ void tst_qdeclarativetext::color() { for (int j = 0; j < colorStrings.size(); j++) { - QString componentStr = "import Qt 4.6\nText { color: \"" + colorStrings.at(i) + "\"; styleColor: \"" + colorStrings.at(j) + "\"; text: \"Hello World\" }"; + QString componentStr = "import Qt 4.7\nText { color: \"" + colorStrings.at(i) + "\"; styleColor: \"" + colorStrings.at(j) + "\"; text: \"Hello World\" }"; QDeclarativeComponent textComponent(&engine); textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast<QDeclarativeText*>(textComponent.create()); @@ -544,7 +544,7 @@ void tst_qdeclarativetext::color() QColor testColor("#001234"); testColor.setAlpha(170); - QString componentStr = "import Qt 4.6\nText { color: \"" + colorStr + "\"; text: \"Hello World\" }"; + QString componentStr = "import Qt 4.7\nText { color: \"" + colorStr + "\"; text: \"Hello World\" }"; QDeclarativeComponent textComponent(&engine); textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast<QDeclarativeText*>(textComponent.create()); @@ -558,14 +558,14 @@ void tst_qdeclarativetext::smooth() for (int i = 0; i < standard.size(); i++) { { - QString componentStr = "import Qt 4.6\nText { smooth: true; text: \"" + standard.at(i) + "\" }"; + QString componentStr = "import Qt 4.7\nText { smooth: true; text: \"" + standard.at(i) + "\" }"; QDeclarativeComponent textComponent(&engine); textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast<QDeclarativeText*>(textComponent.create()); QCOMPARE(textObject->smooth(), true); } { - QString componentStr = "import Qt 4.6\nText { text: \"" + standard.at(i) + "\" }"; + QString componentStr = "import Qt 4.7\nText { text: \"" + standard.at(i) + "\" }"; QDeclarativeComponent textComponent(&engine); textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast<QDeclarativeText*>(textComponent.create()); @@ -575,14 +575,14 @@ void tst_qdeclarativetext::smooth() for (int i = 0; i < richText.size(); i++) { { - QString componentStr = "import Qt 4.6\nText { smooth: true; text: \"" + richText.at(i) + "\" }"; + QString componentStr = "import Qt 4.7\nText { smooth: true; text: \"" + richText.at(i) + "\" }"; QDeclarativeComponent textComponent(&engine); textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast<QDeclarativeText*>(textComponent.create()); QCOMPARE(textObject->smooth(), true); } { - QString componentStr = "import Qt 4.6\nText { text: \"" + richText.at(i) + "\" }"; + QString componentStr = "import Qt 4.7\nText { text: \"" + richText.at(i) + "\" }"; QDeclarativeComponent textComponent(&engine); textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast<QDeclarativeText*>(textComponent.create()); @@ -594,7 +594,7 @@ void tst_qdeclarativetext::smooth() void tst_qdeclarativetext::weight() { { - QString componentStr = "import Qt 4.6\nText { text: \"Hello world!\" }"; + QString componentStr = "import Qt 4.7\nText { text: \"Hello world!\" }"; QDeclarativeComponent textComponent(&engine); textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast<QDeclarativeText*>(textComponent.create()); @@ -603,7 +603,7 @@ void tst_qdeclarativetext::weight() QCOMPARE((int)textObject->font().weight(), (int)QDeclarativeFontValueType::Normal); } { - QString componentStr = "import Qt 4.6\nText { font.weight: \"Bold\"; text: \"Hello world!\" }"; + QString componentStr = "import Qt 4.7\nText { font.weight: \"Bold\"; text: \"Hello world!\" }"; QDeclarativeComponent textComponent(&engine); textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast<QDeclarativeText*>(textComponent.create()); @@ -616,7 +616,7 @@ void tst_qdeclarativetext::weight() void tst_qdeclarativetext::underline() { { - QString componentStr = "import Qt 4.6\nText { text: \"Hello world!\" }"; + QString componentStr = "import Qt 4.7\nText { text: \"Hello world!\" }"; QDeclarativeComponent textComponent(&engine); textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast<QDeclarativeText*>(textComponent.create()); @@ -625,7 +625,7 @@ void tst_qdeclarativetext::underline() QCOMPARE(textObject->font().underline(), false); } { - QString componentStr = "import Qt 4.6\nText { font.underline: true; text: \"Hello world!\" }"; + QString componentStr = "import Qt 4.7\nText { font.underline: true; text: \"Hello world!\" }"; QDeclarativeComponent textComponent(&engine); textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast<QDeclarativeText*>(textComponent.create()); @@ -638,7 +638,7 @@ void tst_qdeclarativetext::underline() void tst_qdeclarativetext::overline() { { - QString componentStr = "import Qt 4.6\nText { text: \"Hello world!\" }"; + QString componentStr = "import Qt 4.7\nText { text: \"Hello world!\" }"; QDeclarativeComponent textComponent(&engine); textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast<QDeclarativeText*>(textComponent.create()); @@ -647,7 +647,7 @@ void tst_qdeclarativetext::overline() QCOMPARE(textObject->font().overline(), false); } { - QString componentStr = "import Qt 4.6\nText { font.overline: true; text: \"Hello world!\" }"; + QString componentStr = "import Qt 4.7\nText { font.overline: true; text: \"Hello world!\" }"; QDeclarativeComponent textComponent(&engine); textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast<QDeclarativeText*>(textComponent.create()); @@ -660,7 +660,7 @@ void tst_qdeclarativetext::overline() void tst_qdeclarativetext::strikeout() { { - QString componentStr = "import Qt 4.6\nText { text: \"Hello world!\" }"; + QString componentStr = "import Qt 4.7\nText { text: \"Hello world!\" }"; QDeclarativeComponent textComponent(&engine); textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast<QDeclarativeText*>(textComponent.create()); @@ -669,7 +669,7 @@ void tst_qdeclarativetext::strikeout() QCOMPARE(textObject->font().strikeOut(), false); } { - QString componentStr = "import Qt 4.6\nText { font.strikeout: true; text: \"Hello world!\" }"; + QString componentStr = "import Qt 4.7\nText { font.strikeout: true; text: \"Hello world!\" }"; QDeclarativeComponent textComponent(&engine); textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast<QDeclarativeText*>(textComponent.create()); @@ -682,7 +682,7 @@ void tst_qdeclarativetext::strikeout() void tst_qdeclarativetext::capitalization() { { - QString componentStr = "import Qt 4.6\nText { text: \"Hello world!\" }"; + QString componentStr = "import Qt 4.7\nText { text: \"Hello world!\" }"; QDeclarativeComponent textComponent(&engine); textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast<QDeclarativeText*>(textComponent.create()); @@ -691,7 +691,7 @@ void tst_qdeclarativetext::capitalization() QCOMPARE((int)textObject->font().capitalization(), (int)QDeclarativeFontValueType::MixedCase); } { - QString componentStr = "import Qt 4.6\nText { text: \"Hello world!\"; font.capitalization: \"AllUppercase\" }"; + QString componentStr = "import Qt 4.7\nText { text: \"Hello world!\"; font.capitalization: \"AllUppercase\" }"; QDeclarativeComponent textComponent(&engine); textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast<QDeclarativeText*>(textComponent.create()); @@ -700,7 +700,7 @@ void tst_qdeclarativetext::capitalization() QCOMPARE((int)textObject->font().capitalization(), (int)QDeclarativeFontValueType::AllUppercase); } { - QString componentStr = "import Qt 4.6\nText { text: \"Hello world!\"; font.capitalization: \"AllLowercase\" }"; + QString componentStr = "import Qt 4.7\nText { text: \"Hello world!\"; font.capitalization: \"AllLowercase\" }"; QDeclarativeComponent textComponent(&engine); textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast<QDeclarativeText*>(textComponent.create()); @@ -709,7 +709,7 @@ void tst_qdeclarativetext::capitalization() QCOMPARE((int)textObject->font().capitalization(), (int)QDeclarativeFontValueType::AllLowercase); } { - QString componentStr = "import Qt 4.6\nText { text: \"Hello world!\"; font.capitalization: \"SmallCaps\" }"; + QString componentStr = "import Qt 4.7\nText { text: \"Hello world!\"; font.capitalization: \"SmallCaps\" }"; QDeclarativeComponent textComponent(&engine); textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast<QDeclarativeText*>(textComponent.create()); @@ -718,7 +718,7 @@ void tst_qdeclarativetext::capitalization() QCOMPARE((int)textObject->font().capitalization(), (int)QDeclarativeFontValueType::SmallCaps); } { - QString componentStr = "import Qt 4.6\nText { text: \"Hello world!\"; font.capitalization: \"Capitalize\" }"; + QString componentStr = "import Qt 4.7\nText { text: \"Hello world!\"; font.capitalization: \"Capitalize\" }"; QDeclarativeComponent textComponent(&engine); textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast<QDeclarativeText*>(textComponent.create()); @@ -731,7 +731,7 @@ void tst_qdeclarativetext::capitalization() void tst_qdeclarativetext::letterSpacing() { { - QString componentStr = "import Qt 4.6\nText { text: \"Hello world!\" }"; + QString componentStr = "import Qt 4.7\nText { text: \"Hello world!\" }"; QDeclarativeComponent textComponent(&engine); textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast<QDeclarativeText*>(textComponent.create()); @@ -740,7 +740,7 @@ void tst_qdeclarativetext::letterSpacing() QCOMPARE(textObject->font().letterSpacing(), 0.0); } { - QString componentStr = "import Qt 4.6\nText { text: \"Hello world!\"; font.letterSpacing: -50 }"; + QString componentStr = "import Qt 4.7\nText { text: \"Hello world!\"; font.letterSpacing: -50 }"; QDeclarativeComponent textComponent(&engine); textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast<QDeclarativeText*>(textComponent.create()); @@ -749,7 +749,7 @@ void tst_qdeclarativetext::letterSpacing() QCOMPARE(textObject->font().letterSpacing(), -50.); } { - QString componentStr = "import Qt 4.6\nText { text: \"Hello world!\"; font.letterSpacing: 200 }"; + QString componentStr = "import Qt 4.7\nText { text: \"Hello world!\"; font.letterSpacing: 200 }"; QDeclarativeComponent textComponent(&engine); textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast<QDeclarativeText*>(textComponent.create()); @@ -762,7 +762,7 @@ void tst_qdeclarativetext::letterSpacing() void tst_qdeclarativetext::wordSpacing() { { - QString componentStr = "import Qt 4.6\nText { text: \"Hello world!\" }"; + QString componentStr = "import Qt 4.7\nText { text: \"Hello world!\" }"; QDeclarativeComponent textComponent(&engine); textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast<QDeclarativeText*>(textComponent.create()); @@ -771,7 +771,7 @@ void tst_qdeclarativetext::wordSpacing() QCOMPARE(textObject->font().wordSpacing(), 0.0); } { - QString componentStr = "import Qt 4.6\nText { text: \"Hello world!\"; font.wordSpacing: -50 }"; + QString componentStr = "import Qt 4.7\nText { text: \"Hello world!\"; font.wordSpacing: -50 }"; QDeclarativeComponent textComponent(&engine); textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast<QDeclarativeText*>(textComponent.create()); @@ -780,7 +780,7 @@ void tst_qdeclarativetext::wordSpacing() QCOMPARE(textObject->font().wordSpacing(), -50.); } { - QString componentStr = "import Qt 4.6\nText { text: \"Hello world!\"; font.wordSpacing: 200 }"; + QString componentStr = "import Qt 4.7\nText { text: \"Hello world!\"; font.wordSpacing: 200 }"; QDeclarativeComponent textComponent(&engine); textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast<QDeclarativeText*>(textComponent.create()); @@ -811,7 +811,7 @@ public slots: void tst_qdeclarativetext::clickLink() { { - QString componentStr = "import Qt 4.6\nText { text: \"<a href=\\\"http://qt.nokia.com\\\">Hello world!</a>\" }"; + QString componentStr = "import Qt 4.7\nText { text: \"<a href=\\\"http://qt.nokia.com\\\">Hello world!</a>\" }"; QDeclarativeComponent textComponent(&engine); textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeText *textObject = qobject_cast<QDeclarativeText*>(textComponent.create()); diff --git a/tests/auto/declarative/qdeclarativetextedit/data/http/cursorHttpTestPass.qml b/tests/auto/declarative/qdeclarativetextedit/data/http/cursorHttpTestPass.qml index de4de00..a44e867 100644 --- a/tests/auto/declarative/qdeclarativetextedit/data/http/cursorHttpTestPass.qml +++ b/tests/auto/declarative/qdeclarativetextedit/data/http/cursorHttpTestPass.qml @@ -1,5 +1,4 @@ import Qt 4.6 -import "http://localhost:42332" Rectangle { width: 300; height: 300; color: "white" resources: [ diff --git a/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp b/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp index d578f68..25101ba 100644 --- a/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp +++ b/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp @@ -79,6 +79,7 @@ private slots: void inputMethodHints(); void cursorDelegate(); + void delegateLoading_data(); void delegateLoading(); void navigation(); void readOnly(); @@ -149,7 +150,7 @@ void tst_qdeclarativetextedit::text() { { QDeclarativeComponent texteditComponent(&engine); - texteditComponent.setData("import Qt 4.6\nTextEdit { text: \"\" }", QUrl()); + texteditComponent.setData("import Qt 4.7\nTextEdit { text: \"\" }", QUrl()); QDeclarativeTextEdit *textEditObject = qobject_cast<QDeclarativeTextEdit*>(texteditComponent.create()); QVERIFY(textEditObject != 0); @@ -158,7 +159,7 @@ void tst_qdeclarativetextedit::text() for (int i = 0; i < standard.size(); i++) { - QString componentStr = "import Qt 4.6\nTextEdit { text: \"" + standard.at(i) + "\" }"; + QString componentStr = "import Qt 4.7\nTextEdit { text: \"" + standard.at(i) + "\" }"; QDeclarativeComponent texteditComponent(&engine); texteditComponent.setData(componentStr.toLatin1(), QUrl()); QDeclarativeTextEdit *textEditObject = qobject_cast<QDeclarativeTextEdit*>(texteditComponent.create()); @@ -169,7 +170,7 @@ void tst_qdeclarativetextedit::text() for (int i = 0; i < richText.size(); i++) { - QString componentStr = "import Qt 4.6\nTextEdit { text: \"" + richText.at(i) + "\" }"; + QString componentStr = "import Qt 4.7\nTextEdit { text: \"" + richText.at(i) + "\" }"; QDeclarativeComponent texteditComponent(&engine); texteditComponent.setData(componentStr.toLatin1(), QUrl()); QDeclarativeTextEdit *textEditObject = qobject_cast<QDeclarativeTextEdit*>(texteditComponent.create()); @@ -189,7 +190,7 @@ void tst_qdeclarativetextedit::width() // uses Font metrics to find the width for standard and document to find the width for rich { QDeclarativeComponent texteditComponent(&engine); - texteditComponent.setData("import Qt 4.6\nTextEdit { text: \"\" }", QUrl()); + texteditComponent.setData("import Qt 4.7\nTextEdit { text: \"\" }", QUrl()); QDeclarativeTextEdit *textEditObject = qobject_cast<QDeclarativeTextEdit*>(texteditComponent.create()); QVERIFY(textEditObject != 0); @@ -203,7 +204,7 @@ void tst_qdeclarativetextedit::width() qreal metricWidth = fm.size(Qt::TextExpandTabs && Qt::TextShowMnemonic, standard.at(i)).width(); metricWidth = floor(metricWidth); - QString componentStr = "import Qt 4.6\nTextEdit { text: \"" + standard.at(i) + "\" }"; + QString componentStr = "import Qt 4.7\nTextEdit { text: \"" + standard.at(i) + "\" }"; QDeclarativeComponent texteditComponent(&engine); texteditComponent.setData(componentStr.toLatin1(), QUrl()); QDeclarativeTextEdit *textEditObject = qobject_cast<QDeclarativeTextEdit*>(texteditComponent.create()); @@ -220,7 +221,7 @@ void tst_qdeclarativetextedit::width() int documentWidth = document.idealWidth(); - QString componentStr = "import Qt 4.6\nTextEdit { text: \"" + richText.at(i) + "\" }"; + QString componentStr = "import Qt 4.7\nTextEdit { text: \"" + richText.at(i) + "\" }"; QDeclarativeComponent texteditComponent(&engine); texteditComponent.setData(componentStr.toLatin1(), QUrl()); QDeclarativeTextEdit *textEditObject = qobject_cast<QDeclarativeTextEdit*>(texteditComponent.create()); @@ -235,7 +236,7 @@ void tst_qdeclarativetextedit::wrap() // for specified width and wrap set true { QDeclarativeComponent texteditComponent(&engine); - texteditComponent.setData("import Qt 4.6\nTextEdit { text: \"\"; wrapMode: TextEdit.WordWrap; width: 300 }", QUrl()); + texteditComponent.setData("import Qt 4.7\nTextEdit { text: \"\"; wrapMode: TextEdit.WordWrap; width: 300 }", QUrl()); QDeclarativeTextEdit *textEditObject = qobject_cast<QDeclarativeTextEdit*>(texteditComponent.create()); QVERIFY(textEditObject != 0); @@ -244,7 +245,7 @@ void tst_qdeclarativetextedit::wrap() for (int i = 0; i < standard.size(); i++) { - QString componentStr = "import Qt 4.6\nTextEdit { wrapMode: TextEdit.WordWrap; width: 300; text: \"" + standard.at(i) + "\" }"; + QString componentStr = "import Qt 4.7\nTextEdit { wrapMode: TextEdit.WordWrap; width: 300; text: \"" + standard.at(i) + "\" }"; QDeclarativeComponent texteditComponent(&engine); texteditComponent.setData(componentStr.toLatin1(), QUrl()); QDeclarativeTextEdit *textEditObject = qobject_cast<QDeclarativeTextEdit*>(texteditComponent.create()); @@ -255,7 +256,7 @@ void tst_qdeclarativetextedit::wrap() for (int i = 0; i < richText.size(); i++) { - QString componentStr = "import Qt 4.6\nTextEdit { wrapMode: TextEdit.WordWrap; width: 300; text: \"" + richText.at(i) + "\" }"; + QString componentStr = "import Qt 4.7\nTextEdit { wrapMode: TextEdit.WordWrap; width: 300; text: \"" + richText.at(i) + "\" }"; QDeclarativeComponent texteditComponent(&engine); texteditComponent.setData(componentStr.toLatin1(), QUrl()); QDeclarativeTextEdit *textEditObject = qobject_cast<QDeclarativeTextEdit*>(texteditComponent.create()); @@ -270,7 +271,7 @@ void tst_qdeclarativetextedit::textFormat() { { QDeclarativeComponent textComponent(&engine); - textComponent.setData("import Qt 4.6\nTextEdit { text: \"Hello\"; textFormat: Text.RichText }", QUrl::fromLocalFile("")); + textComponent.setData("import Qt 4.7\nTextEdit { text: \"Hello\"; textFormat: Text.RichText }", QUrl::fromLocalFile("")); QDeclarativeTextEdit *textObject = qobject_cast<QDeclarativeTextEdit*>(textComponent.create()); QVERIFY(textObject != 0); @@ -278,7 +279,7 @@ void tst_qdeclarativetextedit::textFormat() } { QDeclarativeComponent textComponent(&engine); - textComponent.setData("import Qt 4.6\nTextEdit { text: \"<b>Hello</b>\"; textFormat: Text.PlainText }", QUrl::fromLocalFile("")); + textComponent.setData("import Qt 4.7\nTextEdit { text: \"<b>Hello</b>\"; textFormat: Text.PlainText }", QUrl::fromLocalFile("")); QDeclarativeTextEdit *textObject = qobject_cast<QDeclarativeTextEdit*>(textComponent.create()); QVERIFY(textObject != 0); @@ -295,7 +296,7 @@ void tst_qdeclarativetextedit::hAlign() { for (int j=0; j < hAlignmentStrings.size(); j++) { - QString componentStr = "import Qt 4.6\nTextEdit { horizontalAlignment: \"" + hAlignmentStrings.at(j) + "\"; text: \"" + standard.at(i) + "\" }"; + QString componentStr = "import Qt 4.7\nTextEdit { horizontalAlignment: \"" + hAlignmentStrings.at(j) + "\"; text: \"" + standard.at(i) + "\" }"; QDeclarativeComponent texteditComponent(&engine); texteditComponent.setData(componentStr.toLatin1(), QUrl()); QDeclarativeTextEdit *textEditObject = qobject_cast<QDeclarativeTextEdit*>(texteditComponent.create()); @@ -309,7 +310,7 @@ void tst_qdeclarativetextedit::hAlign() { for (int j=0; j < hAlignmentStrings.size(); j++) { - QString componentStr = "import Qt 4.6\nTextEdit { horizontalAlignment: \"" + hAlignmentStrings.at(j) + "\"; text: \"" + richText.at(i) + "\" }"; + QString componentStr = "import Qt 4.7\nTextEdit { horizontalAlignment: \"" + hAlignmentStrings.at(j) + "\"; text: \"" + richText.at(i) + "\" }"; QDeclarativeComponent texteditComponent(&engine); texteditComponent.setData(componentStr.toLatin1(), QUrl()); QDeclarativeTextEdit *textEditObject = qobject_cast<QDeclarativeTextEdit*>(texteditComponent.create()); @@ -329,7 +330,7 @@ void tst_qdeclarativetextedit::vAlign() { for (int j=0; j < vAlignmentStrings.size(); j++) { - QString componentStr = "import Qt 4.6\nTextEdit { verticalAlignment: \"" + vAlignmentStrings.at(j) + "\"; text: \"" + standard.at(i) + "\" }"; + QString componentStr = "import Qt 4.7\nTextEdit { verticalAlignment: \"" + vAlignmentStrings.at(j) + "\"; text: \"" + standard.at(i) + "\" }"; QDeclarativeComponent texteditComponent(&engine); texteditComponent.setData(componentStr.toLatin1(), QUrl()); QDeclarativeTextEdit *textEditObject = qobject_cast<QDeclarativeTextEdit*>(texteditComponent.create()); @@ -343,7 +344,7 @@ void tst_qdeclarativetextedit::vAlign() { for (int j=0; j < vAlignmentStrings.size(); j++) { - QString componentStr = "import Qt 4.6\nTextEdit { verticalAlignment: \"" + vAlignmentStrings.at(j) + "\"; text: \"" + richText.at(i) + "\" }"; + QString componentStr = "import Qt 4.7\nTextEdit { verticalAlignment: \"" + vAlignmentStrings.at(j) + "\"; text: \"" + richText.at(i) + "\" }"; QDeclarativeComponent texteditComponent(&engine); texteditComponent.setData(componentStr.toLatin1(), QUrl()); QDeclarativeTextEdit *textEditObject = qobject_cast<QDeclarativeTextEdit*>(texteditComponent.create()); @@ -359,7 +360,7 @@ void tst_qdeclarativetextedit::font() { //test size, then bold, then italic, then family { - QString componentStr = "import Qt 4.6\nTextEdit { font.pointSize: 40; text: \"Hello World\" }"; + QString componentStr = "import Qt 4.7\nTextEdit { font.pointSize: 40; text: \"Hello World\" }"; QDeclarativeComponent texteditComponent(&engine); texteditComponent.setData(componentStr.toLatin1(), QUrl()); QDeclarativeTextEdit *textEditObject = qobject_cast<QDeclarativeTextEdit*>(texteditComponent.create()); @@ -371,7 +372,7 @@ void tst_qdeclarativetextedit::font() } { - QString componentStr = "import Qt 4.6\nTextEdit { font.bold: true; text: \"Hello World\" }"; + QString componentStr = "import Qt 4.7\nTextEdit { font.bold: true; text: \"Hello World\" }"; QDeclarativeComponent texteditComponent(&engine); texteditComponent.setData(componentStr.toLatin1(), QUrl()); QDeclarativeTextEdit *textEditObject = qobject_cast<QDeclarativeTextEdit*>(texteditComponent.create()); @@ -382,7 +383,7 @@ void tst_qdeclarativetextedit::font() } { - QString componentStr = "import Qt 4.6\nTextEdit { font.italic: true; text: \"Hello World\" }"; + QString componentStr = "import Qt 4.7\nTextEdit { font.italic: true; text: \"Hello World\" }"; QDeclarativeComponent texteditComponent(&engine); texteditComponent.setData(componentStr.toLatin1(), QUrl()); QDeclarativeTextEdit *textEditObject = qobject_cast<QDeclarativeTextEdit*>(texteditComponent.create()); @@ -393,7 +394,7 @@ void tst_qdeclarativetextedit::font() } { - QString componentStr = "import Qt 4.6\nTextEdit { font.family: \"Helvetica\"; text: \"Hello World\" }"; + QString componentStr = "import Qt 4.7\nTextEdit { font.family: \"Helvetica\"; text: \"Hello World\" }"; QDeclarativeComponent texteditComponent(&engine); texteditComponent.setData(componentStr.toLatin1(), QUrl()); QDeclarativeTextEdit *textEditObject = qobject_cast<QDeclarativeTextEdit*>(texteditComponent.create()); @@ -405,7 +406,7 @@ void tst_qdeclarativetextedit::font() } { - QString componentStr = "import Qt 4.6\nTextEdit { font.family: \"\"; text: \"Hello World\" }"; + QString componentStr = "import Qt 4.7\nTextEdit { font.family: \"\"; text: \"Hello World\" }"; QDeclarativeComponent texteditComponent(&engine); texteditComponent.setData(componentStr.toLatin1(), QUrl()); QDeclarativeTextEdit *textEditObject = qobject_cast<QDeclarativeTextEdit*>(texteditComponent.create()); @@ -420,7 +421,7 @@ void tst_qdeclarativetextedit::color() //test normal for (int i = 0; i < colorStrings.size(); i++) { - QString componentStr = "import Qt 4.6\nTextEdit { color: \"" + colorStrings.at(i) + "\"; text: \"Hello World\" }"; + QString componentStr = "import Qt 4.7\nTextEdit { color: \"" + colorStrings.at(i) + "\"; text: \"Hello World\" }"; QDeclarativeComponent texteditComponent(&engine); texteditComponent.setData(componentStr.toLatin1(), QUrl()); QDeclarativeTextEdit *textEditObject = qobject_cast<QDeclarativeTextEdit*>(texteditComponent.create()); @@ -432,7 +433,7 @@ void tst_qdeclarativetextedit::color() //test selection for (int i = 0; i < colorStrings.size(); i++) { - QString componentStr = "import Qt 4.6\nTextEdit { selectionColor: \"" + colorStrings.at(i) + "\"; text: \"Hello World\" }"; + QString componentStr = "import Qt 4.7\nTextEdit { selectionColor: \"" + colorStrings.at(i) + "\"; text: \"Hello World\" }"; QDeclarativeComponent texteditComponent(&engine); texteditComponent.setData(componentStr.toLatin1(), QUrl()); QDeclarativeTextEdit *textEditObject = qobject_cast<QDeclarativeTextEdit*>(texteditComponent.create()); @@ -443,7 +444,7 @@ void tst_qdeclarativetextedit::color() //test selected text for (int i = 0; i < colorStrings.size(); i++) { - QString componentStr = "import Qt 4.6\nTextEdit { selectedTextColor: \"" + colorStrings.at(i) + "\"; text: \"Hello World\" }"; + QString componentStr = "import Qt 4.7\nTextEdit { selectedTextColor: \"" + colorStrings.at(i) + "\"; text: \"Hello World\" }"; QDeclarativeComponent texteditComponent(&engine); texteditComponent.setData(componentStr.toLatin1(), QUrl()); QDeclarativeTextEdit *textEditObject = qobject_cast<QDeclarativeTextEdit*>(texteditComponent.create()); @@ -456,7 +457,7 @@ void tst_qdeclarativetextedit::color() QColor testColor("#001234"); testColor.setAlpha(170); - QString componentStr = "import Qt 4.6\nTextEdit { color: \"" + colorStr + "\"; text: \"Hello World\" }"; + QString componentStr = "import Qt 4.7\nTextEdit { color: \"" + colorStr + "\"; text: \"Hello World\" }"; QDeclarativeComponent texteditComponent(&engine); texteditComponent.setData(componentStr.toLatin1(), QUrl()); QDeclarativeTextEdit *textEditObject = qobject_cast<QDeclarativeTextEdit*>(texteditComponent.create()); @@ -469,7 +470,7 @@ void tst_qdeclarativetextedit::color() void tst_qdeclarativetextedit::textMargin() { for(qreal i=0; i<=10; i+=0.3){ - QString componentStr = "import Qt 4.6\nTextEdit { textMargin: " + QString::number(i) + "; text: \"Hello World\" }"; + QString componentStr = "import Qt 4.7\nTextEdit { textMargin: " + QString::number(i) + "; text: \"Hello World\" }"; QDeclarativeComponent texteditComponent(&engine); texteditComponent.setData(componentStr.toLatin1(), QUrl()); QDeclarativeTextEdit *textEditObject = qobject_cast<QDeclarativeTextEdit*>(texteditComponent.create()); @@ -481,7 +482,7 @@ void tst_qdeclarativetextedit::textMargin() void tst_qdeclarativetextedit::persistentSelection() { { - QString componentStr = "import Qt 4.6\nTextEdit { persistentSelection: true; text: \"Hello World\" }"; + QString componentStr = "import Qt 4.7\nTextEdit { persistentSelection: true; text: \"Hello World\" }"; QDeclarativeComponent texteditComponent(&engine); texteditComponent.setData(componentStr.toLatin1(), QUrl()); QDeclarativeTextEdit *textEditObject = qobject_cast<QDeclarativeTextEdit*>(texteditComponent.create()); @@ -490,7 +491,7 @@ void tst_qdeclarativetextedit::persistentSelection() } { - QString componentStr = "import Qt 4.6\nTextEdit { persistentSelection: false; text: \"Hello World\" }"; + QString componentStr = "import Qt 4.7\nTextEdit { persistentSelection: false; text: \"Hello World\" }"; QDeclarativeComponent texteditComponent(&engine); texteditComponent.setData(componentStr.toLatin1(), QUrl()); QDeclarativeTextEdit *textEditObject = qobject_cast<QDeclarativeTextEdit*>(texteditComponent.create()); @@ -502,7 +503,7 @@ void tst_qdeclarativetextedit::persistentSelection() void tst_qdeclarativetextedit::focusOnPress() { { - QString componentStr = "import Qt 4.6\nTextEdit { focusOnPress: true; text: \"Hello World\" }"; + QString componentStr = "import Qt 4.7\nTextEdit { focusOnPress: true; text: \"Hello World\" }"; QDeclarativeComponent texteditComponent(&engine); texteditComponent.setData(componentStr.toLatin1(), QUrl()); QDeclarativeTextEdit *textEditObject = qobject_cast<QDeclarativeTextEdit*>(texteditComponent.create()); @@ -511,7 +512,7 @@ void tst_qdeclarativetextedit::focusOnPress() } { - QString componentStr = "import Qt 4.6\nTextEdit { focusOnPress: false; text: \"Hello World\" }"; + QString componentStr = "import Qt 4.7\nTextEdit { focusOnPress: false; text: \"Hello World\" }"; QDeclarativeComponent texteditComponent(&engine); texteditComponent.setData(componentStr.toLatin1(), QUrl()); QDeclarativeTextEdit *textEditObject = qobject_cast<QDeclarativeTextEdit*>(texteditComponent.create()); @@ -523,7 +524,7 @@ void tst_qdeclarativetextedit::focusOnPress() void tst_qdeclarativetextedit::selection() { QString testStr = standard[0];//TODO: What should happen for multiline/rich text? - QString componentStr = "import Qt 4.6\nTextEdit { text: \""+ testStr +"\"; }"; + QString componentStr = "import Qt 4.7\nTextEdit { text: \""+ testStr +"\"; }"; QDeclarativeComponent texteditComponent(&engine); texteditComponent.setData(componentStr.toLatin1(), QUrl()); QDeclarativeTextEdit *textEditObject = qobject_cast<QDeclarativeTextEdit*>(texteditComponent.create()); @@ -641,41 +642,60 @@ void tst_qdeclarativetextedit::cursorDelegate() QVERIFY(!textEditObject->findChild<QDeclarativeItem*>("cursorInstance")); } +void tst_qdeclarativetextedit::delegateLoading_data() +{ + QTest::addColumn<QString>("qmlfile"); + QTest::addColumn<QString>("error"); + + // import installed + QTest::newRow("pass") << "cursorHttpTestPass.qml" << ""; + QTest::newRow("fail1") << "cursorHttpTestFail1.qml" << ":-1: Network error for URL http://localhost:42332/FailItem.qml "; + QTest::newRow("fail2") << "cursorHttpTestFail2.qml" << "http://localhost:42332/ErrItem.qml:4:5: Fungus is not a type "; +} + void tst_qdeclarativetextedit::delegateLoading() { + QFETCH(QString, qmlfile); + QFETCH(QString, error); + TestHTTPServer server(42332); server.serveDirectory(SRCDIR "/data/httpfail", TestHTTPServer::Disconnect); server.serveDirectory(SRCDIR "/data/httpslow", TestHTTPServer::Delay); server.serveDirectory(SRCDIR "/data/http"); + QDeclarativeView* view = new QDeclarativeView(0); - view->setSource(QUrl("http://localhost:42332/cursorHttpTestPass.qml")); - view->show(); - view->setFocus(); - QTRY_VERIFY(view->rootObject());//Wait for loading to finish. - QDeclarativeTextEdit *textEditObject = view->rootObject()->findChild<QDeclarativeTextEdit*>("textEditObject"); - // view->rootObject()->dumpObjectTree(); - QVERIFY(textEditObject != 0); - textEditObject->setFocus(true); - QDeclarativeItem *delegate; - delegate = view->rootObject()->findChild<QDeclarativeItem*>("delegateOkay"); - QVERIFY(delegate); - delegate = view->rootObject()->findChild<QDeclarativeItem*>("delegateSlow"); - QVERIFY(delegate); - view->setSource(QUrl("http://localhost:42332/cursorHttpTestFail1.qml")); - view->show(); - QTRY_VERIFY(view->status()==QDeclarativeView::Error); - view->setFocus(); - QTRY_VERIFY(!view->rootObject()); // there is fail item inside this test - view->setSource(QUrl("http://localhost:42332/cursorHttpTestFail2.qml")); + + view->setSource(QUrl(QLatin1String("http://localhost:42332/") + qmlfile)); view->show(); - QTRY_VERIFY(view->status()==QDeclarativeView::Error); view->setFocus(); - QTRY_VERIFY(!view->rootObject()); // there is fail item inside this test + + if (!error.isEmpty()) { + QTest::ignoreMessage(QtWarningMsg, error.toUtf8()); + QTRY_VERIFY(view->status()==QDeclarativeView::Error); + QTRY_VERIFY(!view->rootObject()); // there is fail item inside this test + } else { + QTRY_VERIFY(view->rootObject());//Wait for loading to finish. + QDeclarativeTextEdit *textEditObject = view->rootObject()->findChild<QDeclarativeTextEdit*>("textEditObject"); + // view->rootObject()->dumpObjectTree(); + QVERIFY(textEditObject != 0); + textEditObject->setFocus(true); + QDeclarativeItem *delegate; + delegate = view->rootObject()->findChild<QDeclarativeItem*>("delegateOkay"); + QVERIFY(delegate); + delegate = view->rootObject()->findChild<QDeclarativeItem*>("delegateSlow"); + QVERIFY(delegate); + + delete delegate; + } + + //A test should be added here with a component which is ready but component.create() returns null //Not sure how to accomplish this with QDeclarativeTextEdits cursor delegate //###This was only needed for code coverage, and could be a case of overzealous defensive programming //delegate = view->rootObject()->findChild<QDeclarativeItem*>("delegateErrorB"); //QVERIFY(!delegate); + + delete view; } /* diff --git a/tests/auto/declarative/qdeclarativetextinput/data/echoMode.qml b/tests/auto/declarative/qdeclarativetextinput/data/echoMode.qml index 5773cc2..66a2017 100644 --- a/tests/auto/declarative/qdeclarativetextinput/data/echoMode.qml +++ b/tests/auto/declarative/qdeclarativetextinput/data/echoMode.qml @@ -1,7 +1,7 @@ import Qt 4.7 Rectangle { - property var myInput: input + property QtObject myInput: input width: 400; height: 200; color: "green" diff --git a/tests/auto/declarative/qdeclarativetextinput/qdeclarativetextinput.pro b/tests/auto/declarative/qdeclarativetextinput/qdeclarativetextinput.pro index 5aed51f..957e75c 100644 --- a/tests/auto/declarative/qdeclarativetextinput/qdeclarativetextinput.pro +++ b/tests/auto/declarative/qdeclarativetextinput/qdeclarativetextinput.pro @@ -6,3 +6,4 @@ SOURCES += tst_qdeclarativetextinput.cpp # Define SRCDIR equal to test's source directory DEFINES += SRCDIR=\\\"$$PWD\\\" + diff --git a/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp b/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp index 9a66a36..fcd7527 100644 --- a/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp +++ b/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp @@ -109,7 +109,7 @@ void tst_qdeclarativetextinput::text() { { QDeclarativeComponent textinputComponent(&engine); - textinputComponent.setData("import Qt 4.6\nTextInput { text: \"\" }", QUrl()); + textinputComponent.setData("import Qt 4.7\nTextInput { text: \"\" }", QUrl()); QDeclarativeTextInput *textinputObject = qobject_cast<QDeclarativeTextInput*>(textinputComponent.create()); QVERIFY(textinputObject != 0); @@ -120,7 +120,7 @@ void tst_qdeclarativetextinput::text() for (int i = 0; i < standard.size(); i++) { - QString componentStr = "import Qt 4.6\nTextInput { text: \"" + standard.at(i) + "\" }"; + QString componentStr = "import Qt 4.7\nTextInput { text: \"" + standard.at(i) + "\" }"; QDeclarativeComponent textinputComponent(&engine); textinputComponent.setData(componentStr.toLatin1(), QUrl()); QDeclarativeTextInput *textinputObject = qobject_cast<QDeclarativeTextInput*>(textinputComponent.create()); @@ -138,7 +138,7 @@ void tst_qdeclarativetextinput::width() // uses Font metrics to find the width for standard { QDeclarativeComponent textinputComponent(&engine); - textinputComponent.setData("import Qt 4.6\nTextInput { text: \"\" }", QUrl()); + textinputComponent.setData("import Qt 4.7\nTextInput { text: \"\" }", QUrl()); QDeclarativeTextInput *textinputObject = qobject_cast<QDeclarativeTextInput*>(textinputComponent.create()); QVERIFY(textinputObject != 0); @@ -153,7 +153,7 @@ void tst_qdeclarativetextinput::width() QFontMetricsF fm(f); qreal metricWidth = fm.width(standard.at(i)); - QString componentStr = "import Qt 4.6\nTextInput { text: \"" + standard.at(i) + "\" }"; + QString componentStr = "import Qt 4.7\nTextInput { text: \"" + standard.at(i) + "\" }"; QDeclarativeComponent textinputComponent(&engine); textinputComponent.setData(componentStr.toLatin1(), QUrl()); QDeclarativeTextInput *textinputObject = qobject_cast<QDeclarativeTextInput*>(textinputComponent.create()); @@ -169,7 +169,7 @@ void tst_qdeclarativetextinput::font() { //test size, then bold, then italic, then family { - QString componentStr = "import Qt 4.6\nTextInput { font.pointSize: 40; text: \"Hello World\" }"; + QString componentStr = "import Qt 4.7\nTextInput { font.pointSize: 40; text: \"Hello World\" }"; QDeclarativeComponent textinputComponent(&engine); textinputComponent.setData(componentStr.toLatin1(), QUrl()); QDeclarativeTextInput *textinputObject = qobject_cast<QDeclarativeTextInput*>(textinputComponent.create()); @@ -183,7 +183,7 @@ void tst_qdeclarativetextinput::font() } { - QString componentStr = "import Qt 4.6\nTextInput { font.bold: true; text: \"Hello World\" }"; + QString componentStr = "import Qt 4.7\nTextInput { font.bold: true; text: \"Hello World\" }"; QDeclarativeComponent textinputComponent(&engine); textinputComponent.setData(componentStr.toLatin1(), QUrl()); QDeclarativeTextInput *textinputObject = qobject_cast<QDeclarativeTextInput*>(textinputComponent.create()); @@ -196,7 +196,7 @@ void tst_qdeclarativetextinput::font() } { - QString componentStr = "import Qt 4.6\nTextInput { font.italic: true; text: \"Hello World\" }"; + QString componentStr = "import Qt 4.7\nTextInput { font.italic: true; text: \"Hello World\" }"; QDeclarativeComponent textinputComponent(&engine); textinputComponent.setData(componentStr.toLatin1(), QUrl()); QDeclarativeTextInput *textinputObject = qobject_cast<QDeclarativeTextInput*>(textinputComponent.create()); @@ -209,7 +209,7 @@ void tst_qdeclarativetextinput::font() } { - QString componentStr = "import Qt 4.6\nTextInput { font.family: \"Helvetica\"; text: \"Hello World\" }"; + QString componentStr = "import Qt 4.7\nTextInput { font.family: \"Helvetica\"; text: \"Hello World\" }"; QDeclarativeComponent textinputComponent(&engine); textinputComponent.setData(componentStr.toLatin1(), QUrl()); QDeclarativeTextInput *textinputObject = qobject_cast<QDeclarativeTextInput*>(textinputComponent.create()); @@ -223,7 +223,7 @@ void tst_qdeclarativetextinput::font() } { - QString componentStr = "import Qt 4.6\nTextInput { font.family: \"\"; text: \"Hello World\" }"; + QString componentStr = "import Qt 4.7\nTextInput { font.family: \"\"; text: \"Hello World\" }"; QDeclarativeComponent textinputComponent(&engine); textinputComponent.setData(componentStr.toLatin1(), QUrl()); QDeclarativeTextInput *textinputObject = qobject_cast<QDeclarativeTextInput*>(textinputComponent.create()); @@ -240,7 +240,7 @@ void tst_qdeclarativetextinput::color() //test color for (int i = 0; i < colorStrings.size(); i++) { - QString componentStr = "import Qt 4.6\nTextInput { color: \"" + colorStrings.at(i) + "\"; text: \"Hello World\" }"; + QString componentStr = "import Qt 4.7\nTextInput { color: \"" + colorStrings.at(i) + "\"; text: \"Hello World\" }"; QDeclarativeComponent textinputComponent(&engine); textinputComponent.setData(componentStr.toLatin1(), QUrl()); QDeclarativeTextInput *textinputObject = qobject_cast<QDeclarativeTextInput*>(textinputComponent.create()); @@ -253,7 +253,7 @@ void tst_qdeclarativetextinput::color() //test selection color for (int i = 0; i < colorStrings.size(); i++) { - QString componentStr = "import Qt 4.6\nTextInput { selectionColor: \"" + colorStrings.at(i) + "\"; text: \"Hello World\" }"; + QString componentStr = "import Qt 4.7\nTextInput { selectionColor: \"" + colorStrings.at(i) + "\"; text: \"Hello World\" }"; QDeclarativeComponent textinputComponent(&engine); textinputComponent.setData(componentStr.toLatin1(), QUrl()); QDeclarativeTextInput *textinputObject = qobject_cast<QDeclarativeTextInput*>(textinputComponent.create()); @@ -266,7 +266,7 @@ void tst_qdeclarativetextinput::color() //test selected text color for (int i = 0; i < colorStrings.size(); i++) { - QString componentStr = "import Qt 4.6\nTextInput { selectedTextColor: \"" + colorStrings.at(i) + "\"; text: \"Hello World\" }"; + QString componentStr = "import Qt 4.7\nTextInput { selectedTextColor: \"" + colorStrings.at(i) + "\"; text: \"Hello World\" }"; QDeclarativeComponent textinputComponent(&engine); textinputComponent.setData(componentStr.toLatin1(), QUrl()); QDeclarativeTextInput *textinputObject = qobject_cast<QDeclarativeTextInput*>(textinputComponent.create()); @@ -281,7 +281,7 @@ void tst_qdeclarativetextinput::color() QColor testColor("#001234"); testColor.setAlpha(170); - QString componentStr = "import Qt 4.6\nTextInput { color: \"" + colorStr + "\"; text: \"Hello World\" }"; + QString componentStr = "import Qt 4.7\nTextInput { color: \"" + colorStr + "\"; text: \"Hello World\" }"; QDeclarativeComponent textinputComponent(&engine); textinputComponent.setData(componentStr.toLatin1(), QUrl()); QDeclarativeTextInput *textinputObject = qobject_cast<QDeclarativeTextInput*>(textinputComponent.create()); @@ -296,7 +296,7 @@ void tst_qdeclarativetextinput::color() void tst_qdeclarativetextinput::selection() { QString testStr = standard[0]; - QString componentStr = "import Qt 4.6\nTextInput { text: \""+ testStr +"\"; }"; + QString componentStr = "import Qt 4.7\nTextInput { text: \""+ testStr +"\"; }"; QDeclarativeComponent textinputComponent(&engine); textinputComponent.setData(componentStr.toLatin1(), QUrl()); QDeclarativeTextInput *textinputObject = qobject_cast<QDeclarativeTextInput*>(textinputComponent.create()); @@ -378,7 +378,7 @@ void tst_qdeclarativetextinput::selection() void tst_qdeclarativetextinput::maxLength() { - //QString componentStr = "import Qt 4.6\nTextInput { maximumLength: 10; }"; + //QString componentStr = "import Qt 4.7\nTextInput { maximumLength: 10; }"; QDeclarativeView *canvas = createView(SRCDIR "/data/maxLength.qml"); canvas->show(); canvas->setFocus(); @@ -408,7 +408,7 @@ void tst_qdeclarativetextinput::maxLength() void tst_qdeclarativetextinput::masks() { //Not a comprehensive test of the possible masks, that's done elsewhere (QLineEdit) - //QString componentStr = "import Qt 4.6\nTextInput { inputMask: 'HHHHhhhh'; }"; + //QString componentStr = "import Qt 4.7\nTextInput { inputMask: 'HHHHhhhh'; }"; QDeclarativeView *canvas = createView(SRCDIR "/data/masks.qml"); canvas->show(); canvas->setFocus(); diff --git a/tests/auto/declarative/qdeclarativetimer/qdeclarativetimer.pro b/tests/auto/declarative/qdeclarativetimer/qdeclarativetimer.pro index b162739..42604d8 100644 --- a/tests/auto/declarative/qdeclarativetimer/qdeclarativetimer.pro +++ b/tests/auto/declarative/qdeclarativetimer/qdeclarativetimer.pro @@ -5,3 +5,5 @@ macx:CONFIG -= app_bundle SOURCES += tst_qdeclarativetimer.cpp DEFINES += SRCDIR=\\\"$$PWD\\\" + +CONFIG += parallel_test diff --git a/tests/auto/declarative/qdeclarativetimer/tst_qdeclarativetimer.cpp b/tests/auto/declarative/qdeclarativetimer/tst_qdeclarativetimer.cpp index 1dfec50..a08a91c 100644 --- a/tests/auto/declarative/qdeclarativetimer/tst_qdeclarativetimer.cpp +++ b/tests/auto/declarative/qdeclarativetimer/tst_qdeclarativetimer.cpp @@ -93,7 +93,7 @@ void tst_qdeclarativetimer::notRepeating() { QDeclarativeEngine engine; QDeclarativeComponent component(&engine); - component.setData(QByteArray("import Qt 4.6\nTimer { interval: 100; running: true }"), QUrl::fromLocalFile("")); + component.setData(QByteArray("import Qt 4.7\nTimer { interval: 100; running: true }"), QUrl::fromLocalFile("")); QDeclarativeTimer *timer = qobject_cast<QDeclarativeTimer*>(component.create()); QVERIFY(timer != 0); QVERIFY(timer->isRunning()); @@ -114,7 +114,7 @@ void tst_qdeclarativetimer::notRepeatingStart() { QDeclarativeEngine engine; QDeclarativeComponent component(&engine); - component.setData(QByteArray("import Qt 4.6\nTimer { interval: 100 }"), QUrl::fromLocalFile("")); + component.setData(QByteArray("import Qt 4.7\nTimer { interval: 100 }"), QUrl::fromLocalFile("")); QDeclarativeTimer *timer = qobject_cast<QDeclarativeTimer*>(component.create()); QVERIFY(timer != 0); QVERIFY(!timer->isRunning()); @@ -139,7 +139,7 @@ void tst_qdeclarativetimer::repeat() { QDeclarativeEngine engine; QDeclarativeComponent component(&engine); - component.setData(QByteArray("import Qt 4.6\nTimer { interval: 100; repeat: true; running: true }"), QUrl::fromLocalFile("")); + component.setData(QByteArray("import Qt 4.7\nTimer { interval: 100; repeat: true; running: true }"), QUrl::fromLocalFile("")); QDeclarativeTimer *timer = qobject_cast<QDeclarativeTimer*>(component.create()); QVERIFY(timer != 0); @@ -181,7 +181,7 @@ void tst_qdeclarativetimer::triggeredOnStart() { QDeclarativeEngine engine; QDeclarativeComponent component(&engine); - component.setData(QByteArray("import Qt 4.6\nTimer { interval: 100; running: true; triggeredOnStart: true }"), QUrl::fromLocalFile("")); + component.setData(QByteArray("import Qt 4.7\nTimer { interval: 100; running: true; triggeredOnStart: true }"), QUrl::fromLocalFile("")); QDeclarativeTimer *timer = qobject_cast<QDeclarativeTimer*>(component.create()); QVERIFY(timer != 0); QVERIFY(timer->triggeredOnStart()); @@ -216,7 +216,7 @@ void tst_qdeclarativetimer::triggeredOnStartRepeat() { QDeclarativeEngine engine; QDeclarativeComponent component(&engine); - component.setData(QByteArray("import Qt 4.6\nTimer { interval: 100; running: true; triggeredOnStart: true; repeat: true }"), QUrl::fromLocalFile("")); + component.setData(QByteArray("import Qt 4.7\nTimer { interval: 100; running: true; triggeredOnStart: true; repeat: true }"), QUrl::fromLocalFile("")); QDeclarativeTimer *timer = qobject_cast<QDeclarativeTimer*>(component.create()); QVERIFY(timer != 0); @@ -240,7 +240,7 @@ void tst_qdeclarativetimer::noTriggerIfNotRunning() QDeclarativeEngine engine; QDeclarativeComponent component(&engine); component.setData(QByteArray( - "import Qt 4.6\n" + "import Qt 4.7\n" "Item { property bool ok: true\n" "Timer { id: t1; interval: 100; repeat: true; running: true; onTriggered: if (!running) ok=false }" "Timer { interval: 10; running: true; onTriggered: t1.running=false }" @@ -258,7 +258,7 @@ void tst_qdeclarativetimer::changeDuration() { QDeclarativeEngine engine; QDeclarativeComponent component(&engine); - component.setData(QByteArray("import Qt 4.6\nTimer { interval: 200; repeat: true; running: true }"), QUrl::fromLocalFile("")); + component.setData(QByteArray("import Qt 4.7\nTimer { interval: 200; repeat: true; running: true }"), QUrl::fromLocalFile("")); QDeclarativeTimer *timer = qobject_cast<QDeclarativeTimer*>(component.create()); QVERIFY(timer != 0); @@ -294,7 +294,7 @@ void tst_qdeclarativetimer::restart() { QDeclarativeEngine engine; QDeclarativeComponent component(&engine); - component.setData(QByteArray("import Qt 4.6\nTimer { interval: 500; repeat: true; running: true }"), QUrl::fromLocalFile("")); + component.setData(QByteArray("import Qt 4.7\nTimer { interval: 500; repeat: true; running: true }"), QUrl::fromLocalFile("")); QDeclarativeTimer *timer = qobject_cast<QDeclarativeTimer*>(component.create()); QVERIFY(timer != 0); diff --git a/tests/auto/declarative/qdeclarativevaluetypes/qdeclarativevaluetypes.pro b/tests/auto/declarative/qdeclarativevaluetypes/qdeclarativevaluetypes.pro index 028fc57..d9f1c13 100644 --- a/tests/auto/declarative/qdeclarativevaluetypes/qdeclarativevaluetypes.pro +++ b/tests/auto/declarative/qdeclarativevaluetypes/qdeclarativevaluetypes.pro @@ -8,3 +8,6 @@ SOURCES += tst_qdeclarativevaluetypes.cpp \ testtypes.cpp DEFINES += SRCDIR=\\\"$$PWD\\\" + +CONFIG += parallel_test + diff --git a/tests/auto/declarative/qdeclarativewebview/qdeclarativewebview.pro b/tests/auto/declarative/qdeclarativewebview/qdeclarativewebview.pro index 20173c6..956272f 100644 --- a/tests/auto/declarative/qdeclarativewebview/qdeclarativewebview.pro +++ b/tests/auto/declarative/qdeclarativewebview/qdeclarativewebview.pro @@ -7,3 +7,5 @@ SOURCES += tst_qdeclarativewebview.cpp # Define SRCDIR equal to test's source directory DEFINES += SRCDIR=\\\"$$PWD\\\" + +CONFIG += parallel_test diff --git a/tests/auto/declarative/qdeclarativewebview/tst_qdeclarativewebview.cpp b/tests/auto/declarative/qdeclarativewebview/tst_qdeclarativewebview.cpp index ce389f3..beabf86 100644 --- a/tests/auto/declarative/qdeclarativewebview/tst_qdeclarativewebview.cpp +++ b/tests/auto/declarative/qdeclarativewebview/tst_qdeclarativewebview.cpp @@ -453,7 +453,7 @@ void tst_qdeclarativewebview::newWindowComponent() QTRY_COMPARE(wv->property("progress").toDouble(), 1.0); QDeclarativeComponent substituteComponent(&engine); - substituteComponent.setData("import Qt 4.6; WebView { objectName: 'newWebView'; url: 'basic.html'; }", QUrl::fromLocalFile("")); + substituteComponent.setData("import Qt 4.7; WebView { objectName: 'newWebView'; url: 'basic.html'; }", QUrl::fromLocalFile("")); QSignalSpy newWindowComponentSpy(wv, SIGNAL(newWindowComponentChanged())); wv->setProperty("newWindowComponent", QVariant::fromValue(&substituteComponent)); diff --git a/tests/auto/declarative/qdeclarativeworkerscript/qdeclarativeworkerscript.pro b/tests/auto/declarative/qdeclarativeworkerscript/qdeclarativeworkerscript.pro index e2b31c7..2e3da4d 100644 --- a/tests/auto/declarative/qdeclarativeworkerscript/qdeclarativeworkerscript.pro +++ b/tests/auto/declarative/qdeclarativeworkerscript/qdeclarativeworkerscript.pro @@ -6,3 +6,6 @@ SOURCES += tst_qdeclarativeworkerscript.cpp # Define SRCDIR equal to test's source directory DEFINES += SRCDIR=\\\"$$PWD\\\" + +CONFIG += parallel_test + diff --git a/tests/auto/declarative/qdeclarativeworkerscript/tst_qdeclarativeworkerscript.cpp b/tests/auto/declarative/qdeclarativeworkerscript/tst_qdeclarativeworkerscript.cpp index fe2dac2..a1dae24 100644 --- a/tests/auto/declarative/qdeclarativeworkerscript/tst_qdeclarativeworkerscript.cpp +++ b/tests/auto/declarative/qdeclarativeworkerscript/tst_qdeclarativeworkerscript.cpp @@ -85,7 +85,7 @@ void tst_QDeclarativeWorkerScript::source() QUrl source = QUrl::fromLocalFile(SRCDIR "/data/worker.qml"); QDeclarativeComponent component(&m_engine); - component.setData("import Qt 4.6\nWorkerScript { source: '" + source.toString().toUtf8() + "'; }", QUrl()); + component.setData("import Qt 4.7\nWorkerScript { source: '" + source.toString().toUtf8() + "'; }", QUrl()); QDeclarativeWorkerScript *item = qobject_cast<QDeclarativeWorkerScript*>(component.create()); QVERIFY(item != 0); diff --git a/tests/auto/declarative/qdeclarativexmlhttprequest/data/abort.expect b/tests/auto/declarative/qdeclarativexmlhttprequest/data/abort.expect index f43e043..4d21122 100644 --- a/tests/auto/declarative/qdeclarativexmlhttprequest/data/abort.expect +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/data/abort.expect @@ -1,9 +1,9 @@ PUT /testdocument.html HTTP/1.1 +ACCEPT-LANGUAGE: en-US Content-Type: text/plain;charset=UTF-8 Content-Length: 9 Connection: Keep-Alive Accept-Encoding: gzip -Accept-Language: en-US,* User-Agent: Mozilla/5.0 Host: 127.0.0.1:14445 diff --git a/tests/auto/declarative/qdeclarativexmlhttprequest/data/abort.qml b/tests/auto/declarative/qdeclarativexmlhttprequest/data/abort.qml index d7b9266..729793e 100644 --- a/tests/auto/declarative/qdeclarativexmlhttprequest/data/abort.qml +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/data/abort.qml @@ -13,6 +13,7 @@ QtObject { var x = new XMLHttpRequest; x.open("GET", urlDummy); x.setRequestHeader("Test-header", "TestValue"); + x.setRequestHeader("Accept-Language", "en-US"); x.send(); x.onreadystatechange = function() { @@ -35,6 +36,7 @@ QtObject { } } x.open("PUT", url); + x.setRequestHeader("Accept-Language", "en-US"); x.send("Test Data"); } } diff --git a/tests/auto/declarative/qdeclarativexmlhttprequest/data/abort_opened.qml b/tests/auto/declarative/qdeclarativexmlhttprequest/data/abort_opened.qml index 72a45e7..33ca020 100644 --- a/tests/auto/declarative/qdeclarativexmlhttprequest/data/abort_opened.qml +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/data/abort_opened.qml @@ -21,10 +21,12 @@ QtObject { readyState = true; x.open("PUT", url); + x.setRequestHeader("Accept-Language", "en-US"); x.abort(); x.open("GET", url); + x.setRequestHeader("Accept-Language", "en-US"); if (x.readyState == XMLHttpRequest.OPENED) openedState = true; diff --git a/tests/auto/declarative/qdeclarativexmlhttprequest/data/abort_unsent.qml b/tests/auto/declarative/qdeclarativexmlhttprequest/data/abort_unsent.qml index aa78cde..c0957ed 100644 --- a/tests/auto/declarative/qdeclarativexmlhttprequest/data/abort_unsent.qml +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/data/abort_unsent.qml @@ -21,6 +21,7 @@ QtObject { readyState = true; x.open("GET", url); + x.setRequestHeader("Accept-Language", "en-US"); if (x.readyState == XMLHttpRequest.OPENED) openedState = true; diff --git a/tests/auto/declarative/qdeclarativexmlhttprequest/data/getAllResponseHeaders.qml b/tests/auto/declarative/qdeclarativexmlhttprequest/data/getAllResponseHeaders.qml index 8d67fad..9096999 100644 --- a/tests/auto/declarative/qdeclarativexmlhttprequest/data/getAllResponseHeaders.qml +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/data/getAllResponseHeaders.qml @@ -31,6 +31,7 @@ QtObject { readyState = true; x.open("GET", url); + x.setRequestHeader("Accept-Language", "en-US"); if (x.readyState == XMLHttpRequest.OPENED) openedState = true; diff --git a/tests/auto/declarative/qdeclarativexmlhttprequest/data/getResponseHeader.expect b/tests/auto/declarative/qdeclarativexmlhttprequest/data/getResponseHeader.expect index a740c79..c6cad70 100644 --- a/tests/auto/declarative/qdeclarativexmlhttprequest/data/getResponseHeader.expect +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/data/getResponseHeader.expect @@ -1,7 +1,7 @@ GET /testdocument.html HTTP/1.1 +ACCEPT-LANGUAGE: en-US Connection: Keep-Alive Accept-Encoding: gzip -Accept-Language: en-US,* User-Agent: Mozilla/5.0 Host: 127.0.0.1:14445 diff --git a/tests/auto/declarative/qdeclarativexmlhttprequest/data/getResponseHeader.qml b/tests/auto/declarative/qdeclarativexmlhttprequest/data/getResponseHeader.qml index 2f949e1..7a65e25 100644 --- a/tests/auto/declarative/qdeclarativexmlhttprequest/data/getResponseHeader.qml +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/data/getResponseHeader.qml @@ -37,6 +37,7 @@ QtObject { readyState = true; x.open("GET", url); + x.setRequestHeader("Accept-Language", "en-US"); if (x.readyState == XMLHttpRequest.OPENED) openedState = true; diff --git a/tests/auto/declarative/qdeclarativexmlhttprequest/data/open.qml b/tests/auto/declarative/qdeclarativexmlhttprequest/data/open.qml index c06bae3..72fb9d7 100644 --- a/tests/auto/declarative/qdeclarativexmlhttprequest/data/open.qml +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/data/open.qml @@ -20,6 +20,7 @@ QtObject { readyState = true; x.open("GET", url); + x.setRequestHeader("Accept-Language","en-US"); if (x.readyState == XMLHttpRequest.OPENED) openedState = true; diff --git a/tests/auto/declarative/qdeclarativexmlhttprequest/data/open_network.expect b/tests/auto/declarative/qdeclarativexmlhttprequest/data/open_network.expect index a740c79..c6cad70 100644 --- a/tests/auto/declarative/qdeclarativexmlhttprequest/data/open_network.expect +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/data/open_network.expect @@ -1,7 +1,7 @@ GET /testdocument.html HTTP/1.1 +ACCEPT-LANGUAGE: en-US Connection: Keep-Alive Accept-Encoding: gzip -Accept-Language: en-US,* User-Agent: Mozilla/5.0 Host: 127.0.0.1:14445 diff --git a/tests/auto/declarative/qdeclarativexmlhttprequest/data/open_user.qml b/tests/auto/declarative/qdeclarativexmlhttprequest/data/open_user.qml index 19e37fa..b07f8e7 100644 --- a/tests/auto/declarative/qdeclarativexmlhttprequest/data/open_user.qml +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/data/open_user.qml @@ -20,6 +20,7 @@ QtObject { readyState = true; x.open("GET", url, true, "username", "password"); + x.setRequestHeader("Accept-Language","en-US"); if (x.readyState == XMLHttpRequest.OPENED) openedState = true; diff --git a/tests/auto/declarative/qdeclarativexmlhttprequest/data/responseText.qml b/tests/auto/declarative/qdeclarativexmlhttprequest/data/responseText.qml index 4bb3a7a..9fa4847 100644 --- a/tests/auto/declarative/qdeclarativexmlhttprequest/data/responseText.qml +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/data/responseText.qml @@ -22,6 +22,7 @@ QtObject { unsent = (x.responseText == ""); x.open("GET", url); + x.setRequestHeader("Accept-Language", "en-US"); opened = (x.responseText == ""); @@ -39,6 +40,7 @@ QtObject { dataOK = (x.responseText == expectedText); x.open("GET", url); + x.setRequestHeader("Accept-Language", "en-US"); reset = (x.responseText == ""); } diff --git a/tests/auto/declarative/qdeclarativexmlhttprequest/data/send_alreadySent.qml b/tests/auto/declarative/qdeclarativexmlhttprequest/data/send_alreadySent.qml index 0bad7df..a9ef3e8 100644 --- a/tests/auto/declarative/qdeclarativexmlhttprequest/data/send_alreadySent.qml +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/data/send_alreadySent.qml @@ -7,6 +7,7 @@ QtObject { Component.onCompleted: { var x = new XMLHttpRequest; x.open("GET", "testdocument.html"); + x.setRequestHeader("Accept-Language","en-US"); // Test to the end x.onreadystatechange = function() { diff --git a/tests/auto/declarative/qdeclarativexmlhttprequest/data/send_data.1.expect b/tests/auto/declarative/qdeclarativexmlhttprequest/data/send_data.1.expect index 81dd4a0..2effbdc 100644 --- a/tests/auto/declarative/qdeclarativexmlhttprequest/data/send_data.1.expect +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/data/send_data.1.expect @@ -1,9 +1,9 @@ POST /testdocument.html HTTP/1.1 +ACCEPT-LANGUAGE: en-US Content-Type: text/plain;charset=UTF-8 Content-Length: 12 Connection: Keep-Alive Accept-Encoding: gzip -Accept-Language: en-US,* User-Agent: Mozilla/5.0 Host: 127.0.0.1:14445 diff --git a/tests/auto/declarative/qdeclarativexmlhttprequest/data/send_data.1.qml b/tests/auto/declarative/qdeclarativexmlhttprequest/data/send_data.1.qml index 03543a9..171e0b1 100644 --- a/tests/auto/declarative/qdeclarativexmlhttprequest/data/send_data.1.qml +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/data/send_data.1.qml @@ -8,6 +8,7 @@ QtObject { Component.onCompleted: { var x = new XMLHttpRequest; x.open("POST", url); + x.setRequestHeader("Accept-Language","en-US"); // Test to the end x.onreadystatechange = function() { diff --git a/tests/auto/declarative/qdeclarativexmlhttprequest/data/send_data.2.qml b/tests/auto/declarative/qdeclarativexmlhttprequest/data/send_data.2.qml index 79a27b6..09b742b 100644 --- a/tests/auto/declarative/qdeclarativexmlhttprequest/data/send_data.2.qml +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/data/send_data.2.qml @@ -9,6 +9,7 @@ QtObject { var x = new XMLHttpRequest; x.open("POST", url); x.setRequestHeader("Content-Type", "text/plain;charset=UTF-8"); + x.setRequestHeader("Accept-Language","en-US"); // Test to the end x.onreadystatechange = function() { diff --git a/tests/auto/declarative/qdeclarativexmlhttprequest/data/send_data.3.qml b/tests/auto/declarative/qdeclarativexmlhttprequest/data/send_data.3.qml index e048769..8786917 100644 --- a/tests/auto/declarative/qdeclarativexmlhttprequest/data/send_data.3.qml +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/data/send_data.3.qml @@ -9,6 +9,7 @@ QtObject { var x = new XMLHttpRequest; x.open("POST", url); x.setRequestHeader("Content-Type", "text/plain;charset=latin1"); + x.setRequestHeader("Accept-Language","en-US"); // Test to the end x.onreadystatechange = function() { diff --git a/tests/auto/declarative/qdeclarativexmlhttprequest/data/send_data.4.expect b/tests/auto/declarative/qdeclarativexmlhttprequest/data/send_data.4.expect index 8fcf3ac..8336860 100644 --- a/tests/auto/declarative/qdeclarativexmlhttprequest/data/send_data.4.expect +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/data/send_data.4.expect @@ -1,9 +1,9 @@ POST /testdocument.html HTTP/1.1 +ACCEPT-LANGUAGE: en-US Content-Type: charset=UTF-8;text/plain Content-Length: 12 Connection: Keep-Alive Accept-Encoding: gzip -Accept-Language: en-US,* User-Agent: Mozilla/5.0 Host: 127.0.0.1:14445 diff --git a/tests/auto/declarative/qdeclarativexmlhttprequest/data/send_data.4.qml b/tests/auto/declarative/qdeclarativexmlhttprequest/data/send_data.4.qml index 7ab0b27..6789480 100644 --- a/tests/auto/declarative/qdeclarativexmlhttprequest/data/send_data.4.qml +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/data/send_data.4.qml @@ -9,6 +9,7 @@ QtObject { var x = new XMLHttpRequest; x.open("POST", url); x.setRequestHeader("Content-Type", "charset=UTF-8;text/plain"); + x.setRequestHeader("Accept-Language","en-US"); // Test to the end x.onreadystatechange = function() { diff --git a/tests/auto/declarative/qdeclarativexmlhttprequest/data/send_data.5.qml b/tests/auto/declarative/qdeclarativexmlhttprequest/data/send_data.5.qml index 29bf2c2..08d999d 100644 --- a/tests/auto/declarative/qdeclarativexmlhttprequest/data/send_data.5.qml +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/data/send_data.5.qml @@ -9,6 +9,7 @@ QtObject { var x = new XMLHttpRequest; x.open("POST", url); x.setRequestHeader("Content-Type", "charset=latin1;text/plain"); + x.setRequestHeader("Accept-Language","en-US"); // Test to the end x.onreadystatechange = function() { diff --git a/tests/auto/declarative/qdeclarativexmlhttprequest/data/send_data.6.expect b/tests/auto/declarative/qdeclarativexmlhttprequest/data/send_data.6.expect index 97e6fac..4f10bbc 100644 --- a/tests/auto/declarative/qdeclarativexmlhttprequest/data/send_data.6.expect +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/data/send_data.6.expect @@ -1,9 +1,9 @@ PUT /testdocument.html HTTP/1.1 +ACCEPT-LANGUAGE: en-US Content-Type: text/plain;charset=UTF-8 Content-Length: 12 Connection: Keep-Alive Accept-Encoding: gzip -Accept-Language: en-US,* User-Agent: Mozilla/5.0 Host: 127.0.0.1:14445 diff --git a/tests/auto/declarative/qdeclarativexmlhttprequest/data/send_data.6.qml b/tests/auto/declarative/qdeclarativexmlhttprequest/data/send_data.6.qml index 135f45c..e047fc8 100644 --- a/tests/auto/declarative/qdeclarativexmlhttprequest/data/send_data.6.qml +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/data/send_data.6.qml @@ -8,6 +8,7 @@ QtObject { Component.onCompleted: { var x = new XMLHttpRequest; x.open("PUT", url); + x.setRequestHeader("Accept-Language","en-US"); // Test to the end x.onreadystatechange = function() { diff --git a/tests/auto/declarative/qdeclarativexmlhttprequest/data/send_data.7.qml b/tests/auto/declarative/qdeclarativexmlhttprequest/data/send_data.7.qml index 4a09527..ba0db25 100644 --- a/tests/auto/declarative/qdeclarativexmlhttprequest/data/send_data.7.qml +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/data/send_data.7.qml @@ -9,6 +9,7 @@ QtObject { var x = new XMLHttpRequest; x.open("POST", url); x.setRequestHeader("Content-Type", "text/plain"); + x.setRequestHeader("Accept-Language","en-US"); // Test to the end x.onreadystatechange = function() { diff --git a/tests/auto/declarative/qdeclarativexmlhttprequest/data/send_ignoreData.qml b/tests/auto/declarative/qdeclarativexmlhttprequest/data/send_ignoreData.qml index dd5fa46..ddf520e 100644 --- a/tests/auto/declarative/qdeclarativexmlhttprequest/data/send_ignoreData.qml +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/data/send_ignoreData.qml @@ -9,6 +9,7 @@ QtObject { Component.onCompleted: { var x = new XMLHttpRequest; x.open(reqType, url); + x.setRequestHeader("Accept-Language","en-US"); // Test to the end x.onreadystatechange = function() { diff --git a/tests/auto/declarative/qdeclarativexmlhttprequest/data/send_ignoreData_GET.expect b/tests/auto/declarative/qdeclarativexmlhttprequest/data/send_ignoreData_GET.expect index a740c79..c6cad70 100644 --- a/tests/auto/declarative/qdeclarativexmlhttprequest/data/send_ignoreData_GET.expect +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/data/send_ignoreData_GET.expect @@ -1,7 +1,7 @@ GET /testdocument.html HTTP/1.1 +ACCEPT-LANGUAGE: en-US Connection: Keep-Alive Accept-Encoding: gzip -Accept-Language: en-US,* User-Agent: Mozilla/5.0 Host: 127.0.0.1:14445 diff --git a/tests/auto/declarative/qdeclarativexmlhttprequest/data/send_ignoreData_PUT.expect b/tests/auto/declarative/qdeclarativexmlhttprequest/data/send_ignoreData_PUT.expect index 991bd59..74a9798 100644 --- a/tests/auto/declarative/qdeclarativexmlhttprequest/data/send_ignoreData_PUT.expect +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/data/send_ignoreData_PUT.expect @@ -1,7 +1,7 @@ HEAD /testdocument.html HTTP/1.1 +ACCEPT-LANGUAGE: en-US Connection: Keep-Alive Accept-Encoding: gzip -Accept-Language: en-US,* User-Agent: Mozilla/5.0 Host: 127.0.0.1:14445 diff --git a/tests/auto/declarative/qdeclarativexmlhttprequest/data/setRequestHeader.expect b/tests/auto/declarative/qdeclarativexmlhttprequest/data/setRequestHeader.expect index 4600f2a..7b8e260 100644 --- a/tests/auto/declarative/qdeclarativexmlhttprequest/data/setRequestHeader.expect +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/data/setRequestHeader.expect @@ -1,9 +1,9 @@ GET /testdocument.html HTTP/1.1 +ACCEPT-LANGUAGE: en-US TEST-HEADER: value TEST-HEADER2: value,value2 Connection: Keep-Alive Accept-Encoding: gzip -Accept-Language: en-US,* User-Agent: Mozilla/5.0 Host: 127.0.0.1:14445 diff --git a/tests/auto/declarative/qdeclarativexmlhttprequest/data/setRequestHeader.qml b/tests/auto/declarative/qdeclarativexmlhttprequest/data/setRequestHeader.qml index b0723aa..61eea33 100644 --- a/tests/auto/declarative/qdeclarativexmlhttprequest/data/setRequestHeader.qml +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/data/setRequestHeader.qml @@ -9,6 +9,7 @@ QtObject { var x = new XMLHttpRequest; x.open("GET", url); + x.setRequestHeader("Accept-Language","en-US"); x.setRequestHeader("Test-header", "value"); x.setRequestHeader("Test-header2", "value"); diff --git a/tests/auto/declarative/qdeclarativexmlhttprequest/data/setRequestHeader_illegalName.qml b/tests/auto/declarative/qdeclarativexmlhttprequest/data/setRequestHeader_illegalName.qml index bf31eca..b22b239 100644 --- a/tests/auto/declarative/qdeclarativexmlhttprequest/data/setRequestHeader_illegalName.qml +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/data/setRequestHeader_illegalName.qml @@ -21,6 +21,7 @@ QtObject { readyState = true; x.open("GET", url); + x.setRequestHeader("Accept-Language","en-US"); x.setRequestHeader(header, "Value"); diff --git a/tests/auto/declarative/qdeclarativexmlhttprequest/data/setRequestHeader_sent.qml b/tests/auto/declarative/qdeclarativexmlhttprequest/data/setRequestHeader_sent.qml index c2bbc6e..666c791 100644 --- a/tests/auto/declarative/qdeclarativexmlhttprequest/data/setRequestHeader_sent.qml +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/data/setRequestHeader_sent.qml @@ -10,6 +10,7 @@ QtObject { var x = new XMLHttpRequest; x.open("GET", url); + x.setRequestHeader("Accept-Language","en-US"); // Test to the end x.onreadystatechange = function() { diff --git a/tests/auto/declarative/qdeclarativexmlhttprequest/data/status.expect b/tests/auto/declarative/qdeclarativexmlhttprequest/data/status.expect index a740c79..c6cad70 100644 --- a/tests/auto/declarative/qdeclarativexmlhttprequest/data/status.expect +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/data/status.expect @@ -1,7 +1,7 @@ GET /testdocument.html HTTP/1.1 +ACCEPT-LANGUAGE: en-US Connection: Keep-Alive Accept-Encoding: gzip -Accept-Language: en-US,* User-Agent: Mozilla/5.0 Host: 127.0.0.1:14445 diff --git a/tests/auto/declarative/qdeclarativexmlhttprequest/data/status.qml b/tests/auto/declarative/qdeclarativexmlhttprequest/data/status.qml index 04202c4..c903e12 100644 --- a/tests/auto/declarative/qdeclarativexmlhttprequest/data/status.qml +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/data/status.qml @@ -27,6 +27,7 @@ QtObject { } x.open("GET", url); + x.setRequestHeader("Accept-Language", "en-US"); try { var a = x.status; @@ -54,6 +55,7 @@ QtObject { } x.open("GET", url); + x.setRequestHeader("Accept-Language", "en-US"); try { var a = x.status; diff --git a/tests/auto/declarative/qdeclarativexmlhttprequest/data/statusText.qml b/tests/auto/declarative/qdeclarativexmlhttprequest/data/statusText.qml index 8becc3b..a3b98be 100644 --- a/tests/auto/declarative/qdeclarativexmlhttprequest/data/statusText.qml +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/data/statusText.qml @@ -27,6 +27,7 @@ QtObject { } x.open("GET", url); + x.setRequestHeader("Accept-Language", "en-US"); try { var a = x.statusText; @@ -54,6 +55,7 @@ QtObject { } x.open("GET", url); + x.setRequestHeader("Accept-Language", "en-US"); try { var a = x.statusText; diff --git a/tests/auto/declarative/qdeclarativexmlhttprequest/qdeclarativexmlhttprequest.pro b/tests/auto/declarative/qdeclarativexmlhttprequest/qdeclarativexmlhttprequest.pro index 7bc92af..160300e 100644 --- a/tests/auto/declarative/qdeclarativexmlhttprequest/qdeclarativexmlhttprequest.pro +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/qdeclarativexmlhttprequest.pro @@ -11,3 +11,6 @@ SOURCES += tst_qdeclarativexmlhttprequest.cpp \ # Define SRCDIR equal to test's source directory DEFINES += SRCDIR=\\\"$$PWD\\\" + +CONFIG += parallel_test + diff --git a/tests/auto/declarative/qdeclarativexmlhttprequest/tst_qdeclarativexmlhttprequest.cpp b/tests/auto/declarative/qdeclarativexmlhttprequest/tst_qdeclarativexmlhttprequest.cpp index 13ed959..1d26f2c 100644 --- a/tests/auto/declarative/qdeclarativexmlhttprequest/tst_qdeclarativexmlhttprequest.cpp +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/tst_qdeclarativexmlhttprequest.cpp @@ -55,12 +55,6 @@ public: tst_qdeclarativexmlhttprequest() {} private slots: - void initTestCase() { - if (QLocale::system().name().replace(QChar::fromAscii('_'),QChar::fromAscii('-')) != QLatin1String("en-US")) { - qWarning() << "Test will fail unless LANG is en_US"; - } - } - void domExceptionCodes(); void callbackException(); void callbackException_data(); diff --git a/tests/auto/declarative/qdeclarativexmllistmodel/qdeclarativexmllistmodel.pro b/tests/auto/declarative/qdeclarativexmllistmodel/qdeclarativexmllistmodel.pro index 88832dc..8c5052a 100644 --- a/tests/auto/declarative/qdeclarativexmllistmodel/qdeclarativexmllistmodel.pro +++ b/tests/auto/declarative/qdeclarativexmllistmodel/qdeclarativexmllistmodel.pro @@ -9,3 +9,6 @@ macx:CONFIG -= app_bundle SOURCES += tst_qdeclarativexmllistmodel.cpp DEFINES += SRCDIR=\\\"$$PWD\\\" + +CONFIG += parallel_test + diff --git a/tests/auto/declarative/qdeclarativexmllistmodel/tst_qdeclarativexmllistmodel.cpp b/tests/auto/declarative/qdeclarativexmllistmodel/tst_qdeclarativexmllistmodel.cpp index 7edf7e9..cf7e357 100644 --- a/tests/auto/declarative/qdeclarativexmllistmodel/tst_qdeclarativexmllistmodel.cpp +++ b/tests/auto/declarative/qdeclarativexmllistmodel/tst_qdeclarativexmllistmodel.cpp @@ -320,7 +320,21 @@ void tst_qdeclarativexmllistmodel::source() QCOMPARE(model->progress(), qreal(0.0)); QTRY_COMPARE(spy.count(), 1); spy.clear(); QCOMPARE(model->status(), QDeclarativeXmlListModel::Loading); - QTRY_COMPARE(spy.count(), 1); spy.clear(); + + QEventLoop loop; + QTimer timer; + timer.setSingleShot(true); + connect(model, SIGNAL(statusChanged(QDeclarativeXmlListModel::Status)), &loop, SLOT(quit())); + connect(&timer, SIGNAL(timeout()), &loop, SLOT(quit())); + timer.start(20000); + loop.exec(); + + if (spy.count() == 0 && status != QDeclarativeXmlListModel::Ready) { + qWarning("QDeclarativeXmlListModel invalid source test timed out"); + } else { + QCOMPARE(spy.count(), 1); spy.clear(); + } + QCOMPARE(model->status(), status); QCOMPARE(model->count(), count); if (status == QDeclarativeXmlListModel::Ready) @@ -336,9 +350,7 @@ void tst_qdeclarativexmllistmodel::source_data() QTest::addColumn<QDeclarativeXmlListModel::Status>("status"); QTest::newRow("valid") << QUrl::fromLocalFile(SRCDIR "/data/model2.xml") << 2 << QDeclarativeXmlListModel::Ready; - - // XXX This test fails on the rare occasion due to networking, fix the test for Error status signal (323) - //QTest::newRow("invalid") << QUrl("http://blah.blah/blah.xml") << 0 << QDeclarativeXmlListModel::Error; + QTest::newRow("invalid") << QUrl("http://blah.blah/blah.xml") << 0 << QDeclarativeXmlListModel::Error; // empty file QTemporaryFile *temp = new QTemporaryFile(this); diff --git a/tests/auto/declarative/qmetaobjectbuilder/qmetaobjectbuilder.pro b/tests/auto/declarative/qmetaobjectbuilder/qmetaobjectbuilder.pro index 94ffe4b..988177e 100644 --- a/tests/auto/declarative/qmetaobjectbuilder/qmetaobjectbuilder.pro +++ b/tests/auto/declarative/qmetaobjectbuilder/qmetaobjectbuilder.pro @@ -5,3 +5,4 @@ macx:CONFIG -= app_bundle SOURCES += \ tst_qmetaobjectbuilder.cpp +CONFIG += parallel_test diff --git a/tests/auto/declarative/qmlvisual/fillmode/data/fillmode.qml b/tests/auto/declarative/qmlvisual/fillmode/data/fillmode.qml index 7ac6f51..08ed609 100644 --- a/tests/auto/declarative/qmlvisual/fillmode/data/fillmode.qml +++ b/tests/auto/declarative/qmlvisual/fillmode/data/fillmode.qml @@ -6,274 +6,6 @@ VisualTest { } Frame { msec: 16 - hash: "c8cb8d51ca04231dc272133faaf2fb6d" - } - Frame { - msec: 32 - hash: "c8cb8d51ca04231dc272133faaf2fb6d" - } - Frame { - msec: 48 - hash: "c8cb8d51ca04231dc272133faaf2fb6d" - } - Frame { - msec: 64 - hash: "c8cb8d51ca04231dc272133faaf2fb6d" - } - Frame { - msec: 80 - hash: "c8cb8d51ca04231dc272133faaf2fb6d" - } - Frame { - msec: 96 - hash: "c8cb8d51ca04231dc272133faaf2fb6d" - } - Frame { - msec: 112 - hash: "c8cb8d51ca04231dc272133faaf2fb6d" - } - Frame { - msec: 128 - hash: "c8cb8d51ca04231dc272133faaf2fb6d" - } - Frame { - msec: 144 - hash: "c8cb8d51ca04231dc272133faaf2fb6d" - } - Frame { - msec: 160 - hash: "c8cb8d51ca04231dc272133faaf2fb6d" - } - Frame { - msec: 176 - hash: "c8cb8d51ca04231dc272133faaf2fb6d" - } - Frame { - msec: 192 - hash: "c8cb8d51ca04231dc272133faaf2fb6d" - } - Frame { - msec: 208 - hash: "c8cb8d51ca04231dc272133faaf2fb6d" - } - Frame { - msec: 224 - hash: "c8cb8d51ca04231dc272133faaf2fb6d" - } - Frame { - msec: 240 - hash: "c8cb8d51ca04231dc272133faaf2fb6d" - } - Frame { - msec: 256 - hash: "c8cb8d51ca04231dc272133faaf2fb6d" - } - Frame { - msec: 272 - hash: "c8cb8d51ca04231dc272133faaf2fb6d" - } - Frame { - msec: 288 - hash: "c8cb8d51ca04231dc272133faaf2fb6d" - } - Frame { - msec: 304 - hash: "c8cb8d51ca04231dc272133faaf2fb6d" - } - Frame { - msec: 320 - hash: "c8cb8d51ca04231dc272133faaf2fb6d" - } - Frame { - msec: 336 - hash: "c8cb8d51ca04231dc272133faaf2fb6d" - } - Frame { - msec: 352 - hash: "c8cb8d51ca04231dc272133faaf2fb6d" - } - Frame { - msec: 368 - hash: "c8cb8d51ca04231dc272133faaf2fb6d" - } - Frame { - msec: 384 - hash: "c8cb8d51ca04231dc272133faaf2fb6d" - } - Frame { - msec: 400 - hash: "c8cb8d51ca04231dc272133faaf2fb6d" - } - Frame { - msec: 416 - hash: "c8cb8d51ca04231dc272133faaf2fb6d" - } - Frame { - msec: 432 - hash: "c8cb8d51ca04231dc272133faaf2fb6d" - } - Frame { - msec: 448 - hash: "c8cb8d51ca04231dc272133faaf2fb6d" - } - Frame { - msec: 464 - hash: "c8cb8d51ca04231dc272133faaf2fb6d" - } - Frame { - msec: 480 - hash: "c8cb8d51ca04231dc272133faaf2fb6d" - } - Frame { - msec: 496 - hash: "c8cb8d51ca04231dc272133faaf2fb6d" - } - Frame { - msec: 512 - hash: "c8cb8d51ca04231dc272133faaf2fb6d" - } - Frame { - msec: 528 - hash: "c8cb8d51ca04231dc272133faaf2fb6d" - } - Frame { - msec: 544 - hash: "c8cb8d51ca04231dc272133faaf2fb6d" - } - Frame { - msec: 560 - hash: "c8cb8d51ca04231dc272133faaf2fb6d" - } - Frame { - msec: 576 - hash: "c8cb8d51ca04231dc272133faaf2fb6d" - } - Frame { - msec: 592 - hash: "c8cb8d51ca04231dc272133faaf2fb6d" - } - Frame { - msec: 608 - hash: "c8cb8d51ca04231dc272133faaf2fb6d" - } - Frame { - msec: 624 - hash: "c8cb8d51ca04231dc272133faaf2fb6d" - } - Frame { - msec: 640 - hash: "c8cb8d51ca04231dc272133faaf2fb6d" - } - Frame { - msec: 656 - hash: "c8cb8d51ca04231dc272133faaf2fb6d" - } - Frame { - msec: 672 - hash: "c8cb8d51ca04231dc272133faaf2fb6d" - } - Frame { - msec: 688 - hash: "c8cb8d51ca04231dc272133faaf2fb6d" - } - Frame { - msec: 704 - hash: "c8cb8d51ca04231dc272133faaf2fb6d" - } - Key { - type: 6 - key: 16777249 - modifiers: 0 - text: "" - autorep: false - count: 1 - } - Frame { - msec: 720 - hash: "c8cb8d51ca04231dc272133faaf2fb6d" - } - Frame { - msec: 736 - hash: "c8cb8d51ca04231dc272133faaf2fb6d" - } - Frame { - msec: 752 - hash: "c8cb8d51ca04231dc272133faaf2fb6d" - } - Frame { - msec: 768 - hash: "c8cb8d51ca04231dc272133faaf2fb6d" - } - Frame { - msec: 784 - hash: "c8cb8d51ca04231dc272133faaf2fb6d" - } - Frame { - msec: 800 - hash: "c8cb8d51ca04231dc272133faaf2fb6d" - } - Frame { - msec: 816 - hash: "c8cb8d51ca04231dc272133faaf2fb6d" - } - Frame { - msec: 832 - hash: "c8cb8d51ca04231dc272133faaf2fb6d" - } - Frame { - msec: 848 - hash: "c8cb8d51ca04231dc272133faaf2fb6d" - } - Frame { - msec: 864 - hash: "c8cb8d51ca04231dc272133faaf2fb6d" - } - Frame { - msec: 880 - hash: "c8cb8d51ca04231dc272133faaf2fb6d" - } - Frame { - msec: 896 - hash: "c8cb8d51ca04231dc272133faaf2fb6d" - } - Frame { - msec: 912 - hash: "c8cb8d51ca04231dc272133faaf2fb6d" - } - Frame { - msec: 928 - hash: "c8cb8d51ca04231dc272133faaf2fb6d" - } - Frame { - msec: 944 - hash: "c8cb8d51ca04231dc272133faaf2fb6d" - } - Frame { - msec: 960 image: "fillmode.0.png" - } - Frame { - msec: 976 - hash: "c8cb8d51ca04231dc272133faaf2fb6d" - } - Frame { - msec: 992 - hash: "c8cb8d51ca04231dc272133faaf2fb6d" - } - Frame { - msec: 1008 - hash: "c8cb8d51ca04231dc272133faaf2fb6d" - } - Frame { - msec: 1024 - hash: "c8cb8d51ca04231dc272133faaf2fb6d" - } - Frame { - msec: 1040 - hash: "c8cb8d51ca04231dc272133faaf2fb6d" - } - Frame { - msec: 1056 - hash: "c8cb8d51ca04231dc272133faaf2fb6d" - } + } } diff --git a/tests/auto/declarative/qmlvisual/qmlvisual.pro b/tests/auto/declarative/qmlvisual/qmlvisual.pro index f2b3bca..a3abbe3 100644 --- a/tests/auto/declarative/qmlvisual/qmlvisual.pro +++ b/tests/auto/declarative/qmlvisual/qmlvisual.pro @@ -5,3 +5,6 @@ macx:CONFIG -= app_bundle SOURCES += tst_qmlvisual.cpp DEFINES += QT_TEST_SOURCE_DIR=\"\\\"$$PWD\\\"\" + +CONFIG += parallel_test + diff --git a/tests/auto/declarative/qmlvisual/tst_qmlvisual.cpp b/tests/auto/declarative/qmlvisual/tst_qmlvisual.cpp index 05c2ebd..718e3a6 100644 --- a/tests/auto/declarative/qmlvisual/tst_qmlvisual.cpp +++ b/tests/auto/declarative/qmlvisual/tst_qmlvisual.cpp @@ -47,7 +47,7 @@ #include <QProcess> #include <QFile> -enum Mode { Record, RecordNoVisuals, Play, TestVisuals, RemoveVisuals, UpdateVisuals, UpdatePlatformVisuals, Test }; +enum Mode { Record, RecordNoVisuals, RecordSnapshot, Play, TestVisuals, RemoveVisuals, UpdateVisuals, UpdatePlatformVisuals, Test }; static QString testdir; class tst_qmlvisual : public QObject @@ -133,7 +133,7 @@ void tst_qmlvisual::visual() QStringList arguments; arguments << "-script" << testdata << "-scriptopts" << "play,testimages,testerror,exitoncomplete,exitonfailure" - << file << "-graphicssystem" << "raster"; + << file; #ifdef Q_WS_QWS arguments << "-qws"; #endif @@ -246,6 +246,11 @@ void action(Mode mode, const QString &file) << "-scriptopts" << "record,saveonexit" << file; break; + case RecordSnapshot: + arguments << "-script" << testdata + << "-scriptopts" << "record,testimages,snapshot,saveonexit" + << file; + break; case Play: arguments << "-script" << testdata << "-scriptopts" << "play,testimages,testerror,exitoncomplete" @@ -283,6 +288,7 @@ void usage() fprintf(stderr, " -listtests : list all the tests seen by tst_qmlvisual, and then exit immediately\n"); fprintf(stderr, " -record file : record new test data for file\n"); fprintf(stderr, " -recordnovisuals file : record new test data for file, but ignore visuals\n"); + fprintf(stderr, " -recordsnapshot file : record new snapshot for file (like record but only records a single frame and then exits)\n"); fprintf(stderr, " -play file : playback test data for file, printing errors\n"); fprintf(stderr, " -testvisuals file : playback test data for file, without errors\n"); fprintf(stderr, " -updatevisuals file : playback test data for file, accept new visuals for file\n"); @@ -340,6 +346,9 @@ int main(int argc, char **argv) } else if (arg == "-recordnovisuals" && (ii + 1) < argc) { mode = RecordNoVisuals; file = argv[++ii]; + } else if (arg == "-recordsnapshot" && (ii + 1) < argc) { + mode = RecordSnapshot; + file = argv[++ii]; } else if (arg == "-testvisuals" && (ii + 1) < argc) { mode = TestVisuals; file = argv[++ii]; diff --git a/tests/auto/declarative/qpacketprotocol/qpacketprotocol.pro b/tests/auto/declarative/qpacketprotocol/qpacketprotocol.pro index f42cecc..7ffda93 100644 --- a/tests/auto/declarative/qpacketprotocol/qpacketprotocol.pro +++ b/tests/auto/declarative/qpacketprotocol/qpacketprotocol.pro @@ -5,3 +5,5 @@ macx:CONFIG -= app_bundle HEADERS += ../shared/debugutil_p.h SOURCES += tst_qpacketprotocol.cpp \ ../shared/debugutil.cpp + +CONFIG += parallel_test diff --git a/tests/auto/declarative/sql/sql.pro b/tests/auto/declarative/sql/sql.pro index 4217eac..7e4fdd8 100644 --- a/tests/auto/declarative/sql/sql.pro +++ b/tests/auto/declarative/sql/sql.pro @@ -7,3 +7,6 @@ SOURCES += tst_sql.cpp # Define SRCDIR equal to test's source directory DEFINES += SRCDIR=\\\"$$PWD\\\" + +CONFIG += parallel_test + diff --git a/tests/auto/declarative/sql/tst_sql.cpp b/tests/auto/declarative/sql/tst_sql.cpp index 1bab2d2..c8b8dc3 100644 --- a/tests/auto/declarative/sql/tst_sql.cpp +++ b/tests/auto/declarative/sql/tst_sql.cpp @@ -196,7 +196,7 @@ void tst_sql::testQml() QFETCH(QString, jsfile); QString qml= - "import Qt 4.6\n" + "import Qt 4.7\n" "import \""+jsfile+"\" as JS\n" "Text { text: JS.test() }"; diff --git a/tests/auto/qdialogbuttonbox/tst_qdialogbuttonbox.cpp b/tests/auto/qdialogbuttonbox/tst_qdialogbuttonbox.cpp index bf4ea5f..195f8b6 100644 --- a/tests/auto/qdialogbuttonbox/tst_qdialogbuttonbox.cpp +++ b/tests/auto/qdialogbuttonbox/tst_qdialogbuttonbox.cpp @@ -721,11 +721,13 @@ void tst_QDialogButtonBox::testDefaultButton_data() static int softKeyCount(QWidget *widget) { int softkeyCount = 0; +#ifndef QT_NO_ACTION QList<QAction *> actions = widget->actions(); foreach (QAction *action, actions) { if (action->softKeyRole() != QAction::NoSoftKey) softkeyCount++; } +#endif return softkeyCount; } @@ -737,14 +739,18 @@ void tst_QDialogButtonBox::testS60SoftKeys() buttonBox.setStandardButtons(QDialogButtonBox::Ok | QDialogButtonBox::Cancel); dialog.show(); +#ifndef QT_NO_ACTION QCOMPARE( softKeyCount(&dialog), 2); +#endif QDialog dialog2(0); QDialogButtonBox buttonBox2(&dialog2); buttonBox2.setStandardButtons(QDialogButtonBox::Cancel); dialog2.show(); +#ifndef QT_NO_ACTION QCOMPARE( softKeyCount(&dialog2), 1); +#endif #else QSKIP("S60-specific test", SkipAll ); @@ -759,21 +765,27 @@ void tst_QDialogButtonBox::testSoftKeyReparenting() buttonBox->addButton(QDialogButtonBox::Ok); buttonBox->addButton(QDialogButtonBox::Cancel); +#ifndef QT_NO_ACTION QCOMPARE(softKeyCount(&dialog), 0); QCOMPARE(softKeyCount(buttonBox), 2); +#endif // Were the softkeys re-parented correctly? dialog.setLayout(new QVBoxLayout); dialog.layout()->addWidget(buttonBox); +#ifndef QT_NO_ACTION QCOMPARE(softKeyCount(&dialog), 2); QCOMPARE(softKeyCount(buttonBox), 0); +#endif // Softkeys are only added to QDialog, not QWidget QWidget *nested = new QWidget; nested->setLayout(new QVBoxLayout); nested->layout()->addWidget(buttonBox); +#ifndef QT_NO_ACTION QCOMPARE(softKeyCount(nested), 0); QCOMPARE(softKeyCount(buttonBox), 2); +#endif } #endif diff --git a/tests/auto/qftp/tst_qftp.cpp b/tests/auto/qftp/tst_qftp.cpp index 638c810..2a42d6d 100644 --- a/tests/auto/qftp/tst_qftp.cpp +++ b/tests/auto/qftp/tst_qftp.cpp @@ -123,6 +123,8 @@ private slots: void doneSignal(); void queueMoreCommandsInDoneSlot(); + void qtbug7359Crash(); + protected slots: void stateChanged( int ); void listInfo( const QUrlInfo & ); @@ -2052,6 +2054,30 @@ void tst_QFtp::cdUpSlot(bool error) } } +void tst_QFtp::qtbug7359Crash() +{ + QFtp ftp; + ftp.connectToHost("127.0.0.1"); + + QTime t; + int elapsed; + + t.start(); + while ((elapsed = t.elapsed()) < 200) + QCoreApplication::processEvents(QEventLoop::AllEvents, 200 - elapsed); + + ftp.close(); + t.restart(); + while ((elapsed = t.elapsed()) < 1000) + QCoreApplication::processEvents(QEventLoop::AllEvents, 1000 - elapsed); + + ftp.connectToHost("127.0.0.1"); + + t.restart(); + while ((elapsed = t.elapsed()) < 2000) + QCoreApplication::processEvents(QEventLoop::AllEvents, 2000 - elapsed); +} + QTEST_MAIN(tst_QFtp) #include "tst_qftp.moc" diff --git a/tests/auto/qhttpsocketengine/tst_qhttpsocketengine.cpp b/tests/auto/qhttpsocketengine/tst_qhttpsocketengine.cpp index 3a3ea79..f86ba63 100644 --- a/tests/auto/qhttpsocketengine/tst_qhttpsocketengine.cpp +++ b/tests/auto/qhttpsocketengine/tst_qhttpsocketengine.cpp @@ -641,7 +641,7 @@ void tst_QHttpSocketEngine::downloadBigFile() QByteArray hostName = QtNetworkSettings::serverName().toLatin1(); QVERIFY(tmpSocket->state() == QAbstractSocket::ConnectedState); - QVERIFY(tmpSocket->write("GET /mediumfile HTTP/1.0\r\n") > 0); + QVERIFY(tmpSocket->write("GET /qtest/mediumfile HTTP/1.0\r\n") > 0); QVERIFY(tmpSocket->write("Host: ") > 0); QVERIFY(tmpSocket->write(hostName.data()) > 0); QVERIFY(tmpSocket->write("\r\n") > 0); diff --git a/tests/auto/qnetworkreply/tst_qnetworkreply.cpp b/tests/auto/qnetworkreply/tst_qnetworkreply.cpp index dd497b0..ff79c09 100644 --- a/tests/auto/qnetworkreply/tst_qnetworkreply.cpp +++ b/tests/auto/qnetworkreply/tst_qnetworkreply.cpp @@ -4113,7 +4113,7 @@ public slots: } } void startOne() { - QUrl url = "http://" + QtNetworkSettings::serverName() + "/gif/fluke.gif"; + QUrl url = "http://" + QtNetworkSettings::serverName() + "/qtest/fluke.gif"; QNetworkRequest request(url); QNetworkReply *reply = manager.get(request); reply->setParent(this); diff --git a/tests/auto/qpathclipper/tst_qpathclipper.cpp b/tests/auto/qpathclipper/tst_qpathclipper.cpp index 38d253a..db5a13e 100644 --- a/tests/auto/qpathclipper/tst_qpathclipper.cpp +++ b/tests/auto/qpathclipper/tst_qpathclipper.cpp @@ -95,6 +95,8 @@ private slots: void task209056(); void task251909(); + + void qtbug3778(); }; Q_DECLARE_METATYPE(QPainterPath) @@ -1346,6 +1348,33 @@ void tst_QPathClipper::task251909() QVERIFY(result.elementCount() <= 5); } +void tst_QPathClipper::qtbug3778() +{ + QPainterPath path1; + path1.moveTo(200, 3.22409e-5); + // e-5 and higher leads to a bug + // Using 3.22409e-4 starts to work correctly + path1.lineTo(0, 0); + path1.lineTo(1.07025e-13, 1450); + path1.lineTo(750, 950); + path1.lineTo(950, 750); + path1.lineTo(200, 3.22409e-13); + + QPainterPath path2; + path2.moveTo(0, 0); + path2.lineTo(200, 800); + path2.lineTo(600, 1500); + path2.lineTo(1500, 1400); + path2.lineTo(1900, 1200); + path2.lineTo(2000, 1000); + path2.lineTo(1400, 0); + path2.lineTo(0, 0); + + QPainterPath p12 = path1.intersected(path2); + + QVERIFY(p12.contains(QPointF(100, 100))); +} + QTEST_APPLESS_MAIN(tst_QPathClipper) diff --git a/tests/auto/qscriptengine/qscriptengine.pro b/tests/auto/qscriptengine/qscriptengine.pro index dd058a4..7d0f5d0 100644 --- a/tests/auto/qscriptengine/qscriptengine.pro +++ b/tests/auto/qscriptengine/qscriptengine.pro @@ -1,6 +1,7 @@ load(qttest_p4) QT = core gui script SOURCES += tst_qscriptengine.cpp +RESOURCES += qscriptengine.qrc wince* { DEFINES += SRCDIR=\\\"./\\\" diff --git a/tests/auto/qscriptengine/qscriptengine.qrc b/tests/auto/qscriptengine/qscriptengine.qrc new file mode 100644 index 0000000..b87f985 --- /dev/null +++ b/tests/auto/qscriptengine/qscriptengine.qrc @@ -0,0 +1,5 @@ +<!DOCTYPE RCC><RCC version="1.0"> +<qresource> + <file>translations/translatable_la.qm</file> +</qresource> +</RCC> diff --git a/tests/auto/qscriptengine/translatable.js b/tests/auto/qscriptengine/translatable.js new file mode 100644 index 0000000..0c948e7 --- /dev/null +++ b/tests/auto/qscriptengine/translatable.js @@ -0,0 +1,7 @@ +qsTr("One"); +qsTranslate("FooContext", "Two"); + +var greeting_strings = [ + QT_TR_NOOP("Hello"), + QT_TRANSLATE_NOOP("FooContext", "Goodbye") +]; diff --git a/tests/auto/qscriptengine/translations/translatable_la.qm b/tests/auto/qscriptengine/translations/translatable_la.qm Binary files differnew file mode 100644 index 0000000..03fcc52 --- /dev/null +++ b/tests/auto/qscriptengine/translations/translatable_la.qm diff --git a/tests/auto/qscriptengine/translations/translatable_la.ts b/tests/auto/qscriptengine/translations/translatable_la.ts new file mode 100644 index 0000000..3f631de --- /dev/null +++ b/tests/auto/qscriptengine/translations/translatable_la.ts @@ -0,0 +1,34 @@ +<?xml version="1.0" encoding="utf-8"?> +<!DOCTYPE TS> +<TS version="2.0" language="nb_NO"> +<context> + <name>FooContext</name> + <message> + <location filename="translatable.js" line="2"/> + <source>Two</source> + <translation>To</translation> + </message> + <message> + <location filename="translatable.js" line="6"/> + <source>Goodbye</source> + <translation>Farvel</translation> + </message> +</context> +<context> + <name>translatable</name> + <message> + <location filename="translatable.js" line="1"/> + <source>One</source> + <translation>En</translation> + </message> + <message> + <location filename="translatable.js" line="5"/> + <source>Hello</source> + <translation>Hallo</translation> + </message> + <message> + <source>Goodbye</source> + <translation type="obsolete">Farvel</translation> + </message> +</context> +</TS> diff --git a/tests/auto/qscriptengine/tst_qscriptengine.cpp b/tests/auto/qscriptengine/tst_qscriptengine.cpp index 25d8e3df..96043f9 100644 --- a/tests/auto/qscriptengine/tst_qscriptengine.cpp +++ b/tests/auto/qscriptengine/tst_qscriptengine.cpp @@ -155,6 +155,7 @@ private slots: void incDecNonObjectProperty(); void installTranslatorFunctions_data(); void installTranslatorFunctions(); + void translateScript(); void functionScopes(); void nativeFunctionScopes(); void evaluateProgram(); @@ -4335,6 +4336,45 @@ void tst_QScriptEngine::installTranslatorFunctions() } } +void tst_QScriptEngine::translateScript() +{ + QScriptEngine engine; + + QTranslator translator; + translator.load(":/translations/translatable_la"); + QCoreApplication::instance()->installTranslator(&translator); + engine.installTranslatorFunctions(); + + QString fileName = QString::fromLatin1("translatable.js"); + // Top-level + QCOMPARE(engine.evaluate("qsTr('One')", fileName).toString(), QString::fromLatin1("En")); + QCOMPARE(engine.evaluate("qsTr('Hello')", fileName).toString(), QString::fromLatin1("Hallo")); + // From function + QCOMPARE(engine.evaluate("(function() { return qsTr('One'); })()", fileName).toString(), QString::fromLatin1("En")); + QCOMPARE(engine.evaluate("(function() { return qsTr('Hello'); })()", fileName).toString(), QString::fromLatin1("Hallo")); + // From eval + QCOMPARE(engine.evaluate("eval('qsTr(\\'One\\')')", fileName).toString(), QString::fromLatin1("En")); + QCOMPARE(engine.evaluate("eval('qsTr(\\'Hello\\')')", fileName).toString(), QString::fromLatin1("Hallo")); + + QCOMPARE(engine.evaluate("qsTranslate('FooContext', 'Two')", fileName).toString(), QString::fromLatin1("To")); + QCOMPARE(engine.evaluate("qsTranslate('FooContext', 'Goodbye')", fileName).toString(), QString::fromLatin1("Farvel")); + // From eval + QCOMPARE(engine.evaluate("eval('qsTranslate(\\'FooContext\\', \\'Two\\')')", fileName).toString(), QString::fromLatin1("To")); + QCOMPARE(engine.evaluate("eval('qsTranslate(\\'FooContext\\', \\'Goodbye\\')')", fileName).toString(), QString::fromLatin1("Farvel")); + + // Don't exist in translation + QCOMPARE(engine.evaluate("qsTr('Three')", fileName).toString(), QString::fromLatin1("Three")); + QCOMPARE(engine.evaluate("qsTranslate('FooContext', 'So long')", fileName).toString(), QString::fromLatin1("So long")); + QCOMPARE(engine.evaluate("qsTranslate('BarContext', 'Goodbye')", fileName).toString(), QString::fromLatin1("Goodbye")); + + // From C++ + // There is no context, but it shouldn't crash + QCOMPARE(engine.globalObject().property("qsTr").call( + QScriptValue(), QScriptValueList() << "One").toString(), QString::fromLatin1("One")); + + QCoreApplication::instance()->removeTranslator(&translator); +} + void tst_QScriptEngine::functionScopes() { QScriptEngine eng; diff --git a/tests/auto/qsocks5socketengine/tst_qsocks5socketengine.cpp b/tests/auto/qsocks5socketengine/tst_qsocks5socketengine.cpp index a679765..8f0cbc3 100644 --- a/tests/auto/qsocks5socketengine/tst_qsocks5socketengine.cpp +++ b/tests/auto/qsocks5socketengine/tst_qsocks5socketengine.cpp @@ -780,7 +780,7 @@ void tst_QSocks5SocketEngine::downloadBigFile() QByteArray hostName = QtNetworkSettings::serverName().toLatin1(); QVERIFY(tmpSocket->state() == QAbstractSocket::ConnectedState); - QVERIFY(tmpSocket->write("GET /mediumfile HTTP/1.0\r\n") > 0); + QVERIFY(tmpSocket->write("GET /qtest/mediumfile HTTP/1.0\r\n") > 0); QVERIFY(tmpSocket->write("HOST: ") > 0); QVERIFY(tmpSocket->write(hostName.data()) > 0); QVERIFY(tmpSocket->write("\r\n") > 0); diff --git a/tests/auto/qtcpsocket/tst_qtcpsocket.cpp b/tests/auto/qtcpsocket/tst_qtcpsocket.cpp index 5a209c2..cd512a1 100644 --- a/tests/auto/qtcpsocket/tst_qtcpsocket.cpp +++ b/tests/auto/qtcpsocket/tst_qtcpsocket.cpp @@ -1117,7 +1117,7 @@ void tst_QTcpSocket::downloadBigFile() QByteArray hostName = QtNetworkSettings::serverName().toLatin1(); QVERIFY(tmpSocket->state() == QAbstractSocket::ConnectedState); - QVERIFY(tmpSocket->write("GET /mediumfile HTTP/1.0\r\n") > 0); + QVERIFY(tmpSocket->write("GET /qtest/mediumfile HTTP/1.0\r\n") > 0); QVERIFY(tmpSocket->write("HOST: ") > 0); QVERIFY(tmpSocket->write(hostName.data()) > 0); QVERIFY(tmpSocket->write("\r\n") > 0); diff --git a/tests/auto/qtreeview/tst_qtreeview.cpp b/tests/auto/qtreeview/tst_qtreeview.cpp index 2de189d..75a4c62 100644 --- a/tests/auto/qtreeview/tst_qtreeview.cpp +++ b/tests/auto/qtreeview/tst_qtreeview.cpp @@ -215,6 +215,7 @@ private slots: void addRowsWhileSectionsAreHidden(); void filterProxyModelCrash(); void styleOptionViewItem(); + void keyboardNavigationWithDisabled(); // task-specific tests: void task174627_moveLeftToRoot(); @@ -3753,5 +3754,36 @@ void tst_QTreeView::taskQTBUG_9216_setSizeAndUniformRowHeightsWrongRepaint() QTRY_VERIFY(view.painted > 0); } +void tst_QTreeView::keyboardNavigationWithDisabled() +{ + QTreeView view; + QStandardItemModel model(90, 0); + for (int i = 0; i < 90; i ++) { + model.setItem(i, new QStandardItem(QString::number(i))); + model.item(i)->setEnabled(i%6 == 0); + } + view.setModel(&model); + + view.resize(200, view.visualRect(model.index(0,0)).height()*10); + view.show(); + QApplication::setActiveWindow(&view); + QTest::qWaitForWindowShown(&view); + QTRY_VERIFY(view.isActiveWindow()); + + view.setCurrentIndex(model.index(1, 0)); + QTest::keyClick(view.viewport(), Qt::Key_Up); + QCOMPARE(view.currentIndex(), model.index(0, 0)); + QTest::keyClick(view.viewport(), Qt::Key_Down); + QCOMPARE(view.currentIndex(), model.index(6, 0)); + QTest::keyClick(view.viewport(), Qt::Key_PageDown); + QCOMPARE(view.currentIndex(), model.index(18, 0)); + QTest::keyClick(view.viewport(), Qt::Key_Down); + QCOMPARE(view.currentIndex(), model.index(24, 0)); + QTest::keyClick(view.viewport(), Qt::Key_PageUp); + QCOMPARE(view.currentIndex(), model.index(12, 0)); + QTest::keyClick(view.viewport(), Qt::Key_Up); + QCOMPARE(view.currentIndex(), model.index(6, 0)); +} + QTEST_MAIN(tst_QTreeView) #include "tst_qtreeview.moc" diff --git a/tools/assistant/lib/fulltextsearch/qclucene-config_p.h b/tools/assistant/lib/fulltextsearch/qclucene-config_p.h index 0c70718..387d64d 100644 --- a/tools/assistant/lib/fulltextsearch/qclucene-config_p.h +++ b/tools/assistant/lib/fulltextsearch/qclucene-config_p.h @@ -314,14 +314,12 @@ configure. #define _CL_HAVE_SYS_TYPES_H 1 #endif -// Do not use the tchar.h that ships with mingw, this causes the qt build to -// fail (211547, 211401, etc...), reuse the replacement as with any other compiler -// #if defined(__MINGW32__) -// /* Define to 1 if you have the <tchar.h> header file. */ -// # ifndef _CL_HAVE_TCHAR_H -// # define _CL_HAVE_TCHAR_H 1 -// # endif -// #endif +#if defined(__MINGW32__) + /* Define to 1 if you have the <tchar.h> header file. */ + # ifndef _CL_HAVE_TCHAR_H + # define _CL_HAVE_TCHAR_H 1 + # endif +#endif #if defined(__MINGW32__) || defined(__SUNPRO_CC) || defined(__SUNPRO_C) /* Define to 1 if you have the `tell' function. */ diff --git a/tools/assistant/lib/fulltextsearch/qclucene_global_p.h b/tools/assistant/lib/fulltextsearch/qclucene_global_p.h index f4b744d..206725b 100644 --- a/tools/assistant/lib/fulltextsearch/qclucene_global_p.h +++ b/tools/assistant/lib/fulltextsearch/qclucene_global_p.h @@ -36,7 +36,7 @@ #include <QtCore/QChar> #include <QtCore/QString> -#if !defined(_MSC_VER) && defined(_CL_HAVE_WCHAR_H) && defined(_CL_HAVE_WCHAR_T) +#if !defined(_MSC_VER) && !defined(__MINGW32__) && defined(_CL_HAVE_WCHAR_H) && defined(_CL_HAVE_WCHAR_T) # if !defined(TCHAR) # define TCHAR wchar_t # endif diff --git a/tools/assistant/tools/assistant/helpviewer_qtb.cpp b/tools/assistant/tools/assistant/helpviewer_qtb.cpp index 3ff64e8..7f82b56 100644 --- a/tools/assistant/tools/assistant/helpviewer_qtb.cpp +++ b/tools/assistant/tools/assistant/helpviewer_qtb.cpp @@ -303,3 +303,5 @@ bool HelpViewer::eventFilter(QObject *obj, QEvent *event) return true; return QTextBrowser::eventFilter(obj, event); } + +QT_END_NAMESPACE diff --git a/tools/configure/environment.cpp b/tools/configure/environment.cpp index 74bebb2..60b8dcc 100644 --- a/tools/configure/environment.cpp +++ b/tools/configure/environment.cpp @@ -73,7 +73,7 @@ struct CompilerInfo{ } compiler_info[] = { // The compilers here are sorted in a reversed-preferred order {CC_BORLAND, "Borland C++", 0, "bcc32.exe"}, - {CC_MINGW, "MinGW (Minimalist GNU for Windows)", 0, "mingw32-gcc.exe"}, + {CC_MINGW, "MinGW (Minimalist GNU for Windows)", 0, "g++.exe"}, {CC_INTEL, "Intel(R) C++ Compiler for 32-bit applications", 0, "icl.exe"}, // xilink.exe, xilink5.exe, xilink6.exe, xilib.exe {CC_MSVC6, "Microsoft (R) 32-bit C/C++ Optimizing Compiler (6.x)", "Software\\Microsoft\\VisualStudio\\6.0\\Setup\\Microsoft Visual C++\\ProductDir", "cl.exe"}, // link.exe, lib.exe {CC_NET2002, "Microsoft (R) 32-bit C/C++ Optimizing Compiler.NET 2002 (7.0)", "Software\\Microsoft\\VisualStudio\\7.0\\Setup\\VC\\ProductDir", "cl.exe"}, // link.exe, lib.exe diff --git a/tools/qml/deviceorientation.h b/tools/qml/deviceorientation.h index c8125cd..d209005 100644 --- a/tools/qml/deviceorientation.h +++ b/tools/qml/deviceorientation.h @@ -50,6 +50,7 @@ class DeviceOrientationPrivate; class DeviceOrientation : public QObject { Q_OBJECT + Q_ENUMS(Orientation) public: enum Orientation { UnknownOrientation, Portrait, Landscape }; virtual Orientation orientation() const = 0; diff --git a/tools/qml/main.cpp b/tools/qml/main.cpp index 01b3912..45c2b85 100644 --- a/tools/qml/main.cpp +++ b/tools/qml/main.cpp @@ -121,6 +121,8 @@ void scriptOptsUsage() qWarning(" play ..................................... playback an existing script"); qWarning(" testimages ............................... record images or compare images on playback"); qWarning(" testerror ................................ test 'error' property of root item on playback"); + qWarning(" snapshot ................................. file being recorded is static,"); + qWarning(" only one frame will be recorded or tested"); qWarning(" exitoncomplete ........................... cleanly exit the viewer on script completion"); qWarning(" exitonfailure ............................ immediately exit the viewer on script failure"); qWarning(" saveonexit ............................... save recording on viewer exit"); @@ -243,7 +245,7 @@ int main(int argc, char ** argv) useNativeFileBrowser = false; } else if (arg == "-I" || arg == "-L") { if (arg == "-L") - fprintf(stderr, "-L option provided for compatibility only, use -I instead"); + fprintf(stderr, "-L option provided for compatibility only, use -I instead\n"); if (lastArg) { QDeclarativeEngine tmpEngine; QString paths = tmpEngine.importPathList().join(QLatin1String(":")); @@ -309,6 +311,8 @@ int main(int argc, char ** argv) scriptOptions |= QDeclarativeViewer::ExitOnFailure; } else if (option == QLatin1String("saveonexit")) { scriptOptions |= QDeclarativeViewer::SaveOnExit; + } else if (option == QLatin1String("snapshot")) { + scriptOptions |= QDeclarativeViewer::Snapshot; } else { scriptOptsUsage(); } diff --git a/tools/qml/qdeclarativetester.cpp b/tools/qml/qdeclarativetester.cpp index 6245124..cf537ee 100644 --- a/tools/qml/qdeclarativetester.cpp +++ b/tools/qml/qdeclarativetester.cpp @@ -240,6 +240,8 @@ void QDeclarativeTester::save() void QDeclarativeTester::updateCurrentTime(int msec) { QDeclarativeItemPrivate::setConsistentTime(msec); + if (!testscript && msec > 16 && options & QDeclarativeViewer::Snapshot) + return; QImage img(m_view->width(), m_view->height(), QImage::Format_RGB32); @@ -249,11 +251,13 @@ void QDeclarativeTester::updateCurrentTime(int msec) m_view->render(&p); } + bool snapshot = msec == 16 && options & QDeclarativeViewer::Snapshot; + FrameEvent fe; fe.msec = msec; if (msec == 0 || !(options & QDeclarativeViewer::TestImages)) { // Skip first frame, skip if not doing images - } else if (0 == (m_savedFrameEvents.count() % 60)) { + } else if (0 == (m_savedFrameEvents.count() % 60) || snapshot) { fe.image = img; } else { QCryptographicHash hash(QCryptographicHash::Md5); @@ -366,8 +370,11 @@ void QDeclarativeTester::updateCurrentTime(int msec) filterEvents = true; - if (testscript && testscript->count() <= testscriptidx) + if (testscript && testscript->count() <= testscriptidx) { + //if (msec == 16) //for a snapshot, leave it up long enough to see + // (void)::sleep(1); complete(); + } } void QDeclarativeTester::registerTypes() diff --git a/tools/qml/qml.pro b/tools/qml/qml.pro index bc6d032..1ed8b2c 100644 --- a/tools/qml/qml.pro +++ b/tools/qml/qml.pro @@ -56,7 +56,7 @@ symbian { INCLUDEPATH += $$QT_SOURCE_TREE/examples/network/qftp/ TARGET.EPOCHEAPSIZE = 0x20000 0x2000000 LIBS += -lesock -lcommdb -lconnmon -linsock - TARGET.CAPABILITY = "All -TCB" + TARGET.CAPABILITY = NetworkServices ReadUserData } mac { QMAKE_INFO_PLIST=Info_mac.plist diff --git a/tools/qml/qmlruntime.cpp b/tools/qml/qmlruntime.cpp index c4ebd80..df29294 100644 --- a/tools/qml/qmlruntime.cpp +++ b/tools/qml/qmlruntime.cpp @@ -112,33 +112,47 @@ QT_BEGIN_NAMESPACE -class Screen : public QObject +class Runtime : public QObject { Q_OBJECT - Q_PROPERTY(Orientation orientation READ orientation NOTIFY orientationChanged) - Q_ENUMS(Orientation) + Q_PROPERTY(bool isActiveWindow READ isActiveWindow NOTIFY isActiveWindowChanged) + Q_PROPERTY(DeviceOrientation::Orientation orientation READ orientation NOTIFY orientationChanged) public: - Screen(QObject *parent=0) : QObject(parent) { - connect(DeviceOrientation::instance(), SIGNAL(orientationChanged()), - this, SIGNAL(orientationChanged())); + static Runtime* instance() + { + static Runtime *instance = 0; + if (!instance) + instance = new Runtime; + return instance; } - enum Orientation { UnknownOrientation = DeviceOrientation::UnknownOrientation, - Portrait = DeviceOrientation::Portrait, - Landscape = DeviceOrientation::Landscape }; - Orientation orientation() const { return Orientation(DeviceOrientation::instance()->orientation()); } + bool isActiveWindow() const { return activeWindow; } + void setActiveWindow(bool active) + { + if (active == activeWindow) + return; + activeWindow = active; + emit isActiveWindowChanged(); + } -signals: + DeviceOrientation::Orientation orientation() const { return DeviceOrientation::instance()->orientation(); } + +Q_SIGNALS: + void isActiveWindowChanged(); void orientationChanged(); -}; -QT_END_NAMESPACE +private: + Runtime(QObject *parent=0) : QObject(parent), activeWindow(false) + { + connect(DeviceOrientation::instance(), SIGNAL(orientationChanged()), + this, SIGNAL(orientationChanged())); + } -QML_DECLARE_TYPE(Screen) + bool activeWindow; +}; -QT_BEGIN_NAMESPACE class SizedMenuBar : public QMenuBar { @@ -1035,7 +1049,7 @@ void QDeclarativeViewer::openQml(const QString& file_or_url) url = QUrl(file_or_url); setWindowTitle(tr("%1 - Qt Declarative UI Viewer").arg(file_or_url)); - if (!m_script.isEmpty()) + if (!m_script.isEmpty()) tester = new QDeclarativeTester(m_script, m_scriptOptions, canvas); delete canvas->rootObject(); @@ -1048,6 +1062,8 @@ void QDeclarativeViewer::openQml(const QString& file_or_url) ctxt->setContextProperty("qmlViewerFolder", QDir::currentPath()); #endif + ctxt->setContextProperty("runtime", Runtime::instance()); + QString fileName = url.toLocalFile(); if (!fileName.isEmpty()) { QFileInfo fi(fileName); @@ -1249,6 +1265,16 @@ void QDeclarativeViewer::keyPressEvent(QKeyEvent *event) QWidget::keyPressEvent(event); } +bool QDeclarativeViewer::event(QEvent *event) +{ + if (event->type() == QEvent::WindowActivate) { + Runtime::instance()->setActiveWindow(true); + } else if (event->type() == QEvent::WindowDeactivate) { + Runtime::instance()->setActiveWindow(false); + } + return QWidget::event(event); +} + void QDeclarativeViewer::senseImageMagick() { QProcess proc; @@ -1474,7 +1500,8 @@ void QDeclarativeViewer::setUseNativeFileBrowser(bool use) void QDeclarativeViewer::registerTypes() { - qmlRegisterType<Screen>("QDeclarativeViewer", 1, 0, "Screen"); + // registering only for exposing the DeviceOrientation::Orientation enum + qmlRegisterUncreatableType<DeviceOrientation>("Qt",4,6,"Orientation"); } QT_END_NAMESPACE diff --git a/tools/qml/qmlruntime.h b/tools/qml/qmlruntime.h index 6f1e425..1ae771a 100644 --- a/tools/qml/qmlruntime.h +++ b/tools/qml/qmlruntime.h @@ -81,7 +81,8 @@ public: TestErrorProperty = 0x00000008, SaveOnExit = 0x00000010, ExitOnComplete = 0x00000020, - ExitOnFailure = 0x00000040 + ExitOnFailure = 0x00000040, + Snapshot = 0x00000080 }; Q_DECLARE_FLAGS(ScriptOptions, ScriptOption) void setScript(const QString &s) { m_script = s; } @@ -125,6 +126,7 @@ public slots: protected: virtual void keyPressEvent(QKeyEvent *); + virtual bool event(QEvent *); void createMenu(QMenuBar *menu, QMenu *flatmenu); diff --git a/tools/qtestlib/wince/cetest/cetest.pro b/tools/qtestlib/wince/cetest/cetest.pro index 43ed18e..82747da 100644 --- a/tools/qtestlib/wince/cetest/cetest.pro +++ b/tools/qtestlib/wince/cetest/cetest.pro @@ -13,8 +13,7 @@ DEFINES += QT_BUILD_QMAKE QT_BOOTSTRAPPED QT_NO_CODECS QT_LITE_UNICODE QT QT_NO_STL QT_NO_COMPRESS QT_NO_DATASTREAM \ QT_NO_TEXTCODEC QT_NO_UNICODETABLES QT_NO_THREAD \ QT_NO_SYSTEMLOCALE QT_NO_GEOM_VARIANT \ - QT_NODLL QT_NO_QOBJECT \ - QT_BUILD_QMAKE_NO_GENERATORS + QT_NODLL QT_NO_QOBJECT INCLUDEPATH = \ $$QT_SOURCE_TREE/tools/qtestlib/ce/cetest \ diff --git a/tools/qtestlib/wince/cetest/qmake_include.pri b/tools/qtestlib/wince/cetest/qmake_include.pri index 8b415b0..35fbc64 100644 --- a/tools/qtestlib/wince/cetest/qmake_include.pri +++ b/tools/qtestlib/wince/cetest/qmake_include.pri @@ -5,7 +5,9 @@ SOURCES += \ $$QT_SOURCE_TREE/qmake/option.cpp \ $$QT_SOURCE_TREE/qmake/project.cpp \ $$QT_SOURCE_TREE/qmake/property.cpp \ + $$QT_SOURCE_TREE/qmake/generators/metamakefile.cpp \ $$QT_SOURCE_TREE/qmake/generators/symbian/initprojectdeploy_symbian.cpp \ $$QT_SOURCE_TREE/tools/shared/symbian/epocroot.cpp \ $$QT_SOURCE_TREE/tools/shared/windows/registry.cpp +DEFINES += QT_QMAKE_PARSER_ONLY |