From 941b44c2e36eeafe1acd1be5fd1cb27151db99d2 Mon Sep 17 00:00:00 2001 From: Bea Lam Date: Mon, 24 May 2010 13:40:11 +1000 Subject: Clean up project files for c++ examples --- .../cppextensions/imageprovider/imageprovider.pro | 15 +++++++-------- examples/declarative/cppextensions/plugins/plugins.pro | 16 +++++++--------- examples/declarative/cppextensions/qwidgets/qwidgets.pro | 12 +++++------- .../extending/chapter5-plugins/chapter5-plugins.pro | 8 ++++---- 4 files changed, 23 insertions(+), 28 deletions(-) diff --git a/examples/declarative/cppextensions/imageprovider/imageprovider.pro b/examples/declarative/cppextensions/imageprovider/imageprovider.pro index 945a301..462f7d9d 100644 --- a/examples/declarative/cppextensions/imageprovider/imageprovider.pro +++ b/examples/declarative/cppextensions/imageprovider/imageprovider.pro @@ -1,12 +1,10 @@ TEMPLATE = lib -TARGET = imageprovider -QT += declarative CONFIG += qt plugin +QT += declarative -TARGET = $$qtLibraryTarget($$TARGET) DESTDIR = ImageProviderCore +TARGET = imageprovider -# Input SOURCES += imageprovider.cpp sources.files = $$SOURCES imageprovider.qml imageprovider.pro @@ -18,8 +16,9 @@ ImageProviderCore_sources.files = \ ImageProviderCore/qmldir ImageProviderCore_sources.path = $$[QT_INSTALL_EXAMPLES]/declarative/imageprovider/ImageProviderCore -symbian:{ - TARGET.EPOCALLOWDLLDATA=1 -} - INSTALLS = sources ImageProviderCore_sources target + +symbian { + include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri) + TARGET.EPOCALLOWDLLDATA = 1 +} diff --git a/examples/declarative/cppextensions/plugins/plugins.pro b/examples/declarative/cppextensions/plugins/plugins.pro index b501ae3..d37ff40 100644 --- a/examples/declarative/cppextensions/plugins/plugins.pro +++ b/examples/declarative/cppextensions/plugins/plugins.pro @@ -1,9 +1,10 @@ TEMPLATE = lib -DESTDIR = com/nokia/TimeExample -TARGET = qtimeexampleqmlplugin CONFIG += qt plugin QT += declarative +DESTDIR = com/nokia/TimeExample +TARGET = qtimeexampleqmlplugin + SOURCES += plugin.cpp qdeclarativesources.files += \ @@ -18,14 +19,11 @@ qdeclarativesources.path += $$[QT_INSTALL_EXAMPLES]/declarative/plugins/com/noki sources.files += plugins.pro plugin.cpp plugins.qml README sources.path += $$[QT_INSTALL_EXAMPLES]/declarative/plugins - target.path += $$[QT_INSTALL_EXAMPLES]/declarative/plugins/com/nokia/TimeExample -symbian:{ - TARGET.EPOCALLOWDLLDATA=1 -} - - INSTALLS += qdeclarativesources sources target -symbian: include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri) +symbian { + include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri) + TARGET.EPOCALLOWDLLDATA = 1 +} diff --git a/examples/declarative/cppextensions/qwidgets/qwidgets.pro b/examples/declarative/cppextensions/qwidgets/qwidgets.pro index 37f313d..c5f8bcf 100644 --- a/examples/declarative/cppextensions/qwidgets/qwidgets.pro +++ b/examples/declarative/cppextensions/qwidgets/qwidgets.pro @@ -1,21 +1,19 @@ TEMPLATE = lib -DESTDIR = QWidgets -TARGET = qwidgetsplugin CONFIG += qt plugin QT += declarative +DESTDIR = QWidgets +TARGET = qwidgetsplugin + SOURCES += qwidgets.cpp sources.files += qwidgets.pro qwidgets.cpp qwidgets.qml - sources.path += $$[QT_INSTALL_EXAMPLES]/declarative/plugins - target.path += $$[QT_INSTALL_EXAMPLES]/declarative/plugins INSTALLS += sources target -symbian: include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri) - -symbian:{ +symbian { + include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri) TARGET.EPOCALLOWDLLDATA = 1 } diff --git a/examples/declarative/tutorials/extending/chapter5-plugins/chapter5-plugins.pro b/examples/declarative/tutorials/extending/chapter5-plugins/chapter5-plugins.pro index a8fb565..483da8f 100644 --- a/examples/declarative/tutorials/extending/chapter5-plugins/chapter5-plugins.pro +++ b/examples/declarative/tutorials/extending/chapter5-plugins/chapter5-plugins.pro @@ -2,6 +2,10 @@ TEMPLATE = lib CONFIG += qt plugin QT += declarative +DESTDIR = lib +OBJECTS_DIR = tmp +MOC_DIR = tmp + HEADERS += musician.h \ instrument.h \ musicplugin.h @@ -10,10 +14,6 @@ SOURCES += musician.cpp \ instrument.cpp \ musicplugin.cpp -DESTDIR = lib -OBJECTS_DIR = tmp -MOC_DIR = tmp - symbian { include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri) TARGET.EPOCALLOWDLLDATA = 1 -- cgit v0.12 From 96f47aeec086b2d35b859194e42721dbc2d2db6a Mon Sep 17 00:00:00 2001 From: Bea Lam Date: Mon, 24 May 2010 15:23:10 +1000 Subject: Clean up and don't allow clicks on already filled places --- .../toys/tic-tac-toe/content/Button.qml | 34 ++--- .../toys/tic-tac-toe/content/tic-tac-toe.js | 144 +++++++++++---------- .../declarative/toys/tic-tac-toe/tic-tac-toe.qml | 110 ++++++++-------- 3 files changed, 149 insertions(+), 139 deletions(-) diff --git a/examples/declarative/toys/tic-tac-toe/content/Button.qml b/examples/declarative/toys/tic-tac-toe/content/Button.qml index 9b2dc8e..d0f387f 100644 --- a/examples/declarative/toys/tic-tac-toe/content/Button.qml +++ b/examples/declarative/toys/tic-tac-toe/content/Button.qml @@ -43,35 +43,37 @@ import Qt 4.7 Rectangle { id: container - property string text: "Button" - property bool down: false - property string mainCol: "lightgray" - property string darkCol: "darkgray" - property string lightCol: "white" + property string text + property bool pressed: false + + signal clicked width: buttonLabel.width + 20; height: buttonLabel.height + 6 - border { width: 1; color: Qt.darker(mainCol) } - radius: 8; - color: mainCol + border { width: 1; color: Qt.darker(container.color) } + radius: 8 + color: "lightgray" smooth: true gradient: Gradient { GradientStop { - id: topGrad; position: 0.0 - color: if (container.down) { darkCol } else { lightCol } + position: 0.0 + color: container.pressed ? "darkgray" : "white" + } + GradientStop { + position: 1.0 + color: container.color } - GradientStop { position: 1.0; color: mainCol } } - signal clicked - - MouseArea { id: mr; anchors.fill: parent; onClicked: container.clicked() } + MouseArea { + anchors.fill: parent + onClicked: container.clicked() + } Text { id: buttonLabel - anchors.centerIn: container - text: container.text; + text: container.text font.pixelSize: 14 } } diff --git a/examples/declarative/toys/tic-tac-toe/content/tic-tac-toe.js b/examples/declarative/toys/tic-tac-toe/content/tic-tac-toe.js index f8d6d9f..5a166b7 100644 --- a/examples/declarative/toys/tic-tac-toe/content/tic-tac-toe.js +++ b/examples/declarative/toys/tic-tac-toe/content/tic-tac-toe.js @@ -1,145 +1,149 @@ function winner(board) { for (var i=0; i<3; ++i) { - if (board.children[i].state!="" - && board.children[i].state==board.children[i+3].state - && board.children[i].state==board.children[i+6].state) + if (board.children[i].state != "" + && board.children[i].state == board.children[i+3].state + && board.children[i].state == board.children[i+6].state) return true - if (board.children[i*3].state!="" - && board.children[i*3].state==board.children[i*3+1].state - && board.children[i*3].state==board.children[i*3+2].state) + if (board.children[i*3].state != "" + && board.children[i*3].state == board.children[i*3+1].state + && board.children[i*3].state == board.children[i*3+2].state) return true } - if (board.children[0].state!="" - && board.children[0].state==board.children[4].state!="" - && board.children[0].state==board.children[8].state!="") + if (board.children[0].state != "" + && board.children[0].state == board.children[4].state != "" + && board.children[0].state == board.children[8].state != "") return true - if (board.children[2].state!="" - && board.children[2].state==board.children[4].state!="" - && board.children[2].state==board.children[6].state!="") + if (board.children[2].state != "" + && board.children[2].state == board.children[4].state != "" + && board.children[2].state == board.children[6].state != "") return true return false } -function restart() +function restartGame() { - // No moves left - start again + game.running = true + for (var i=0; i<9; ++i) board.children[i].state = "" } -function makeMove(pos,player) +function makeMove(pos, player) { board.children[pos].state = player if (winner(board)) { - win(player + " wins") + gameFinished(player + " wins") return true } else { return false } } +function canPlayAtPos(pos) +{ + return board.children[pos].state == "" +} + function computerTurn() { var r = Math.random(); - if(r < game.difficulty){ + if (r < game.difficulty) smartAI(); - }else{ - randAI(); - } + else + randomAI(); } function smartAI() { - function boardCopy(a){ + function boardCopy(a) { var ret = new Object; ret.children = new Array(9); - for(var i = 0; i<9; i++){ + for (var i = 0; i<9; i++) { ret.children[i] = new Object; ret.children[i].state = a.children[i].state; } return ret; } - for(var i=0; i<9; i++){ + + for (var i=0; i<9; i++) { var simpleBoard = boardCopy(board); - if (board.children[i].state == "") { + if (canPlayAtPos(i)) { simpleBoard.children[i].state = "O"; - if(winner(simpleBoard)){ - makeMove(i,"O") + if (winner(simpleBoard)) { + makeMove(i, "O") return } } } - for(var i=0; i<9; i++){ + for (var i=0; i<9; i++) { var simpleBoard = boardCopy(board); - if (board.children[i].state == "") { + if (canPlayAtPos(i)) { simpleBoard.children[i].state = "X"; - if(winner(simpleBoard)){ - makeMove(i,"O") + if (winner(simpleBoard)) { + makeMove(i, "O") return } } } - function thwart(a,b,c){//If they are at a, try b or c + + function thwart(a,b,c) { //If they are at a, try b or c if (board.children[a].state == "X") { - if (board.children[b].state == "") { - makeMove(b,"O") + if (canPlayAtPos(b)) { + makeMove(b, "O") return true - }else if (board.children[c].state == "") { - makeMove(c,"O") + } else if (canPlayAtPos(c)) { + makeMove(c, "O") return true } } return false; } - if(thwart(4,0,2)) return; - if(thwart(0,4,3)) return; - if(thwart(2,4,1)) return; - if(thwart(6,4,7)) return; - if(thwart(8,4,5)) return; - if(thwart(1,4,2)) return; - if(thwart(3,4,0)) return; - if(thwart(5,4,8)) return; - if(thwart(7,4,6)) return; - for(var i =0; i<9; i++){//Backup - if (board.children[i].state == "") { - makeMove(i,"O") + + if (thwart(4,0,2)) return; + if (thwart(0,4,3)) return; + if (thwart(2,4,1)) return; + if (thwart(6,4,7)) return; + if (thwart(8,4,5)) return; + if (thwart(1,4,2)) return; + if (thwart(3,4,0)) return; + if (thwart(5,4,8)) return; + if (thwart(7,4,6)) return; + + for (var i =0; i<9; i++) { + if (canPlayAtPos(i)) { + makeMove(i, "O") return } } - restart(); + restartGame(); } -function randAI() +function randomAI() { - var open = 0; - for (var i=0; i<9; ++i) - if (board.children[i].state == "") { - open += 1; - } - if(open == 0){ - restart(); - return; + var unfilledPosns = new Array(); + + for (var i=0; i<9; ++i) { + if (canPlayAtPos(i)) + unfilledPosns.push(i); + } + + if (unfilledPosns.length == 0) { + restartGame(); + } else { + var choice = unfilledPosns[Math.floor(Math.random() * unfilledPosns.length)]; + makeMove(choice, "O"); } - var openA = new Array(open);//JS doesn't have lists I can append to (i think) - var acc = 0; - for (var i=0; i<9; ++i) - if (board.children[i].state == "") { - openA[acc] = i; - acc += 1; - } - var choice = openA[Math.floor(Math.random() * open)]; - makeMove(choice, "O"); } -function win(s) +function gameFinished(message) { - msg.text = s - msg.opacity = 1 - endtimer.running = true + messageDisplay.text = message + messageDisplay.visible = true + game.running = false } diff --git a/examples/declarative/toys/tic-tac-toe/tic-tac-toe.qml b/examples/declarative/toys/tic-tac-toe/tic-tac-toe.qml index 707add7..34c3130 100644 --- a/examples/declarative/toys/tic-tac-toe/tic-tac-toe.qml +++ b/examples/declarative/toys/tic-tac-toe/tic-tac-toe.qml @@ -42,76 +42,80 @@ import Qt 4.7 import "content" import "content/tic-tac-toe.js" as Logic -Item { +Rectangle { id: game - property bool show: false + property bool running: true property real difficulty: 1.0 //chance it will actually think - width: 440 - height: 480 - anchors.fill: parent + width: display.width; height: display.height + 10 Image { - id: boardimage - anchors { verticalCenter: parent.verticalCenter; horizontalCenter: parent.horizontalCenter } + id: boardImage source: "content/pics/board.png" } - Grid { - id: board - anchors.fill: boardimage - columns: 3 - - Repeater { - model: 9 - TicTac { - width: board.width/3 - height: board.height/3 - onClicked: { - if (!endtimer.running) { - if (!Logic.makeMove(index,"X")) - Logic.computerTurn() - } - } - } - } + Text { + id: messageDisplay + anchors.centerIn: parent + color: "blue" + style: Text.Outline; styleColor: "white" + font.pixelSize: 50; font.bold: true + visible: false Timer { - id: endtimer - interval: 1600 - onTriggered: { msg.opacity = 0; Logic.restart() } + running: messageDisplay.visible + onTriggered: { + messageDisplay.visible = false; + Logic.restartGame(); + } } } - Row { - spacing: 4 - anchors { top: board.bottom; horizontalCenter: board.horizontalCenter } + Column { + id: display - Button { - text: "Hard" - onClicked: game.difficulty = 1.0; - down: game.difficulty == 1.0 - } - Button { - text: "Moderate" - onClicked: game.difficulty = 0.8; - down: game.difficulty == 0.8 - } - Button { - text: "Easy" - onClicked: game.difficulty = 0.2; - down: game.difficulty == 0.2 + Grid { + id: board + width: boardImage.width; height: boardImage.height + columns: 3 + + Repeater { + model: 9 + + TicTac { + width: board.width/3 + height: board.height/3 + + onClicked: { + if (game.running && Logic.canPlayAtPos(index)) { + if (!Logic.makeMove(index, "X")) + Logic.computerTurn(); + } + } + } + } } - } - Text { - id: msg + Row { + spacing: 4 + anchors.horizontalCenter: parent.horizontalCenter - anchors.centerIn: parent - opacity: 0 - color: "blue" - style: Text.Outline; styleColor: "white" - font.pixelSize: 50; font.bold: true + Button { + text: "Hard" + pressed: game.difficulty == 1.0 + onClicked: { game.difficulty = 1.0 } + } + Button { + text: "Moderate" + pressed: game.difficulty == 0.8 + onClicked: { game.difficulty = 0.8 } + } + Button { + text: "Easy" + pressed: game.difficulty == 0.2 + onClicked: { game.difficulty = 0.2 } + } + } } } -- cgit v0.12 From a014c8587918f8ead56fc915400fca037eeaf0b3 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Tue, 25 May 2010 15:06:17 +0200 Subject: Doc: Removed a misleading sentence about signals. Reviewed-by: Stephen Kelly --- src/corelib/kernel/qabstractitemmodel.cpp | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/corelib/kernel/qabstractitemmodel.cpp b/src/corelib/kernel/qabstractitemmodel.cpp index 3660a3c..24c26b6 100644 --- a/src/corelib/kernel/qabstractitemmodel.cpp +++ b/src/corelib/kernel/qabstractitemmodel.cpp @@ -2501,6 +2501,8 @@ bool QAbstractItemModelPrivate::allowMove(const QModelIndex &srcParent, int star } /*! + \since 4.6 + Begins a row move operation. When reimplementing a subclass, this method simplifies moving @@ -2526,7 +2528,7 @@ bool QAbstractItemModelPrivate::allowMove(const QModelIndex &srcParent, int star same, in which case you must ensure that the \a destinationChild is not within the range of \a sourceFirst and \a sourceLast. You must also ensure that you do not attempt to move a row to one of - its own chilren or ancestors. This method returns false if either + its own children or ancestors. This method returns false if either condition is true, in which case you should abort your move operation. @@ -2582,13 +2584,7 @@ bool QAbstractItemModelPrivate::allowMove(const QModelIndex &srcParent, int star Note that other rows may be displaced accordingly. \endtable - \note This function emits the rowsAboutToBeInserted() signal which - connected views (or proxies) must handle before the data is inserted. - Otherwise, the views may end up in an invalid state. - \sa endMoveRows() - - \since 4.6 */ bool QAbstractItemModel::beginMoveRows(const QModelIndex &sourceParent, int sourceFirst, int sourceLast, const QModelIndex &destinationParent, int destinationChild) { -- cgit v0.12 From 3501614b3797272dcbd683adcca4fdacc5b319e9 Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Wed, 26 May 2010 09:19:10 +1000 Subject: Add inherits Item to TextEdit and TextInput docs. Task-number: QTBUG-10969 --- src/declarative/graphicsitems/qdeclarativetextedit.cpp | 3 ++- src/declarative/graphicsitems/qdeclarativetextinput.cpp | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/declarative/graphicsitems/qdeclarativetextedit.cpp b/src/declarative/graphicsitems/qdeclarativetextedit.cpp index e34bb3d..f41cdd0 100644 --- a/src/declarative/graphicsitems/qdeclarativetextedit.cpp +++ b/src/declarative/graphicsitems/qdeclarativetextedit.cpp @@ -61,8 +61,9 @@ QT_BEGIN_NAMESPACE /*! \qmlclass TextEdit QDeclarativeTextEdit - \since 4.7 + \since 4.7 \brief The TextEdit item allows you to add editable formatted text to a scene. + \inherits Item It can display both plain and rich text. For example: diff --git a/src/declarative/graphicsitems/qdeclarativetextinput.cpp b/src/declarative/graphicsitems/qdeclarativetextinput.cpp index 2e7715f..b624c5b 100644 --- a/src/declarative/graphicsitems/qdeclarativetextinput.cpp +++ b/src/declarative/graphicsitems/qdeclarativetextinput.cpp @@ -54,8 +54,9 @@ QT_BEGIN_NAMESPACE /*! \qmlclass TextInput QDeclarativeTextInput - \since 4.7 + \since 4.7 \brief The TextInput item allows you to add an editable line of text to a scene. + \inherits Item TextInput can only display a single line of text, and can only display plain text. However it can provide addition input constraints on the text. -- cgit v0.12 From 291dce4ceba88a6cada0415524e3466621ac1612 Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Wed, 26 May 2010 09:24:07 +1000 Subject: Mention TextInput/Edit::selectByMouse property in QmlChanges. --- src/declarative/QmlChanges.txt | 1 + src/declarative/graphicsitems/qdeclarativetextedit.cpp | 2 +- src/declarative/graphicsitems/qdeclarativetextinput.cpp | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/declarative/QmlChanges.txt b/src/declarative/QmlChanges.txt index 25c2417..3eed8d6 100644 --- a/src/declarative/QmlChanges.txt +++ b/src/declarative/QmlChanges.txt @@ -15,6 +15,7 @@ QList models no longer provide properties in model object. The properties are now updated when the object changes. An object's property "foo" may now be accessed as "foo", modelData.foo" or model.modelData.foo" component.createObject has gained a mandatory "parent" argument +TextEdit and TextInput now have a "selectByMouse" property that defaults to false. C++ API ------- diff --git a/src/declarative/graphicsitems/qdeclarativetextedit.cpp b/src/declarative/graphicsitems/qdeclarativetextedit.cpp index f41cdd0..a154d53 100644 --- a/src/declarative/graphicsitems/qdeclarativetextedit.cpp +++ b/src/declarative/graphicsitems/qdeclarativetextedit.cpp @@ -782,7 +782,7 @@ void QDeclarativeTextEdit::componentComplete() } /*! - \qmlproperty string TextEdit::selectByMouse + \qmlproperty bool TextEdit::selectByMouse Defaults to false. diff --git a/src/declarative/graphicsitems/qdeclarativetextinput.cpp b/src/declarative/graphicsitems/qdeclarativetextinput.cpp index b624c5b..1ac1b4e 100644 --- a/src/declarative/graphicsitems/qdeclarativetextinput.cpp +++ b/src/declarative/graphicsitems/qdeclarativetextinput.cpp @@ -1121,7 +1121,7 @@ QString QDeclarativeTextInput::displayText() const } /*! - \qmlproperty string TextInput::selectByMouse + \qmlproperty bool TextInput::selectByMouse Defaults to false. -- cgit v0.12 From 5613693326eaa272d6fab5819072c52b743d7785 Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Wed, 26 May 2010 10:26:42 +1000 Subject: Don't display unnecessary copyright headers in doc --- doc/src/declarative/extending-tutorial.qdoc | 8 ++++---- doc/src/declarative/globalobject.qdoc | 2 +- examples/declarative/sqllocalstorage/hello.qml | 2 +- examples/declarative/tutorials/extending/chapter1-basics/app.qml | 2 +- examples/declarative/tutorials/extending/chapter2-methods/app.qml | 2 +- .../declarative/tutorials/extending/chapter3-bindings/app.qml | 2 +- .../tutorials/extending/chapter4-customPropertyTypes/app.qml | 2 +- 7 files changed, 10 insertions(+), 10 deletions(-) diff --git a/doc/src/declarative/extending-tutorial.qdoc b/doc/src/declarative/extending-tutorial.qdoc index f00b858..7ec9087 100644 --- a/doc/src/declarative/extending-tutorial.qdoc +++ b/doc/src/declarative/extending-tutorial.qdoc @@ -107,7 +107,7 @@ The class implementation in \c musician.cpp simply sets and returns the \c m_nam Our QML file, \c app.qml, creates a \c Musician item and display the musician's details using a standard QML \l Text item: -\quotefile declarative/tutorials/extending/chapter1-basics/app.qml +\snippet declarative/tutorials/extending/chapter1-basics/app.qml 0 We'll also create a C++ application that uses a QDeclarativeView to run and display \c app.qml. The application must register the \c Musician type @@ -147,7 +147,7 @@ to the console and then emits a "performanceEnded" signal. Other elements would be able to call \c perform() and receive \c performanceEnded() signals like this: -\quotefile declarative/tutorials/extending/chapter2-methods/app.qml +\snippet declarative/tutorials/extending/chapter2-methods/app.qml 0 To do this, we add a \c perform() method and a \c performanceEnded() signal to our C++ class: @@ -193,7 +193,7 @@ other elements' values when property values change. Let's enable property bindings for the \c instrument property. That means if we have code like this: -\quotefile declarative/tutorials/extending/chapter3-bindings/app.qml +\snippet declarative/tutorials/extending/chapter3-bindings/app.qml 0 The "instrument: reddy.instrument" statement binds the \c instrument value of \c craig to the \c instrument of \c reddy. @@ -275,7 +275,7 @@ For example, let's change the type of the \c instrument property from a string t new type called "Instrument". Instead of assigning a string value to \c instrument, we assign an \c Instrument value: -\quotefile declarative/tutorials/extending/chapter4-customPropertyTypes/app.qml +\snippet declarative/tutorials/extending/chapter4-customPropertyTypes/app.qml 0 Like \c Musician, this new \c Instrument type has to inherit from QObject and declare its properties with Q_PROPERTY(): diff --git a/doc/src/declarative/globalobject.qdoc b/doc/src/declarative/globalobject.qdoc index 2885dd5..fcd227d 100644 --- a/doc/src/declarative/globalobject.qdoc +++ b/doc/src/declarative/globalobject.qdoc @@ -141,7 +141,7 @@ of QDeclarativeEngine::offlineStoragePath(), currently as SQLite databases. The API can be used from JavaScript functions in your QML: -\quotefile declarative/sqllocalstorage/hello.qml +\snippet declarative/sqllocalstorage/hello.qml 0 The API conforms to the Synchronous API of the HTML5 Web Database API, \link http://www.w3.org/TR/2009/WD-webdatabase-20091029/ W3C Working Draft 29 October 2009\endlink. diff --git a/examples/declarative/sqllocalstorage/hello.qml b/examples/declarative/sqllocalstorage/hello.qml index 67f542e..0913d42 100644 --- a/examples/declarative/sqllocalstorage/hello.qml +++ b/examples/declarative/sqllocalstorage/hello.qml @@ -37,7 +37,7 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ - +//![0] import Qt 4.7 Text { diff --git a/examples/declarative/tutorials/extending/chapter1-basics/app.qml b/examples/declarative/tutorials/extending/chapter1-basics/app.qml index 96c543e..7de32f2 100644 --- a/examples/declarative/tutorials/extending/chapter1-basics/app.qml +++ b/examples/declarative/tutorials/extending/chapter1-basics/app.qml @@ -37,7 +37,7 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ - +//![0] import Music 1.0 import Qt 4.7 diff --git a/examples/declarative/tutorials/extending/chapter2-methods/app.qml b/examples/declarative/tutorials/extending/chapter2-methods/app.qml index 82740d2..495413f 100644 --- a/examples/declarative/tutorials/extending/chapter2-methods/app.qml +++ b/examples/declarative/tutorials/extending/chapter2-methods/app.qml @@ -37,7 +37,7 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ - +//![0] import Music 1.0 import Qt 4.7 diff --git a/examples/declarative/tutorials/extending/chapter3-bindings/app.qml b/examples/declarative/tutorials/extending/chapter3-bindings/app.qml index 138d504..46408cb 100644 --- a/examples/declarative/tutorials/extending/chapter3-bindings/app.qml +++ b/examples/declarative/tutorials/extending/chapter3-bindings/app.qml @@ -37,7 +37,7 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ - +//![0] import Music 1.0 import Qt 4.7 diff --git a/examples/declarative/tutorials/extending/chapter4-customPropertyTypes/app.qml b/examples/declarative/tutorials/extending/chapter4-customPropertyTypes/app.qml index e238ec4..09662d6 100644 --- a/examples/declarative/tutorials/extending/chapter4-customPropertyTypes/app.qml +++ b/examples/declarative/tutorials/extending/chapter4-customPropertyTypes/app.qml @@ -37,7 +37,7 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ - +//![0] import Music 1.0 import Qt 4.7 -- cgit v0.12 From 113d7a6a1eab75ad5673f9b50ccf8df456b5d628 Mon Sep 17 00:00:00 2001 From: Yann Bodson Date: Wed, 26 May 2010 11:24:37 +1000 Subject: Fix Gradient doc snippet. --- doc/src/snippets/declarative/gradient.qml | 2 ++ src/declarative/graphicsitems/qdeclarativerectangle.cpp | 6 +----- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/doc/src/snippets/declarative/gradient.qml b/doc/src/snippets/declarative/gradient.qml index d25352b..7a68233 100644 --- a/doc/src/snippets/declarative/gradient.qml +++ b/doc/src/snippets/declarative/gradient.qml @@ -41,6 +41,7 @@ import Qt 4.7 +//![code] Rectangle { width: 100; height: 100 gradient: Gradient { @@ -49,3 +50,4 @@ Rectangle { GradientStop { position: 1.0; color: "green" } } } +//![code] diff --git a/src/declarative/graphicsitems/qdeclarativerectangle.cpp b/src/declarative/graphicsitems/qdeclarativerectangle.cpp index d098aa0..4f7a722 100644 --- a/src/declarative/graphicsitems/qdeclarativerectangle.cpp +++ b/src/declarative/graphicsitems/qdeclarativerectangle.cpp @@ -114,11 +114,7 @@ void QDeclarativeGradientStop::updateGradient() rectangle with a gradient starting with red, blending to yellow at 1/3 of the size of the rectangle, and ending with Green: - \table - \row - \o \image gradient.png - \o \quotefile doc/src/snippets/declarative/gradient.qml - \endtable + \snippet doc/src/snippets/declarative/gradient.qml code \sa GradientStop */ -- cgit v0.12 From 5a6a5b1b83e2196b4cad11fbb0f175682b6f7e8e Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Wed, 26 May 2010 11:30:20 +1000 Subject: Replace QTime with QElapsedTimer --- src/declarative/util/qdeclarativeview.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/declarative/util/qdeclarativeview.cpp b/src/declarative/util/qdeclarativeview.cpp index e68ef94..b7ce9c9 100644 --- a/src/declarative/util/qdeclarativeview.cpp +++ b/src/declarative/util/qdeclarativeview.cpp @@ -116,7 +116,7 @@ public: void frameBreak() { ++breaks; } private: - QTime timer; + QElapsedTimer timer; int breaks; }; @@ -152,7 +152,7 @@ public: QBasicTimer resizetimer; QDeclarativeView::ResizeMode resizeMode; - QTime frameTimer; + QElapsedTimer frameTimer; void init(); -- cgit v0.12 From 4fe568ffb7a59909b0c72bed7da959fd36702f19 Mon Sep 17 00:00:00 2001 From: Joona Petrell Date: Wed, 26 May 2010 12:42:36 +1000 Subject: Add a way to control when software input panels are shown in TextInput and TextEdit elements Task-number: QTBUG-10841 Reviewed-by: Warwick Allison --- .../graphicsitems/qdeclarativetextedit.cpp | 131 +++++++++++++++++++-- .../graphicsitems/qdeclarativetextedit_p.h | 10 ++ .../graphicsitems/qdeclarativetextedit_p_p.h | 8 +- .../graphicsitems/qdeclarativetextinput.cpp | 131 +++++++++++++++++++-- .../graphicsitems/qdeclarativetextinput_p.h | 10 ++ .../graphicsitems/qdeclarativetextinput_p_p.h | 4 +- .../tst_qdeclarativetextedit.cpp | 85 ++++++++++--- .../tst_qdeclarativetextinput.cpp | 86 +++++++++++--- 8 files changed, 413 insertions(+), 52 deletions(-) diff --git a/src/declarative/graphicsitems/qdeclarativetextedit.cpp b/src/declarative/graphicsitems/qdeclarativetextedit.cpp index a154d53..d4fbb8b 100644 --- a/src/declarative/graphicsitems/qdeclarativetextedit.cpp +++ b/src/declarative/graphicsitems/qdeclarativetextedit.cpp @@ -940,7 +940,6 @@ Handles the given mouse \a event. void QDeclarativeTextEdit::mousePressEvent(QGraphicsSceneMouseEvent *event) { Q_D(QDeclarativeTextEdit); - bool hadFocus = hasFocus(); if (d->focusOnPress){ QGraphicsItem *p = parentItem();//###Is there a better way to find my focus scope? while(p) { @@ -950,8 +949,6 @@ void QDeclarativeTextEdit::mousePressEvent(QGraphicsSceneMouseEvent *event) } setFocus(true); } - if (!hadFocus && hasFocus()) - d->clickCausedFocus = true; if (event->type() != QEvent::GraphicsSceneMouseDoubleClick || d->selectByMouse) d->control->processEvent(event, QPointF(0, -d->yoff)); if (!event->isAccepted()) @@ -965,11 +962,6 @@ Handles the given mouse \a event. void QDeclarativeTextEdit::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) { Q_D(QDeclarativeTextEdit); - QWidget *widget = event->widget(); - if (widget && (d->control->textInteractionFlags() & Qt::TextEditable) && boundingRect().contains(event->pos())) - qt_widget_private(widget)->handleSoftwareInputPanel(event->button(), d->clickCausedFocus); - d->clickCausedFocus = false; - d->control->processEvent(event, QPointF(0, -d->yoff)); if (!event->isAccepted()) QDeclarativePaintedItem::mouseReleaseEvent(event); @@ -1205,4 +1197,127 @@ void QDeclarativeTextEditPrivate::updateDefaultTextOption() document->setDefaultTextOption(opt); } + +/*! + \qmlmethod void TextEdit::openSoftwareInputPanel() + + Opens software input panels like virtual keyboards for typing, useful for + customizing when you want the input keyboard to be shown and hidden in + your application. + + By default input panels are shown when TextEdit element gains focus and hidden + when the focus is lost. You can disable the automatic behavior by setting the + property showInputPanelOnFocus to false and use functions openSoftwareInputPanel() + and closeSoftwareInputPanel() to implement the behavior you want. + + Only relevant on platforms, which provide virtual keyboards. + + \code + import Qt 4.7 + TextEdit { + id: textEdit + text: "Hello world!" + showInputPanelOnFocus: false + MouseArea { + anchors.fill: parent + onClicked: textEdit.openSoftwareInputPanel() + } + onFocusChanged: if (!focus) closeSoftwareInputpanel() + } + \endcode +*/ +void QDeclarativeTextEdit::openSoftwareInputPanel() +{ + QEvent event(QEvent::RequestSoftwareInputPanel); + if (qApp) { + if (QGraphicsView * view = qobject_cast(qApp->focusWidget())) { + if (view->scene() && view->scene() == scene()) { + QApplication::sendEvent(view, &event); + } + } + } +} + +/*! + \qmlmethod void TextEdit::closeSoftwareInputPanel() + + Closes a software input panel like a virtual keyboard shown on the screen, useful + for customizing when you want the input keyboard to be shown and hidden in + your application. + + By default input panels are shown when TextEdit element gains focus and hidden + when the focus is lost. You can disable the automatic behavior by setting the + property showInputPanelOnFocus to false and use functions openSoftwareInputPanel() + and closeSoftwareInputPanel() to implement the behavior you want. + + Only relevant on platforms, which provide virtual keyboards. + + \code + import Qt 4.7 + TextEdit { + id: textEdit + text: "Hello world!" + showInputPanelOnFocus: false + MouseArea { + anchors.fill: parent + onClicked: textEdit.openSoftwareInputPanel() + } + onFocusChanged: if (!focus) closeSoftwareInputpanel() + } + \endcode +*/ +void QDeclarativeTextEdit::closeSoftwareInputPanel() +{ + QEvent event(QEvent::CloseSoftwareInputPanel); + if (qApp) { + if (QGraphicsView * view = qobject_cast(qApp->focusWidget())) { + if (view->scene() && view->scene() == scene()) { + QApplication::sendEvent(view, &event); + } + } + } +} + +/*! + \qmlproperty bool TextEdit::showInputPanelOnFocus + Whether input panels are automatically shown when TextEdit element gains + focus and hidden when focus is lost. By default this is set to true. + + Only relevant on platforms, which provide virtual keyboards. +*/ +bool QDeclarativeTextEdit::showInputPanelOnFocus() const +{ + Q_D(const QDeclarativeTextEdit); + return d->showInputPanelOnFocus; +} + +void QDeclarativeTextEdit::setShowInputPanelOnFocus(bool showOnFocus) +{ + Q_D(QDeclarativeTextEdit); + if (d->showInputPanelOnFocus == showOnFocus) + return; + + d->showInputPanelOnFocus = showOnFocus; + + emit showInputPanelOnFocusChanged(d->showInputPanelOnFocus); +} + +void QDeclarativeTextEdit::focusInEvent(QFocusEvent *event) +{ + Q_D(const QDeclarativeTextEdit); + if (d->showInputPanelOnFocus && !isReadOnly()) { + openSoftwareInputPanel(); + } + QDeclarativePaintedItem::focusInEvent(event); +} + +void QDeclarativeTextEdit::focusOutEvent(QFocusEvent *event) +{ + Q_D(const QDeclarativeTextEdit); + if (d->showInputPanelOnFocus && !isReadOnly()) { + closeSoftwareInputPanel(); + } + QDeclarativePaintedItem::focusOutEvent(event); +} + QT_END_NAMESPACE diff --git a/src/declarative/graphicsitems/qdeclarativetextedit_p.h b/src/declarative/graphicsitems/qdeclarativetextedit_p.h index 891b868..fdac5cf 100644 --- a/src/declarative/graphicsitems/qdeclarativetextedit_p.h +++ b/src/declarative/graphicsitems/qdeclarativetextedit_p.h @@ -84,6 +84,7 @@ class Q_DECLARATIVE_EXPORT QDeclarativeTextEdit : public QDeclarativePaintedItem Q_PROPERTY(int selectionEnd READ selectionEnd WRITE setSelectionEnd NOTIFY selectionEndChanged) Q_PROPERTY(QString selectedText READ selectedText NOTIFY selectionChanged) Q_PROPERTY(bool focusOnPress READ focusOnPress WRITE setFocusOnPress NOTIFY focusOnPressChanged) + Q_PROPERTY(bool showInputPanelOnFocus READ showInputPanelOnFocus WRITE setShowInputPanelOnFocus NOTIFY showInputPanelOnFocusChanged) Q_PROPERTY(bool persistentSelection READ persistentSelection WRITE setPersistentSelection NOTIFY persistentSelectionChanged) Q_PROPERTY(qreal textMargin READ textMargin WRITE setTextMargin NOTIFY textMarginChanged) Q_PROPERTY(Qt::InputMethodHints inputMethodHints READ inputMethodHints WRITE setInputMethodHints) @@ -116,6 +117,9 @@ public: WrapAtWordBoundaryOrAnywhere = QTextOption::WrapAtWordBoundaryOrAnywhere }; + Q_INVOKABLE void openSoftwareInputPanel(); + Q_INVOKABLE void closeSoftwareInputPanel(); + QString text() const; void setText(const QString &); @@ -163,6 +167,9 @@ public: bool focusOnPress() const; void setFocusOnPress(bool on); + bool showInputPanelOnFocus() const; + void setShowInputPanelOnFocus(bool showOnFocus); + bool persistentSelection() const; void setPersistentSelection(bool on); @@ -207,6 +214,7 @@ Q_SIGNALS: void persistentSelectionChanged(bool isPersistentSelection); void textMarginChanged(qreal textMargin); void selectByMouseChanged(bool selectByMouse); + void showInputPanelOnFocusChanged(bool showOnFocus); public Q_SLOTS: void selectAll(); @@ -228,6 +236,8 @@ protected: bool event(QEvent *); void keyPressEvent(QKeyEvent *); void keyReleaseEvent(QKeyEvent *); + void focusInEvent(QFocusEvent *event); + void focusOutEvent(QFocusEvent *event); // mouse filter? void mousePressEvent(QGraphicsSceneMouseEvent *event); diff --git a/src/declarative/graphicsitems/qdeclarativetextedit_p_p.h b/src/declarative/graphicsitems/qdeclarativetextedit_p_p.h index d96796c..8e1d630 100644 --- a/src/declarative/graphicsitems/qdeclarativetextedit_p_p.h +++ b/src/declarative/graphicsitems/qdeclarativetextedit_p_p.h @@ -70,9 +70,9 @@ public: QDeclarativeTextEditPrivate() : color("black"), hAlign(QDeclarativeTextEdit::AlignLeft), vAlign(QDeclarativeTextEdit::AlignTop), imgDirty(true), dirty(false), richText(false), cursorVisible(false), focusOnPress(true), - persistentSelection(true), clickCausedFocus(false), textMargin(0.0), lastSelectionStart(0), lastSelectionEnd(0), - cursorComponent(0), cursor(0), format(QDeclarativeTextEdit::AutoText), document(0), - wrapMode(QDeclarativeTextEdit::NoWrap), + showInputPanelOnFocus(true), persistentSelection(true), textMargin(0.0), lastSelectionStart(0), + lastSelectionEnd(0), cursorComponent(0), cursor(0), format(QDeclarativeTextEdit::AutoText), + document(0), wrapMode(QDeclarativeTextEdit::NoWrap), selectByMouse(false), yoff(0) { @@ -101,8 +101,8 @@ public: bool richText : 1; bool cursorVisible : 1; bool focusOnPress : 1; + bool showInputPanelOnFocus : 1; bool persistentSelection : 1; - bool clickCausedFocus : 1; qreal textMargin; int lastSelectionStart; int lastSelectionEnd; diff --git a/src/declarative/graphicsitems/qdeclarativetextinput.cpp b/src/declarative/graphicsitems/qdeclarativetextinput.cpp index 1ac1b4e..47cd110 100644 --- a/src/declarative/graphicsitems/qdeclarativetextinput.cpp +++ b/src/declarative/graphicsitems/qdeclarativetextinput.cpp @@ -886,7 +886,6 @@ void QDeclarativeTextInput::keyPressEvent(QKeyEvent* ev) void QDeclarativeTextInput::mousePressEvent(QGraphicsSceneMouseEvent *event) { Q_D(QDeclarativeTextInput); - bool hadFocus = hasFocus(); if(d->focusOnPress){ QGraphicsItem *p = parentItem();//###Is there a better way to find my focus scope? while(p) { @@ -896,8 +895,6 @@ void QDeclarativeTextInput::mousePressEvent(QGraphicsSceneMouseEvent *event) } setFocus(true); } - if (!hadFocus && hasFocus()) - d->clickCausedFocus = true; bool mark = event->modifiers() & Qt::ShiftModifier; int cursor = d->xToPos(event->pos().x()); @@ -923,10 +920,7 @@ Handles the given mouse \a event. void QDeclarativeTextInput::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) { Q_D(QDeclarativeTextInput); - QWidget *widget = event->widget(); - if (widget && !d->control->isReadOnly() && boundingRect().contains(event->pos())) - qt_widget_private(widget)->handleSoftwareInputPanel(event->button(), d->clickCausedFocus); - d->clickCausedFocus = false; + d->control->processEvent(event); if (!event->isAccepted()) QDeclarativePaintedItem::mouseReleaseEvent(event); } @@ -1175,6 +1169,129 @@ void QDeclarativeTextInput::moveCursorSelection(int position) d->control->moveCursor(position, true); } +/*! + \qmlmethod void TextInput::openSoftwareInputPanel() + + Opens software input panels like virtual keyboards for typing, useful for + customizing when you want the input keyboard to be shown and hidden in + your application. + + By default input panels are shown when TextInput element gains focus and hidden + when the focus is lost. You can disable the automatic behavior by setting the + property showInputPanelOnFocus to false and use functions openSoftwareInputPanel() + and closeSoftwareInputPanel() to implement the behavior you want. + + Only relevant on platforms, which provide virtual keyboards. + + \code + import Qt 4.7 + TextInput { + id: textInput + text: "Hello world!" + showInputPanelOnFocus: false + MouseArea { + anchors.fill: parent + onClicked: textInput.openSoftwareInputPanel() + } + onFocusChanged: if (!focus) closeSoftwareInputPanel() + } + \endcode +*/ +void QDeclarativeTextInput::openSoftwareInputPanel() +{ + QEvent event(QEvent::RequestSoftwareInputPanel); + if (qApp) { + if (QGraphicsView * view = qobject_cast(qApp->focusWidget())) { + if (view->scene() && view->scene() == scene()) { + QApplication::sendEvent(view, &event); + } + } + } +} + +/*! + \qmlmethod void TextInput::closeSoftwareInputPanel() + + Closes a software input panel like a virtual keyboard shown on the screen, useful + for customizing when you want the input keyboard to be shown and hidden in + your application. + + By default input panels are shown when TextInput element gains focus and hidden + when the focus is lost. You can disable the automatic behavior by setting the + property showInputPanelOnFocus to false and use functions openSoftwareInputPanel() + and closeSoftwareInputPanel() to implement the behavior you want. + + Only relevant on platforms, which provide virtual keyboards. + + \code + import Qt 4.7 + TextInput { + id: textInput + text: "Hello world!" + showInputPanelOnFocus: false + MouseArea { + anchors.fill: parent + onClicked: textInput.openSoftwareInputPanel() + } + onFocusChanged: if (!focus) closeSoftwareInputPanel() + } + \endcode +*/ +void QDeclarativeTextInput::closeSoftwareInputPanel() +{ + QEvent event(QEvent::CloseSoftwareInputPanel); + if (qApp) { + QEvent event(QEvent::CloseSoftwareInputPanel); + if (QGraphicsView * view = qobject_cast(qApp->focusWidget())) { + if (view->scene() && view->scene() == scene()) { + QApplication::sendEvent(view, &event); + } + } + } +} + +/*! + \qmlproperty bool TextInput::showInputPanelOnFocus + Whether input panels are automatically shown when TextInput element gains + focus and hidden when focus is lost. By default this is set to true. + + Only relevant on platforms, which provide virtual keyboards. +*/ +bool QDeclarativeTextInput::showInputPanelOnFocus() const +{ + Q_D(const QDeclarativeTextInput); + return d->showInputPanelOnFocus; +} + +void QDeclarativeTextInput::setShowInputPanelOnFocus(bool showOnFocus) +{ + Q_D(QDeclarativeTextInput); + if (d->showInputPanelOnFocus == showOnFocus) + return; + + d->showInputPanelOnFocus = showOnFocus; + + emit showInputPanelOnFocusChanged(d->showInputPanelOnFocus); +} + +void QDeclarativeTextInput::focusInEvent(QFocusEvent *event) +{ + Q_D(const QDeclarativeTextInput); + if (d->showInputPanelOnFocus && !isReadOnly()) { + openSoftwareInputPanel(); + } + QDeclarativePaintedItem::focusInEvent(event); +} + +void QDeclarativeTextInput::focusOutEvent(QFocusEvent *event) +{ + Q_D(const QDeclarativeTextInput); + if (d->showInputPanelOnFocus && !isReadOnly()) { + closeSoftwareInputPanel(); + } + QDeclarativePaintedItem::focusOutEvent(event); +} + void QDeclarativeTextInputPrivate::init() { Q_Q(QDeclarativeTextInput); diff --git a/src/declarative/graphicsitems/qdeclarativetextinput_p.h b/src/declarative/graphicsitems/qdeclarativetextinput_p.h index b2fd057..438293a 100644 --- a/src/declarative/graphicsitems/qdeclarativetextinput_p.h +++ b/src/declarative/graphicsitems/qdeclarativetextinput_p.h @@ -86,6 +86,7 @@ class Q_DECLARATIVE_EXPORT QDeclarativeTextInput : public QDeclarativePaintedIte Q_PROPERTY(bool acceptableInput READ hasAcceptableInput NOTIFY acceptableInputChanged) Q_PROPERTY(EchoMode echoMode READ echoMode WRITE setEchoMode NOTIFY echoModeChanged) Q_PROPERTY(bool focusOnPress READ focusOnPress WRITE setFocusOnPress NOTIFY focusOnPressChanged) + Q_PROPERTY(bool showInputPanelOnFocus READ showInputPanelOnFocus WRITE setShowInputPanelOnFocus NOTIFY showInputPanelOnFocusChanged) Q_PROPERTY(QString passwordCharacter READ passwordCharacter WRITE setPasswordCharacter NOTIFY passwordCharacterChanged) Q_PROPERTY(QString displayText READ displayText NOTIFY displayTextChanged) Q_PROPERTY(bool autoScroll READ autoScroll WRITE setAutoScroll NOTIFY autoScrollChanged) @@ -112,6 +113,9 @@ public: Q_INVOKABLE int xToPosition(int x); Q_INVOKABLE void moveCursorSelection(int pos); + Q_INVOKABLE void openSoftwareInputPanel(); + Q_INVOKABLE void closeSoftwareInputPanel(); + QString text() const; void setText(const QString &); @@ -172,6 +176,9 @@ public: bool focusOnPress() const; void setFocusOnPress(bool); + bool showInputPanelOnFocus() const; + void setShowInputPanelOnFocus(bool showOnFocus); + bool autoScroll() const; void setAutoScroll(bool); @@ -208,6 +215,7 @@ Q_SIGNALS: void focusOnPressChanged(bool focusOnPress); void autoScrollChanged(bool autoScroll); void selectByMouseChanged(bool selectByMouse); + void showInputPanelOnFocusChanged(bool showOnFocus); protected: virtual void geometryChanged(const QRectF &newGeometry, @@ -218,6 +226,8 @@ protected: void mouseReleaseEvent(QGraphicsSceneMouseEvent *event); void keyPressEvent(QKeyEvent* ev); bool event(QEvent *e); + void focusInEvent(QFocusEvent *event); + void focusOutEvent(QFocusEvent *event); public Q_SLOTS: void selectAll(); diff --git a/src/declarative/graphicsitems/qdeclarativetextinput_p_p.h b/src/declarative/graphicsitems/qdeclarativetextinput_p_p.h index 1d8e0f7..f44d014 100644 --- a/src/declarative/graphicsitems/qdeclarativetextinput_p_p.h +++ b/src/declarative/graphicsitems/qdeclarativetextinput_p_p.h @@ -72,7 +72,7 @@ public: color((QRgb)0), style(QDeclarativeText::Normal), styleColor((QRgb)0), hAlign(QDeclarativeTextInput::AlignLeft), hscroll(0), oldScroll(0), focused(false), focusOnPress(true), - cursorVisible(false), autoScroll(true), clickCausedFocus(false), + showInputPanelOnFocus(true), cursorVisible(false), autoScroll(true), selectByMouse(false) { } @@ -115,9 +115,9 @@ public: int oldScroll; bool focused; bool focusOnPress; + bool showInputPanelOnFocus; bool cursorVisible; bool autoScroll; - bool clickCausedFocus; bool selectByMouse; }; diff --git a/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp b/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp index b07849d..2b6f2aa 100644 --- a/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp +++ b/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp @@ -39,6 +39,7 @@ ** ****************************************************************************/ #include +#include #include "../../../shared/util.h" #include "../shared/testhttpserver.h" #include @@ -811,7 +812,7 @@ QDeclarativeView *tst_qdeclarativetextedit::createView(const QString &filename) class MyInputContext : public QInputContext { public: - MyInputContext() : softwareInputPanelEventReceived(false) {} + MyInputContext() : openInputPanelReceived(false), closeInputPanelReceived(false) {} ~MyInputContext() {} QString identifierName() { return QString(); } @@ -824,10 +825,13 @@ public: bool filterEvent( const QEvent *event ) { if (event->type() == QEvent::RequestSoftwareInputPanel) - softwareInputPanelEventReceived = true; + openInputPanelReceived = true; + if (event->type() == QEvent::CloseSoftwareInputPanel) + closeInputPanelReceived = true; return QInputContext::filterEvent(event); } - bool softwareInputPanelEventReceived; + bool openInputPanelReceived; + bool closeInputPanelReceived; }; void tst_qdeclarativetextedit::sendRequestSoftwareInputPanelEvent() @@ -835,10 +839,9 @@ void tst_qdeclarativetextedit::sendRequestSoftwareInputPanelEvent() QGraphicsScene scene; QGraphicsView view(&scene); MyInputContext ic; - view.viewport()->setInputContext(&ic); - QStyle::RequestSoftwareInputPanel behavior = QStyle::RequestSoftwareInputPanel( - view.style()->styleHint(QStyle::SH_RequestSoftwareInputPanel)); + view.setInputContext(&ic); QDeclarativeTextEdit edit; + QSignalSpy inputPanelonFocusSpy(&edit, SIGNAL(showInputPanelOnFocusChanged(bool))); edit.setText("Hello world"); edit.setPos(0, 0); scene.addItem(&edit); @@ -847,16 +850,68 @@ void tst_qdeclarativetextedit::sendRequestSoftwareInputPanelEvent() QApplication::setActiveWindow(&view); QTest::qWaitForWindowShown(&view); QTRY_COMPARE(QApplication::activeWindow(), static_cast(&view)); - QTest::mouseClick(view.viewport(), Qt::LeftButton, 0, view.mapFromScene(edit.scenePos())); + + QVERIFY(edit.showInputPanelOnFocus()); + QCOMPARE(ic.openInputPanelReceived, false); + QCOMPARE(ic.closeInputPanelReceived, false); + + // focus on press, input panel on focus + QTest::mousePress(view.viewport(), Qt::LeftButton, 0, view.mapFromScene(edit.scenePos())); QApplication::processEvents(); - if (behavior == QStyle::RSIP_OnMouseClickAndAlreadyFocused) { - QCOMPARE(ic.softwareInputPanelEventReceived, false); - QTest::mouseClick(view.viewport(), Qt::LeftButton, 0, view.mapFromScene(edit.scenePos())); - QApplication::processEvents(); - QCOMPARE(ic.softwareInputPanelEventReceived, true); - } else if (behavior == QStyle::RSIP_OnMouseClick) { - QCOMPARE(ic.softwareInputPanelEventReceived, true); - } + QCOMPARE(ic.openInputPanelReceived, true); + QCOMPARE(ic.closeInputPanelReceived, false); + ic.openInputPanelReceived = false; + + // no events on release + QTest::mouseRelease(view.viewport(), Qt::LeftButton, 0, view.mapFromScene(edit.scenePos())); + QCOMPARE(ic.openInputPanelReceived, false); + QCOMPARE(ic.closeInputPanelReceived, false); + ic.openInputPanelReceived = false; + + // input panel closed on focus lost + edit.setFocus(false); + QApplication::processEvents(); + QCOMPARE(ic.openInputPanelReceived, false); + QCOMPARE(ic.closeInputPanelReceived, true); + ic.closeInputPanelReceived = false; + + // no input panel events if showInputPanelOnFocus is false + edit.setShowInputPanelOnFocus(false); + QCOMPARE(inputPanelonFocusSpy.count(),1); + QTest::mousePress(view.viewport(), Qt::LeftButton, 0, view.mapFromScene(edit.scenePos())); + QTest::mouseRelease(view.viewport(), Qt::LeftButton, 0, view.mapFromScene(edit.scenePos())); + edit.setFocus(false); + edit.setFocus(true); + QCOMPARE(ic.openInputPanelReceived, false); + QCOMPARE(ic.closeInputPanelReceived, false); + + edit.setShowInputPanelOnFocus(false); + QCOMPARE(inputPanelonFocusSpy.count(),1); + + // one show input panel event when openSoftwareInputPanel is called + edit.openSoftwareInputPanel(); + QCOMPARE(ic.openInputPanelReceived, true); + QCOMPARE(ic.closeInputPanelReceived, false); + ic.openInputPanelReceived = false; + + // one close input panel event when closeSoftwareInputPanel is called + edit.closeSoftwareInputPanel(); + QCOMPARE(ic.openInputPanelReceived, false); + QCOMPARE(ic.closeInputPanelReceived, true); + ic.openInputPanelReceived = false; + + // set showInputPanelOnFocus back to true + edit.setShowInputPanelOnFocus(true); + QCOMPARE(inputPanelonFocusSpy.count(),2); + edit.setFocus(false); + QCOMPARE(ic.openInputPanelReceived, false); + QCOMPARE(ic.closeInputPanelReceived, true); + edit.setFocus(true); + QCOMPARE(ic.openInputPanelReceived, true); + QCOMPARE(ic.closeInputPanelReceived, true); + + edit.setShowInputPanelOnFocus(true); + QCOMPARE(inputPanelonFocusSpy.count(),2); } void tst_qdeclarativetextedit::geometrySignals() diff --git a/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp b/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp index ac80edb..b3e16c4 100644 --- a/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp +++ b/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp @@ -39,6 +39,7 @@ ** ****************************************************************************/ #include +#include #include "../../../shared/util.h" #include #include @@ -712,11 +713,10 @@ QDeclarativeView *tst_qdeclarativetextinput::createView(const QString &filename) return canvas; } - class MyInputContext : public QInputContext { public: - MyInputContext() : softwareInputPanelEventReceived(false) {} + MyInputContext() : openInputPanelReceived(false), closeInputPanelReceived(false) {} ~MyInputContext() {} QString identifierName() { return QString(); } @@ -729,10 +729,13 @@ public: bool filterEvent( const QEvent *event ) { if (event->type() == QEvent::RequestSoftwareInputPanel) - softwareInputPanelEventReceived = true; + openInputPanelReceived = true; + if (event->type() == QEvent::CloseSoftwareInputPanel) + closeInputPanelReceived = true; return QInputContext::filterEvent(event); } - bool softwareInputPanelEventReceived; + bool openInputPanelReceived; + bool closeInputPanelReceived; }; void tst_qdeclarativetextinput::sendRequestSoftwareInputPanelEvent() @@ -740,10 +743,9 @@ void tst_qdeclarativetextinput::sendRequestSoftwareInputPanelEvent() QGraphicsScene scene; QGraphicsView view(&scene); MyInputContext ic; - view.viewport()->setInputContext(&ic); - QStyle::RequestSoftwareInputPanel behavior = QStyle::RequestSoftwareInputPanel( - view.style()->styleHint(QStyle::SH_RequestSoftwareInputPanel)); + view.setInputContext(&ic); QDeclarativeTextInput input; + QSignalSpy inputPanelonFocusSpy(&input, SIGNAL(showInputPanelOnFocusChanged(bool))); input.setText("Hello world"); input.setPos(0, 0); scene.addItem(&input); @@ -752,16 +754,68 @@ void tst_qdeclarativetextinput::sendRequestSoftwareInputPanelEvent() QApplication::setActiveWindow(&view); QTest::qWaitForWindowShown(&view); QTRY_COMPARE(QApplication::activeWindow(), static_cast(&view)); - QTest::mouseClick(view.viewport(), Qt::LeftButton, 0, view.mapFromScene(input.scenePos())); + + QVERIFY(input.showInputPanelOnFocus()); + QCOMPARE(ic.openInputPanelReceived, false); + QCOMPARE(ic.closeInputPanelReceived, false); + + // focus on press, input panel on focus + QTest::mousePress(view.viewport(), Qt::LeftButton, 0, view.mapFromScene(input.scenePos())); QApplication::processEvents(); - if (behavior == QStyle::RSIP_OnMouseClickAndAlreadyFocused) { - QCOMPARE(ic.softwareInputPanelEventReceived, false); - QTest::mouseClick(view.viewport(), Qt::LeftButton, 0, view.mapFromScene(input.scenePos())); - QApplication::processEvents(); - QCOMPARE(ic.softwareInputPanelEventReceived, true); - } else if (behavior == QStyle::RSIP_OnMouseClick) { - QCOMPARE(ic.softwareInputPanelEventReceived, true); - } + QCOMPARE(ic.openInputPanelReceived, true); + QCOMPARE(ic.closeInputPanelReceived, false); + ic.openInputPanelReceived = false; + + // no events on release + QTest::mouseRelease(view.viewport(), Qt::LeftButton, 0, view.mapFromScene(input.scenePos())); + QCOMPARE(ic.openInputPanelReceived, false); + QCOMPARE(ic.closeInputPanelReceived, false); + ic.openInputPanelReceived = false; + + // input panel closed on focus lost + input.setFocus(false); + QApplication::processEvents(); + QCOMPARE(ic.openInputPanelReceived, false); + QCOMPARE(ic.closeInputPanelReceived, true); + ic.closeInputPanelReceived = false; + + // no input panel events if showInputPanelOnFocus is false + input.setShowInputPanelOnFocus(false); + QCOMPARE(inputPanelonFocusSpy.count(),1); + QTest::mousePress(view.viewport(), Qt::LeftButton, 0, view.mapFromScene(input.scenePos())); + QTest::mouseRelease(view.viewport(), Qt::LeftButton, 0, view.mapFromScene(input.scenePos())); + input.setFocus(false); + input.setFocus(true); + QCOMPARE(ic.openInputPanelReceived, false); + QCOMPARE(ic.closeInputPanelReceived, false); + + input.setShowInputPanelOnFocus(false); + QCOMPARE(inputPanelonFocusSpy.count(),1); + + // one show input panel event when openSoftwareInputPanel is called + input.openSoftwareInputPanel(); + QCOMPARE(ic.openInputPanelReceived, true); + QCOMPARE(ic.closeInputPanelReceived, false); + ic.openInputPanelReceived = false; + + // one close input panel event when closeSoftwareInputPanel is called + input.closeSoftwareInputPanel(); + QCOMPARE(ic.openInputPanelReceived, false); + QCOMPARE(ic.closeInputPanelReceived, true); + ic.openInputPanelReceived = false; + + // set showInputPanelOnFocus back to true + input.setShowInputPanelOnFocus(true); + QCOMPARE(inputPanelonFocusSpy.count(),2); + input.setFocus(false); + QCOMPARE(ic.openInputPanelReceived, false); + QCOMPARE(ic.closeInputPanelReceived, true); + input.setFocus(true); + QCOMPARE(ic.openInputPanelReceived, true); + QCOMPARE(ic.closeInputPanelReceived, true); + + input.setShowInputPanelOnFocus(true); + QCOMPARE(inputPanelonFocusSpy.count(),2); } class MyTextInput : public QDeclarativeTextInput -- cgit v0.12 From 3e3a5a2a2eece6e0eff934c34f25c41699a45b78 Mon Sep 17 00:00:00 2001 From: Joona Petrell Date: Wed, 26 May 2010 13:35:53 +1000 Subject: Unify naming of import plugin targets Task-number: QTBUG-10834 Reviewed-by: Warwick Allison --- demos/declarative/minehunt/MinehuntCore/qmldir | 2 +- demos/declarative/minehunt/minehunt.pro | 6 +++--- .../cppextensions/imageprovider/ImageProviderCore/qmldir | 2 +- .../declarative/cppextensions/imageprovider/imageprovider.pro | 9 +++++++-- .../cppextensions/plugins/com/nokia/TimeExample/qmldir | 2 +- examples/declarative/cppextensions/plugins/plugin.cpp | 2 +- examples/declarative/cppextensions/plugins/plugins.pro | 2 +- examples/declarative/cppextensions/qwidgets/QWidgets/qmldir | 2 +- examples/declarative/cppextensions/qwidgets/qwidgets.cpp | 2 +- examples/declarative/cppextensions/qwidgets/qwidgets.pro | 10 ++++++++-- src/imports/gestures/gestures.pro | 4 ++-- src/imports/gestures/plugin.cpp | 2 +- src/imports/gestures/qmldir | 2 +- src/imports/particles/particles.cpp | 2 +- src/imports/particles/particles.pro | 4 ++-- src/imports/particles/qmldir | 2 +- src/imports/webkit/plugin.cpp | 2 +- src/imports/webkit/qmldir | 2 +- src/imports/webkit/webkit.pro | 4 ++-- 19 files changed, 37 insertions(+), 26 deletions(-) diff --git a/demos/declarative/minehunt/MinehuntCore/qmldir b/demos/declarative/minehunt/MinehuntCore/qmldir index 95bccc8..2beccf9 100644 --- a/demos/declarative/minehunt/MinehuntCore/qmldir +++ b/demos/declarative/minehunt/MinehuntCore/qmldir @@ -1,3 +1,3 @@ -plugin minehunt +plugin qmlminehuntplugin Explosion 1.0 Explosion.qml Tile 1.0 Tile.qml diff --git a/demos/declarative/minehunt/minehunt.pro b/demos/declarative/minehunt/minehunt.pro index 41640f5..91d02cf 100644 --- a/demos/declarative/minehunt/minehunt.pro +++ b/demos/declarative/minehunt/minehunt.pro @@ -1,5 +1,5 @@ TEMPLATE = lib -TARGET = minehunt +TARGET = qmlminehuntplugin QT += declarative CONFIG += qt plugin @@ -28,11 +28,11 @@ symbian:{ TARGET.EPOCALLOWDLLDATA = 1 include($$QT_SOURCE_TREE/demos/symbianpkgrules.pri) TARGET.CAPABILITY = NetworkServices ReadUserData - importFiles.sources = minehunt.dll \ + importFiles.sources = qmlminehuntplugin.dll \ MinehuntCore/Explosion.qml \ MinehuntCore/pics \ MinehuntCore/qmldir - importFiles.path = $$QT_IMPORTS_BASE_DIR/MinehuntCore + importFiles.path = MinehuntCore DEPLOYMENT = importFiles } diff --git a/examples/declarative/cppextensions/imageprovider/ImageProviderCore/qmldir b/examples/declarative/cppextensions/imageprovider/ImageProviderCore/qmldir index 1028590..6be88bc 100644 --- a/examples/declarative/cppextensions/imageprovider/ImageProviderCore/qmldir +++ b/examples/declarative/cppextensions/imageprovider/ImageProviderCore/qmldir @@ -1,2 +1,2 @@ -plugin imageprovider +plugin qmlimageproviderplugin diff --git a/examples/declarative/cppextensions/imageprovider/imageprovider.pro b/examples/declarative/cppextensions/imageprovider/imageprovider.pro index 462f7d9d..f218c30 100644 --- a/examples/declarative/cppextensions/imageprovider/imageprovider.pro +++ b/examples/declarative/cppextensions/imageprovider/imageprovider.pro @@ -3,7 +3,7 @@ CONFIG += qt plugin QT += declarative DESTDIR = ImageProviderCore -TARGET = imageprovider +TARGET = qmlimageproviderplugin SOURCES += imageprovider.cpp @@ -18,7 +18,12 @@ ImageProviderCore_sources.path = $$[QT_INSTALL_EXAMPLES]/declarative/imageprovid INSTALLS = sources ImageProviderCore_sources target -symbian { +symbian:{ + load(data_caging_paths) include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri) TARGET.EPOCALLOWDLLDATA = 1 + + importFiles.sources = qmlimageproviderplugin.dll ImageProviderCore/qmldir + importFiles.path = ImageProviderCore + DEPLOYMENT = importFiles } diff --git a/examples/declarative/cppextensions/plugins/com/nokia/TimeExample/qmldir b/examples/declarative/cppextensions/plugins/com/nokia/TimeExample/qmldir index e9ef115..e1288cf 100644 --- a/examples/declarative/cppextensions/plugins/com/nokia/TimeExample/qmldir +++ b/examples/declarative/cppextensions/plugins/com/nokia/TimeExample/qmldir @@ -1,2 +1,2 @@ Clock 1.0 Clock.qml -plugin qtimeexampleqmlplugin +plugin qmlqtimeexampleplugin diff --git a/examples/declarative/cppextensions/plugins/plugin.cpp b/examples/declarative/cppextensions/plugins/plugin.cpp index 2b1b320..355ca3f 100644 --- a/examples/declarative/cppextensions/plugins/plugin.cpp +++ b/examples/declarative/cppextensions/plugins/plugin.cpp @@ -148,4 +148,4 @@ public: #include "plugin.moc" -Q_EXPORT_PLUGIN2(qtimeexampleqmlplugin, QExampleQmlPlugin); +Q_EXPORT_PLUGIN2(qmlqtimeexampleplugin, QExampleQmlPlugin); diff --git a/examples/declarative/cppextensions/plugins/plugins.pro b/examples/declarative/cppextensions/plugins/plugins.pro index d37ff40..b7610a8 100644 --- a/examples/declarative/cppextensions/plugins/plugins.pro +++ b/examples/declarative/cppextensions/plugins/plugins.pro @@ -3,7 +3,7 @@ CONFIG += qt plugin QT += declarative DESTDIR = com/nokia/TimeExample -TARGET = qtimeexampleqmlplugin +TARGET = qmlqtimeexampleplugin SOURCES += plugin.cpp diff --git a/examples/declarative/cppextensions/qwidgets/QWidgets/qmldir b/examples/declarative/cppextensions/qwidgets/QWidgets/qmldir index e55267c..a7c1d95 100644 --- a/examples/declarative/cppextensions/qwidgets/QWidgets/qmldir +++ b/examples/declarative/cppextensions/qwidgets/QWidgets/qmldir @@ -1 +1 @@ -plugin proxywidgetsplugin +plugin qmlqwidgetsplugin diff --git a/examples/declarative/cppextensions/qwidgets/qwidgets.cpp b/examples/declarative/cppextensions/qwidgets/qwidgets.cpp index 228f9f1..47d3932 100644 --- a/examples/declarative/cppextensions/qwidgets/qwidgets.cpp +++ b/examples/declarative/cppextensions/qwidgets/qwidgets.cpp @@ -94,4 +94,4 @@ public: #include "qwidgets.moc" -Q_EXPORT_PLUGIN2(qwidgetsplugin, QWidgetsPlugin); +Q_EXPORT_PLUGIN2(qmlqwidgetsplugin, QWidgetsPlugin); diff --git a/examples/declarative/cppextensions/qwidgets/qwidgets.pro b/examples/declarative/cppextensions/qwidgets/qwidgets.pro index c5f8bcf..8d87804 100644 --- a/examples/declarative/cppextensions/qwidgets/qwidgets.pro +++ b/examples/declarative/cppextensions/qwidgets/qwidgets.pro @@ -3,7 +3,7 @@ CONFIG += qt plugin QT += declarative DESTDIR = QWidgets -TARGET = qwidgetsplugin +TARGET = qmlqwidgetsplugin SOURCES += qwidgets.cpp @@ -13,7 +13,13 @@ target.path += $$[QT_INSTALL_EXAMPLES]/declarative/plugins INSTALLS += sources target -symbian { +symbian:{ + load(data_caging_paths) include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri) TARGET.EPOCALLOWDLLDATA = 1 + + importFiles.sources = qmlqwidgetsplugin.dll QWidgets/qmldir + importFiles.path = QWidgets + + DEPLOYMENT = importFiles } diff --git a/src/imports/gestures/gestures.pro b/src/imports/gestures/gestures.pro index f55c00e..4ef7931 100644 --- a/src/imports/gestures/gestures.pro +++ b/src/imports/gestures/gestures.pro @@ -1,4 +1,4 @@ -TARGET = gesturesqmlplugin +TARGET = qmlgesturesplugin TARGETPATH = Qt/labs/gestures include(../qimportbase.pri) @@ -17,7 +17,7 @@ symbian:{ load(data_caging_paths) include($$QT_SOURCE_TREE/demos/symbianpkgrules.pri) - importFiles.sources = gesturesqmlplugin.dll qmldir + importFiles.sources = qmlgesturesplugin.dll qmldir importFiles.path = $$QT_IMPORTS_BASE_DIR/$$TARGETPATH DEPLOYMENT = importFiles diff --git a/src/imports/gestures/plugin.cpp b/src/imports/gestures/plugin.cpp index b8a9751..11f2392 100644 --- a/src/imports/gestures/plugin.cpp +++ b/src/imports/gestures/plugin.cpp @@ -61,5 +61,5 @@ QT_END_NAMESPACE #include "plugin.moc" -Q_EXPORT_PLUGIN2(gesturesqmlplugin, QT_PREPEND_NAMESPACE(GestureAreaQmlPlugin)); +Q_EXPORT_PLUGIN2(qmlgesturesplugin, QT_PREPEND_NAMESPACE(GestureAreaQmlPlugin)); diff --git a/src/imports/gestures/qmldir b/src/imports/gestures/qmldir index 9d9d587..2a31920 100644 --- a/src/imports/gestures/qmldir +++ b/src/imports/gestures/qmldir @@ -1 +1 @@ -plugin gesturesqmlplugin +plugin qmlgesturesplugin diff --git a/src/imports/particles/particles.cpp b/src/imports/particles/particles.cpp index ae3f318..ca2b060 100644 --- a/src/imports/particles/particles.cpp +++ b/src/imports/particles/particles.cpp @@ -65,5 +65,5 @@ QT_END_NAMESPACE #include "particles.moc" -Q_EXPORT_PLUGIN2(particlesqmlmodule, QT_PREPEND_NAMESPACE(QParticlesQmlModule)); +Q_EXPORT_PLUGIN2(qmlparticlesplugin, QT_PREPEND_NAMESPACE(QParticlesQmlModule)); diff --git a/src/imports/particles/particles.pro b/src/imports/particles/particles.pro index 79ac543..9fd4db5 100644 --- a/src/imports/particles/particles.pro +++ b/src/imports/particles/particles.pro @@ -1,4 +1,4 @@ -TARGET = particles +TARGET = qmlparticlesplugin TARGETPATH = Qt/labs/particles include(../qimportbase.pri) @@ -21,7 +21,7 @@ symbian:{ load(data_caging_paths) include($$QT_SOURCE_TREE/demos/symbianpkgrules.pri) - importFiles.sources = particles.dll qmldir + importFiles.sources = qmlparticlesplugin.dll qmldir importFiles.path = $$QT_IMPORTS_BASE_DIR/$$TARGETPATH DEPLOYMENT = importFiles diff --git a/src/imports/particles/qmldir b/src/imports/particles/qmldir index 15456bb..aeebd2c 100644 --- a/src/imports/particles/qmldir +++ b/src/imports/particles/qmldir @@ -1 +1 @@ -plugin particles +plugin qmlparticlesplugin diff --git a/src/imports/webkit/plugin.cpp b/src/imports/webkit/plugin.cpp index e3d73ec..c8e56ba 100644 --- a/src/imports/webkit/plugin.cpp +++ b/src/imports/webkit/plugin.cpp @@ -63,5 +63,5 @@ QT_END_NAMESPACE #include "plugin.moc" -Q_EXPORT_PLUGIN2(webkitqmlplugin, QT_PREPEND_NAMESPACE(WebKitQmlPlugin)); +Q_EXPORT_PLUGIN2(qmlwebkitplugin, QT_PREPEND_NAMESPACE(WebKitQmlPlugin)); diff --git a/src/imports/webkit/qmldir b/src/imports/webkit/qmldir index 258aa2c..dcfdd06 100644 --- a/src/imports/webkit/qmldir +++ b/src/imports/webkit/qmldir @@ -1 +1 @@ -plugin webkitqmlplugin +plugin qmlwebkitplugin diff --git a/src/imports/webkit/webkit.pro b/src/imports/webkit/webkit.pro index 77cbc4d..7b2ac66 100644 --- a/src/imports/webkit/webkit.pro +++ b/src/imports/webkit/webkit.pro @@ -1,4 +1,4 @@ -TARGET = webkitqmlplugin +TARGET = qmlwebkitplugin TARGETPATH = org/webkit include(../qimportbase.pri) @@ -18,7 +18,7 @@ symbian:{ load(data_caging_paths) include($$QT_SOURCE_TREE/demos/symbianpkgrules.pri) - importFiles.sources = webkitqmlplugin.dll qmldir + importFiles.sources = qmlwebkitplugin.dll qmldir importFiles.path = $$QT_IMPORTS_BASE_DIR/$$TARGETPATH DEPLOYMENT = importFiles -- cgit v0.12 From dc08c8bc7aba55ff4762d70b193a053ad210fb60 Mon Sep 17 00:00:00 2001 From: Joona Petrell Date: Wed, 26 May 2010 14:31:08 +1000 Subject: Fix for qml reloaded in qml viewer not being maximized properly on a device Task-number: Reviewed-by: Martin Jones --- tools/qml/qmlruntime.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tools/qml/qmlruntime.cpp b/tools/qml/qmlruntime.cpp index 5308e98..fe323c1 100644 --- a/tools/qml/qmlruntime.cpp +++ b/tools/qml/qmlruntime.cpp @@ -808,7 +808,9 @@ void QDeclarativeViewer::statusChanged() initialSize = canvas->sizeHint(); if (canvas->resizeMode() == QDeclarativeView::SizeRootObjectToView) { updateSizeHints(); - resize(QSize(initialSize.width(), initialSize.height()+menuBarHeight())); + if (!isFullScreen() && !isMaximized()) { + resize(QSize(initialSize.width(), initialSize.height()+menuBarHeight())); + } } } } -- cgit v0.12 From e9a25332df933227c6b71a1654260d8421f56415 Mon Sep 17 00:00:00 2001 From: Warwick Allison Date: Wed, 26 May 2010 15:15:45 +1000 Subject: Fix TextEdit clipping when not wrapped. Rename most-useful-wrap-mode to "Wrap". --- .../twitter/TwitterCore/HomeTitleBar.qml | 2 +- doc/src/snippets/declarative/texteditor.qml | 8 ++-- .../graphicsitems/qdeclarativepainteditem.cpp | 17 ++++++-- .../graphicsitems/qdeclarativepainteditem_p.h | 1 + src/declarative/graphicsitems/qdeclarativetext.cpp | 37 ++++++++++++++---- src/declarative/graphicsitems/qdeclarativetext_p.h | 9 ++++- .../graphicsitems/qdeclarativetextedit.cpp | 45 +++++++++++++++++----- .../graphicsitems/qdeclarativetextedit_p.h | 9 ++++- .../qmlvisual/qdeclarativetext/font/plaintext.qml | 2 +- .../qmlvisual/qdeclarativetext/font/richtext.qml | 2 +- .../qmlvisual/qdeclarativetextedit/wrap.qml | 2 +- 11 files changed, 104 insertions(+), 30 deletions(-) diff --git a/demos/declarative/twitter/TwitterCore/HomeTitleBar.qml b/demos/declarative/twitter/TwitterCore/HomeTitleBar.qml index 2eaa40c..3828a40 100644 --- a/demos/declarative/twitter/TwitterCore/HomeTitleBar.qml +++ b/demos/declarative/twitter/TwitterCore/HomeTitleBar.qml @@ -129,7 +129,7 @@ Item { width: parent.width - 12 height: parent.height - 8 font.pointSize: 10 - wrapMode: TextEdit.WrapAtWordBoundaryOrAnywhere + wrapMode: TextEdit.Wrap color: "#151515"; selectionColor: "green" } Keys.forwardTo: [(returnKey), (editor)] diff --git a/doc/src/snippets/declarative/texteditor.qml b/doc/src/snippets/declarative/texteditor.qml index 0bd79b5..6735c6c 100644 --- a/doc/src/snippets/declarative/texteditor.qml +++ b/doc/src/snippets/declarative/texteditor.qml @@ -45,7 +45,8 @@ Flickable { id: flick width: 300; height: 200; - contentHeight: edit.height + contentWidth: edit.paintedWidth + contentHeight: edit.paintedHeight clip: true function ensureVisible(r) @@ -62,9 +63,10 @@ Flickable { TextEdit { id: edit - width: parent.width + width: flick.width + height: flick.height focus: true - wrapMode: TextEdit.WrapAtWordBoundaryOrAnywhere + wrapMode: TextEdit.Wrap onCursorRectangleChanged: flick.ensureVisible(cursorRectangle) } } diff --git a/src/declarative/graphicsitems/qdeclarativepainteditem.cpp b/src/declarative/graphicsitems/qdeclarativepainteditem.cpp index c4f0b86..13d1b61 100644 --- a/src/declarative/graphicsitems/qdeclarativepainteditem.cpp +++ b/src/declarative/graphicsitems/qdeclarativepainteditem.cpp @@ -152,8 +152,6 @@ void QDeclarativePaintedItem::setContentsSize(const QSize &size) Q_D(QDeclarativePaintedItem); if (d->contentsSize == size) return; d->contentsSize = size; - setImplicitWidth(size.width()*d->contentsScale); - setImplicitHeight(size.height()*d->contentsScale); clearCache(); update(); emit contentsSizeChanged(); @@ -170,8 +168,6 @@ void QDeclarativePaintedItem::setContentsScale(qreal scale) Q_D(QDeclarativePaintedItem); if (d->contentsScale == scale) return; d->contentsScale = scale; - setImplicitWidth(d->contentsSize.width()*scale); - setImplicitHeight(d->contentsSize.height()*scale); clearCache(); update(); emit contentsScaleChanged(); @@ -232,6 +228,19 @@ void QDeclarativePaintedItem::setCacheFrozen(bool frozen) // XXX clear cache? } +QRectF QDeclarativePaintedItem::boundingRect() const +{ + Q_D(const QDeclarativePaintedItem); + qreal w = d->mWidth; + QSizeF sz = d->contentsSize * d->contentsScale; + if (w < sz.width()) + w = sz.width(); + qreal h = d->mHeight; + if (h < sz.height()) + h = sz.height(); + return QRectF(0.0,0.0,w,h); +} + /*! \internal */ diff --git a/src/declarative/graphicsitems/qdeclarativepainteditem_p.h b/src/declarative/graphicsitems/qdeclarativepainteditem_p.h index 8d08ba2..86f065a 100644 --- a/src/declarative/graphicsitems/qdeclarativepainteditem_p.h +++ b/src/declarative/graphicsitems/qdeclarativepainteditem_p.h @@ -93,6 +93,7 @@ protected: const QVariant &value); void setCacheFrozen(bool); + QRectF boundingRect() const; Q_SIGNALS: void fillColorChanged(); diff --git a/src/declarative/graphicsitems/qdeclarativetext.cpp b/src/declarative/graphicsitems/qdeclarativetext.cpp index 4e7e0fd..2c1eb67 100644 --- a/src/declarative/graphicsitems/qdeclarativetext.cpp +++ b/src/declarative/graphicsitems/qdeclarativetext.cpp @@ -499,13 +499,10 @@ void QDeclarativeText::setVAlign(VAlignment align) wrap if an explicit width has been set. wrapMode can be one of: \list - \o Text.NoWrap - no wrapping will be performed. - \o Text.WordWrap - wrapping is done on word boundaries. If the text cannot be - word-wrapped to the specified width it will be partially drawn outside of the item's bounds. - If this is undesirable then enable clipping on the item (Item::clip). - \o Text.WrapAnywhere - Text can be wrapped at any point on a line, even if it occurs in the middle of a word. - \o Text.WrapAtWordBoundaryOrAnywhere - If possible, wrapping occurs at a word boundary; otherwise it - will occur at the appropriate point on the line, even in the middle of a word. + \o Text.NoWrap - no wrapping will be performed. If the text contains insufficient newlines, then implicitWidth will exceed a set width. + \o Text.WordWrap - wrapping is done on word boundaries only. If a word is too long, implicitWidth will exceed a set width. + \o Text.WrapAnywhere - wrapping is done at any point on a line, even if it occurs in the middle of a word. + \o Text.Wrap - if possible, wrapping occurs at a word boundary; otherwise it will occur at the appropriate point on the line, even in the middle of a word. \endlist The default is Text.NoWrap. @@ -715,6 +712,7 @@ void QDeclarativeTextPrivate::updateSize() QFontMetrics fm(font); if (text.isEmpty()) { q->setImplicitHeight(fm.height()); + emit q->paintedSizeChanged(); return; } @@ -753,11 +751,36 @@ void QDeclarativeTextPrivate::updateSize() //### need to comfirm cost of always setting these for richText q->setImplicitWidth(richText ? (int)doc->idealWidth() : size.width()); q->setImplicitHeight(richText ? (int)doc->size().height() : size.height()); + emit q->paintedSizeChanged(); } else { dirty = true; } } +/*! + \qmlproperty real Text::paintedWidth + + Returns the width of the text, including width past the width + which is covered due to insufficient wrapping if WrapMode is set. +*/ +qreal QDeclarativeText::paintedWidth() const +{ + return implicitWidth(); +} + +/*! + \qmlproperty real Text::paintedHeight + + Returns the height of the text, including height past the height + which is covered due to there being more text than fits in the set height. +*/ +qreal QDeclarativeText::paintedHeight() const +{ + return implicitHeight(); +} + + + // ### text layout handling should be profiled and optimized as needed // what about QStackTextEngine engine(tmp, d->font.font()); QTextLayout textLayout(&engine); diff --git a/src/declarative/graphicsitems/qdeclarativetext_p.h b/src/declarative/graphicsitems/qdeclarativetext_p.h index 00ce126..db21140 100644 --- a/src/declarative/graphicsitems/qdeclarativetext_p.h +++ b/src/declarative/graphicsitems/qdeclarativetext_p.h @@ -71,6 +71,8 @@ class Q_DECLARATIVE_EXPORT QDeclarativeText : public QDeclarativeItem Q_PROPERTY(WrapMode wrapMode READ wrapMode WRITE setWrapMode NOTIFY wrapModeChanged) Q_PROPERTY(TextFormat textFormat READ textFormat WRITE setTextFormat NOTIFY textFormatChanged) Q_PROPERTY(TextElideMode elide READ elideMode WRITE setElideMode NOTIFY elideModeChanged) //### elideMode? + Q_PROPERTY(qreal paintedWidth READ paintedWidth NOTIFY paintedSizeChanged) + Q_PROPERTY(qreal paintedHeight READ paintedHeight NOTIFY paintedSizeChanged) public: QDeclarativeText(QDeclarativeItem *parent=0); @@ -98,7 +100,8 @@ public: enum WrapMode { NoWrap = QTextOption::NoWrap, WordWrap = QTextOption::WordWrap, WrapAnywhere = QTextOption::WrapAnywhere, - WrapAtWordBoundaryOrAnywhere = QTextOption::WrapAtWordBoundaryOrAnywhere + WrapAtWordBoundaryOrAnywhere = QTextOption::WrapAtWordBoundaryOrAnywhere, // COMPAT + Wrap = QTextOption::WrapAtWordBoundaryOrAnywhere }; QString text() const; @@ -137,6 +140,9 @@ public: int resourcesLoading() const; // mainly for testing + qreal paintedWidth() const; + qreal paintedHeight() const; + Q_SIGNALS: void textChanged(const QString &text); void linkActivated(const QString &link); @@ -149,6 +155,7 @@ Q_SIGNALS: void wrapModeChanged(); void textFormatChanged(TextFormat textFormat); void elideModeChanged(TextElideMode mode); + void paintedSizeChanged(); protected: void mousePressEvent(QGraphicsSceneMouseEvent *event); diff --git a/src/declarative/graphicsitems/qdeclarativetextedit.cpp b/src/declarative/graphicsitems/qdeclarativetextedit.cpp index a154d53..f105171 100644 --- a/src/declarative/graphicsitems/qdeclarativetextedit.cpp +++ b/src/declarative/graphicsitems/qdeclarativetextedit.cpp @@ -484,14 +484,13 @@ void QDeclarativeTextEdit::setVAlign(QDeclarativeTextEdit::VAlignment alignment) The text will only wrap if an explicit width has been set. \list - \o TextEdit.NoWrap - no wrapping will be performed. - \o TextEdit.WordWrap - wrapping is done on word boundaries. - \o TextEdit.WrapAnywhere - Text can be wrapped at any point on a line, even if it occurs in the middle of a word. - \o TextEdit.WrapAtWordBoundaryOrAnywhere - If possible, wrapping occurs at a word boundary; otherwise it - will occur at the appropriate point on the line, even in the middle of a word. + \o TextEdit.NoWrap - no wrapping will be performed. If the text contains insufficient newlines, then implicitWidth will exceed a set width. + \o TextEdit.WordWrap - wrapping is done on word boundaries only. If a word is too long, implicitWidth will exceed a set width. + \o TextEdit.WrapAnywhere - wrapping is done at any point on a line, even if it occurs in the middle of a word. + \o TextEdit.Wrap - if possible, wrapping occurs at a word boundary; otherwise it will occur at the appropriate point on the line, even in the middle of a word. \endlist - The default is TextEdit.NoWrap. + The default is TextEdit.NoWrap. If you set a width, consider using TextEdit.Wrap. */ QDeclarativeTextEdit::WrapMode QDeclarativeTextEdit::wrapMode() const { @@ -511,6 +510,29 @@ void QDeclarativeTextEdit::setWrapMode(WrapMode mode) } /*! + \qmlproperty real TextEdit::paintedWidth + + Returns the width of the text, including width past the width + which is covered due to insufficient wrapping if WrapMode is set. +*/ +qreal QDeclarativeTextEdit::paintedWidth() const +{ + return implicitWidth(); +} + +/*! + \qmlproperty real TextEdit::paintedHeight + + Returns the height of the text, including height past the height + which is covered due to there being more text than fits in the set height. +*/ +qreal QDeclarativeTextEdit::paintedHeight() const +{ + return implicitHeight(); +} + + +/*! \qmlproperty bool TextEdit::cursorVisible If true the text edit shows a cursor. @@ -1156,7 +1178,7 @@ void QDeclarativeTextEdit::updateSize() int dy = height(); // ### assumes that if the width is set, the text will fill to edges // ### (unless wrap is false, then clipping will occur) - if (widthValid()) + if (widthValid() && d->document->textWidth() != width()) d->document->setTextWidth(width()); dy -= (int)d->document->size().height(); @@ -1172,7 +1194,7 @@ void QDeclarativeTextEdit::updateSize() //### need to comfirm cost of always setting these int newWidth = qCeil(d->document->idealWidth()); - if (!widthValid()) + if (!widthValid() && d->document->textWidth() != newWidth) d->document->setTextWidth(newWidth); // ### Text does not align if width is not set (QTextDoc bug) int cursorWidth = 1; if(d->cursor) @@ -1182,9 +1204,12 @@ void QDeclarativeTextEdit::updateSize() newWidth += 3;// ### Need a better way of accounting for space between char and cursor // ### Setting the implicitWidth triggers another updateSize(), and unless there are bindings nothing has changed. setImplicitWidth(newWidth); - setImplicitHeight(d->document->isEmpty() ? fm.height() : (int)d->document->size().height()); + qreal newHeight = d->document->isEmpty() ? fm.height() : (int)d->document->size().height(); + setImplicitHeight(newHeight); + + setContentsSize(QSize(newWidth, newHeight)); - setContentsSize(QSize(width(), height())); + emit paintedSizeChanged(); } else { d->dirty = true; } diff --git a/src/declarative/graphicsitems/qdeclarativetextedit_p.h b/src/declarative/graphicsitems/qdeclarativetextedit_p.h index 891b868..51bb974 100644 --- a/src/declarative/graphicsitems/qdeclarativetextedit_p.h +++ b/src/declarative/graphicsitems/qdeclarativetextedit_p.h @@ -74,6 +74,8 @@ class Q_DECLARATIVE_EXPORT QDeclarativeTextEdit : public QDeclarativePaintedItem Q_PROPERTY(HAlignment horizontalAlignment READ hAlign WRITE setHAlign NOTIFY horizontalAlignmentChanged) Q_PROPERTY(VAlignment verticalAlignment READ vAlign WRITE setVAlign NOTIFY verticalAlignmentChanged) Q_PROPERTY(WrapMode wrapMode READ wrapMode WRITE setWrapMode NOTIFY wrapModeChanged) + Q_PROPERTY(qreal paintedWidth READ paintedWidth NOTIFY paintedSizeChanged) + Q_PROPERTY(qreal paintedHeight READ paintedHeight NOTIFY paintedSizeChanged) Q_PROPERTY(TextFormat textFormat READ textFormat WRITE setTextFormat NOTIFY textFormatChanged) Q_PROPERTY(bool readOnly READ isReadOnly WRITE setReadOnly NOTIFY readOnlyChanged) Q_PROPERTY(bool cursorVisible READ isCursorVisible WRITE setCursorVisible NOTIFY cursorVisibleChanged) @@ -113,7 +115,8 @@ public: enum WrapMode { NoWrap = QTextOption::NoWrap, WordWrap = QTextOption::WordWrap, WrapAnywhere = QTextOption::WrapAnywhere, - WrapAtWordBoundaryOrAnywhere = QTextOption::WrapAtWordBoundaryOrAnywhere + WrapAtWordBoundaryOrAnywhere = QTextOption::WrapAtWordBoundaryOrAnywhere, // COMPAT + Wrap = QTextOption::WrapAtWordBoundaryOrAnywhere }; QString text() const; @@ -185,8 +188,12 @@ public: QVariant inputMethodQuery(Qt::InputMethodQuery property) const; + qreal paintedWidth() const; + qreal paintedHeight() const; + Q_SIGNALS: void textChanged(const QString &); + void paintedSizeChanged(); void cursorPositionChanged(); void cursorRectangleChanged(); void selectionStartChanged(); diff --git a/tests/auto/declarative/qmlvisual/qdeclarativetext/font/plaintext.qml b/tests/auto/declarative/qmlvisual/qdeclarativetext/font/plaintext.qml index d948e4a..73dd4d7 100644 --- a/tests/auto/declarative/qmlvisual/qdeclarativetext/font/plaintext.qml +++ b/tests/auto/declarative/qmlvisual/qdeclarativetext/font/plaintext.qml @@ -85,7 +85,7 @@ Rectangle { text: s.text + " thisisaverylongstringwithnospaces"; width: 150; wrapMode: Text.WrapAnywhere } Text { - text: s.text + " thisisaverylongstringwithnospaces"; width: 150; wrapMode: Text.WrapAtWordBoundaryOrAnywhere + text: s.text + " thisisaverylongstringwithnospaces"; width: 150; wrapMode: Text.Wrap } } } diff --git a/tests/auto/declarative/qmlvisual/qdeclarativetext/font/richtext.qml b/tests/auto/declarative/qmlvisual/qdeclarativetext/font/richtext.qml index d10cfd3..b41b93a 100644 --- a/tests/auto/declarative/qmlvisual/qdeclarativetext/font/richtext.qml +++ b/tests/auto/declarative/qmlvisual/qdeclarativetext/font/richtext.qml @@ -85,7 +85,7 @@ Rectangle { text: s.text + " thisisaverylongstringwithnospaces"; width: 150; wrapMode: Text.WrapAnywhere } Text { - text: s.text + " thisisaverylongstringwithnospaces"; width: 150; wrapMode: Text.WrapAtWordBoundaryOrAnywhere + text: s.text + " thisisaverylongstringwithnospaces"; width: 150; wrapMode: Text.Wrap } } } diff --git a/tests/auto/declarative/qmlvisual/qdeclarativetextedit/wrap.qml b/tests/auto/declarative/qmlvisual/qdeclarativetextedit/wrap.qml index abb4464..a1dc5bf 100644 --- a/tests/auto/declarative/qmlvisual/qdeclarativetextedit/wrap.qml +++ b/tests/auto/declarative/qmlvisual/qdeclarativetextedit/wrap.qml @@ -27,7 +27,7 @@ Item { TextEdit { width: 150 height: 100 - wrapMode: TextEdit.WrapAtWordBoundaryOrAnywhere + wrapMode: TextEdit.Wrap text: "This is a test that text edit wraps correctly. thisisaverylongstringwithnospaces" y:300 } -- cgit v0.12 From ef2bc487ab9b66e052920b671e947abc4a6d8ef4 Mon Sep 17 00:00:00 2001 From: Yann Bodson Date: Wed, 26 May 2010 14:28:23 +1000 Subject: Fix horizontal/verticalCenter anchors bug. Task-number: QTBUG-10999 Reviewed-by: Michael Brasser --- .../graphicsitems/qdeclarativeanchors.cpp | 34 +++++++++++----------- .../graphicsitems/qdeclarativeanchors_p_p.h | 2 +- .../qdeclarativeanchors/data/hvCenter.qml | 11 +++++++ .../tst_qdeclarativeanchors.cpp | 14 +++++++++ 4 files changed, 43 insertions(+), 18 deletions(-) create mode 100644 tests/auto/declarative/qdeclarativeanchors/data/hvCenter.qml diff --git a/src/declarative/graphicsitems/qdeclarativeanchors.cpp b/src/declarative/graphicsitems/qdeclarativeanchors.cpp index ef07cbb..aa53aba 100644 --- a/src/declarative/graphicsitems/qdeclarativeanchors.cpp +++ b/src/declarative/graphicsitems/qdeclarativeanchors.cpp @@ -92,17 +92,17 @@ static qreal position(QGraphicsObject *item, QDeclarativeAnchorLine::AnchorLine //position when origin is 0,0 static qreal adjustedPosition(QGraphicsObject *item, QDeclarativeAnchorLine::AnchorLine anchorLine) { - int ret = 0; + qreal ret = 0.0; QGraphicsItemPrivate *d = QGraphicsItemPrivate::get(item); switch(anchorLine) { case QDeclarativeAnchorLine::Left: - ret = 0; + ret = 0.0; break; case QDeclarativeAnchorLine::Right: ret = d->width(); break; case QDeclarativeAnchorLine::Top: - ret = 0; + ret = 0.0; break; case QDeclarativeAnchorLine::Bottom: ret = d->height(); @@ -459,10 +459,10 @@ void QDeclarativeAnchors::resetCenterIn() bool QDeclarativeAnchorsPrivate::calcStretch(const QDeclarativeAnchorLine &edge1, const QDeclarativeAnchorLine &edge2, - int offset1, - int offset2, + qreal offset1, + qreal offset2, QDeclarativeAnchorLine::AnchorLine line, - int &stretch) + qreal &stretch) { bool edge1IsParent = (edge1.item == item->parentItem()); bool edge2IsParent = (edge2.item == item->parentItem()); @@ -471,15 +471,15 @@ bool QDeclarativeAnchorsPrivate::calcStretch(const QDeclarativeAnchorLine &edge1 bool invalid = false; if ((edge2IsParent && edge1IsParent) || (edge2IsSibling && edge1IsSibling)) { - stretch = ((int)position(edge2.item, edge2.anchorLine) + offset2) - - ((int)position(edge1.item, edge1.anchorLine) + offset1); + stretch = (position(edge2.item, edge2.anchorLine) + offset2) + - (position(edge1.item, edge1.anchorLine) + offset1); } else if (edge2IsParent && edge1IsSibling) { - stretch = ((int)position(edge2.item, edge2.anchorLine) + offset2) - - ((int)position(item->parentObject(), line) - + (int)position(edge1.item, edge1.anchorLine) + offset1); + stretch = (position(edge2.item, edge2.anchorLine) + offset2) + - (position(item->parentObject(), line) + + position(edge1.item, edge1.anchorLine) + offset1); } else if (edge2IsSibling && edge1IsParent) { - stretch = ((int)position(item->parentObject(), line) + (int)position(edge2.item, edge2.anchorLine) + offset2) - - ((int)position(edge1.item, edge1.anchorLine) + offset1); + stretch = (position(item->parentObject(), line) + position(edge2.item, edge2.anchorLine) + offset2) + - (position(edge1.item, edge1.anchorLine) + offset1); } else invalid = true; @@ -497,7 +497,7 @@ void QDeclarativeAnchorsPrivate::updateVerticalAnchors() if (usedAnchors & QDeclarativeAnchors::TopAnchor) { //Handle stretching bool invalid = true; - int height = 0; + qreal height = 0.0; if (usedAnchors & QDeclarativeAnchors::BottomAnchor) { invalid = calcStretch(top, bottom, topMargin, -bottomMargin, QDeclarativeAnchorLine::Top, height); } else if (usedAnchors & QDeclarativeAnchors::VCenterAnchor) { @@ -516,7 +516,7 @@ void QDeclarativeAnchorsPrivate::updateVerticalAnchors() } else if (usedAnchors & QDeclarativeAnchors::BottomAnchor) { //Handle stretching (top + bottom case is handled above) if (usedAnchors & QDeclarativeAnchors::VCenterAnchor) { - int height = 0; + qreal height = 0.0; bool invalid = calcStretch(vCenter, bottom, vCenterOffset, -bottomMargin, QDeclarativeAnchorLine::Top, height); if (!invalid) @@ -569,7 +569,7 @@ void QDeclarativeAnchorsPrivate::updateHorizontalAnchors() if (usedAnchors & QDeclarativeAnchors::LeftAnchor) { //Handle stretching bool invalid = true; - int width = 0; + qreal width = 0.0; if (usedAnchors & QDeclarativeAnchors::RightAnchor) { invalid = calcStretch(left, right, leftMargin, -rightMargin, QDeclarativeAnchorLine::Left, width); } else if (usedAnchors & QDeclarativeAnchors::HCenterAnchor) { @@ -588,7 +588,7 @@ void QDeclarativeAnchorsPrivate::updateHorizontalAnchors() } else if (usedAnchors & QDeclarativeAnchors::RightAnchor) { //Handle stretching (left + right case is handled in updateLeftAnchor) if (usedAnchors & QDeclarativeAnchors::HCenterAnchor) { - int width = 0; + qreal width = 0.0; bool invalid = calcStretch(hCenter, right, hCenterOffset, -rightMargin, QDeclarativeAnchorLine::Left, width); if (!invalid) diff --git a/src/declarative/graphicsitems/qdeclarativeanchors_p_p.h b/src/declarative/graphicsitems/qdeclarativeanchors_p_p.h index 05be6c5..1bbea36 100644 --- a/src/declarative/graphicsitems/qdeclarativeanchors_p_p.h +++ b/src/declarative/graphicsitems/qdeclarativeanchors_p_p.h @@ -131,7 +131,7 @@ public: bool checkVValid() const; bool checkHAnchorValid(QDeclarativeAnchorLine anchor) const; bool checkVAnchorValid(QDeclarativeAnchorLine anchor) const; - bool calcStretch(const QDeclarativeAnchorLine &edge1, const QDeclarativeAnchorLine &edge2, int offset1, int offset2, QDeclarativeAnchorLine::AnchorLine line, int &stretch); + bool calcStretch(const QDeclarativeAnchorLine &edge1, const QDeclarativeAnchorLine &edge2, qreal offset1, qreal offset2, QDeclarativeAnchorLine::AnchorLine line, qreal &stretch); void updateHorizontalAnchors(); void updateVerticalAnchors(); diff --git a/tests/auto/declarative/qdeclarativeanchors/data/hvCenter.qml b/tests/auto/declarative/qdeclarativeanchors/data/hvCenter.qml new file mode 100644 index 0000000..7cd4f26 --- /dev/null +++ b/tests/auto/declarative/qdeclarativeanchors/data/hvCenter.qml @@ -0,0 +1,11 @@ +import Qt 4.7 + +Rectangle { + width: 77; height: 95 + Rectangle { + objectName: "centered" + width: 57; height: 57; color: "blue" + anchors.verticalCenter: parent.verticalCenter + anchors.horizontalCenter: parent.horizontalCenter + } +} diff --git a/tests/auto/declarative/qdeclarativeanchors/tst_qdeclarativeanchors.cpp b/tests/auto/declarative/qdeclarativeanchors/tst_qdeclarativeanchors.cpp index e169fa2..22f7966 100644 --- a/tests/auto/declarative/qdeclarativeanchors/tst_qdeclarativeanchors.cpp +++ b/tests/auto/declarative/qdeclarativeanchors/tst_qdeclarativeanchors.cpp @@ -77,6 +77,7 @@ private slots: void nullItem_data(); void crash1(); void centerIn(); + void hvCenter(); void fill(); void margins(); }; @@ -526,6 +527,19 @@ void tst_qdeclarativeanchors::centerIn() delete view; } +void tst_qdeclarativeanchors::hvCenter() +{ + QDeclarativeView *view = new QDeclarativeView(QUrl::fromLocalFile(SRCDIR "/data/hvCenter.qml")); + + qApp->processEvents(); + QDeclarativeRectangle* rect = findItem(view->rootObject(), QLatin1String("centered")); + QDeclarativeItemPrivate *rectPrivate = QDeclarativeItemPrivate::get(rect); + // test QTBUG-10999 + QCOMPARE(rect->x(), 10.0); + QCOMPARE(rect->y(), 19.0); + delete view; +} + void tst_qdeclarativeanchors::margins() { QDeclarativeView *view = new QDeclarativeView(QUrl::fromLocalFile(SRCDIR "/data/margins.qml")); -- cgit v0.12 From 1256a212460438462367b48de086ab690f722be5 Mon Sep 17 00:00:00 2001 From: Joona Petrell Date: Wed, 26 May 2010 16:26:19 +1000 Subject: Open input panel on press if TextInput or TextEdit are already focused but panel has been closed Task-number: Reviewed-by: Martin Jones --- src/declarative/graphicsitems/qdeclarativetextedit.cpp | 5 +++++ src/declarative/graphicsitems/qdeclarativetextinput.cpp | 5 +++++ .../qdeclarativetextedit/tst_qdeclarativetextedit.cpp | 9 +++++++++ .../qdeclarativetextinput/tst_qdeclarativetextinput.cpp | 9 +++++++++ 4 files changed, 28 insertions(+) diff --git a/src/declarative/graphicsitems/qdeclarativetextedit.cpp b/src/declarative/graphicsitems/qdeclarativetextedit.cpp index 348a8bd..167db77 100644 --- a/src/declarative/graphicsitems/qdeclarativetextedit.cpp +++ b/src/declarative/graphicsitems/qdeclarativetextedit.cpp @@ -963,6 +963,7 @@ void QDeclarativeTextEdit::mousePressEvent(QGraphicsSceneMouseEvent *event) { Q_D(QDeclarativeTextEdit); if (d->focusOnPress){ + bool hadFocus = hasFocus(); QGraphicsItem *p = parentItem();//###Is there a better way to find my focus scope? while(p) { if (p->flags() & QGraphicsItem::ItemIsFocusScope) @@ -970,6 +971,10 @@ void QDeclarativeTextEdit::mousePressEvent(QGraphicsSceneMouseEvent *event) p = p->parentItem(); } setFocus(true); + if (hasFocus() == hadFocus && d->showInputPanelOnFocus && !isReadOnly()) { + // re-open input panel on press if already focused + openSoftwareInputPanel(); + } } if (event->type() != QEvent::GraphicsSceneMouseDoubleClick || d->selectByMouse) d->control->processEvent(event, QPointF(0, -d->yoff)); diff --git a/src/declarative/graphicsitems/qdeclarativetextinput.cpp b/src/declarative/graphicsitems/qdeclarativetextinput.cpp index 47cd110..18e3595 100644 --- a/src/declarative/graphicsitems/qdeclarativetextinput.cpp +++ b/src/declarative/graphicsitems/qdeclarativetextinput.cpp @@ -887,6 +887,7 @@ void QDeclarativeTextInput::mousePressEvent(QGraphicsSceneMouseEvent *event) { Q_D(QDeclarativeTextInput); if(d->focusOnPress){ + bool hadFocus = hasFocus(); QGraphicsItem *p = parentItem();//###Is there a better way to find my focus scope? while(p) { if (p->flags() & QGraphicsItem::ItemIsFocusScope) @@ -894,6 +895,10 @@ void QDeclarativeTextInput::mousePressEvent(QGraphicsSceneMouseEvent *event) p = p->parentItem(); } setFocus(true); + if (hasFocus() == hadFocus && d->showInputPanelOnFocus && !isReadOnly()) { + // re-open input panel on press w already focused + openSoftwareInputPanel(); + } } bool mark = event->modifiers() & Qt::ShiftModifier; diff --git a/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp b/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp index 2b6f2aa..0df28d0 100644 --- a/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp +++ b/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp @@ -858,6 +858,7 @@ void tst_qdeclarativetextedit::sendRequestSoftwareInputPanelEvent() // focus on press, input panel on focus QTest::mousePress(view.viewport(), Qt::LeftButton, 0, view.mapFromScene(edit.scenePos())); QApplication::processEvents(); + QVERIFY(edit.hasFocus()); QCOMPARE(ic.openInputPanelReceived, true); QCOMPARE(ic.closeInputPanelReceived, false); ic.openInputPanelReceived = false; @@ -868,6 +869,14 @@ void tst_qdeclarativetextedit::sendRequestSoftwareInputPanelEvent() QCOMPARE(ic.closeInputPanelReceived, false); ic.openInputPanelReceived = false; + // Even with focus already gained, user needs + // to be able to open panel by pressing on the editor + QTest::mousePress(view.viewport(), Qt::LeftButton, 0, view.mapFromScene(edit.scenePos())); + QApplication::processEvents(); + QCOMPARE(ic.openInputPanelReceived, true); + QCOMPARE(ic.closeInputPanelReceived, false); + ic.openInputPanelReceived = false; + // input panel closed on focus lost edit.setFocus(false); QApplication::processEvents(); diff --git a/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp b/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp index b3e16c4..155223d 100644 --- a/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp +++ b/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp @@ -762,6 +762,7 @@ void tst_qdeclarativetextinput::sendRequestSoftwareInputPanelEvent() // focus on press, input panel on focus QTest::mousePress(view.viewport(), Qt::LeftButton, 0, view.mapFromScene(input.scenePos())); QApplication::processEvents(); + QVERIFY(input.hasFocus()); QCOMPARE(ic.openInputPanelReceived, true); QCOMPARE(ic.closeInputPanelReceived, false); ic.openInputPanelReceived = false; @@ -772,6 +773,14 @@ void tst_qdeclarativetextinput::sendRequestSoftwareInputPanelEvent() QCOMPARE(ic.closeInputPanelReceived, false); ic.openInputPanelReceived = false; + // Even with focus already gained, user needs + // to be able to open panel by pressing on the editor + QTest::mousePress(view.viewport(), Qt::LeftButton, 0, view.mapFromScene(input.scenePos())); + QApplication::processEvents(); + QCOMPARE(ic.openInputPanelReceived, true); + QCOMPARE(ic.closeInputPanelReceived, false); + ic.openInputPanelReceived = false; + // input panel closed on focus lost input.setFocus(false); QApplication::processEvents(); -- cgit v0.12 From b930d1a26b0c5999c205f224d75d7de6fa40699c Mon Sep 17 00:00:00 2001 From: Bea Lam Date: Wed, 26 May 2010 13:35:11 +1000 Subject: Add more examples of XPath expressions to XmlRole. Task-number: QTBUG-10852 --- doc/src/snippets/declarative/xmlrole.qml | 81 +++++++++++++++++++++++ doc/src/snippets/declarative/xmlrole.xml | 14 ++++ src/declarative/util/qdeclarativexmllistmodel.cpp | 33 ++++++--- 3 files changed, 118 insertions(+), 10 deletions(-) create mode 100644 doc/src/snippets/declarative/xmlrole.qml create mode 100644 doc/src/snippets/declarative/xmlrole.xml diff --git a/doc/src/snippets/declarative/xmlrole.qml b/doc/src/snippets/declarative/xmlrole.qml new file mode 100644 index 0000000..6d04daf --- /dev/null +++ b/doc/src/snippets/declarative/xmlrole.qml @@ -0,0 +1,81 @@ +/**************************************************************************** +** +** 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$ +** +****************************************************************************/ + +import Qt 4.7 + +Rectangle { + width: 300; height: 200 + +//![0] +XmlListModel { + id: model +//![0] + source: "xmlrole.xml" + +//![1] + // XmlRole queries will be made on elements + query: "/catalogue/book" + + // query the book title + XmlRole { name: "title"; query: "title/string()" } + + // query the book's year + XmlRole { name: "year"; query: "year/number()" } + + // query the book's type (the '@' indicates 'type' is an attribute, not an element) + XmlRole { name: "type"; query: "@type/string()" } + + // query the book's first listed author (note in XPath the first index is 1, not 0) + XmlRole { name: "first_author"; query: "author[1]/string()" } +} +//![1] + +ListView { + width: 300; height: 200 + model: model + delegate: Column { + Text { text: title + " (" + type + ")"; font.bold: true } + Text { text: first_author } + Text { text: year } + } +} + +} diff --git a/doc/src/snippets/declarative/xmlrole.xml b/doc/src/snippets/declarative/xmlrole.xml new file mode 100644 index 0000000..c9f999e --- /dev/null +++ b/doc/src/snippets/declarative/xmlrole.xml @@ -0,0 +1,14 @@ + + + + C++ GUI Programming with Qt 4 + 2006 + Jasmin Blanchette + Mark Summerfield + + + Programming with Qt + 2002 + Matthias Kalle Dalheimer + + diff --git a/src/declarative/util/qdeclarativexmllistmodel.cpp b/src/declarative/util/qdeclarativexmllistmodel.cpp index d08e37b..4f9355b 100644 --- a/src/declarative/util/qdeclarativexmllistmodel.cpp +++ b/src/declarative/util/qdeclarativexmllistmodel.cpp @@ -80,7 +80,11 @@ typedef QPair QDeclarativeXmlListRange; /*! \qmlproperty string XmlRole::name - The name for the role. This name is used to access the model data for this role from Qml. + + The name for the role. This name is used to access the model data for this role. + + For example, the following model has a role named "title", which can be accessed + from the view's delegate: \qml XmlListModel { @@ -91,19 +95,27 @@ typedef QPair QDeclarativeXmlListRange; ListView { model: xmlModel - Text { text: title } + delegate: Text { text: title } } \endqml */ /*! \qmlproperty string XmlRole::query - The relative XPath query for this role. The query should not start with a '/' (i.e. it must be - relative). + The relative XPath expression query for this role. The query must be relative; it cannot start + with a '/'. - \qml - XmlRole { name: "title"; query: "title/string()" } - \endqml + For example, if there is an XML document like this: + + \quotefile doc/src/snippets/declarative/xmlrole.xml + + Here are some valid XPath expressions for XmlRole queries on this document: + + \snippet doc/src/snippets/declarative/xmlrole.qml 0 + \dots 4 + \snippet doc/src/snippets/declarative/xmlrole.qml 1 + + See the \l{http://www.w3.org/TR/xpath20/}{W3C XPath 2.0 specification} for more information. */ /*! @@ -521,9 +533,12 @@ void QDeclarativeXmlListModelPrivate::clear_role(QDeclarativeListProperty in the XML document. The XmlRole objects define the + a model item for each \c in the XML document. + + The XmlRole objects define the model item attributes; here, each model item will have \c title and \c pubDate attributes that match the \c title and \c pubDate values of its corresponding \c . + (See \l XmlRole::query for more examples of valid XPath expressions for XmlRole.) The model could be used in a ListView, like this: @@ -559,8 +574,6 @@ void QDeclarativeXmlListModelPrivate::clear_role(QDeclarativeListProperty Date: Wed, 26 May 2010 14:47:11 +1000 Subject: Allow js files with '.pragma library' to be used from WorkerScript --- src/declarative/qml/qdeclarativeworkerscript.cpp | 1 + .../qdeclarativeworkerscript/data/BaseWorker.qml | 24 ++++++++++++ .../qdeclarativeworkerscript/data/script.js | 1 - .../data/script_fixed_return.js | 4 ++ .../qdeclarativeworkerscript/data/script_pragma.js | 6 +++ .../qdeclarativeworkerscript/data/worker.qml | 21 +---------- .../data/worker_pragma.qml | 6 +++ .../tst_qdeclarativeworkerscript.cpp | 43 ++++++++++++++++++---- 8 files changed, 77 insertions(+), 29 deletions(-) create mode 100644 tests/auto/declarative/qdeclarativeworkerscript/data/BaseWorker.qml create mode 100644 tests/auto/declarative/qdeclarativeworkerscript/data/script_fixed_return.js create mode 100644 tests/auto/declarative/qdeclarativeworkerscript/data/script_pragma.js create mode 100644 tests/auto/declarative/qdeclarativeworkerscript/data/worker_pragma.qml diff --git a/src/declarative/qml/qdeclarativeworkerscript.cpp b/src/declarative/qml/qdeclarativeworkerscript.cpp index 1550351..2ca030e 100644 --- a/src/declarative/qml/qdeclarativeworkerscript.cpp +++ b/src/declarative/qml/qdeclarativeworkerscript.cpp @@ -295,6 +295,7 @@ void QDeclarativeWorkerScriptEnginePrivate::processLoad(int id, const QUrl &url) ctxt->pushScope(urlContext); ctxt->pushScope(activation); ctxt->setActivationObject(activation); + QDeclarativeScriptParser::extractPragmas(script); workerEngine->baseUrl = url; workerEngine->evaluate(script); diff --git a/tests/auto/declarative/qdeclarativeworkerscript/data/BaseWorker.qml b/tests/auto/declarative/qdeclarativeworkerscript/data/BaseWorker.qml new file mode 100644 index 0000000..d275ca8 --- /dev/null +++ b/tests/auto/declarative/qdeclarativeworkerscript/data/BaseWorker.qml @@ -0,0 +1,24 @@ +import Qt 4.7 + +WorkerScript { + id: worker + + property variant response + + signal done() + + function testSend(value) { + worker.sendMessage(value) + } + + function compareLiteralResponse(expected) { + var e = eval('(' + expected + ')') + return worker.response == e + } + + onMessage: { + worker.response = messageObject + worker.done() + } +} + diff --git a/tests/auto/declarative/qdeclarativeworkerscript/data/script.js b/tests/auto/declarative/qdeclarativeworkerscript/data/script.js index 09199de..90aae26 100644 --- a/tests/auto/declarative/qdeclarativeworkerscript/data/script.js +++ b/tests/auto/declarative/qdeclarativeworkerscript/data/script.js @@ -2,4 +2,3 @@ WorkerScript.onMessage = function(msg) { WorkerScript.sendMessage(msg) } - diff --git a/tests/auto/declarative/qdeclarativeworkerscript/data/script_fixed_return.js b/tests/auto/declarative/qdeclarativeworkerscript/data/script_fixed_return.js new file mode 100644 index 0000000..14f6f17 --- /dev/null +++ b/tests/auto/declarative/qdeclarativeworkerscript/data/script_fixed_return.js @@ -0,0 +1,4 @@ +WorkerScript.onMessage = function(msg) { + WorkerScript.sendMessage('Hello_World') +} + diff --git a/tests/auto/declarative/qdeclarativeworkerscript/data/script_pragma.js b/tests/auto/declarative/qdeclarativeworkerscript/data/script_pragma.js new file mode 100644 index 0000000..cb3b6d3 --- /dev/null +++ b/tests/auto/declarative/qdeclarativeworkerscript/data/script_pragma.js @@ -0,0 +1,6 @@ +.pragma library + +WorkerScript.onMessage = function(msg) { + WorkerScript.sendMessage(msg) +} + diff --git a/tests/auto/declarative/qdeclarativeworkerscript/data/worker.qml b/tests/auto/declarative/qdeclarativeworkerscript/data/worker.qml index 5c7a5ff..1a20098 100644 --- a/tests/auto/declarative/qdeclarativeworkerscript/data/worker.qml +++ b/tests/auto/declarative/qdeclarativeworkerscript/data/worker.qml @@ -1,24 +1,5 @@ import Qt 4.7 -WorkerScript { - id: worker +BaseWorker { source: "script.js" - - property variant response - - signal done() - - function testSend(value) { - worker.sendMessage(value) - } - - function compareLiteralResponse(expected) { - var e = eval('(' + expected + ')') - return worker.response == e - } - - onMessage: { - worker.response = messageObject - worker.done() - } } diff --git a/tests/auto/declarative/qdeclarativeworkerscript/data/worker_pragma.qml b/tests/auto/declarative/qdeclarativeworkerscript/data/worker_pragma.qml new file mode 100644 index 0000000..3b720ef --- /dev/null +++ b/tests/auto/declarative/qdeclarativeworkerscript/data/worker_pragma.qml @@ -0,0 +1,6 @@ +import Qt 4.7 + +BaseWorker { + source: "script_pragma.js" +} + diff --git a/tests/auto/declarative/qdeclarativeworkerscript/tst_qdeclarativeworkerscript.cpp b/tests/auto/declarative/qdeclarativeworkerscript/tst_qdeclarativeworkerscript.cpp index a1dae24..7a4315a 100644 --- a/tests/auto/declarative/qdeclarativeworkerscript/tst_qdeclarativeworkerscript.cpp +++ b/tests/auto/declarative/qdeclarativeworkerscript/tst_qdeclarativeworkerscript.cpp @@ -64,6 +64,7 @@ private slots: void messaging_data(); void messaging_sendQObjectList(); void messaging_sendJsObject(); + void script_with_pragma(); private: void waitForEchoMessage(QDeclarativeWorkerScript *worker) { @@ -82,18 +83,25 @@ private: void tst_QDeclarativeWorkerScript::source() { - QUrl source = QUrl::fromLocalFile(SRCDIR "/data/worker.qml"); - - QDeclarativeComponent component(&m_engine); - component.setData("import Qt 4.7\nWorkerScript { source: '" + source.toString().toUtf8() + "'; }", QUrl()); + QDeclarativeComponent component(&m_engine, SRCDIR "/data/worker.qml"); + QDeclarativeWorkerScript *worker = qobject_cast(component.create()); + QVERIFY(worker != 0); + const QMetaObject *mo = worker->metaObject(); - QDeclarativeWorkerScript *item = qobject_cast(component.create()); - QVERIFY(item != 0); + QVariant value(100); + QVERIFY(QMetaObject::invokeMethod(worker, "testSend", Q_ARG(QVariant, value))); + waitForEchoMessage(worker); + QCOMPARE(mo->property(mo->indexOfProperty("response")).read(worker).value(), value); - QCOMPARE(item->source(), source); + QUrl source = QUrl::fromLocalFile(SRCDIR "/data/script_fixed_return.js"); + worker->setSource(source); + QCOMPARE(worker->source(), source); + QVERIFY(QMetaObject::invokeMethod(worker, "testSend", Q_ARG(QVariant, value))); + waitForEchoMessage(worker); + QCOMPARE(mo->property(mo->indexOfProperty("response")).read(worker).value(), qVariantFromValue(QString("Hello_World"))); qApp->processEvents(); - delete item; + delete worker; } void tst_QDeclarativeWorkerScript::messaging() @@ -177,6 +185,25 @@ void tst_QDeclarativeWorkerScript::messaging_sendJsObject() delete worker; } +void tst_QDeclarativeWorkerScript::script_with_pragma() +{ + QVariant value(100); + + QDeclarativeComponent component(&m_engine, SRCDIR "/data/worker_pragma.qml"); + QDeclarativeWorkerScript *worker = qobject_cast(component.create()); + QVERIFY(worker != 0); + + QVERIFY(QMetaObject::invokeMethod(worker, "testSend", Q_ARG(QVariant, value))); + waitForEchoMessage(worker); + + const QMetaObject *mo = worker->metaObject(); + QCOMPARE(mo->property(mo->indexOfProperty("response")).read(worker).value(), value); + + qApp->processEvents(); + delete worker; +} + + QTEST_MAIN(tst_QDeclarativeWorkerScript) #include "tst_qdeclarativeworkerscript.moc" -- cgit v0.12 From b08165d372e60c0c61b25dbaf5d0340ce8f985bc Mon Sep 17 00:00:00 2001 From: Bea Lam Date: Wed, 26 May 2010 17:23:41 +1000 Subject: Doc fixes, improvements --- doc/src/declarative/advtutorial.qdoc | 4 +- doc/src/declarative/dynamicobjects.qdoc | 14 +-- doc/src/declarative/examples.qdoc | 23 +++-- doc/src/declarative/globalobject.qdoc | 2 +- doc/src/declarative/qtdeclarative.qdoc | 4 +- .../ui-components/dialcontrol/dial.qmlproject | 16 ---- .../dialcontrol/dialcontrol.qmlproject | 16 ++++ src/declarative/qml/qdeclarativeengine.cpp | 102 +++++++++------------ 8 files changed, 88 insertions(+), 93 deletions(-) delete mode 100644 examples/declarative/ui-components/dialcontrol/dial.qmlproject create mode 100644 examples/declarative/ui-components/dialcontrol/dialcontrol.qmlproject diff --git a/doc/src/declarative/advtutorial.qdoc b/doc/src/declarative/advtutorial.qdoc index 47504ae..abfeadb 100644 --- a/doc/src/declarative/advtutorial.qdoc +++ b/doc/src/declarative/advtutorial.qdoc @@ -178,7 +178,7 @@ The \c createBlock() function creates a block from the \c Block.qml file and moves the new block to its position on the game canvas. This involves several steps: \list -\o \l {Qt.createComponent(url file)}{Qt.createComponent()} is called to generate an element from \c Block.qml. +\o \l {Qt::createComponent()}{Qt.createComponent()} is called to generate an element from \c Block.qml. If the component is ready, we can call \c createObject() to create an instance of the \c Block item. \o If \c createObject() returned null (i.e. if there was an error while loading the object), print the error information. @@ -468,6 +468,6 @@ By following this tutorial you've seen how you can write a fully functional appl \endlist There is so much more to learn about QML that we haven't been able to cover in this tutorial. Check out all the -demos and examples and the \l {Declarative UI Using QML}{documentation} to find out all the things you can do with QML! +demos and examples and the \l {Qt Quick}{documentation} to find out all the things you can do with QML! */ diff --git a/doc/src/declarative/dynamicobjects.qdoc b/doc/src/declarative/dynamicobjects.qdoc index 633489b..5e606f4 100644 --- a/doc/src/declarative/dynamicobjects.qdoc +++ b/doc/src/declarative/dynamicobjects.qdoc @@ -56,15 +56,15 @@ application, and there are no C++ components involved. \section1 Creating Objects Dynamically There are two ways to create objects dynamically from JavaScript. You can either call -\l {Qt.createComponent(url file)}{Qt.createComponent()} to create -a component which instantiates items, or use \l{Qt.createQmlObject(string qml, object parent, string filepath)}{Qt.createQmlObject()} +\l {Qt::createComponent()}{Qt.createComponent()} to create +a component which instantiates items, or use \l{Qt::createQmlObject()}{Qt.createQmlObject()} to create an item from a string of QML. Creating a component is better if you have a predefined item, and you want to create dynamic instances of that item; creating an item from a string of QML is useful when the item QML itself is generated at runtime. If you have a component specified in a QML file, you can dynamically load it with -the \l {Qt.createComponent(url file)}{Qt.createComponent()} function on the \l{QML Global Object}. +the \l {Qt::createComponent()}{Qt.createComponent()} function on the \l{QML Global Object}. This function takes the URL of the QML file as its only argument and returns a component object which can be used to create and load that QML file. @@ -98,10 +98,10 @@ in \c main.qml). After creating an item, you must set its parent to an item with Otherwise your dynamically created item will not appear in the scene. When using files with relative paths, the path should -be relative to the file where \l {Qt.createComponent(url file)}{Qt.createComponent()} is executed. +be relative to the file where \l {Qt::createComponent()}{Qt.createComponent()} is executed. If the QML component does not exist until runtime, you can create a QML item from -a string of QML using the \l{Qt.createQmlObject(string qml, object parent, string filepath)}{Qt.createQmlObject()} function, as in the following example: +a string of QML using the \l{Qt::createQmlObject()}{Qt.createQmlObject()} function, as in the following example: \snippet doc/src/snippets/declarative/createQmlObject.qml 0 @@ -121,9 +121,9 @@ the bindings in the dynamic item will no longer work. The actual creation context depends on how an item is created: \list -\o If \l {Qt.createComponent(url file)}{Qt.createComponent()} is used, the creation context +\o If \l {Qt::createComponent()}{Qt.createComponent()} is used, the creation context is the QDeclarativeContext in which this method is called -\o If \l{Qt.createQmlObject(string qml, object parent, string filepath)}{Qt.createQmlObject()} +\o If \l{Qt::createQmlObject()}{Qt.createQmlObject()} if called, it is the context of the item used as the second argument to this method \o If a \c {Component{}} item is defined and \l {Component::createObject()}{createObject()} is called on that item, it is the context in which the \c Component is defined diff --git a/doc/src/declarative/examples.qdoc b/doc/src/declarative/examples.qdoc index 6e0426c..5cb83fa 100644 --- a/doc/src/declarative/examples.qdoc +++ b/doc/src/declarative/examples.qdoc @@ -84,7 +84,10 @@ For example, from your build directory, run: \o \l{declarative/imageelements/borderimage}{BorderImage} \endlist -\section2 \l{declarative/positioners}{Positioners} +\section2 Positioners +\list +\o \l{declarative/positioners}{Example} +\endlist \section2 Key Interaction \list @@ -99,6 +102,7 @@ For example, from your build directory, run: \section2 UI Components \list +\o \l{declarative/ui-components/dialcontrol}{Dial control} \o \l{declarative/ui-components/flipable}{Flipable} \o \l{declarative/ui-components/progressbar}{Progress bar} \o \l{declarative/ui-components/scrollbar}{Scroll bar} @@ -112,10 +116,10 @@ For example, from your build directory, run: \list \o \l{declarative/modelviews/gridview}{GridView} \o \l{declarative/modelviews/listview}{ListView} -\o \l{declarative/modelviews/objectlistmodel}{Object list model} +\o \l{declarative/modelviews/objectlistmodel}{Object ListModel} \o \l{declarative/modelviews/package}{Package} \o \l{declarative/modelviews/parallax}{Parallax} -\o \l{declarative/modelviews/stringlistmodel}{String list model} +\o \l{declarative/modelviews/stringlistmodel}{String ListModel} \o \l{declarative/modelviews/webview}{WebView} \endlist @@ -124,7 +128,10 @@ For example, from your build directory, run: \o \l{declarative/xml/xmlhttprequest}{XmlHttpRequest} \endlist -\section2 \l{declarative/i18n}{Internationalization (i18n)} +\section2 Internationalization (i18n) +\list +\o \l{declarative/i18n}{Example} +\endlist \section2 Threading \list @@ -132,11 +139,14 @@ For example, from your build directory, run: \o \l{declarative/threading/workerscript}{WorkerScript} \endlist -\section2 \l{declarative/sqllocalstorage}{SQL Local Storage} +\section2 SQL Local Storage +\list +\o \l{declarative/sqllocalstorage}{Example} +\endlist \section2 C++ Extensions \list -\o \l{declarative-cppextensions-reference.html}{Reference examples} (discussed in \l {Extending QML in C++}) +\o \l{declarative-cppextensions-reference.html}{Reference examples} \o \l{declarative/cppextensions/plugins}{Plugins} \o \l{declarative-cppextensions-qgraphicslayouts.html}{QGraphicsLayouts} \o \l{declarative/cppextensions/qwidgets}{QWidgets} @@ -148,7 +158,6 @@ For example, from your build directory, run: \list \o \l{declarative/toys/clocks}{Clocks} \o \l{declarative/toys/corkboards}{Corkboards} -\o \l{declarative/toys/dial}{Dial} \o \l{declarative/toys/dynamicscene}{Dynamic Scene} \o \l{declarative/toys/tic-tac-toe}{Tic Tac Toe} \o \l{declarative/toys/tvtennis}{TV Tennis} diff --git a/doc/src/declarative/globalobject.qdoc b/doc/src/declarative/globalobject.qdoc index 2885dd5..3a2ad81 100644 --- a/doc/src/declarative/globalobject.qdoc +++ b/doc/src/declarative/globalobject.qdoc @@ -49,7 +49,7 @@ Contains all the properties of the JavaScript global object, plus: \section1 Qt Object -The \l{qt-qml.html}{Qt object} provides useful enums and functions from Qt, for use in all QML +The \l{qml-qt.html}{Qt object} provides useful enums and functions from Qt, for use in all QML files. \section1 XMLHttpRequest diff --git a/doc/src/declarative/qtdeclarative.qdoc b/doc/src/declarative/qtdeclarative.qdoc index c47ab23..f7cb722 100644 --- a/doc/src/declarative/qtdeclarative.qdoc +++ b/doc/src/declarative/qtdeclarative.qdoc @@ -112,7 +112,7 @@ Returns the QML type id. - \sa qmlRegisterTypeNotAvailable + \sa qmlRegisterTypeNotAvailable() */ /*! @@ -147,7 +147,7 @@ fun.qml: Get back to work, slacker! Without this, a generic "Game is not a type" message would be given. - \sa qmlRegisterUncreatableType + \sa qmlRegisterUncreatableType() */ /*! diff --git a/examples/declarative/ui-components/dialcontrol/dial.qmlproject b/examples/declarative/ui-components/dialcontrol/dial.qmlproject deleted file mode 100644 index d4909f8..0000000 --- a/examples/declarative/ui-components/dialcontrol/dial.qmlproject +++ /dev/null @@ -1,16 +0,0 @@ -import QmlProject 1.0 - -Project { - /* Include .qml, .js, and image files from current directory and subdirectories */ - QmlFiles { - directory: "." - } - JavaScriptFiles { - directory: "." - } - ImageFiles { - directory: "." - } - /* List of plugin directories passed to QML runtime */ - // importPaths: [ " ../exampleplugin " ] -} diff --git a/examples/declarative/ui-components/dialcontrol/dialcontrol.qmlproject b/examples/declarative/ui-components/dialcontrol/dialcontrol.qmlproject new file mode 100644 index 0000000..d4909f8 --- /dev/null +++ b/examples/declarative/ui-components/dialcontrol/dialcontrol.qmlproject @@ -0,0 +1,16 @@ +import QmlProject 1.0 + +Project { + /* Include .qml, .js, and image files from current directory and subdirectories */ + QmlFiles { + directory: "." + } + JavaScriptFiles { + directory: "." + } + ImageFiles { + directory: "." + } + /* List of plugin directories passed to QML runtime */ + // importPaths: [ " ../exampleplugin " ] +} diff --git a/src/declarative/qml/qdeclarativeengine.cpp b/src/declarative/qml/qdeclarativeengine.cpp index a7384a9..8679e76 100644 --- a/src/declarative/qml/qdeclarativeengine.cpp +++ b/src/declarative/qml/qdeclarativeengine.cpp @@ -153,11 +153,11 @@ void QDeclarativeEnginePrivate::defineModule() /*! \qmlclass Qt QDeclarativeEnginePrivate -\brief The QML Global Qt Object +\brief The QML global Qt object provides useful enums and functions from Qt. -The Qt object provides useful enums and functions from Qt, for use in all QML -files. Note that you do note create instances of this type, but instead use -the members of the global "Qt" object. +The Qt object provides useful enums and functions from Qt, for use in all QML files. + +You do not create instances of this type, but instead use the members of the global "Qt" object. \section1 Enums @@ -172,23 +172,23 @@ data types. This is primarily useful when setting the properties of an item when the property has one of the following types: \list -\o Color -\o Rect -\o Point -\o Size -\o Vector3D +\o \c color - use \l{Qt::rgba()}{Qt.rgba()}, \l{Qt::darker()}{Qt.darker()}, \l{Qt::lighter()}{Qt.lighter()} or \l{Qt::tint()}{Qt.tint()} +\o \c rect - use \l{Qt::rect()}{Qt.rect()} +\o \c point - use \l{Qt::point()}{Qt.point()} +\o \c size - use \l{Qt::size()}{Qt.size()} +\o \c vector3d - use \l{Qt::vector3d()}{Qt.vector3d()} \endlist -There are also string based constructors for these types, see \l{qdeclarativebasictypes.html}{Qml Types}. +There are also string based constructors for these types, see \l{qdeclarativebasictypes.html}{QML Basic Types}. \section1 Date/Time Formatters The Qt object contains several functions for formatting dates and times. \list - \o \l{Qt::formatDateTime}{string Qt.formatDateTime(datetime date, variant format) - \o \l{Qt::formatDate}{string Qt.formatDate(datetime date, variant format) - \o \l{Qt::formatTime}{string Qt.formatTime(datetime date, variant format) + \o \l{Qt::formatDateTime}{string Qt.formatDateTime(datetime date, variant format)} + \o \l{Qt::formatDate}{string Qt.formatDate(datetime date, variant format)} + \o \l{Qt::formatTime}{string Qt.formatTime(datetime date, variant format)} \endlist The format specification is described at \l{Qt::formatDateTime}{Qt.formatDateTime}. @@ -226,8 +226,7 @@ QDeclarativeEnginePrivate::QDeclarativeEnginePrivate(QDeclarativeEngine *e) /*! \qmlmethod url Qt::resolvedUrl(url) -This function returns \c url resolved relative to the URL of the -caller. +Returns \c url resolved relative to the URL of the caller. */ QUrl QDeclarativeScriptEngine::resolvedUrl(QScriptContext *context, const QUrl& url) { @@ -1035,8 +1034,11 @@ QString QDeclarativeEnginePrivate::urlToLocalFileOrQrc(const QUrl& url) /*! \qmlmethod object Qt::createComponent(url) -This function takes the URL of a QML file as its only argument. It returns -a component object which can be used to create and load that QML file. +Returns a \l Component object created from the QML file at the specified \a url, +or \c null if there was an error in creating the component. + +Call \l {Component::createObject()}{Component.createObject()} on the returned +component to create an object instance of the component. Here is an example. Remember that QML files that might be loaded over the network cannot be expected to be ready immediately. @@ -1049,17 +1051,8 @@ If you are certain the files will be local, you could simplify to: \snippet doc/src/snippets/declarative/componentCreation.js 2 -The methods and properties of the \l {Component} element are defined in its own -page, but when using it dynamically only two methods are usually used. - \l {Component::createObject()}{Component.createObject()} returns the created object or \c null if there is an error. -If there is an error, \l {Component::errorString()}{Component.errorString()} describes -the error that occurred. Note that createObject() takes exactly one argument, which is set -to the parent of the created object. Graphical objects without a parent will not appear -on the scene, but if you do not wish to parent the item at this point you can safely pass -in null. - -If you want to just create an arbitrary string of QML, instead of -loading a QML file, consider the \l{Qt.createQmlObject(string qml, object parent, string filepath)}{Qt.createQmlObject()} function. +To create a QML object from an arbitrary string of QML (instead of a file), +use \l{Qt::createQmlObject()}{Qt.createQmlObject()}. */ QScriptValue QDeclarativeEnginePrivate::createComponent(QScriptContext *ctxt, QScriptEngine *engine) @@ -1088,29 +1081,22 @@ QScriptValue QDeclarativeEnginePrivate::createComponent(QScriptContext *ctxt, QS /*! \qmlmethod object Qt::createQmlObject(string qml, object parent, string filepath) -Creates a new object from the specified string of QML. It requires a -second argument, which is the id of an existing QML object to use as -the new object's parent. If a third argument is provided, this is used -for error reporting as the filepath that the QML came from. +Returns a new object created from the given \a string of QML with the specified \a parent, +or \c null if there was an error in creating the object. + +If \a filepath is specified, it will be used for error reporting for the created object. Example (where \c targetItem is the id of an existing QML item): \snippet doc/src/snippets/declarative/createQmlObject.qml 0 -This function is intended for use inside QML only. It is intended to behave -similarly to eval, but for creating QML elements. - -Returns the created object, \c or null if there is an error. In the case of an -error, a QtScript Error object is thrown. This object has the additional property, -qmlErrors, which is an array of all the errors encountered when trying to execute the -QML. Each object in the array has the members \c lineNumber, \c columnNumber, \c fileName and \c message. +In the case of an error, a QtScript Error object is thrown. This object has an additional property, +\c qmlErrors, which is an array of the errors encountered. +Each object in this array has the members \c lineNumber, \c columnNumber, \c fileName and \c message. Note that this function returns immediately, and therefore may not work if -the QML loads new components. If you are trying to load a new component, -for example from a QML file, consider the \l{Qt.createComponent(url file)}{Qt.createComponent()} function -instead. 'New components' refers to external QML files that have not yet -been loaded, and so it is safe to use \c Qt.createQmlObject() to load built-in -components. +the \a qml string loads new components (that is, external QML files that have not yet been loaded). +If this is the case, consider using \l{Qt::createComponent()}{Qt.createComponent()} instead. */ QScriptValue QDeclarativeEnginePrivate::createQmlObject(QScriptContext *ctxt, QScriptEngine *engine) @@ -1217,7 +1203,7 @@ QScriptValue QDeclarativeEnginePrivate::isQtObject(QScriptContext *ctxt, QScript /*! \qmlmethod Qt::vector3d(real x, real y, real z) -This function returns a Vector3D with the specified \c x, \c y and \c z. +Returns a Vector3D with the specified \c x, \c y and \c z. */ QScriptValue QDeclarativeEnginePrivate::vector3d(QScriptContext *ctxt, QScriptEngine *engine) { @@ -1231,7 +1217,7 @@ QScriptValue QDeclarativeEnginePrivate::vector3d(QScriptContext *ctxt, QScriptEn /*! \qmlmethod string Qt::formatDate(datetime date, variant format) -This function returns the string representation of \c date, formatted according to \c format. +Returns the string representation of \c date, formatted according to \c format. */ QScriptValue QDeclarativeEnginePrivate::formatDate(QScriptContext*ctxt, QScriptEngine*engine) { @@ -1256,7 +1242,7 @@ QScriptValue QDeclarativeEnginePrivate::formatDate(QScriptContext*ctxt, QScriptE /*! \qmlmethod string Qt::formatTime(datetime time, variant format) -This function returns the string representation of \c time, formatted according to \c format. +Returns the string representation of \c time, formatted according to \c format. See Qt::formatDateTime for how to define \c format. */ @@ -1283,7 +1269,7 @@ QScriptValue QDeclarativeEnginePrivate::formatTime(QScriptContext*ctxt, QScriptE /*! \qmlmethod string Qt::formatDateTime(datetime dateTime, variant format) -This function returns the string representation of \c dateTime, formatted according to \c format. +Returns the string representation of \c dateTime, formatted according to \c format. \c format for the date/time formatting functions is be specified as follows. @@ -1374,7 +1360,7 @@ QScriptValue QDeclarativeEnginePrivate::formatDateTime(QScriptContext*ctxt, QScr /*! \qmlmethod color Qt::rgba(real red, real green, real blue, real alpha) -This function returns a Color with the specified \c red, \c green, \c blue and \c alpha components. +Returns a Color with the specified \c red, \c green, \c blue and \c alpha components. All components should be in the range 0-1 inclusive. */ QScriptValue QDeclarativeEnginePrivate::rgba(QScriptContext *ctxt, QScriptEngine *engine) @@ -1402,7 +1388,7 @@ QScriptValue QDeclarativeEnginePrivate::rgba(QScriptContext *ctxt, QScriptEngine /*! \qmlmethod color Qt::hsla(real hue, real saturation, real lightness, real alpha) -This function returns a Color with the specified \c hue, \c saturation, \c lightness and \c alpha components. +Returns a Color with the specified \c hue, \c saturation, \c lightness and \c alpha components. All components should be in the range 0-1 inclusive. */ QScriptValue QDeclarativeEnginePrivate::hsla(QScriptContext *ctxt, QScriptEngine *engine) @@ -1430,7 +1416,7 @@ QScriptValue QDeclarativeEnginePrivate::hsla(QScriptContext *ctxt, QScriptEngine /*! \qmlmethod rect Qt::rect(int x, int y, int width, int height) -This function returns a Rect with the top-left corner at \c x, \c y and the specified \c width and \c height. +Returns a Rect with the top-left corner at \c x, \c y and the specified \c width and \c height. */ QScriptValue QDeclarativeEnginePrivate::rect(QScriptContext *ctxt, QScriptEngine *engine) { @@ -1450,7 +1436,7 @@ QScriptValue QDeclarativeEnginePrivate::rect(QScriptContext *ctxt, QScriptEngine /*! \qmlmethod point Qt::point(int x, int y) -This function returns a Point with the specified \c x and \c y coordinates. +Returns a Point with the specified \c x and \c y coordinates. */ QScriptValue QDeclarativeEnginePrivate::point(QScriptContext *ctxt, QScriptEngine *engine) { @@ -1463,7 +1449,7 @@ QScriptValue QDeclarativeEnginePrivate::point(QScriptContext *ctxt, QScriptEngin /*! \qmlmethod Qt::size(int width, int height) -This function returns as Size with the specified \c width and \c height. +Returns a Size with the specified \c width and \c height. */ QScriptValue QDeclarativeEnginePrivate::size(QScriptContext *ctxt, QScriptEngine *engine) { @@ -1476,7 +1462,7 @@ QScriptValue QDeclarativeEnginePrivate::size(QScriptContext *ctxt, QScriptEngine /*! \qmlmethod color Qt::lighter(color baseColor, real factor) -This function returns a color lighter than \c baseColor by the \c factor provided. +Returns a color lighter than \c baseColor by the \c factor provided. If the factor is greater than 1.0, this functions returns a lighter color. Setting factor to 1.5 returns a color that is 50% brighter. If the factor is less than 1.0, @@ -1512,7 +1498,7 @@ QScriptValue QDeclarativeEnginePrivate::lighter(QScriptContext *ctxt, QScriptEng /*! \qmlmethod color Qt::darker(color baseColor, real factor) -This function returns a color darker than \c baseColor by the \c factor provided. +Returns a color darker than \c baseColor by the \c factor provided. If the factor is greater than 1.0, this function returns a darker color. Setting factor to 3.0 returns a color that has one-third the brightness. @@ -1549,7 +1535,7 @@ QScriptValue QDeclarativeEnginePrivate::darker(QScriptContext *ctxt, QScriptEngi /*! \qmlmethod bool Qt::openUrlExternally(url target) -This function attempts to open the specified \c target url in an external application, based on the user's desktop preferences. It will return true if it succeeds, and false otherwise. +Attempts to open the specified \c target url in an external application, based on the user's desktop preferences. Returns true if it succeeds, and false otherwise. */ QScriptValue QDeclarativeEnginePrivate::desktopOpenUrl(QScriptContext *ctxt, QScriptEngine *e) { @@ -1564,7 +1550,7 @@ QScriptValue QDeclarativeEnginePrivate::desktopOpenUrl(QScriptContext *ctxt, QSc /*! \qmlmethod list Qt::fontFamilies() -This function returns a list of the font families available to the application. +Returns a list of the font families available to the application. */ QScriptValue QDeclarativeEnginePrivate::fontFamilies(QScriptContext *ctxt, QScriptEngine *e) @@ -1579,7 +1565,7 @@ QScriptValue QDeclarativeEnginePrivate::fontFamilies(QScriptContext *ctxt, QScri /*! \qmlmethod string Qt::md5(data) -This function returns a hex string of the md5 hash of \c data. +Returns a hex string of the md5 hash of \c data. */ QScriptValue QDeclarativeEnginePrivate::md5(QScriptContext *ctxt, QScriptEngine *) { -- cgit v0.12 From 058fa44c7aba859c3383f912da4f976c896f921d Mon Sep 17 00:00:00 2001 From: David Faure Date: Wed, 26 May 2010 11:43:39 +0200 Subject: Update the state of the keyboard modifiers on drop events. In the case of drag-n-drop between processes we do not get key events for the pressed modifiers, so we need to update the state of the modifiers (using XQueryPointer) to get a correct value of QApplication::keyboardModifiers() and QDropEvent::keyboardModifiers() at drop time. This is necessary for fixing KDE bug 178679. Merge-request: 590 Reviewed-by: Bradley T. Hughes Reviewed-by: Andreas Aardal Hanssen --- src/gui/kernel/qdnd_x11.cpp | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/src/gui/kernel/qdnd_x11.cpp b/src/gui/kernel/qdnd_x11.cpp index 2b12317..92dd0a1 100644 --- a/src/gui/kernel/qdnd_x11.cpp +++ b/src/gui/kernel/qdnd_x11.cpp @@ -64,6 +64,7 @@ #include "qtextcodec.h" #include "qdnd_p.h" +#include "qapplication_p.h" #include "qt_x11_p.h" #include "qx11info_x11.h" @@ -1111,7 +1112,20 @@ void qt_xdnd_send_leave() waiting_for_status = false; } - +// TODO: remove and use QApplication::currentKeyboardModifiers() in Qt 4.8. +static Qt::KeyboardModifiers currentKeyboardModifiers() +{ + Window root; + Window child; + int root_x, root_y, win_x, win_y; + uint keybstate; + for (int i = 0; i < ScreenCount(X11->display); ++i) { + if (XQueryPointer(X11->display, QX11Info::appRootWindow(i), &root, &child, + &root_x, &root_y, &win_x, &win_y, &keybstate)) + return X11->translateModifiers(keybstate & 0x00ff); + } + return 0; +} void QX11Data::xdndHandleDrop(QWidget *, const XEvent * xe, bool passive) { @@ -1159,6 +1173,11 @@ void QX11Data::xdndHandleDrop(QWidget *, const XEvent * xe, bool passive) if (!dropData) dropData = (manager->object) ? manager->dragPrivate()->data : manager->dropData; + // Drop coming from another app? Update keyboard modifiers. + if (!qt_xdnd_dragging) { + QApplicationPrivate::modifier_buttons = currentKeyboardModifiers(); + } + QDropEvent de(qt_xdnd_current_position, possible_actions, dropData, QApplication::mouseButtons(), QApplication::keyboardModifiers()); QApplication::sendEvent(qt_xdnd_current_widget, &de); -- cgit v0.12 From e0dc3b88abc9c4bcd6c3710c458c4948e5b8a912 Mon Sep 17 00:00:00 2001 From: Jakub Wieczorek Date: Wed, 26 May 2010 11:50:57 +0200 Subject: QXmlStreamWriter: Auto-formatting does not behave properly with processing instructions. When writing a processing instruction with auto-formatting enabled, it should put it in a new line for readability and apply the indentation properly. Merge-request: 620 Reviewed-by: Olivier Goffart --- src/corelib/xml/qxmlstream.cpp | 3 ++- tests/auto/qxmlstream/tst_qxmlstream.cpp | 17 +++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/src/corelib/xml/qxmlstream.cpp b/src/corelib/xml/qxmlstream.cpp index 1bf00b8..ae12007 100644 --- a/src/corelib/xml/qxmlstream.cpp +++ b/src/corelib/xml/qxmlstream.cpp @@ -3716,7 +3716,8 @@ void QXmlStreamWriter::writeProcessingInstruction(const QString &target, const Q { Q_D(QXmlStreamWriter); Q_ASSERT(!data.contains(QLatin1String("?>"))); - d->finishStartElement(); + if (!d->finishStartElement(false) && d->autoFormatting) + d->indent(d->tagStack.size()); d->write("write(target); if (!data.isNull()) { diff --git a/tests/auto/qxmlstream/tst_qxmlstream.cpp b/tests/auto/qxmlstream/tst_qxmlstream.cpp index 3c5358c..f93d4fc 100644 --- a/tests/auto/qxmlstream/tst_qxmlstream.cpp +++ b/tests/auto/qxmlstream/tst_qxmlstream.cpp @@ -546,6 +546,7 @@ private slots: void writerHangs() const; void writerAutoFormattingWithComments() const; void writerAutoFormattingWithTabs() const; + void writerAutoFormattingWithProcessingInstructions() const; void writerAutoEmptyTags() const; void writeAttributesWithSpace() const; void addExtraNamespaceDeclarations(); @@ -1030,6 +1031,22 @@ void tst_QXmlStream::writerAutoFormattingWithTabs() const QCOMPARE(buffer.buffer().data(), str); } +void tst_QXmlStream::writerAutoFormattingWithProcessingInstructions() const +{ + QBuffer buffer; + buffer.open(QIODevice::WriteOnly); + + QXmlStreamWriter writer(&buffer); + writer.setAutoFormatting(true); + writer.writeStartDocument(); + writer.writeProcessingInstruction("B", "C"); + writer.writeStartElement("A"); + writer.writeEndElement(); + writer.writeEndDocument(); + const char *str = "\n\n\n"; + QCOMPARE(buffer.buffer().data(), str); +} + /*! Task 204822 */ -- cgit v0.12 From 2eedb392048fdebbb29615345ea3716cebabd451 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Wed, 26 May 2010 11:59:48 +0200 Subject: tst_qxmlstream: fix in shadowbuild --- tests/auto/qxmlstream/qxmlstream.pro | 5 ++++- tests/auto/qxmlstream/tst_qxmlstream.cpp | 9 ++++----- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/tests/auto/qxmlstream/qxmlstream.pro b/tests/auto/qxmlstream/qxmlstream.pro index ac03d42..f82a7b3 100644 --- a/tests/auto/qxmlstream/qxmlstream.pro +++ b/tests/auto/qxmlstream/qxmlstream.pro @@ -1,5 +1,5 @@ load(qttest_p4) -SOURCES += tst_qxmlstream.cpp +SOURCES += tst_qxmlstream.cpp QT = core xml network @@ -8,4 +8,7 @@ wince*|symbian*: { addFiles.sources = data XML-Test-Suite addFiles.path = . DEPLOYMENT += addFiles + DEFINES += SRCDIR=\\\"\\\" +} else { + DEFINES += SRCDIR=\\\"$$PWD/\\\" } diff --git a/tests/auto/qxmlstream/tst_qxmlstream.cpp b/tests/auto/qxmlstream/tst_qxmlstream.cpp index f93d4fc..7d5e3b7 100644 --- a/tests/auto/qxmlstream/tst_qxmlstream.cpp +++ b/tests/auto/qxmlstream/tst_qxmlstream.cpp @@ -57,7 +57,7 @@ Q_DECLARE_METATYPE(QXmlStreamReader::ReadElementTextBehaviour) -static const char *const catalogFile = "XML-Test-Suite/xmlconf/finalCatalog.xml"; +static const char *const catalogFile = SRCDIR "XML-Test-Suite/xmlconf/finalCatalog.xml"; static const int expectedRunCount = 1646; static const int expectedSkipCount = 532; @@ -527,8 +527,7 @@ class tst_QXmlStream: public QObject { Q_OBJECT public: - tst_QXmlStream() : m_handler(QUrl::fromLocalFile(QDir::currentPath() + QLatin1Char('/')) - .resolved(QUrl(QLatin1String(catalogFile)))) + tst_QXmlStream() : m_handler(QUrl::fromLocalFile(QLatin1String(catalogFile))) { } @@ -806,7 +805,7 @@ void tst_QXmlStream::testReader_data() const QTest::addColumn("xml"); QTest::addColumn("ref"); QDir dir; - dir.cd("data/"); + dir.cd(SRCDIR "data/"); foreach(QString filename , dir.entryList(QStringList() << "*.xml")) { QString reference = QFileInfo(filename).baseName() + ".ref"; QTest::newRow(dir.filePath(filename).toLatin1().data()) << dir.filePath(filename) << dir.filePath(reference); @@ -1201,7 +1200,7 @@ void tst_QXmlStream::crashInUTF16Codec() const QEventLoop eventLoop; QNetworkAccessManager networkManager; - QNetworkRequest request(QUrl::fromLocalFile(QLatin1String("data/051reduced.xml"))); + QNetworkRequest request(QUrl::fromLocalFile(QLatin1String(SRCDIR "data/051reduced.xml"))); QNetworkReply *const reply = networkManager.get(request); eventLoop.connect(reply, SIGNAL(finished()), SLOT(quit())); -- cgit v0.12 From f777fccd2db2d2dccd32fe42d0a0cd5c65c6347c Mon Sep 17 00:00:00 2001 From: Alan Alpert Date: Wed, 26 May 2010 12:09:53 +0200 Subject: Improve gradient docs --- src/declarative/graphicsitems/qdeclarativerectangle.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/declarative/graphicsitems/qdeclarativerectangle.cpp b/src/declarative/graphicsitems/qdeclarativerectangle.cpp index 4f7a722..301ca00 100644 --- a/src/declarative/graphicsitems/qdeclarativerectangle.cpp +++ b/src/declarative/graphicsitems/qdeclarativerectangle.cpp @@ -116,6 +116,10 @@ void QDeclarativeGradientStop::updateGradient() \snippet doc/src/snippets/declarative/gradient.qml code + Note that this item is not a visual representation of a gradient. To display a + gradient use a visual item (like rectangle) which supports having a gradient set + on it for display. + \sa GradientStop */ -- cgit v0.12 From ccc37850ddedba6f70b02919074097b3a716a243 Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Wed, 26 May 2010 13:49:44 +0200 Subject: qdoc: Improved the address book tutorial I think this is not the final solution, but I need to decide how to handle \example commands. --- doc/src/getting-started/examples.qdoc | 2 +- doc/src/tutorials/addressbook.qdoc | 235 +++++++++++++++----------------- doc/src/tutorials/widgets-tutorial.qdoc | 2 +- 3 files changed, 112 insertions(+), 127 deletions(-) diff --git a/doc/src/getting-started/examples.qdoc b/doc/src/getting-started/examples.qdoc index a3393dd..643e42b 100644 --- a/doc/src/getting-started/examples.qdoc +++ b/doc/src/getting-started/examples.qdoc @@ -560,7 +560,7 @@ \page examples-multimedia.html \ingroup all-examples \title Multimedia Examples - \brief Accessing audio support from Qt + \brief Audio, video, and Phonon with Qt \image phonon-examples.png diff --git a/doc/src/tutorials/addressbook.qdoc b/doc/src/tutorials/addressbook.qdoc index 04410eb..e5cb448a 100644 --- a/doc/src/tutorials/addressbook.qdoc +++ b/doc/src/tutorials/addressbook.qdoc @@ -42,15 +42,11 @@ /*! \page tutorials-addressbook.html - \startpage {index.html}{Qt Reference Documentation} - \contentspage Tutorials - \nextpage {tutorials/addressbook/part1}{Chapter 1} - \title Address Book Tutorial \brief An introduction to GUI programming, showing how to put together a simple yet fully-functioning application. - This tutorial gives an introduction to GUI programming using the Qt + This tutorial is an introduction to GUI programming with the Qt cross-platform framework. \image addressbook-tutorial-screenshot.png @@ -61,8 +57,8 @@ Some commonly used features are never used in this tutorial. \endomit - In the process, we will learn about some basic technologies provided by Qt, - such as + In this tutorial, you will learn about some of the basic + components of Qt, including: \list \o Widgets and layout managers @@ -71,13 +67,9 @@ \o Input and output devices \endlist - If you are completely new to Qt, please read \l{How to Learn Qt} if you - have not already done so. - - The tutorial's source code is located in Qt's \c examples/tutorials/addressbook - directory. + If you are new to Qt, we recommend reading \l{How to Learn Qt} first. - Tutorial chapters: + Tutorial contents: \list 1 \o \l{tutorials/addressbook/part1}{Designing the User Interface} @@ -89,28 +81,30 @@ \o \l{tutorials/addressbook/part7}{Additional Features} \endlist - Although this little application does not look much like a fully-fledged - modern GUI application, it uses many of the basic techniques that are used - in more complex applications. After you have worked through it, we - recommend checking out the \l{mainwindows/application}{Application} - example, which presents a small GUI application, with menus, toolbars, a - status bar, and so on. + The tutorial source code is located in \c{examples/tutorials/addressbook}. + + Although this little application does not look much like a + fully-fledged modern GUI application, it uses many of the basic + elements that are used in more complex applications. After you + have worked through this tutorial, we recommend reading the + \l{mainwindows/application}{Application} example, which presents a + small GUI application, with menus, toolbars, a status bar, and so + on. */ /*! \page tutorials-addressbook-part1.html - \contentspage {Address Book Tutorial}{Contents} - \nextpage {tutorials/addressbook/part2}{Chapter 2} + \example tutorials/addressbook/part1 - \title Address Book 1 - Designing the User Interface + \title Part 1 - Designing the User Interface - The first part of this tutorial covers the design of the basic graphical - user interface (GUI) we use for the Address Book application. + This first part covers the design of the basic graphical user + interface (GUI) for our address book application. - The first step to creating a GUI program is to design the user interface. - In this chapter, our goal is to set up the labels and input fields needed - to implement a basic address book application. The figure below is a - screenshot of our expected output. + The first step in creating a GUI program is to design the user + interface. Here the our goal is to set up the labels and input + fields to implement a basic address book. The figure below is a + screenshot of the expected output. \image addressbook-tutorial-part1-screenshot.png @@ -169,14 +163,15 @@ \snippet tutorials/addressbook/part1/addressbook.h class definition - The class holds declarations of \c nameLine and \c addressText, the - private instances of QLineEdit and QTextEdit mentioned earlier. - You will see, in the coming chapters, that data stored in \c nameLine and - \c addressText is needed for many of the address book's functions. + The class holds declarations of \c nameLine and \c addressText, + the private instances of QLineEdit and QTextEdit mentioned + earlier. The data stored in \c nameLine and \c addressText will + be needed for many of the address book functions. - We do not need to include declarations of the QLabel objects we will use - because we will not need to reference them once they have been created. - The way Qt tracks the ownership of objects is explained in the next section. + We don't include declarations of the QLabel objects we will use + because we will not need to reference them once they have been + created. The way Qt tracks the ownership of objects is explained + in the next section. The Q_OBJECT macro itself implements some of the more advanced features of Qt. For now, it is useful to think of the Q_OBJECT macro as a shortcut which allows @@ -195,15 +190,14 @@ \snippet tutorials/addressbook/part1/addressbook.cpp constructor and input fields - Within this constructor, we declare and instantiate two local QLabel objects, - \c nameLabel and \c addressLabel, as well as instantiate \c nameLine and - \c addressText. The - \l{QObject::tr()}{tr()} function returns a translated version of the - string, if there is one available; otherwise, it returns the string itself. - Think of this function as an \c{} marker to mark - QString objects for translation. You will notice, in the coming chapters as - well as in the \l{Qt Examples}, that we include it whenever we use a - translatable string. + In this constructor, the QLabel objects \c nameLabel and \c + addressLabel are instantiated, as well as \c nameLine and \c + addressText. The \l{QObject::tr()}{tr()} function returns a + translated version of the string, if there is one + available. Otherwise it returns the string itself. This function + marks its QString parameter as one that should be translated into + other languages. It should be used wherever a translatable string + appears. When programming with Qt, it is useful to know how layouts work. Qt provides three main layout classes: QHBoxLayout, QVBoxLayout @@ -254,14 +248,12 @@ /*! \page tutorials-addressbook-part2.html - \previouspage Address Book 1 - Designing the User Interface - \contentspage {Address Book Tutorial}{Contents} - \nextpage {tutorials/addressbook/part3}{Chapter 3} + \example tutorials/addressbook/part2 - \title Address Book 2 - Adding Addresses + \title Part 2 - Adding Addresses - The next step to creating our basic address book application is to allow - a little bit of user interaction. + The next step in creating the address book is to implement some + user interactions. \image addressbook-tutorial-part2-add-contact.png @@ -283,9 +275,9 @@ However, for an overview of Qt's signals and slots concept, you can refer to the \l{Signals and Slots} document. - Three QPushButton objects: \c addButton, \c submitButton and - \c cancelButton, are now included in our private variable declarations, - along with \c nameLine and \c addressText from the last chapter. + Three QPushButton objects (\c addButton, \c submitButton, and + \c cancelButton) are now included in our private variable declarations, + along with \c nameLine and \c addressText. \snippet tutorials/addressbook/part2/addressbook.h pushbutton declaration @@ -407,20 +399,20 @@ /*! \page tutorials-addressbook-part3.html - \previouspage Address Book 2 - Adding Addresses - \contentspage {Address Book Tutorial}{Contents} - \nextpage {tutorials/addressbook/part4}{Chapter 4} + \example tutorials/addressbook/part3 - \title Address Book 3 - Navigating between Entries + \title Part 3 - Navigating between Entries - The address book application is now half complete. We need to add some - functions to navigate between contacts. But first, we have to decide - what sort of a data structure we would like to use to hold these contacts. + The address book is now about half complete. We should add the + capability to navigate among the contacts, but first we must + decide what sort of a data structure we need for containing these + contacts. - In Chapter 2, we used a QMap of key-value pairs with the contact's name - as the \e key, and the contact's address as the \e value. This works well - for our case. However, in order to navigate and display each entry, a - little bit of enhancement is needed. + In the previous section, we used a QMap of key-value pairs with + the contact's name as the \e key, and the contact's address as the + \e value. This works well for our case. However, in order to + navigate and display each entry, a little bit of enhancement is + needed. We enhance the QMap by making it replicate a data structure similar to a circularly-linked list, where all elements are connected, including the @@ -431,9 +423,9 @@ \section1 Defining the AddressBook Class - In order to add navigation functions to the address book application, we - need to add two more slots to our \c AddressBook class: \c next() and - \c previous(). These are added to our \c addressbook.h file: + To add navigation functions to the address book, we must add two + more slots to the \c AddressBook class: \c next() and \c + previous() to the \c addressbook.h file: \snippet tutorials/addressbook/part3/addressbook.h navigation functions @@ -455,8 +447,7 @@ \snippet tutorials/addressbook/part3/addressbook.cpp connecting navigation signals - The image below is our expected graphical user interface. Notice that it - is getting closer to our final application. + The image below is the expected graphical user interface. \image addressbook-tutorial-part3-screenshot.png @@ -525,27 +516,26 @@ /*! \page tutorials-addressbook-part4.html - \previouspage Address Book 3 - Navigating between Entries - \contentspage {Address Book Tutorial}{Contents} - \nextpage {tutorials/addressbook/part5}{Chapter 5} + \example tutorials/addressbook/part4 - \title Address Book 4 - Editing and Removing Addresses + \title Part 4 - Editing and Removing Addresses - In this chapter, we look at ways to modify the contents of contacts stored - in the address book application. + Now we look at ways to modify the contents of contacts stored in + the address book. \image addressbook-tutorial-screenshot.png - We now have an address book that not only holds contacts in an organized - manner, but also allows navigation. It would be convenient to include - edit and remove functions so that a contact's details can be changed - when needed. However, this requires a little improvement, in the form of - enums. In our previous chapters, we had two modes: \c{AddingMode} and - \c{NavigationMode} - but they were not defined as enums. Instead, we - enabled and disabled the corresponding buttons manually, resulting in - multiple lines of repeated code. + We now have an address book that not only holds contacts in an + organized manner, but also allows navigation. It would be + convenient to include edit and remove functions so that a + contact's details can be changed when needed. However, this + requires a little improvement, in the form of enums. We defined + two modes: \c{AddingMode} and \c{NavigationMode}, but they were + not defined as enum values. Instead, we enabled and disabled the + corresponding buttons manually, resulting in multiple lines of + repeated code. - In this chapter, we define the \c Mode enum with three different values: + Here we define the \c Mode enum with three different values: \list \o \c{NavigationMode}, @@ -579,10 +569,10 @@ \section1 Implementing the AddressBook Class - We now have to implement the mode-changing features of the address book - application. The \c editButton and \c removeButton are instantiated and - disabled by default, as the address book starts up with zero contacts in - memory. + We now implement the mode-changing features of the address + book. The \c editButton and \c removeButton are instantiated and + disabled by default. The address book starts with zero contacts + in memory. \snippet tutorials/addressbook/part4/addressbook.cpp edit and remove buttons @@ -653,33 +643,31 @@ \snippet tutorials/addressbook/part4/addressbook.cpp update interface() part 2 - By performing the task of setting the mode and updating the user interface in - the same function, we avoid the possibility of the user interface getting "out - of sync" with the internal state of the application. -*/ + By setting the mode and updating the user interface in the same + function, we avoid the possibility of the user interface getting + out of sync with the internal state of the application. + */ /*! \page tutorials-addressbook-part5.html - \previouspage Address Book 4 - Editing and Removing Addresses - \contentspage {Address Book Tutorial}{Contents} - \nextpage {tutorials/addressbook/part6}{Chapter 6} + \example tutorials/addressbook/part5 - \title Address Book 5 - Adding a Find Function + \title Part 5 - Adding a Find Function - In this chapter, we look at ways to locate contacts and addresses in - the address book application. + Here we look at ways to locate contacts and addresses in the + address book. \image addressbook-tutorial-part5-screenshot.png - As we keep adding contacts to our address book application, it becomes - tedious to navigate them with the \e Next and \e Previous buttons. In this - case, a \e Find function would be more efficient in looking up contacts. - The screenshot above shows the \e Find button and its position on the panel - of buttons. + As we add contacts to our address book, it becomes tedious to + navigate the list with the \e Next and \e Previous buttons. A \e + Find function would be more efficient. The screenshot above shows + the \e Find button and its position on the panel of buttons. - When the user clicks on the \e Find button, it is useful to display a - dialog that can prompt the user for a contact's name. Qt provides QDialog, - which we subclass in this chapter, to implement a \c FindDialog class. + When the user clicks on the \e Find button, it is useful to + display a dialog that prompts for a contact's name. Qt provides + QDialog, which we subclass here to implement a \c FindDialog + class. \section1 Defining the FindDialog Class @@ -806,20 +794,18 @@ /*! \page tutorials-addressbook-part6.html - \previouspage Address Book 5 - Adding a Find Function - \contentspage {Address Book Tutorial}{Contents} - \nextpage {tutorials/addressbook/part7}{Chapter 7} + \example tutorials/addressbook/part6 - \title Address Book 6 - Loading and Saving + \title Part 6 - Loading and Saving - This chapter covers the file handling features of Qt that we use to write - loading and saving routines for the address book application. + This part covers the Qt file handling features we use to write + loading and saving routines for the address book. \image addressbook-tutorial-part6-screenshot.png - Although browsing and searching for contacts are useful features, our - address book is not ready for use until we can save existing contacts and - load them again at a later time. + Although browsing and searching the contact list are useful + features, our address book is not complete until we can save + existing contacts and load them again at a later time. Qt provides a number of classes for \l{Input/Output and Networking} {input and output}, but we have chosen to use two which are simple to use @@ -930,21 +916,20 @@ /*! \page tutorials-addressbook-part7.html - \previouspage Address Book 6 - Loading and Saving - \contentspage {Address Book Tutorial}{Contents} + \example tutorials/addressbook/part7 - \title Address Book 7 - Additional Features + \title Part 7 - Additional Features - This chapter covers some additional features that make the address book - application more convenient for everyday use. + This part covers some additional features that make the address + book more convenient for the frequent user. \image addressbook-tutorial-part7-screenshot.png - Although our address book application is useful in its own right, it would - be useful if we could exchange contact data with other applications. - The vCard format is a popular file format that can be used for this purpose. - In this chapter, we extend our address book client to allow contacts to - be exported to vCard \c{.vcf} files. + Although our address book is useful in isolation, it would be + better if we could exchange contact data with other applications. + The vCard format is a popular file format that can be used for + this purpose. Here we extend our address book client to allow + contacts to be exported to vCard \c{.vcf} files. \section1 Defining the AddressBook Class diff --git a/doc/src/tutorials/widgets-tutorial.qdoc b/doc/src/tutorials/widgets-tutorial.qdoc index 0422e1a..2b5f8cc 100644 --- a/doc/src/tutorials/widgets-tutorial.qdoc +++ b/doc/src/tutorials/widgets-tutorial.qdoc @@ -102,7 +102,7 @@ \section1 Real world widget examples - In these \l{Widgets examples} {more advanced examples}, the code + In these \l{Widget examples} {more advanced examples}, the code that creates the widgets and layouts is stored in other files. For example, the GUI for a main window may be created in the constructor of a QMainWindow subclass. -- cgit v0.12 From 01483b3d921eea7c4e3c8fa159ab60a3ca32f1ee Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Wed, 26 May 2010 14:18:31 +0200 Subject: qdoc: Fixed the French version of the address book tutorial --- doc/src/tutorials/addressbook-fr.qdoc | 30 +++++++----------------------- 1 file changed, 7 insertions(+), 23 deletions(-) diff --git a/doc/src/tutorials/addressbook-fr.qdoc b/doc/src/tutorials/addressbook-fr.qdoc index 98c44a3..85a9acf 100644 --- a/doc/src/tutorials/addressbook-fr.qdoc +++ b/doc/src/tutorials/addressbook-fr.qdoc @@ -42,10 +42,6 @@ /*! \page tutorials-addressbook-fr.html - \startpage {index.html}{Qt Reference Documentation} - \contentspage Tutorials - \nextpage {tutorials/addressbook-fr/part1}{Chapitre 1} - \title Tutoriel "Carnet d'adresses" \brief Une introduction à la programation d'interface graphique montrant comment construire une application simple avec Qt. @@ -93,8 +89,7 @@ /*! \page tutorials-addressbook-fr-part1.html - \contentspage {Tutoriel "Carnet d'adresses"}{Sommaire} - \nextpage {tutorials/addressbook-fr/part2}{Chapitre 2} + \example tutorials/addressbook-fr/part1 \title Carnet d'adresses 1 - Conception de l'interface utilisateur @@ -252,9 +247,7 @@ /*! \page tutorials-addressbook-fr-part2.html - \previouspage {tutorials/addressbook-fr/part1}{Chapitre 1} - \contentspage {Tutoriel "Carnet d'adresses"}{Sommaire} - \nextpage {tutorials/addressbook-fr/part3}{Chapitre 3} + \example tutorials/addressbook-fr/part2 \title Carnet d'adresses 2 - Ajouter des adresses @@ -414,9 +407,7 @@ /*! \page tutorials-addressbook-fr-part3.html - \previouspage {tutorials/addressbook-fr/part2}{Chapitre 2} - \contentspage {Tutoriel "Carnet d'adresses"}{Sommaire} - \nextpage {tutorials/addressbook-fr/part4}{Chapitre 4} + \example tutorials/addressbook-fr/part3 \title Carnet d'adresses 3 - Navigation entre les éléments @@ -536,9 +527,7 @@ /*! \page tutorials-addressbook-fr-part4.html - \previouspage {tutorials/addressbook-fr/part3}{Chapitre 3} - \contentspage {Tutoriel "Carnet d'adresses"}{Sommaire} - \nextpage {tutorials/addressbook-fr/part5}{Chapitre 5} + \example tutorials/addressbook-fr/part4 \title Carnet d'Adresses 4 - éditer et supprimer des adresses @@ -688,9 +677,7 @@ /*! \page tutorials-addressbook-fr-part5.html - \previouspage {tutorials/addressbook-fr/part4}{Chapitre 4} - \contentspage {Tutoriel "Carnet d'adresses"}{Sommaire} - \nextpage {tutorials/addressbook-fr/part6}{Chapitre 6} + \example tutorials/addressbook-fr/part5 \title Carnet d'adresse 5 - Ajout d'une fonction de recherche @@ -839,9 +826,7 @@ /*! \page tutorials-addressbook-part6.html - \previouspage {tutorials/addressbook-fr/part5}{Chapitre 5} - \contentspage {Tutoriel "Carnet d'adresses"}{Sommaire} - \nextpage {tutorials/addressbook-fr/part7}{Chapitre 7} + \example tutorials/addressbook-fr/part6 \title Carnet d'Adresses 6 - Sauvegarde et chargement @@ -978,8 +963,7 @@ /*! \page tutorials-addressbook-fr-part7.html - \previouspage {tutorials/addressbook-fr/part6}{Chapitre 6} - \contentspage {Tutoriel "Carnet d'adresses"}{Sommaire} + \example tutorials/addressbook-fr/part7 \title Carnet d'adresse 7 - Fonctionnalités avancées -- cgit v0.12 From 44e33b3c8d776b66b2122eb3757177dfbd7baa4c Mon Sep 17 00:00:00 2001 From: Carlos Manuel Duclos Vergara Date: Wed, 26 May 2010 14:29:40 +0200 Subject: qaccessibility::eventTest(...) was failing. The problem here is the fact that to test the mouse click the test depended on some "magical" coordinates which are not valid anymore. But since QTest::mouseClick(...) will target the center of the button, there is no need to calculate coordinates. Reviewed-by: Richard Moe Gustavsen --- tests/auto/qaccessibility/tst_qaccessibility.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/auto/qaccessibility/tst_qaccessibility.cpp b/tests/auto/qaccessibility/tst_qaccessibility.cpp index e5a332a..cea259c 100644 --- a/tests/auto/qaccessibility/tst_qaccessibility.cpp +++ b/tests/auto/qaccessibility/tst_qaccessibility.cpp @@ -475,7 +475,7 @@ void tst_QAccessibility::eventTest() QVERIFY_EVENT(button, 0, QAccessible::ObjectShow); button->setFocus(Qt::MouseFocusReason); QTestAccessibility::clearEvents(); - QTest::mouseClick(button, Qt::LeftButton, 0, QPoint(button->width()-7,button->height()-5)); + QTest::mouseClick(button, Qt::LeftButton, 0); QVERIFY_EVENT(button, 0, QAccessible::StateChanged); QVERIFY_EVENT(button, 0, QAccessible::StateChanged); -- cgit v0.12 From cf1e3150247d6694e8c00b924627c66e798f2382 Mon Sep 17 00:00:00 2001 From: Pierre Rossi Date: Tue, 6 Apr 2010 19:59:08 +0200 Subject: Fixes a proxymodel sorting odity. Sort order was modified when sorted according to an empty column always in the same order Reviewed-by: Thierry --- src/gui/itemviews/qsortfilterproxymodel.cpp | 2 +- .../tst_qsortfilterproxymodel.cpp | 36 ++++++++++++++++++++++ 2 files changed, 37 insertions(+), 1 deletion(-) diff --git a/src/gui/itemviews/qsortfilterproxymodel.cpp b/src/gui/itemviews/qsortfilterproxymodel.cpp index b12cd45..f9b6b94 100644 --- a/src/gui/itemviews/qsortfilterproxymodel.cpp +++ b/src/gui/itemviews/qsortfilterproxymodel.cpp @@ -2392,7 +2392,7 @@ bool QSortFilterProxyModel::lessThan(const QModelIndex &left, const QModelIndex QVariant r = (right.model() ? right.model()->data(right, d->sort_role) : QVariant()); switch (l.userType()) { case QVariant::Invalid: - return (r.type() == QVariant::Invalid); + return (r.type() != QVariant::Invalid); case QVariant::Int: return l.toInt() < r.toInt(); case QVariant::UInt: diff --git a/tests/auto/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp b/tests/auto/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp index 992c95e..53fefee 100644 --- a/tests/auto/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp +++ b/tests/auto/qsortfilterproxymodel/tst_qsortfilterproxymodel.cpp @@ -127,6 +127,8 @@ private slots: void sortColumnTracking1(); void sortColumnTracking2(); + void sortStable(); + void task236755_hiddenColumns(); void task247867_insertRowsSort(); void task248868_staticSorting(); @@ -2442,6 +2444,40 @@ void tst_QSortFilterProxyModel::sortColumnTracking2() QCOMPARE(proxyModel.data(proxyModel.index(strings.count()-1,0)).toString(),QString::fromLatin1("zz")); } +void tst_QSortFilterProxyModel::sortStable() +{ + QStandardItemModel* model = new QStandardItemModel(5, 2); + for (int r=0; r<5; r++) { + for (int c=0; c<2; c++) { + QStandardItem* item = new QStandardItem( + QString("Row:%0, Column:%1").arg(r).arg(c) ); + for( int i=0; i<3; i++ ) { + QStandardItem* child = new QStandardItem( + QString("Item %0").arg(i) ); + item->appendRow( child ); + } + model->setItem(r, c, item); + } + } + model->setHorizontalHeaderItem( 0, new QStandardItem( "Name" )); + model->setHorizontalHeaderItem( 1, new QStandardItem( "Value" ) ); + + + QSortFilterProxyModel *filterModel = new QSortFilterProxyModel(model); + filterModel->setSourceModel(model); + + QTreeView *view = new QTreeView; + view->setModel(filterModel); + QModelIndex firstRoot = filterModel->index(0,0); + view->expand(firstRoot); + view->setSortingEnabled(true); + + view->model()->sort(1, Qt::DescendingOrder); + QVariant lastItemData =filterModel->index(2,0, firstRoot).data(); + view->model()->sort(1, Qt::DescendingOrder); + QCOMPARE(lastItemData, filterModel->index(2,0, firstRoot).data()); +} + void tst_QSortFilterProxyModel::task236755_hiddenColumns() { class MyStandardItemModel : public QStandardItemModel -- cgit v0.12 From 11a8c52498e8dc74fdfef48e953055338c8f18d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Nilsen?= Date: Wed, 26 May 2010 15:53:06 +0200 Subject: Redraw issues when removing a fully transparent QGraphicsItem from the scene. This only happened with fully transparent ancestors (item's effectiveOpacity() == 0.0). Problem was that we didn't take into account the ancestors' opacity when removing an item from the scene. More specifically: The calculated effective opacity for the item was zero and we ignored update requests. We have to ignore the opacity if any of the ancestors' ignoreOpacity bit is 1, which means the opacity is set to 0 and the update request has not yet been processed. Auto test included. Task-number: QTBUG-10778 --- src/gui/graphicsview/qgraphicsscene.cpp | 18 ++++++++++ tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp | 43 ++++++++++++++++++++++++ 2 files changed, 61 insertions(+) diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp index ae0abf9..22c3f92 100644 --- a/src/gui/graphicsview/qgraphicsscene.cpp +++ b/src/gui/graphicsview/qgraphicsscene.cpp @@ -4889,6 +4889,24 @@ void QGraphicsScenePrivate::markDirty(QGraphicsItem *item, const QRectF &rect, b if (updateAll) return; + if (removingItemFromScene && !ignoreOpacity && !item->d_ptr->ignoreOpacity) { + // If any of the item's ancestors ignore opacity, it means that the opacity + // was set to 0 (and the update request has not yet been processed). That + // also means that we have to ignore the opacity for the item itself; otherwise + // things like: parent->setOpacity(0); scene->removeItem(child) won't work. + // Note that we only do this when removing items from the scene. In all other + // cases the ignoreOpacity bit propagates properly in processDirtyItems, but + // since the item is removed immediately it won't be processed there. + QGraphicsItem *p = item->d_ptr->parent; + while (p) { + if (p->d_ptr->ignoreOpacity) { + item->d_ptr->ignoreOpacity = true; + break; + } + p = p->d_ptr->parent; + } + } + if (item->d_ptr->discardUpdateRequest(/*ignoreVisibleBit=*/force, /*ignoreDirtyBit=*/removingItemFromScene || invalidateChildren, /*ignoreOpacity=*/ignoreOpacity)) { diff --git a/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp b/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp index a155222..67a41ca 100644 --- a/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp +++ b/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp @@ -275,6 +275,7 @@ private slots: void polishItems2(); void isActive(); void siblingIndexAlwaysValid(); + void removeFullyTransparentItem(); // task specific tests below me void task139710_bspTreeCrash(); @@ -4333,6 +4334,48 @@ void tst_QGraphicsScene::siblingIndexAlwaysValid() } +void tst_QGraphicsScene::removeFullyTransparentItem() +{ + QGraphicsScene scene; + + QGraphicsItem *parent = scene.addRect(0, 0, 100, 100); + parent->setFlag(QGraphicsItem::ItemHasNoContents); + + QGraphicsItem *child = scene.addRect(0, 0, 100, 100); + child->setParentItem(parent); + + CustomView view; + view.setScene(&scene); + view.show(); + QTest::qWaitForWindowShown(&view); + + // NB! The parent has the ItemHasNoContents flag set, which means + // the parent itself doesn't generate any update requests, only the + // child can possibly trigger an update. Also note that the child + // is removed before processing events. + view.repaints = 0; + parent->setOpacity(0); + QVERIFY(qFuzzyIsNull(child->effectiveOpacity())); + scene.removeItem(child); + QVERIFY(!scene.items().contains(child)); + QTRY_VERIFY(view.repaints > 0); + + // Re-add child. There's nothing new to display (child is still + // effectively hidden), so it shouldn't trigger an update. + view.repaints = 0; + child->setParentItem(parent); + QVERIFY(scene.items().contains(child)); + QVERIFY(qFuzzyIsNull(child->effectiveOpacity())); + QApplication::processEvents(); + QCOMPARE(view.repaints, 0); + + // Nothing is visible on the screen, removing child item shouldn't trigger an update. + scene.removeItem(child); + QApplication::processEvents(); + QCOMPARE(view.repaints, 0); + delete child; +} + void tst_QGraphicsScene::taskQTBUG_5904_crashWithDeviceCoordinateCache() { QGraphicsScene scene; -- cgit v0.12 From f1ba0329a90fe62a850e4b00bf3bd13011dbe4fa Mon Sep 17 00:00:00 2001 From: Alan Alpert Date: Wed, 26 May 2010 17:54:35 +0200 Subject: Add key event handling to the declarative web view This is a very simple approach, I don't know if a more nuanced system would be appropriate. Task-number: QTBUG-11025 --- src/imports/webkit/qdeclarativewebview.cpp | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/src/imports/webkit/qdeclarativewebview.cpp b/src/imports/webkit/qdeclarativewebview.cpp index 36a25f6..050e2b7 100644 --- a/src/imports/webkit/qdeclarativewebview.cpp +++ b/src/imports/webkit/qdeclarativewebview.cpp @@ -150,6 +150,9 @@ public: The item includes no scrolling, scaling, toolbars, etc., those must be implemented around WebView. See the WebBrowser example for a demonstration of this. + + When this item has keyboard focus, all keyboard input will be sent directly to the + web page within. */ /*! @@ -701,20 +704,12 @@ void QDeclarativeWebView::hoverMoveEvent (QGraphicsSceneHoverEvent * event) QDeclarativeItem::hoverMoveEvent(event); } -bool QDeclarativeWebView::sceneEvent(QEvent *event) -{ - if (event->type() == QEvent::KeyPress) { - QKeyEvent *k = static_cast(event); - if (k->key() == Qt::Key_Tab || k->key() == Qt::Key_Backtab) { - if (!(k->modifiers() & (Qt::ControlModifier | Qt::AltModifier))) { //### Add MetaModifier? - page()->event(event); - if (event->isAccepted()) - return true; - } - } - } +bool QDeclarativeWebView::sceneEvent(QEvent *event) +{ + if (event->type() == QEvent::KeyPress || event->type() == QEvent::KeyRelease)//Key events go to the page + return page()->event(event); return QDeclarativeItem::sceneEvent(event); -} +} /*! -- cgit v0.12 From c22dc63d5333c85afd167944675bfebec6b5c9a3 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Wed, 26 May 2010 13:54:40 +0200 Subject: complain about unescaped backslashes --- qmake/project.cpp | 6 ++++++ qmake/project.h | 1 + 2 files changed, 7 insertions(+) diff --git a/qmake/project.cpp b/qmake/project.cpp index 2be68be..9cf6a6f 100644 --- a/qmake/project.cpp +++ b/qmake/project.cpp @@ -671,6 +671,7 @@ QMakeProject::reset() scope_blocks.push(ScopeBlock()); iterator = 0; function = 0; + backslashWarned = false; } bool @@ -2933,6 +2934,11 @@ QMakeProject::doVariableReplaceExpand(const QString &str, QMap Date: Wed, 26 May 2010 14:05:58 +0200 Subject: escape backslashes this makes windows-style path specs *ugly*. that's intentional. :-P --- demos/embedded/desktopservices/desktopservices.pro | 4 +-- examples/painting/svgviewer/svgviewer.pro | 6 ++-- examples/xml/dombookmarks/dombookmarks.pro | 2 +- examples/xml/saxbookmarks/saxbookmarks.pro | 2 +- mkspecs/common/symbian/symbian-makefile.conf | 2 +- mkspecs/common/wince/qmake.conf | 6 ++-- mkspecs/features/dbusadaptors.prf | 2 +- mkspecs/features/dbusinterfaces.prf | 2 +- mkspecs/features/incredibuild_xge.prf | 4 +-- mkspecs/features/lex.prf | 6 ++-- mkspecs/features/moc.prf | 6 ++-- mkspecs/features/sis_targets.prf | 2 +- mkspecs/features/symbian/add_mmp_rules.prf | 2 +- mkspecs/features/symbian/application_icon.prf | 4 +-- mkspecs/features/symbian/def_files.prf | 2 +- mkspecs/features/symbian/moc.prf | 6 ++-- mkspecs/features/symbian/symbian_building.prf | 14 ++++----- mkspecs/features/uic.prf | 8 ++--- mkspecs/features/win32/embed_manifest_dll.prf | 6 ++-- mkspecs/features/win32/embed_manifest_exe.prf | 6 ++-- mkspecs/features/win32/qaxserver.prf | 6 ++-- mkspecs/features/yacc.prf | 10 +++--- mkspecs/win32-borland/qmake.conf | 8 ++--- mkspecs/win32-icc/qmake.conf | 6 ++-- mkspecs/win32-msvc2003/qmake.conf | 6 ++-- mkspecs/win32-msvc2005/qmake.conf | 6 ++-- mkspecs/win32-msvc2008/qmake.conf | 6 ++-- mkspecs/win32-msvc2010/qmake.conf | 6 ++-- projects.pro | 36 +++++++++++----------- src/3rdparty/webkit/WebCore/WebCore.pro | 2 +- .../webkit/WebKit/qt/Api/DerivedSources.pro | 6 ++-- src/3rdparty/webkit/WebKit/qt/docs/docs.pri | 2 +- src/activeqt/control/control.pro | 2 +- .../auto/declarative/parserstress/parserstress.pro | 2 +- .../lupdate/testdata/good/backslashes/project.pro | 4 +-- .../auto/patternistexamples/patternistexamples.pro | 2 +- tests/auto/qaccessibility/qaccessibility.pro | 2 +- tests/auto/qdesktopservices/qdesktopservices.pro | 22 ++++++------- tests/auto/qdirmodel/qdirmodel.pro | 6 ++-- tests/auto/qfile/test/test.pro | 8 ++--- tests/auto/qfileinfo/qfileinfo.pro | 2 +- tests/auto/qgraphicsscene/qgraphicsscene.pro | 4 +-- tests/auto/qimagewriter/qimagewriter.pro | 4 +-- tests/auto/qlibrary/lib2/lib2.pro | 6 ++-- tests/auto/qlocale/test/test.pro | 2 +- tests/auto/qlocalsocket/test/test.pro | 2 +- tests/auto/qmainwindow/qmainwindow.pro | 2 +- tests/auto/qmake/testdata/functions/functions.pro | 2 +- tests/auto/qmovie/qmovie.pro | 4 +-- tests/auto/qnetworkreply/test/test.pro | 2 +- tests/auto/qobject/tst_qobject.pro | 2 +- tests/auto/qprocess/test/test.pro | 2 +- .../qsocks5socketengine/qsocks5socketengine.pro | 2 +- tests/auto/solutions.pri | 4 +-- tests/auto/windowsmobile/test/test.pro | 2 +- .../lib/fulltextsearch/fulltextsearch.pro | 2 +- 56 files changed, 142 insertions(+), 142 deletions(-) diff --git a/demos/embedded/desktopservices/desktopservices.pro b/demos/embedded/desktopservices/desktopservices.pro index bff7c46..94ddedd 100644 --- a/demos/embedded/desktopservices/desktopservices.pro +++ b/demos/embedded/desktopservices/desktopservices.pro @@ -24,8 +24,8 @@ symbian { } wince*{ - music.path = "\My Documents\My Music" - image.path = "\My Documents\My Pictures" + music.path = "\\My Documents\\My Music" + image.path = "\\My Documents\\My Pictures" DEPLOYMENT += music image } diff --git a/examples/painting/svgviewer/svgviewer.pro b/examples/painting/svgviewer/svgviewer.pro index 5af8731..4809b91 100644 --- a/examples/painting/svgviewer/svgviewer.pro +++ b/examples/painting/svgviewer/svgviewer.pro @@ -17,15 +17,15 @@ sources.path = $$[QT_INSTALL_EXAMPLES]/painting/svgviewer INSTALLS += target sources wince*: { - addFiles.sources = files\*.svg - addFiles.path = \My Documents + addFiles.sources = files\\*.svg + addFiles.path = "\\My Documents" DEPLOYMENT += addFiles } symbian: { TARGET.UID3 = 0xA000A64E include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri) - addFiles.sources = files\*.svg + addFiles.sources = files\\*.svg addFiles.path = . DEPLOYMENT += addFiles } diff --git a/examples/xml/dombookmarks/dombookmarks.pro b/examples/xml/dombookmarks/dombookmarks.pro index 25e21cd..f906d2f 100644 --- a/examples/xml/dombookmarks/dombookmarks.pro +++ b/examples/xml/dombookmarks/dombookmarks.pro @@ -15,6 +15,6 @@ symbian: include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri) wince*: { addFiles.sources = frank.xbel jennifer.xbel - addFiles.path = \My Documents + addFiles.path = "\\My Documents" DEPLOYMENT += addFiles } diff --git a/examples/xml/saxbookmarks/saxbookmarks.pro b/examples/xml/saxbookmarks/saxbookmarks.pro index 4af3ddd..7293bd1 100644 --- a/examples/xml/saxbookmarks/saxbookmarks.pro +++ b/examples/xml/saxbookmarks/saxbookmarks.pro @@ -15,7 +15,7 @@ INSTALLS += target sources wince*: { addFiles.sources = frank.xbel jennifer.xbel - addFiles.path = \My Documents + addFiles.path = "\\My Documents" DEPLOYMENT += addFiles } diff --git a/mkspecs/common/symbian/symbian-makefile.conf b/mkspecs/common/symbian/symbian-makefile.conf index 66b3d7f..a3aade7 100644 --- a/mkspecs/common/symbian/symbian-makefile.conf +++ b/mkspecs/common/symbian/symbian-makefile.conf @@ -32,7 +32,7 @@ QMAKE_PREFIX_STATICLIB = QMAKE_EXTENSION_STATICLIB = lib QMAKE_SYMBIAN_SHLIB = 1 -DEFINES *= __PRODUCT_INCLUDE__=\<$${EPOCROOT}epoc32/include/variant/symbian_os.hrh\> \ +DEFINES *= __PRODUCT_INCLUDE__=\\<$${EPOCROOT}epoc32/include/variant/symbian_os.hrh\\> \ __SYMBIAN32__ \ __MARM_INTERWORK__ \ _UNICODE \ diff --git a/mkspecs/common/wince/qmake.conf b/mkspecs/common/wince/qmake.conf index 705cdc3..57b89b9 100644 --- a/mkspecs/common/wince/qmake.conf +++ b/mkspecs/common/wince/qmake.conf @@ -70,9 +70,9 @@ QMAKE_LIBS_OPENGL_ES2 = libGLESv2.lib QMAKE_LIBS_QT_ENTRY = -lqtmain -QMAKE_MOC = $$[QT_INSTALL_BINS]\moc.exe -QMAKE_UIC = $$[QT_INSTALL_BINS]\uic.exe -QMAKE_IDC = $$[QT_INSTALL_BINS]\idc.exe +QMAKE_MOC = $$[QT_INSTALL_BINS]\\moc.exe +QMAKE_UIC = $$[QT_INSTALL_BINS]\\uic.exe +QMAKE_IDC = $$[QT_INSTALL_BINS]\\idc.exe QMAKE_IDL = midl QMAKE_LIB = lib diff --git a/mkspecs/features/dbusadaptors.prf b/mkspecs/features/dbusadaptors.prf index 17dffa5..3463d58 100644 --- a/mkspecs/features/dbusadaptors.prf +++ b/mkspecs/features/dbusadaptors.prf @@ -2,7 +2,7 @@ qtPrepareTool(QMAKE_QDBUSXML2CPP, qdbusxml2cpp) for(DBUS_ADAPTOR, $$list($$unique(DBUS_ADAPTORS))) { - !contains(DBUS_ADAPTOR, .*\w\.xml$) { + !contains(DBUS_ADAPTOR, .*\\w\\.xml$) { warning("Invalid D-BUS adaptor: '$${DBUS_ADAPTOR}', please use 'com.mydomain.myinterface.xml' instead.") next() } diff --git a/mkspecs/features/dbusinterfaces.prf b/mkspecs/features/dbusinterfaces.prf index 412e80f..1828802 100644 --- a/mkspecs/features/dbusinterfaces.prf +++ b/mkspecs/features/dbusinterfaces.prf @@ -4,7 +4,7 @@ qtPrepareTool(QMAKE_QDBUSXML2CPP, qdbusxml2cpp) for(DBUS_INTERFACE, $$list($$unique(DBUS_INTERFACES))) { - !contains(DBUS_INTERFACE, .*\w\.xml$) { + !contains(DBUS_INTERFACE, .*\\w\\.xml$) { warning("Invalid D-BUS interface : '$${DBUS_INTERFACE}', please use 'com.mydomain.myinterface.xml' instead.") next() } diff --git a/mkspecs/features/incredibuild_xge.prf b/mkspecs/features/incredibuild_xge.prf index e241ca4..b8ca571 100644 --- a/mkspecs/features/incredibuild_xge.prf +++ b/mkspecs/features/incredibuild_xge.prf @@ -1,9 +1,9 @@ contains(TEMPLATE, "vc.*")|contains(TEMPLATE_PREFIX, "vc") { - EOC = \$\$escape_expand(\n\t) + EOC = \$\$escape_expand(\\\\n\\\\t) # The VCPROJ generator will replace the \r\h with the coded \r\n: # No other generator understands the \h - win32-msvc2*|wince*msvc*: EOC = \$\$escape_expand(\r\h) + win32-msvc2*|wince*msvc*: EOC = \$\$escape_expand(\\\\r\\\\h) for(xge, INCREDIBUILD_XGE) { eval($${xge}.commands = Rem IncrediBuild_AllowRemote $$EOC Rem IncrediBuild_OutputFile $$replace($${xge}.output,/,\\) $$EOC $$eval($${xge}.commands)) diff --git a/mkspecs/features/lex.prf b/mkspecs/features/lex.prf index df76a68..43d8fbd 100644 --- a/mkspecs/features/lex.prf +++ b/mkspecs/features/lex.prf @@ -14,9 +14,9 @@ QMAKE_LEXEXTRAFLAGS = $$QMAKE_LEXFLAGS !yacc_no_name_mangle:QMAKE_LEXEXTRAFLAGS += $$QMAKE_LEXFLAGS_MANGLE - lex.commands = $$QMAKE_LEX $$QMAKE_LEXEXTRAFLAGS ${QMAKE_FILE_IN}$$escape_expand(\n\t) \ - $$QMAKE_DEL_FILE $${QMAKE_CPP_MOD_MOC}${QMAKE_FILE_BASE}_lex$${first(QMAKE_EXT_CPP)}$$escape_expand(\n\t) \ - $$QMAKE_MOVE lex.${QMAKE_FILE_BASE}.c $${QMAKE_CPP_MOD_MOC}${QMAKE_FILE_BASE}_lex$${first(QMAKE_EXT_CPP)}$$escape_expand(\n\t) + lex.commands = $$QMAKE_LEX $$QMAKE_LEXEXTRAFLAGS ${QMAKE_FILE_IN}$$escape_expand(\\n\\t) \ + $$QMAKE_DEL_FILE $${QMAKE_CPP_MOD_MOC}${QMAKE_FILE_BASE}_lex$${first(QMAKE_EXT_CPP)}$$escape_expand(\\n\\t) \ + $$QMAKE_MOVE lex.${QMAKE_FILE_BASE}.c $${QMAKE_CPP_MOD_MOC}${QMAKE_FILE_BASE}_lex$${first(QMAKE_EXT_CPP)}$$escape_expand(\\n\\t) lex.output = $${QMAKE_CPP_MOD_MOC}${QMAKE_FILE_BASE}_lex$${first(QMAKE_EXT_CPP)} silent:lex.commands = @echo Lex ${QMAKE_FILE_IN} && $$lex.commands diff --git a/mkspecs/features/moc.prf b/mkspecs/features/moc.prf index e1032fd..abda78f 100644 --- a/mkspecs/features/moc.prf +++ b/mkspecs/features/moc.prf @@ -14,13 +14,13 @@ win32:count($$list($$INCLUDEPATH), 40, >) { WIN_INCLUDETEMP=$$INCLUDETEMP - EOC = $$escape_expand(\n\t) + EOC = $$escape_expand(\\n\\t) if(contains(TEMPLATE, "vc.*")|contains(TEMPLATE_PREFIX, "vc")) { # the VCPROJ generator will replace the \r\h with the coded \r\n: # No other generator understands the \h - if(win32-msvc2*|wince*msvc*): EOC = $$escape_expand(\r\h) - else: EOC = $$escape_expand(\\)$$escape_expand(\n\t) + if(win32-msvc2*|wince*msvc*): EOC = $$escape_expand(\\r\\h) + else: EOC = $$escape_expand(\\\\\\n\\t) } unset(INCFILELIST) diff --git a/mkspecs/features/sis_targets.prf b/mkspecs/features/sis_targets.prf index da2d250..13ee1ad 100644 --- a/mkspecs/features/sis_targets.prf +++ b/mkspecs/features/sis_targets.prf @@ -96,7 +96,7 @@ contains(TEMPLATE, app)|!count(DEPLOYMENT, 1) { } } else { sis_destdir = $$DESTDIR - !isEmpty(sis_destdir):!contains(sis_destdir, "[/\\]$"):sis_destdir = $${sis_destdir}/ + !isEmpty(sis_destdir):!contains(sis_destdir, "[/\\\\]$"):sis_destdir = $${sis_destdir}/ contains(QMAKE_HOST.os, "Windows"):sis_destdir = $$replace(sis_destdir, "/", "\\") sis_target.target = sis diff --git a/mkspecs/features/symbian/add_mmp_rules.prf b/mkspecs/features/symbian/add_mmp_rules.prf index 5384dbe..7f96b81 100644 --- a/mkspecs/features/symbian/add_mmp_rules.prf +++ b/mkspecs/features/symbian/add_mmp_rules.prf @@ -23,7 +23,7 @@ defineTest(addMMPRules) { # No value defined for current condition, so use default varVal = $$eval($${var}.default) } - !isEmpty(varVal): libBlock += "$$join(varVal,$$escape_expand(\n))" + !isEmpty(varVal): libBlock += "$$join(varVal,$$escape_expand(\\n))" } MMP_RULES += $$libBlock diff --git a/mkspecs/features/symbian/application_icon.prf b/mkspecs/features/symbian/application_icon.prf index 76f9ba1..c5654d9 100644 --- a/mkspecs/features/symbian/application_icon.prf +++ b/mkspecs/features/symbian/application_icon.prf @@ -21,11 +21,11 @@ contains( CONFIG, no_icon ) { # only uses filename from RSS_RULES.icon_file when referring to icon file name. baseTarget = $$basename(TARGET) baseTarget = $$replace(baseTarget, /,_) - baseTarget = $$replace(baseTarget, \\,_) + baseTarget = $$replace(baseTarget, \\\\,_) baseTarget = $$replace(baseTarget, " ",_) symbian-abld|symbian-sbsv2 { baseTarget = $$replace(baseTarget, -,_) - baseTarget = $$replace(baseTarget, \.,_) + baseTarget = $$replace(baseTarget, \\.,_) baseTarget = $$replace(baseTarget, :,_) } diff --git a/mkspecs/features/symbian/def_files.prf b/mkspecs/features/symbian/def_files.prf index 8bcd096..eb17402 100644 --- a/mkspecs/features/symbian/def_files.prf +++ b/mkspecs/features/symbian/def_files.prf @@ -63,7 +63,7 @@ symbian-abld|symbian-sbsv2 { freeze_target.target = freeze freeze_target.depends = first # The perl part is to convert to unix line endings and remove comments, which the s60 tools refuse to do. - freeze_target.commands = perl -n -e \'next if (/; NEW/); s/\r//g; if (/MISSING:(.*)/x) { print(\"\$\$1 ABSENT\\n\"); } else { print; }\' < $$symbianObjdir/$${TARGET}.def > $$elf2e32FileToAdd + freeze_target.commands = perl -n -e \'next if (/; NEW/); s/\\r//g; if (/MISSING:(.*)/x) { print(\"\$\$1 ABSENT\\n\"); } else { print; }\' < $$symbianObjdir/$${TARGET}.def > $$elf2e32FileToAdd QMAKE_EXTRA_TARGETS += freeze_target } else:contains(TEMPLATE, subdirs) { freeze_target.target = freeze diff --git a/mkspecs/features/symbian/moc.prf b/mkspecs/features/symbian/moc.prf index 29e0d8d..6030944 100644 --- a/mkspecs/features/symbian/moc.prf +++ b/mkspecs/features/symbian/moc.prf @@ -1,17 +1,17 @@ load(moc) symbian-abld|symbian-sbsv2 { - RET = $$find(MOC_DIR, "(/|^)\.[^/]+/?$") + RET = $$find(MOC_DIR, "(/|^)\\.[^/]+/?$") !isEmpty(RET):{ error("Symbian does not support directories starting with a dot. Please set MOC_DIR to a different value in your profile. MOC_DIR: $$MOC_DIR") } - RET = $$find(RCC_DIR, "(/|^)\.[^/]+/?$") + RET = $$find(RCC_DIR, "(/|^)\\.[^/]+/?$") !isEmpty(RET):{ error("Symbian does not support directories starting with a dot. Please set RCC_DIR to a different value in your profile. RCC_DIR: $$RCC_DIR") } - RET = $$find(OBJECTS_DIR, "(/|^)\.[^/]+/?$") + RET = $$find(OBJECTS_DIR, "(/|^)\\.[^/]+/?$") !isEmpty(RET):{ error("Symbian does not support directories starting with a dot. Please set OBJECTS_DIR to a different value in your profile. OBJECTS_DIR: $$OBJECTS_DIR") } diff --git a/mkspecs/features/symbian/symbian_building.prf b/mkspecs/features/symbian/symbian_building.prf index 802adde..c230272 100644 --- a/mkspecs/features/symbian/symbian_building.prf +++ b/mkspecs/features/symbian/symbian_building.prf @@ -22,16 +22,16 @@ contains(QMAKE_CFLAGS, "--thumb")|contains(QMAKE_CXXFLAGS, "--thumb")|contains(Q } defineReplace(processSymbianLibraries) { - library = $$replace(1, "\.dll$", ".dso") + library = $$replace(1, "\\.dll$", ".dso") library = $$replace(library, "^-l", "") - isFullName = $$find(library, \.) + isFullName = $$find(library, \\.) isEmpty(isFullName):library="$${library}.dso" linux-gcce { newLIB = "-l:$${library}" } else { newLIB = "$${library}" } - contains(library, "\.dso$")|contains(library, ".lib$"):PRE_TARGETDEPS += $$library + contains(library, "\\.dso$")|contains(library, "\\.lib$"):PRE_TARGETDEPS += $$library return($$newLIB) } @@ -55,7 +55,7 @@ isEmpty(VERSION) { } # Check for version validity. -!isEmpty(VERSION):!contains(VERSION, "[0-9]+"):!contains(VERSION, "[0-9]+\.[0-9]+")!contains(VERSION, "[0-9]+(\.[0-9]+){2}") { +!isEmpty(VERSION):!contains(VERSION, "[0-9]+"):!contains(VERSION, "[0-9]+\\.[0-9]+")!contains(VERSION, "[0-9]+(\\.[0-9]+){2}") { error("Invalid VERSION for Symbian: $$VERSION") } @@ -86,7 +86,7 @@ isEmpty(TARGET.UID2):TARGET.UID2 = 0x00000000 capability = $$replace(TARGET.CAPABILITY, " ", "+") capability = $$join(capability, "+") -capability = $$replace(capability, "\+-", "-") +capability = $$replace(capability, "\\+-", "-") isEmpty(capability): capability = "None" capability = "--capability=$$capability" @@ -214,9 +214,9 @@ symbian_resources_INCLUDES += "-I $$symbian_resources_RCC_DIR" for(symbian_resource, SYMBIAN_RESOURCES) { symbian_resource = $$basename(symbian_resource) - symbian_resource_clean = $$replace(symbian_resource, "\.rss$", ".rsc") + symbian_resource_clean = $$replace(symbian_resource, "\\.rss$", ".rsc") QMAKE_DISTCLEAN += $${symbianDestdir}/$${symbian_resource_clean} - symbian_resource_clean = $$replace(symbian_resource, "\.rss$", ".rpp") + symbian_resource_clean = $$replace(symbian_resource, "\\.rss$", ".rpp") QMAKE_CLEAN += $${symbian_resources_RCC_DIR}/$${symbian_resource_clean} } diff --git a/mkspecs/features/uic.prf b/mkspecs/features/uic.prf index c87372d..5324e65 100644 --- a/mkspecs/features/uic.prf +++ b/mkspecs/features/uic.prf @@ -86,14 +86,14 @@ defineReplace(imageCollectionCmd) { for(image, $$list($$split(1))) { EMBEDDED_IMAGES += $$image count(EMBEDDED_IMAGES, 5) { - isEmpty(RET): RET += echo $$EMBEDDED_IMAGES > images.tmp $$escape_expand(\n\t) - else: RET += echo $$EMBEDDED_IMAGES >> images.tmp $$escape_expand(\n\t) + isEmpty(RET): RET += echo $$EMBEDDED_IMAGES > images.tmp $$escape_expand(\\n\\t) + else: RET += echo $$EMBEDDED_IMAGES >> images.tmp $$escape_expand(\\n\\t) unset(EMBEDDED_IMAGES) } } - !isEmpty(EMBEDDED_IMAGES):RET += echo $$EMBEDDED_IMAGES >> images.tmp $$escape_expand(\n\t) + !isEmpty(EMBEDDED_IMAGES):RET += echo $$EMBEDDED_IMAGES >> images.tmp $$escape_expand(\\n\\t) !isEmpty(RET) { - RET += $$QMAKE_UIC3 -embed $$TARGET -f images.tmp -o $$2 $$escape_expand(\n\t) + RET += $$QMAKE_UIC3 -embed $$TARGET -f images.tmp -o $$2 $$escape_expand(\\n\\t) return($$RET) } return($$QMAKE_UIC3 -embed $$TARGET $$1 -o $$2) diff --git a/mkspecs/features/win32/embed_manifest_dll.prf b/mkspecs/features/win32/embed_manifest_dll.prf index 60a55ce..7305c04 100644 --- a/mkspecs/features/win32/embed_manifest_dll.prf +++ b/mkspecs/features/win32/embed_manifest_dll.prf @@ -2,12 +2,12 @@ MANIFEST_DIR = $$OBJECTS_DIR isEmpty(MANIFEST_DIR):MANIFEST_DIR = . !if(plugin:no_plugin_manifest):if(win32-msvc2005*|win32-msvc2008*|win32-msvc2010*):!static:!equals(TEMPLATE_PREFIX, "vc"):equals(TEMPLATE, "lib") { NOPATH_TARGET = $$TARGET - NOPATH_TARGET ~= s,\\ , ,q # Remove space escaping (NOPATH_TARGET is quoted) - NOPATH_TARGET ~= s,\\,/,g # Change to single type separators + NOPATH_TARGET ~= s,\\\\ , ,q # Remove space escaping (NOPATH_TARGET is quoted) + NOPATH_TARGET ~= s,\\\\,/,g # Change to single type separators NOPATH_TARGET ~= s,^(.*/)+,, # Remove all paths QMAKE_LFLAGS += /MANIFEST $$quote(/MANIFESTFILE:\"$${MANIFEST_DIR}\\$${NOPATH_TARGET}.intermediate.manifest\") QMAKE_PREV_POST_LINK = $$QMAKE_POST_LINK - QMAKE_POST_LINK = $$quote(mt.exe -nologo -manifest \"$$replace(MANIFEST_DIR,/,\\)\\$${NOPATH_TARGET}.intermediate.manifest\" -outputresource:$(DESTDIR_TARGET);2$$escape_expand(\n\t)) + QMAKE_POST_LINK = $$quote(mt.exe -nologo -manifest \"$$replace(MANIFEST_DIR,/,\\)\\$${NOPATH_TARGET}.intermediate.manifest\" -outputresource:$(DESTDIR_TARGET);2$$escape_expand(\\n\\t)) QMAKE_POST_LINK += $$QMAKE_PREV_POST_LINK QMAKE_CLEAN += \"$$replace(MANIFEST_DIR,/,\\)\\$${NOPATH_TARGET}.intermediate.manifest\" } diff --git a/mkspecs/features/win32/embed_manifest_exe.prf b/mkspecs/features/win32/embed_manifest_exe.prf index 169134d..5b37a6d 100644 --- a/mkspecs/features/win32/embed_manifest_exe.prf +++ b/mkspecs/features/win32/embed_manifest_exe.prf @@ -2,12 +2,12 @@ MANIFEST_DIR = $$OBJECTS_DIR isEmpty(MANIFEST_DIR):MANIFEST_DIR = . if(win32-msvc2005*|win32-msvc2008*|win32-msvc2010*):!equals(TEMPLATE_PREFIX, "vc"):equals(TEMPLATE, "app") { NOPATH_TARGET = $$TARGET - NOPATH_TARGET ~= s,\\ , ,q # Remove space escaping (NOPATH_TARGET is quoted) - NOPATH_TARGET ~= s,\\,/,g # Change to single type separators + NOPATH_TARGET ~= s,\\\\ , ,q # Remove space escaping (NOPATH_TARGET is quoted) + NOPATH_TARGET ~= s,\\\\,/,g # Change to single type separators NOPATH_TARGET ~= s,^(.*/)+,, # Remove all paths QMAKE_LFLAGS += /MANIFEST $$quote(/MANIFESTFILE:\"$${MANIFEST_DIR}\\$${NOPATH_TARGET}.intermediate.manifest\") QMAKE_PREV_POST_LINK = $$QMAKE_POST_LINK - QMAKE_POST_LINK = $$quote(mt.exe -nologo -manifest \"$$replace(MANIFEST_DIR,/,\\)\\$${NOPATH_TARGET}.intermediate.manifest\" -outputresource:$(DESTDIR_TARGET);1$$escape_expand(\n\t)) + QMAKE_POST_LINK = $$quote(mt.exe -nologo -manifest \"$$replace(MANIFEST_DIR,/,\\)\\$${NOPATH_TARGET}.intermediate.manifest\" -outputresource:$(DESTDIR_TARGET);1$$escape_expand(\\n\\t)) QMAKE_POST_LINK += $$QMAKE_PREV_POST_LINK QMAKE_CLEAN += \"$$replace(MANIFEST_DIR,/,\\)\\$${NOPATH_TARGET}.intermediate.manifest\" } diff --git a/mkspecs/features/win32/qaxserver.prf b/mkspecs/features/win32/qaxserver.prf index 1ff6825..2899976 100644 --- a/mkspecs/features/win32/qaxserver.prf +++ b/mkspecs/features/win32/qaxserver.prf @@ -19,10 +19,10 @@ equals(ACTIVEQT_IDE, "VisualStudio") { ACTIVEQT_IDL = $${QMAKE_IDL} ACTIVEQT_TARGET = "$(TargetPath)" win32-msvc { - ACTIVEQT_NEWLINE = $$escape_expand(\t) + ACTIVEQT_NEWLINE = $$escape_expand(\\t) ACTIVEQT_OUTPUT = $(IntDir)/$${TARGET} } else { - ACTIVEQT_NEWLINE = $$escape_expand(\n\t) + ACTIVEQT_NEWLINE = $$escape_expand(\\n\\t) ACTIVEQT_OUTPUT = $(IntDir)$${TARGET} } ACTIVEQT_TLBOUT = "$(TargetDir)/$${TARGET}.tlb" @@ -31,7 +31,7 @@ equals(ACTIVEQT_IDE, "VisualStudio") { equals(ACTIVEQT_IDE, "makefile") { ACTIVEQT_IDC = -$(IDC) ACTIVEQT_IDL = -$(IDL) - ACTIVEQT_NEWLINE = $$escape_expand(\n\t) + ACTIVEQT_NEWLINE = $$escape_expand(\\n\\t) ACTIVEQT_TARGET = $(DESTDIR_TARGET) ACTIVEQT_OUTPUT = $(OBJECTS_DIR)/$${TARGET} isEmpty(DESTDIR) { diff --git a/mkspecs/features/yacc.prf b/mkspecs/features/yacc.prf index c078e09..4d7e0a3 100644 --- a/mkspecs/features/yacc.prf +++ b/mkspecs/features/yacc.prf @@ -21,10 +21,10 @@ !yacc_no_name_mangle:QMAKE_YACCDECLFLAGS += $$QMAKE_YACCFLAGS_MANGLE yacc_decl.commands = \ - $$QMAKE_YACC $$QMAKE_YACCDECLFLAGS ${QMAKE_FILE_IN}$$escape_expand(\n\t) \ - $$QMAKE_DEL_FILE $${QMAKE_CPP_MOD_MOC}${QMAKE_FILE_BASE}_yacc$${first(QMAKE_EXT_H)} $${QMAKE_CPP_MOD_MOC}${QMAKE_FILE_BASE}_yacc$${first(QMAKE_EXT_CPP)}$$escape_expand(\n\t) \ - $$QMAKE_MOVE $${QMAKE_YACC_HEADER} $${QMAKE_CPP_MOD_MOC}${QMAKE_FILE_BASE}_yacc$${first(QMAKE_EXT_H)}$$escape_expand(\n\t) \ - $$QMAKE_MOVE $${QMAKE_YACC_SOURCE} $${QMAKE_CPP_MOD_MOC}${QMAKE_FILE_BASE}_yacc$${first(QMAKE_EXT_CPP)}$$escape_expand(\n\t) + $$QMAKE_YACC $$QMAKE_YACCDECLFLAGS ${QMAKE_FILE_IN}$$escape_expand(\\n\\t) \ + $$QMAKE_DEL_FILE $${QMAKE_CPP_MOD_MOC}${QMAKE_FILE_BASE}_yacc$${first(QMAKE_EXT_H)} $${QMAKE_CPP_MOD_MOC}${QMAKE_FILE_BASE}_yacc$${first(QMAKE_EXT_CPP)}$$escape_expand(\\n\\t) \ + $$QMAKE_MOVE $${QMAKE_YACC_HEADER} $${QMAKE_CPP_MOD_MOC}${QMAKE_FILE_BASE}_yacc$${first(QMAKE_EXT_H)}$$escape_expand(\\n\\t) \ + $$QMAKE_MOVE $${QMAKE_YACC_SOURCE} $${QMAKE_CPP_MOD_MOC}${QMAKE_FILE_BASE}_yacc$${first(QMAKE_EXT_CPP)}$$escape_expand(\\n\\t) yacc_decl.output = $${QMAKE_CPP_MOD_MOC}${QMAKE_FILE_BASE}_yacc$${first(QMAKE_EXT_H)} silent:yacc_decl.commands = @echo Yacc ${QMAKE_FILE_IN} && $$yacc_decl.commands @@ -35,7 +35,7 @@ yacc_impl.name = source for ${QMAKE_FILE_IN} yacc_impl.input = YACCSOURCES yacc_impl.variable_out = GENERATED_SOURCES - yacc_impl.commands = $$escape_expand(\n) # We don't want any commands where, but if command is empty no rules are created + yacc_impl.commands = $$escape_expand(\\n) # We don't want any commands where, but if command is empty no rules are created yacc_impl.depends = $${QMAKE_CPP_MOD_MOC}${QMAKE_FILE_BASE}_yacc$${first(QMAKE_EXT_H)} # Make sure we depend on the step above yacc_impl.output = $${QMAKE_CPP_MOD_MOC}${QMAKE_FILE_BASE}_yacc$${first(QMAKE_EXT_CPP)} # Faked output from this step, output really created in step above QMAKE_EXTRA_COMPILERS += yacc_impl diff --git a/mkspecs/win32-borland/qmake.conf b/mkspecs/win32-borland/qmake.conf index 63bf07a..2ba742c 100644 --- a/mkspecs/win32-borland/qmake.conf +++ b/mkspecs/win32-borland/qmake.conf @@ -41,7 +41,7 @@ QMAKE_CXXFLAGS_EXCEPTIONS_ON = QMAKE_CXXFLAGS_EXCEPTIONS_OFF = -x- QMAKE_INCDIR = -QMAKE_LIBDIR = $(BCB)\lib +QMAKE_LIBDIR = $(BCB)\\lib QMAKE_INCDIR_QT = $$[QT_INSTALL_HEADERS] QMAKE_LIBDIR_QT = $$[QT_INSTALL_LIBS] @@ -69,9 +69,9 @@ QMAKE_LIBS_QT_ENTRY = -lqtmain #QMAKE_LIBS_OPENGL = #QMAKE_LFLAGS_OPENGL = /dopengl32.dll -QMAKE_MOC = $$[QT_INSTALL_BINS]\moc.exe -QMAKE_UIC = $$[QT_INSTALL_BINS]\uic.exe -QMAKE_IDC = $$[QT_INSTALL_BINS]\idc.exe +QMAKE_MOC = $$[QT_INSTALL_BINS]\\moc.exe +QMAKE_UIC = $$[QT_INSTALL_BINS]\\uic.exe +QMAKE_IDC = $$[QT_INSTALL_BINS]\\idc.exe QMAKE_IDL = midl QMAKE_LIB = tlib /C /P256 diff --git a/mkspecs/win32-icc/qmake.conf b/mkspecs/win32-icc/qmake.conf index fcc7691..acff5e1 100644 --- a/mkspecs/win32-icc/qmake.conf +++ b/mkspecs/win32-icc/qmake.conf @@ -67,9 +67,9 @@ QMAKE_LIBS_OPENGL = opengl32.lib glu32.lib gdi32.lib user32.lib delayimp.l QMAKE_LIBS_COMPAT = advapi32.lib shell32.lib comdlg32.lib user32.lib gdi32.lib ws2_32.lib QMAKE_LIBS_QT_ENTRY = -lqtmain -QMAKE_MOC = $$[QT_INSTALL_BINS]\moc.exe -QMAKE_UIC = $$[QT_INSTALL_BINS]\uic.exe -QMAKE_IDC = $$[QT_INSTALL_BINS]\idc.exe +QMAKE_MOC = $$[QT_INSTALL_BINS]\\moc.exe +QMAKE_UIC = $$[QT_INSTALL_BINS]\\uic.exe +QMAKE_IDC = $$[QT_INSTALL_BINS]\\idc.exe QMAKE_IDL = midl QMAKE_LIB = lib /NOLOGO diff --git a/mkspecs/win32-msvc2003/qmake.conf b/mkspecs/win32-msvc2003/qmake.conf index e92df12..5344331 100644 --- a/mkspecs/win32-msvc2003/qmake.conf +++ b/mkspecs/win32-msvc2003/qmake.conf @@ -64,9 +64,9 @@ QMAKE_LIBS_COMPAT = advapi32.lib shell32.lib comdlg32.lib user32.lib gdi32 QMAKE_LIBS_QT_ENTRY = -lqtmain -QMAKE_MOC = $$[QT_INSTALL_BINS]\moc.exe -QMAKE_UIC = $$[QT_INSTALL_BINS]\uic.exe -QMAKE_IDC = $$[QT_INSTALL_BINS]\idc.exe +QMAKE_MOC = $$[QT_INSTALL_BINS]\\moc.exe +QMAKE_UIC = $$[QT_INSTALL_BINS]\\uic.exe +QMAKE_IDC = $$[QT_INSTALL_BINS]\\idc.exe QMAKE_IDL = midl QMAKE_LIB = lib /NOLOGO diff --git a/mkspecs/win32-msvc2005/qmake.conf b/mkspecs/win32-msvc2005/qmake.conf index 5ed8e01..84e831f 100644 --- a/mkspecs/win32-msvc2005/qmake.conf +++ b/mkspecs/win32-msvc2005/qmake.conf @@ -67,9 +67,9 @@ QMAKE_LIBS_COMPAT = advapi32.lib shell32.lib comdlg32.lib user32.lib gdi32 QMAKE_LIBS_QT_ENTRY = -lqtmain -QMAKE_MOC = $$[QT_INSTALL_BINS]\moc.exe -QMAKE_UIC = $$[QT_INSTALL_BINS]\uic.exe -QMAKE_IDC = $$[QT_INSTALL_BINS]\idc.exe +QMAKE_MOC = $$[QT_INSTALL_BINS]\\moc.exe +QMAKE_UIC = $$[QT_INSTALL_BINS]\\uic.exe +QMAKE_IDC = $$[QT_INSTALL_BINS]\\idc.exe QMAKE_IDL = midl QMAKE_LIB = lib /NOLOGO diff --git a/mkspecs/win32-msvc2008/qmake.conf b/mkspecs/win32-msvc2008/qmake.conf index 373a36d..3e0bfb5 100644 --- a/mkspecs/win32-msvc2008/qmake.conf +++ b/mkspecs/win32-msvc2008/qmake.conf @@ -67,9 +67,9 @@ QMAKE_LIBS_COMPAT = advapi32.lib shell32.lib comdlg32.lib user32.lib gdi32 QMAKE_LIBS_QT_ENTRY = -lqtmain -QMAKE_MOC = $$[QT_INSTALL_BINS]\moc.exe -QMAKE_UIC = $$[QT_INSTALL_BINS]\uic.exe -QMAKE_IDC = $$[QT_INSTALL_BINS]\idc.exe +QMAKE_MOC = $$[QT_INSTALL_BINS]\\moc.exe +QMAKE_UIC = $$[QT_INSTALL_BINS]\\uic.exe +QMAKE_IDC = $$[QT_INSTALL_BINS]\\idc.exe QMAKE_IDL = midl QMAKE_LIB = lib /NOLOGO diff --git a/mkspecs/win32-msvc2010/qmake.conf b/mkspecs/win32-msvc2010/qmake.conf index 2a48938..d9fe711 100644 --- a/mkspecs/win32-msvc2010/qmake.conf +++ b/mkspecs/win32-msvc2010/qmake.conf @@ -67,9 +67,9 @@ QMAKE_LIBS_COMPAT = advapi32.lib shell32.lib comdlg32.lib user32.lib gdi32 QMAKE_LIBS_QT_ENTRY = -lqtmain -QMAKE_MOC = $$[QT_INSTALL_BINS]\moc.exe -QMAKE_UIC = $$[QT_INSTALL_BINS]\uic.exe -QMAKE_IDC = $$[QT_INSTALL_BINS]\idc.exe +QMAKE_MOC = $$[QT_INSTALL_BINS]\\moc.exe +QMAKE_UIC = $$[QT_INSTALL_BINS]\\uic.exe +QMAKE_IDC = $$[QT_INSTALL_BINS]\\idc.exe QMAKE_IDL = midl QMAKE_LIB = lib /NOLOGO diff --git a/projects.pro b/projects.pro index 45fb8da..373b049 100644 --- a/projects.pro +++ b/projects.pro @@ -104,33 +104,33 @@ unix:!symbian { (cd qmake && $(MAKE) distclean); } win32 { - confclean.commands += -$(DEL_FILE) src\core\global\qconfig.h $$escape_expand(\n\t) \ - -$(DEL_FILE) src\core\global\qconfig.cpp $$escape_expand(\n\t) \ - -$(DEL_FILE) mkspecs\qconfig.pri $$escape_expand(\n\t) \ - -$(DEL_FILE) .qmake.cache $$escape_expand(\n\t) \ + confclean.commands += -$(DEL_FILE) src\\core\\global\\qconfig.h $$escape_expand(\\n\\t) \ + -$(DEL_FILE) src\\core\\global\\qconfig.cpp $$escape_expand(\\n\\t) \ + -$(DEL_FILE) mkspecs\\qconfig.pri $$escape_expand(\\n\\t) \ + -$(DEL_FILE) .qmake.cache $$escape_expand(\\n\\t) \ (cd qmake && $(MAKE) distclean) } symbian { confclean.depends += distclean contains(QMAKE_HOST.os, "Windows") { confclean.commands += \ - (cd src\tools\moc && $(MAKE) distclean) $$escape_expand(\n\t) \ - (cd src\tools\rcc && $(MAKE) distclean) $$escape_expand(\n\t) \ - (cd src\tools\uic && $(MAKE) distclean) $$escape_expand(\n\t) \ - -$(DEL_FILE) src\corelib\global\qconfig.h $$escape_expand(\n\t) \ - -$(DEL_FILE) src\corelib\global\qconfig.cpp $$escape_expand(\n\t) \ - -$(DEL_FILE) mkspecs\qconfig.pri $$escape_expand(\n\t) \ - -$(DEL_FILE) .qmake.cache $$escape_expand(\n\t) \ + (cd src\\tools\\moc && $(MAKE) distclean) $$escape_expand(\\n\\t) \ + (cd src\\tools\\rcc && $(MAKE) distclean) $$escape_expand(\\n\\t) \ + (cd src\\tools\\uic && $(MAKE) distclean) $$escape_expand(\\n\\t) \ + -$(DEL_FILE) src\\corelib\\global\\qconfig.h $$escape_expand(\\n\\t) \ + -$(DEL_FILE) src\\corelib\\global\\qconfig.cpp $$escape_expand(\\n\\t) \ + -$(DEL_FILE) mkspecs\\qconfig.pri $$escape_expand(\\n\\t) \ + -$(DEL_FILE) .qmake.cache $$escape_expand(\\n\\t) \ (cd qmake && $(MAKE) distclean) } else { confclean.commands += \ - (cd src/tools/moc && $(MAKE) distclean) $$escape_expand(\n\t) \ - (cd src/tools/rcc && $(MAKE) distclean) $$escape_expand(\n\t) \ - (cd src/tools/uic && $(MAKE) distclean) $$escape_expand(\n\t) \ - -$(DEL_FILE) src/corelib/global/qconfig.h $$escape_expand(\n\t) \ - -$(DEL_FILE) src/corelib/global/qconfig.cpp $$escape_expand(\n\t) \ - -$(DEL_FILE) mkspecs/qconfig.pri $$escape_expand(\n\t) \ - -$(DEL_FILE) .qmake.cache $$escape_expand(\n\t) \ + (cd src/tools/moc && $(MAKE) distclean) $$escape_expand(\\n\\t) \ + (cd src/tools/rcc && $(MAKE) distclean) $$escape_expand(\\n\\t) \ + (cd src/tools/uic && $(MAKE) distclean) $$escape_expand(\\n\\t) \ + -$(DEL_FILE) src/corelib/global/qconfig.h $$escape_expand(\\n\\t) \ + -$(DEL_FILE) src/corelib/global/qconfig.cpp $$escape_expand(\\n\\t) \ + -$(DEL_FILE) mkspecs/qconfig.pri $$escape_expand(\\n\\t) \ + -$(DEL_FILE) .qmake.cache $$escape_expand(\\n\\t) \ (cd qmake && $(MAKE) distclean) } } diff --git a/src/3rdparty/webkit/WebCore/WebCore.pro b/src/3rdparty/webkit/WebCore/WebCore.pro index 5def728..63e78a7 100644 --- a/src/3rdparty/webkit/WebCore/WebCore.pro +++ b/src/3rdparty/webkit/WebCore/WebCore.pro @@ -159,7 +159,7 @@ defineTest(addExtraCompiler) { for(file,input) { base = $$basename(file) - base ~= s/\..+// + base ~= s/\\..+// newfile=$$replace(outputRule,\\$\\{QMAKE_FILE_BASE\\},$$base) SOURCES += $$newfile } diff --git a/src/3rdparty/webkit/WebKit/qt/Api/DerivedSources.pro b/src/3rdparty/webkit/WebKit/qt/Api/DerivedSources.pro index 389fb5f..22d4c8d 100644 --- a/src/3rdparty/webkit/WebKit/qt/Api/DerivedSources.pro +++ b/src/3rdparty/webkit/WebKit/qt/Api/DerivedSources.pro @@ -28,7 +28,7 @@ qtheader_module.commands += echo $${QUOTE}$${LITERAL_HASH}define QT_QTWEBKIT_MOD qtheader_module.commands += echo $${QUOTE}$${LITERAL_HASH}include $${ESCAPE}$${QUOTE} >> $${qtheader_module.target} && WEBKIT_CLASS_HEADERS = $${LITERAL_DOLLAR}$${LITERAL_DOLLAR}$${LITERAL_DOLLAR}$${LITERAL_DOLLAR}PWD/QtWebKit -regex = ".*\sclass\sQWEBKIT_EXPORT\s(\w+)\s(.*)" +regex = ".*\\sclass\\sQWEBKIT_EXPORT\\s(\\w+)\\s(.*)" for(HEADER, WEBKIT_API_HEADERS) { # 1. Append to QtWebKit header that includes all other header files @@ -70,7 +70,7 @@ for(HEADER, WEBKIT_API_HEADERS) { res = $$find(src, $$regex) isEmpty(res):break() - exp = $$replace(src, $$regex, "EXPORTED_CLASS = \1") + exp = $$replace(src, $$regex, "EXPORTED_CLASS = \\1") eval($$exp) CLASS_TARGET = "qtheader_$${EXPORTED_CLASS}" @@ -87,7 +87,7 @@ for(HEADER, WEBKIT_API_HEADERS) { # Qt's QRegExp does not support inline non-greedy matching, # so we'll have to work around it by updating the haystack - src = $$replace(src, $$regex, "\2") + src = $$replace(src, $$regex, "\\2") src_words = $$join(src, $${LITERAL_WHITESPACE}) } } diff --git a/src/3rdparty/webkit/WebKit/qt/docs/docs.pri b/src/3rdparty/webkit/WebKit/qt/docs/docs.pri index 804817b..a56ddb4 100644 --- a/src/3rdparty/webkit/WebKit/qt/docs/docs.pri +++ b/src/3rdparty/webkit/WebKit/qt/docs/docs.pri @@ -3,7 +3,7 @@ include(../../../WebKit.pri) unix { QDOC = SRCDIR=$$PWD/../../.. OUTPUT_DIR=$$OUTPUT_DIR $$(QTDIR)/bin/qdoc3 } else { - QDOC = $$(QTDIR)\bin\qdoc3.exe + QDOC = $$(QTDIR)\\bin\\qdoc3.exe } unix { diff --git a/src/activeqt/control/control.pro b/src/activeqt/control/control.pro index bf3647e..44eb928 100644 --- a/src/activeqt/control/control.pro +++ b/src/activeqt/control/control.pro @@ -15,7 +15,7 @@ TARGET = QAxServer } CONFIG += qt warn_off staticlib -QTDIR_build:DESTDIR = $$QT_BUILD_TREE\lib +QTDIR_build:DESTDIR = $$QT_BUILD_TREE\\lib DEFINES += QAX_SERVER win32-g++:DEFINES += QT_NEEDS_QMAIN diff --git a/tests/auto/declarative/parserstress/parserstress.pro b/tests/auto/declarative/parserstress/parserstress.pro index a95a855..3a675e4 100644 --- a/tests/auto/declarative/parserstress/parserstress.pro +++ b/tests/auto/declarative/parserstress/parserstress.pro @@ -6,7 +6,7 @@ SOURCES += tst_parserstress.cpp symbian: { DEFINES += SRCDIR=\".\" - importFiles.sources = ..\..\qscriptjstestsuite\tests + importFiles.sources = ..\\..\\qscriptjstestsuite\\tests importFiles.path = DEPLOYMENT = importFiles } else { diff --git a/tests/auto/linguist/lupdate/testdata/good/backslashes/project.pro b/tests/auto/linguist/lupdate/testdata/good/backslashes/project.pro index 4698b2b..d4dcda8 100644 --- a/tests/auto/linguist/lupdate/testdata/good/backslashes/project.pro +++ b/tests/auto/linguist/lupdate/testdata/good/backslashes/project.pro @@ -1,3 +1,3 @@ -SOURCES += src\main.cpp +SOURCES += src\\main.cpp -TRANSLATIONS = ts\project.ts +TRANSLATIONS = ts\\project.ts diff --git a/tests/auto/patternistexamples/patternistexamples.pro b/tests/auto/patternistexamples/patternistexamples.pro index 4092fc8..c528c93 100644 --- a/tests/auto/patternistexamples/patternistexamples.pro +++ b/tests/auto/patternistexamples/patternistexamples.pro @@ -13,7 +13,7 @@ wince*|symbian*: { recipes.sources = $$QT_SOURCE_TREE/examples/xmlpatterns/recipes/* recipes.path = recipes files.sources = $$QT_SOURCE_TREE/examples/xmlpatterns/recipes/files/* - files.path = recipes\files + files.path = recipes\\files DEPLOYMENT += snippets widgetRen globVar filetree recipes files # take care of dependency diff --git a/tests/auto/qaccessibility/qaccessibility.pro b/tests/auto/qaccessibility/qaccessibility.pro index e33c04d..1b30beb 100644 --- a/tests/auto/qaccessibility/qaccessibility.pro +++ b/tests/auto/qaccessibility/qaccessibility.pro @@ -5,7 +5,7 @@ unix:!mac:LIBS+=-lm contains(QT_CONFIG, qt3support): QT += qt3support wince*: { - accessneeded.sources = $$QT_BUILD_TREE\plugins\accessible\*.dll + accessneeded.sources = $$QT_BUILD_TREE\\plugins\\accessible\\*.dll accessneeded.path = accessible DEPLOYMENT += accessneeded } \ No newline at end of file diff --git a/tests/auto/qdesktopservices/qdesktopservices.pro b/tests/auto/qdesktopservices/qdesktopservices.pro index 9ef557d..d32ed4c 100644 --- a/tests/auto/qdesktopservices/qdesktopservices.pro +++ b/tests/auto/qdesktopservices/qdesktopservices.pro @@ -3,23 +3,23 @@ CONFIG += qttest_p4 SOURCES += tst_qdesktopservices.cpp TARGET = tst_qdesktopservices symbian: { - dummy.sources = text\testfile.txt + dummy.sources = text\\testfile.txt dummy.path = . - text.sources = text\* - text.path = \data\others\ + text.sources = text\\* + text.path = \\data\\others - image.sources = image\* - image.path = \data\images\ + image.sources = image\\* + image.path = \\data\\images - audio.sources = audio\* - audio.path = \data\sounds\ + audio.sources = audio\\* + audio.path = \\data\\sounds - video.sources = video\* - video.path = \data\videos\ + video.sources = video\\* + video.path = \\data\\videos - install.sources = install\* - install.path = \data\installs\ + install.sources = install\\* + install.path = \\data\\installs DEPLOYMENT += image audio video install diff --git a/tests/auto/qdirmodel/qdirmodel.pro b/tests/auto/qdirmodel/qdirmodel.pro index 5a66883..36929b9 100644 --- a/tests/auto/qdirmodel/qdirmodel.pro +++ b/tests/auto/qdirmodel/qdirmodel.pro @@ -2,9 +2,9 @@ load(qttest_p4) SOURCES += tst_qdirmodel.cpp wince*|symbian { - addit.sources = dirtest\test1\* - addit.path = dirtest\test1 - tests.sources = test\* + addit.sources = dirtest\\test1\\* + addit.path = dirtest\\test1 + tests.sources = test\\* tests.path = test sourceFile.sources = tst_qdirmodel.cpp sourceFile.path = . diff --git a/tests/auto/qfile/test/test.pro b/tests/auto/qfile/test/test.pro index faaa927..70c93ce 100644 --- a/tests/auto/qfile/test/test.pro +++ b/tests/auto/qfile/test/test.pro @@ -3,11 +3,11 @@ SOURCES += ../tst_qfile.cpp wince*|symbian { QT = core gui - files.sources += ..\dosfile.txt ..\noendofline.txt ..\testfile.txt \ - ..\testlog.txt ..\two.dots.file ..\tst_qfile.cpp \ - ..\Makefile ..\forCopying.txt ..\forRenaming.txt + files.sources += ..\\dosfile.txt ..\\noendofline.txt ..\\testfile.txt \ + ..\\testlog.txt ..\\two.dots.file ..\\tst_qfile.cpp \ + ..\\Makefile ..\\forCopying.txt ..\\forRenaming.txt files.path = . - resour.sources += ..\resources\file1.ext1 + resour.sources += ..\\resources\\file1.ext1 resour.path = resources DEPLOYMENT = files resour diff --git a/tests/auto/qfileinfo/qfileinfo.pro b/tests/auto/qfileinfo/qfileinfo.pro index 93599f4..2038514 100644 --- a/tests/auto/qfileinfo/qfileinfo.pro +++ b/tests/auto/qfileinfo/qfileinfo.pro @@ -8,7 +8,7 @@ RESOURCES += qfileinfo.qrc wince*:|symbian*: { deploy.sources += qfileinfo.qrc tst_qfileinfo.cpp - res.sources = resources\file1 resources\file1.ext1 resources\file1.ext1.ext2 + res.sources = resources\\file1 resources\\file1.ext1 resources\\file1.ext1.ext2 res.path = resources DEPLOYMENT = deploy res } diff --git a/tests/auto/qgraphicsscene/qgraphicsscene.pro b/tests/auto/qgraphicsscene/qgraphicsscene.pro index 31bb769..401c9eb 100644 --- a/tests/auto/qgraphicsscene/qgraphicsscene.pro +++ b/tests/auto/qgraphicsscene/qgraphicsscene.pro @@ -9,8 +9,8 @@ DEFINES += QT_NO_CAST_TO_ASCII wince*|symbian*: { rootFiles.sources = Ash_European.jpg graphicsScene_selection.data rootFiles.path = . - renderFiles.sources = testData\render\* - renderFiles.path = testData\render + renderFiles.sources = testData\\render\\* + renderFiles.path = testData\\render DEPLOYMENT += rootFiles renderFiles } wince*:{ diff --git a/tests/auto/qimagewriter/qimagewriter.pro b/tests/auto/qimagewriter/qimagewriter.pro index 8da2942..2171c3e 100644 --- a/tests/auto/qimagewriter/qimagewriter.pro +++ b/tests/auto/qimagewriter/qimagewriter.pro @@ -6,12 +6,12 @@ win32-msvc:QMAKE_CXXFLAGS -= -Zm200 win32-msvc:QMAKE_CXXFLAGS += -Zm800 wince*: { - addFiles.sources = images\*.* + addFiles.sources = images\\*.* addFiles.path = images DEPLOYMENT += addFiles DEFINES += SRCDIR=\\\".\\\" } else:symbian* { - addFiles.sources = images\*.* + addFiles.sources = images\\*.* addFiles.path = images DEPLOYMENT += addFiles qt_not_deployed { diff --git a/tests/auto/qlibrary/lib2/lib2.pro b/tests/auto/qlibrary/lib2/lib2.pro index 4654f4d..b441569 100644 --- a/tests/auto/qlibrary/lib2/lib2.pro +++ b/tests/auto/qlibrary/lib2/lib2.pro @@ -38,9 +38,9 @@ symbian-abld: { TARGET.CAPABILITY=ALL -TCB FIXEDROOT = $$replace(EPOCROOT,/,\\) QMAKE_POST_LINK = \ - copy /Y $${FIXEDROOT}epoc32\release\\$(PLATFORM)\\$(CFG)\mylib.dll $${FIXEDROOT}epoc32\release\\$(PLATFORM)\\$(CFG)\mylib.dl2 && \ - copy /Y $${FIXEDROOT}epoc32\release\\$(PLATFORM)\\$(CFG)\mylib.dll $${FIXEDROOT}epoc32\release\\$(PLATFORM)\\$(CFG)\system.trolltech.test.mylib.dll && \ - IF NOT "$(PLATFORM)==WINSCW" copy /Y $${FIXEDROOT}epoc32\release\\$(PLATFORM)\\$(CFG)\mylib.dll ..\tst\mylib.dl2 + copy /Y $${FIXEDROOT}epoc32\\release\\$(PLATFORM)\\$(CFG)\\mylib.dll $${FIXEDROOT}epoc32\\release\\$(PLATFORM)\\$(CFG)\\mylib.dl2 && \ + copy /Y $${FIXEDROOT}epoc32\\release\\$(PLATFORM)\\$(CFG)\\mylib.dll $${FIXEDROOT}epoc32\\release\\$(PLATFORM)\\$(CFG)\\system.trolltech.test.mylib.dll && \ + IF NOT "$(PLATFORM)==WINSCW" copy /Y $${FIXEDROOT}epoc32\\release\\$(PLATFORM)\\$(CFG)\\mylib.dll ..\\tst\\mylib.dl2 } symbian-sbsv2: { diff --git a/tests/auto/qlocale/test/test.pro b/tests/auto/qlocale/test/test.pro index 7bc9f59..d57f2d1 100644 --- a/tests/auto/qlocale/test/test.pro +++ b/tests/auto/qlocale/test/test.pro @@ -25,7 +25,7 @@ wince*: { addFiles.sources = \ ../syslocaleapp - addFiles.path = \Program Files\tst_qlocale + addFiles.path = "\\Program Files\\tst_qlocale" DEPLOYMENT += addFiles } diff --git a/tests/auto/qlocalsocket/test/test.pro b/tests/auto/qlocalsocket/test/test.pro index cfdc89b..687aae2 100644 --- a/tests/auto/qlocalsocket/test/test.pro +++ b/tests/auto/qlocalsocket/test/test.pro @@ -34,7 +34,7 @@ wince* { symbian { additionalFiles.sources = lackey.exe - additionalFiles.path = \sys\bin + additionalFiles.path = \\sys\\bin TARGET.UID3 = 0xE0340005 DEFINES += SYMBIAN_SRCDIR_UID=$$lower($$replace(TARGET.UID3,"0x","")) } diff --git a/tests/auto/qmainwindow/qmainwindow.pro b/tests/auto/qmainwindow/qmainwindow.pro index 43d73ae..e015f95 100644 --- a/tests/auto/qmainwindow/qmainwindow.pro +++ b/tests/auto/qmainwindow/qmainwindow.pro @@ -2,5 +2,5 @@ load(qttest_p4) SOURCES += tst_qmainwindow.cpp # Symbian toolchain does not support correct include semantics -symbian:INCPATH+=..\..\..\include\QtGui\private +symbian:INCPATH+=..\\..\\..\\include\\QtGui\\private diff --git a/tests/auto/qmake/testdata/functions/functions.pro b/tests/auto/qmake/testdata/functions/functions.pro index 5e089e4..ad66ee8 100644 --- a/tests/auto/qmake/testdata/functions/functions.pro +++ b/tests/auto/qmake/testdata/functions/functions.pro @@ -53,7 +53,7 @@ include( infiletest.pro, "", true ) #replace VERSION=1.0.0 -VERSION_replaced=$$replace(VERSION,\.,_) +VERSION_replaced=$$replace(VERSION,\\.,_) !isEqual(VERSION_replaced, 1_0_0) { message( "FAILED: replace function: $$VERSION_replaced" ) } diff --git a/tests/auto/qmovie/qmovie.pro b/tests/auto/qmovie/qmovie.pro index 30e5901..a8ec478 100644 --- a/tests/auto/qmovie/qmovie.pro +++ b/tests/auto/qmovie/qmovie.pro @@ -7,14 +7,14 @@ MOC_DIR=tmp !contains(QT_CONFIG, no-mng):DEFINES += QTEST_HAVE_MNG wince*: { - addFiles.sources = animations\* + addFiles.sources = animations\\* addFiles.path = animations DEPLOYMENT += addFiles } symbian*: { - addFiles.sources = animations\* + addFiles.sources = animations\\* addFiles.path = animations DEPLOYMENT += addFiles diff --git a/tests/auto/qnetworkreply/test/test.pro b/tests/auto/qnetworkreply/test/test.pro index 7bf3852..b9ece38 100644 --- a/tests/auto/qnetworkreply/test/test.pro +++ b/tests/auto/qnetworkreply/test/test.pro @@ -31,7 +31,7 @@ symbian:{ DEPLOYMENT += certFiles # Symbian toolchain does not support correct include semantics - INCPATH+=..\..\..\..\include\QtNetwork\private + INCPATH+=..\\..\\..\\..\\include\\QtNetwork\\private # bigfile test case requires more heap TARGET.EPOCHEAPSIZE="0x100 0x1000000" TARGET.CAPABILITY="ALL -TCB" diff --git a/tests/auto/qobject/tst_qobject.pro b/tests/auto/qobject/tst_qobject.pro index 0200f3e..1d6993a 100644 --- a/tests/auto/qobject/tst_qobject.pro +++ b/tests/auto/qobject/tst_qobject.pro @@ -16,6 +16,6 @@ wince*: { } symbian: { addFiles.sources = signalbug.exe - addFiles.path = \sys\bin + addFiles.path = \\sys\\bin DEPLOYMENT += addFiles } diff --git a/tests/auto/qprocess/test/test.pro b/tests/auto/qprocess/test/test.pro index e1afd22..d555067 100644 --- a/tests/auto/qprocess/test/test.pro +++ b/tests/auto/qprocess/test/test.pro @@ -118,7 +118,7 @@ symbian: { testProcessOutput.exe \ nospace.exe \ testSpaceInName.exe - binDep.path = \sys\bin + binDep.path = \\sys\\bin DEPLOYMENT += binDep } diff --git a/tests/auto/qsocks5socketengine/qsocks5socketengine.pro b/tests/auto/qsocks5socketengine/qsocks5socketengine.pro index cd5e6e7..62c0c87 100644 --- a/tests/auto/qsocks5socketengine/qsocks5socketengine.pro +++ b/tests/auto/qsocks5socketengine/qsocks5socketengine.pro @@ -10,7 +10,7 @@ MOC_DIR=tmp QT = core network # Symbian toolchain does not support correct include semantics -symbian:INCPATH+=..\..\..\include\QtNetwork\private +symbian:INCPATH+=..\\..\\..\\include\\QtNetwork\\private symbian: TARGET.CAPABILITY = NetworkServices diff --git a/tests/auto/solutions.pri b/tests/auto/solutions.pri index bcffb64..5c069c5 100644 --- a/tests/auto/solutions.pri +++ b/tests/auto/solutions.pri @@ -7,10 +7,10 @@ SOLUTIONBASEDIR = $$(SOLUTIONBASEDIR) # strip the trailing "..." -# SOLUTIONBASEDIR ~= s/\.\.\.$// +# SOLUTIONBASEDIR ~= s/\\.\\.\\.$// # replace \ with / -# win32:SOLUTIONBASEDIR ~= s.\\./.g +# win32:SOLUTIONBASEDIR ~= s.\\\\./.g isEmpty(SOLUTIONBASEDIR):DEFINES += QT_NO_SOLUTIONS diff --git a/tests/auto/windowsmobile/test/test.pro b/tests/auto/windowsmobile/test/test.pro index 61e275d..f3124a3 100644 --- a/tests/auto/windowsmobile/test/test.pro +++ b/tests/auto/windowsmobile/test/test.pro @@ -11,7 +11,7 @@ wincewm*: { addFiles.sources = $$OUT_PWD/../testQMenuBar/*.exe - addFiles.path = "\Program Files\tst_windowsmobile" + addFiles.path = "\\Program Files\\tst_windowsmobile" DEPLOYMENT += addFiles } diff --git a/tools/assistant/lib/fulltextsearch/fulltextsearch.pro b/tools/assistant/lib/fulltextsearch/fulltextsearch.pro index e0cd13a..fb1a0dd 100644 --- a/tools/assistant/lib/fulltextsearch/fulltextsearch.pro +++ b/tools/assistant/lib/fulltextsearch/fulltextsearch.pro @@ -46,5 +46,5 @@ win32-msvc.net | win32-msvc2* { # the following define could be set globally in case we need it elsewhere solaris* { - DEFINES += Q_SOLARIS_VERSION=$$system(uname -r | sed -e 's/5\.//') + DEFINES += Q_SOLARIS_VERSION=$$system(uname -r | sed -e 's/5\\.//') } -- cgit v0.12 From 487c05895751985a695f117fd984d1ecfe7b1252 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Wed, 26 May 2010 14:06:27 +0200 Subject: escape quotes meant for the shell --- mkspecs/features/unix/separate_debug_info.prf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mkspecs/features/unix/separate_debug_info.prf b/mkspecs/features/unix/separate_debug_info.prf index c675828..40d52cb 100644 --- a/mkspecs/features/unix/separate_debug_info.prf +++ b/mkspecs/features/unix/separate_debug_info.prf @@ -1,7 +1,7 @@ !separate_debug_info_nocopy:!staticlib:!static:!contains(TEMPLATE, subdirs):!isEmpty(QMAKE_OBJCOPY) { QMAKE_SEPARATE_DEBUG_INFO = (test -z \"$(DESTDIR)\" || cd \"$(DESTDIR)\" ; targ=`basename $(TARGET)`; $$QMAKE_OBJCOPY --only-keep-debug \"\$\$targ\" \"\$\$targ.debug\" && $$QMAKE_OBJCOPY --strip-debug \"\$\$targ\" && $$QMAKE_OBJCOPY --add-gnu-debuglink=\"\$\$targ.debug\" \"\$\$targ\" && chmod -x \"\$\$targ.debug\" ) ; - QMAKE_INSTALL_SEPARATE_DEBUG_INFO = test -z "$(DESTDIR)" || cd \"$(DESTDIR)\" ; $(INSTALL_FILE) `basename $(TARGET)`.debug $(INSTALL_ROOT)/\$\$target_path/ + QMAKE_INSTALL_SEPARATE_DEBUG_INFO = test -z \"$(DESTDIR)\" || cd \"$(DESTDIR)\" ; $(INSTALL_FILE) `basename $(TARGET)`.debug $(INSTALL_ROOT)/\$\$target_path/ QMAKE_POST_LINK = $$QMAKE_SEPARATE_DEBUG_INFO $$QMAKE_POST_LINK silent:QMAKE_POST_LINK = @echo creating $@.debug && $$QMAKE_POST_LINK -- cgit v0.12 From a5391f187b91aaf9d6932f2ad1e81701e6cd0352 Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Thu, 27 May 2010 08:59:03 +1000 Subject: Remove deprecated Flickable::overshoot property. --- .../graphicsitems/qdeclarativeflickable.cpp | 19 ------------------- .../graphicsitems/qdeclarativeflickable_p.h | 5 ----- 2 files changed, 24 deletions(-) diff --git a/src/declarative/graphicsitems/qdeclarativeflickable.cpp b/src/declarative/graphicsitems/qdeclarativeflickable.cpp index 560d586..1dde510 100644 --- a/src/declarative/graphicsitems/qdeclarativeflickable.cpp +++ b/src/declarative/graphicsitems/qdeclarativeflickable.cpp @@ -1026,24 +1026,6 @@ QDeclarativeListProperty QDeclarativeFlickable::flickableChildr return QGraphicsItemPrivate::get(d->viewport)->childrenList(); } -bool QDeclarativeFlickable::overShoot() const -{ - Q_D(const QDeclarativeFlickable); - return d->boundsBehavior == DragAndOvershootBounds; -} - -void QDeclarativeFlickable::setOverShoot(bool o) -{ - Q_D(QDeclarativeFlickable); - if ((o && d->boundsBehavior == DragAndOvershootBounds) - || (!o && d->boundsBehavior == StopAtBounds)) - return; - qmlInfo(this) << "overshoot is deprecated and will be removed imminently - use boundsBehavior."; - d->boundsBehavior = o ? DragAndOvershootBounds : StopAtBounds; - emit boundsBehaviorChanged(); - emit overShootChanged(); -} - /*! \qmlproperty enumeration Flickable::boundsBehavior This property holds whether the surface may be dragged @@ -1078,7 +1060,6 @@ void QDeclarativeFlickable::setBoundsBehavior(BoundsBehavior b) return; d->boundsBehavior = b; emit boundsBehaviorChanged(); - emit overShootChanged(); } /*! diff --git a/src/declarative/graphicsitems/qdeclarativeflickable_p.h b/src/declarative/graphicsitems/qdeclarativeflickable_p.h index 05887b8..d40a0dc 100644 --- a/src/declarative/graphicsitems/qdeclarativeflickable_p.h +++ b/src/declarative/graphicsitems/qdeclarativeflickable_p.h @@ -64,7 +64,6 @@ class Q_DECLARATIVE_EXPORT QDeclarativeFlickable : public QDeclarativeItem Q_PROPERTY(qreal horizontalVelocity READ horizontalVelocity NOTIFY horizontalVelocityChanged) Q_PROPERTY(qreal verticalVelocity READ verticalVelocity NOTIFY verticalVelocityChanged) - Q_PROPERTY(bool overShoot READ overShoot WRITE setOverShoot NOTIFY overShootChanged) // deprecated Q_PROPERTY(BoundsBehavior boundsBehavior READ boundsBehavior WRITE setBoundsBehavior NOTIFY boundsBehaviorChanged) Q_PROPERTY(qreal maximumFlickVelocity READ maximumFlickVelocity WRITE setMaximumFlickVelocity NOTIFY maximumFlickVelocityChanged) Q_PROPERTY(qreal flickDeceleration READ flickDeceleration WRITE setFlickDeceleration NOTIFY flickDecelerationChanged) @@ -101,9 +100,6 @@ public: QDeclarativeListProperty flickableData(); QDeclarativeListProperty flickableChildren(); - bool overShoot() const; - void setOverShoot(bool); - enum BoundsBehavior { StopAtBounds, DragOverBounds, DragAndOvershootBounds }; BoundsBehavior boundsBehavior() const; void setBoundsBehavior(BoundsBehavior); @@ -172,7 +168,6 @@ Q_SIGNALS: void pageChanged(); void flickableDirectionChanged(); void interactiveChanged(); - void overShootChanged(); void boundsBehaviorChanged(); void maximumFlickVelocityChanged(); void flickDecelerationChanged(); -- cgit v0.12 From 0da1b076bf4e33f239ebe9dc4d8f5363ee24110b Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Thu, 27 May 2010 14:30:23 +1000 Subject: If a pathview delegate changes size, reposition center on path Task-number: QTBUG-11006 --- .../graphicsitems/qdeclarativepathview.cpp | 15 ++++++++++++++ .../graphicsitems/qdeclarativepathview_p.h | 1 + .../graphicsitems/qdeclarativepathview_p_p.h | 24 ++++++++++++++++++---- .../qdeclarativepathview/data/pathview0.qml | 6 ++++-- .../tst_qdeclarativepathview.cpp | 6 ++++++ 5 files changed, 46 insertions(+), 6 deletions(-) diff --git a/src/declarative/graphicsitems/qdeclarativepathview.cpp b/src/declarative/graphicsitems/qdeclarativepathview.cpp index 207cc25..3a69f44 100644 --- a/src/declarative/graphicsitems/qdeclarativepathview.cpp +++ b/src/declarative/graphicsitems/qdeclarativepathview.cpp @@ -110,6 +110,8 @@ QDeclarativeItem *QDeclarativePathViewPrivate::getItem(int modelIndex) att->setOnPath(true); } item->setParentItem(q); + QDeclarativeItemPrivate *itemPrivate = static_cast(QGraphicsItemPrivate::get(item)); + itemPrivate->addItemChangeListener(this, QDeclarativeItemPrivate::Geometry); } requestedIndex = -1; return item; @@ -121,6 +123,8 @@ void QDeclarativePathViewPrivate::releaseItem(QDeclarativeItem *item) return; if (QDeclarativePathViewAttached *att = attached(item)) att->setOnPath(false); + QDeclarativeItemPrivate *itemPrivate = static_cast(QGraphicsItemPrivate::get(item)); + itemPrivate->removeItemChangeListener(this, QDeclarativeItemPrivate::Geometry); model->release(item); } @@ -1084,6 +1088,16 @@ bool QDeclarativePathView::sceneEventFilter(QGraphicsItem *i, QEvent *e) return QDeclarativeItem::sceneEventFilter(i, e); } +bool QDeclarativePathView::event(QEvent *event) +{ + if (event->type() == QEvent::User) { + refill(); + return true; + } + + return QDeclarativeItem::event(event); +} + void QDeclarativePathView::componentComplete() { Q_D(QDeclarativePathView); @@ -1103,6 +1117,7 @@ void QDeclarativePathView::refill() if (!d->isValid() || !isComponentComplete()) return; + d->layoutScheduled = false; bool currentVisible = false; // first move existing items and remove items off path diff --git a/src/declarative/graphicsitems/qdeclarativepathview_p.h b/src/declarative/graphicsitems/qdeclarativepathview_p.h index 349a01c..8a6f53f 100644 --- a/src/declarative/graphicsitems/qdeclarativepathview_p.h +++ b/src/declarative/graphicsitems/qdeclarativepathview_p.h @@ -161,6 +161,7 @@ protected: void mouseReleaseEvent(QGraphicsSceneMouseEvent *); bool sendMouseEvent(QGraphicsSceneMouseEvent *event); bool sceneEventFilter(QGraphicsItem *, QEvent *); + bool event(QEvent *event); void componentComplete(); private Q_SLOTS: diff --git a/src/declarative/graphicsitems/qdeclarativepathview_p_p.h b/src/declarative/graphicsitems/qdeclarativepathview_p_p.h index 303486f..3abb2f4 100644 --- a/src/declarative/graphicsitems/qdeclarativepathview_p_p.h +++ b/src/declarative/graphicsitems/qdeclarativepathview_p_p.h @@ -68,7 +68,7 @@ QT_BEGIN_NAMESPACE class QDeclarativeOpenMetaObjectType; class QDeclarativePathViewAttached; -class QDeclarativePathViewPrivate : public QDeclarativeItemPrivate +class QDeclarativePathViewPrivate : public QDeclarativeItemPrivate, public QDeclarativeItemChangeListener { Q_DECLARE_PUBLIC(QDeclarativePathView) @@ -77,7 +77,8 @@ public: : path(0), currentIndex(0), currentItemOffset(0.0), startPc(0), lastDist(0) , lastElapsed(0), mappedRange(1.0) , stealMouse(false), ownModel(false), interactive(true), haveHighlightRange(true) - , autoHighlight(true), highlightUp(false), dragMargin(0), deceleration(100) + , autoHighlight(true), highlightUp(false), layoutScheduled(false) + , dragMargin(0), deceleration(100) , moveOffset(this, &QDeclarativePathViewPrivate::setOffset) , firstIndex(-1), pathItems(-1), requestedIndex(-1) , moveReason(Other), attType(0), highlightComponent(0), highlightItem(0) @@ -89,8 +90,7 @@ public: { } - void init() - { + void init() { Q_Q(QDeclarativePathView); offset = 0; q->setAcceptedMouseButtons(Qt::LeftButton); @@ -99,6 +99,21 @@ public: q->connect(&tl, SIGNAL(updated()), q, SLOT(ticked())); } + void itemGeometryChanged(QDeclarativeItem *item, const QRectF &newGeometry, const QRectF &oldGeometry) { + if ((newGeometry.size() != oldGeometry.size()) + && (!highlightItem || item != highlightItem)) { + scheduleLayout(); + } + } + + void scheduleLayout() { + Q_Q(QDeclarativePathView); + if (!layoutScheduled) { + layoutScheduled = true; + QCoreApplication::postEvent(q, new QEvent(QEvent::User), Qt::HighEventPriority); + } + } + QDeclarativeItem *getItem(int modelIndex); void releaseItem(QDeclarativeItem *item); QDeclarativePathViewAttached *attached(QDeclarativeItem *item); @@ -138,6 +153,7 @@ public: bool haveHighlightRange : 1; bool autoHighlight : 1; bool highlightUp : 1; + bool layoutScheduled : 1; QTime lastPosTime; QPointF lastPos; qreal dragMargin; diff --git a/tests/auto/declarative/qdeclarativepathview/data/pathview0.qml b/tests/auto/declarative/qdeclarativepathview/data/pathview0.qml index a3afd38..8956205 100644 --- a/tests/auto/declarative/qdeclarativepathview/data/pathview0.qml +++ b/tests/auto/declarative/qdeclarativepathview/data/pathview0.qml @@ -4,6 +4,8 @@ Rectangle { id: root property int currentA: -1 property int currentB: -1 + property real delegateWidth: 60 + property real delegateHeight: 20 width: 240 height: 320 color: "#ffffff" @@ -13,8 +15,8 @@ Rectangle { Rectangle { id: wrapper objectName: "wrapper" - height: 20 - width: 60 + height: root.delegateHeight + width: root.delegateWidth color: PathView.isCurrentItem ? "lightsteelblue" : "white" border.color: "black" Text { diff --git a/tests/auto/declarative/qdeclarativepathview/tst_qdeclarativepathview.cpp b/tests/auto/declarative/qdeclarativepathview/tst_qdeclarativepathview.cpp index f32a6c7..dffc7ac 100644 --- a/tests/auto/declarative/qdeclarativepathview/tst_qdeclarativepathview.cpp +++ b/tests/auto/declarative/qdeclarativepathview/tst_qdeclarativepathview.cpp @@ -445,6 +445,12 @@ void tst_QDeclarativePathView::pathMoved() pathview->setOffset(0.0); QCOMPARE(firstItem->pos() + offset, start); + // Change delegate size + canvas->rootObject()->setProperty("delegateWidth", 30); + QCOMPARE(firstItem->width(), 30.0); + offset.setX(firstItem->width()/2); + QTRY_COMPARE(firstItem->pos() + offset, start); + delete canvas; } -- cgit v0.12 From f1603f8a4bd3027be201920fa99c9370264bee03 Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Thu, 27 May 2010 15:21:28 +1000 Subject: Improve QML framerate debugging --- src/declarative/debugger/debugger.pri | 6 +- .../debugger/qdeclarativedebugservice.cpp | 11 +++ .../debugger/qdeclarativedebugtiming.cpp | 95 +++++++++++++++++++++ .../debugger/qdeclarativedebugtiming_p.h | 96 +++++++++++++++++++++ src/declarative/qml/qdeclarativecomponent.cpp | 8 ++ src/declarative/util/qdeclarativeview.cpp | 98 +++++++++++----------- 6 files changed, 265 insertions(+), 49 deletions(-) create mode 100644 src/declarative/debugger/qdeclarativedebugtiming.cpp create mode 100644 src/declarative/debugger/qdeclarativedebugtiming_p.h diff --git a/src/declarative/debugger/debugger.pri b/src/declarative/debugger/debugger.pri index dedea55..6777868 100644 --- a/src/declarative/debugger/debugger.pri +++ b/src/declarative/debugger/debugger.pri @@ -5,11 +5,13 @@ SOURCES += \ $$PWD/qpacketprotocol.cpp \ $$PWD/qdeclarativedebugservice.cpp \ $$PWD/qdeclarativedebugclient.cpp \ - $$PWD/qdeclarativedebug.cpp + $$PWD/qdeclarativedebug.cpp \ + $$PWD/qdeclarativedebugtiming.cpp HEADERS += \ $$PWD/qdeclarativedebuggerstatus_p.h \ $$PWD/qpacketprotocol_p.h \ $$PWD/qdeclarativedebugservice_p.h \ $$PWD/qdeclarativedebugclient_p.h \ - $$PWD/qdeclarativedebug_p.h + $$PWD/qdeclarativedebug_p.h \ + $$PWD/qdeclarativedebugtiming_p.h diff --git a/src/declarative/debugger/qdeclarativedebugservice.cpp b/src/declarative/debugger/qdeclarativedebugservice.cpp index 34e73fd..dca2695 100644 --- a/src/declarative/debugger/qdeclarativedebugservice.cpp +++ b/src/declarative/debugger/qdeclarativedebugservice.cpp @@ -61,6 +61,7 @@ class QDeclarativeDebugServer : public QObject public: static QDeclarativeDebugServer *instance(); void listen(); + void waitForConnection(); bool hasDebuggingClient() const; private Q_SLOTS: @@ -115,6 +116,12 @@ void QDeclarativeDebugServer::listen() qWarning("QDeclarativeDebugServer: Unable to listen on port %d", d->port); } +void QDeclarativeDebugServer::waitForConnection() +{ + Q_D(QDeclarativeDebugServer); + d->tcpServer->waitForNewConnection(-1); +} + void QDeclarativeDebugServer::newConnection() { Q_D(QDeclarativeDebugServer); @@ -144,6 +151,7 @@ QDeclarativeDebugServer *QDeclarativeDebugServer::instance() if (!envTested) { envTested = true; QByteArray env = qgetenv("QML_DEBUG_SERVER_PORT"); + QByteArray block = qgetenv("QML_DEBUG_SERVER_BLOCK"); bool ok = false; int port = env.toInt(&ok); @@ -151,6 +159,9 @@ QDeclarativeDebugServer *QDeclarativeDebugServer::instance() if (ok && port > 1024) { server = new QDeclarativeDebugServer(port); server->listen(); + if (!block.isEmpty()) { + server->waitForConnection(); + } } } diff --git a/src/declarative/debugger/qdeclarativedebugtiming.cpp b/src/declarative/debugger/qdeclarativedebugtiming.cpp new file mode 100644 index 0000000..5b93852 --- /dev/null +++ b/src/declarative/debugger/qdeclarativedebugtiming.cpp @@ -0,0 +1,95 @@ +/**************************************************************************** +** +** 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 "qdeclarativedebugtiming_p.h" + +#include + +Q_GLOBAL_STATIC(QDeclarativeDebugTiming, timerInstance); + +QDeclarativeDebugTiming::QDeclarativeDebugTiming() +: QDeclarativeDebugService(QLatin1String("CanvasFrameRate")) +{ + m_timer.start(); +} + +void QDeclarativeDebugTiming::addEvent(EventType t) +{ + if (QDeclarativeDebugService::isDebuggingEnabled()) + timerInstance()->addEventImpl(t); +} + +void QDeclarativeDebugTiming::startRange(RangeType t) +{ + if (QDeclarativeDebugService::isDebuggingEnabled()) + timerInstance()->startRangeImpl(t); +} + +void QDeclarativeDebugTiming::endRange(RangeType t) +{ + if (QDeclarativeDebugService::isDebuggingEnabled()) + timerInstance()->endRangeImpl(t); +} + +void QDeclarativeDebugTiming::addEventImpl(EventType event) +{ + QByteArray data; + QDataStream ds(&data, QIODevice::WriteOnly); + ds << m_timer.elapsed() << (int)Event << (int)event; + sendMessage(data); +} + +void QDeclarativeDebugTiming::startRangeImpl(RangeType range) +{ + QByteArray data; + QDataStream ds(&data, QIODevice::WriteOnly); + ds << m_timer.elapsed() << (int)RangeStart << (int)range; + sendMessage(data); +} + +void QDeclarativeDebugTiming::endRangeImpl(RangeType range) +{ + QByteArray data; + QDataStream ds(&data, QIODevice::WriteOnly); + ds << m_timer.elapsed() << (int)RangeEnd << (int)range; + sendMessage(data); +} + diff --git a/src/declarative/debugger/qdeclarativedebugtiming_p.h b/src/declarative/debugger/qdeclarativedebugtiming_p.h new file mode 100644 index 0000000..d9ed67c --- /dev/null +++ b/src/declarative/debugger/qdeclarativedebugtiming_p.h @@ -0,0 +1,96 @@ +/**************************************************************************** +** +** 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 QDECLARATIVEDEBUGTIMING_P_H +#define QDECLARATIVEDEBUGTIMING_P_H + +#include +#include + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +class QDeclarativeDebugTiming : public QDeclarativeDebugService +{ +public: + enum EventType { + FramePaint, + Mouse, + Key, + + MaximumEventType + }; + + enum Message { + Event, + RangeStart, + RangeEnd, + + MaximumMessage + }; + + enum RangeType { + Painting, + Compiling, + Creating, + + MaximumRangeType + }; + + static void addEvent(EventType); + static void startRange(RangeType); + static void endRange(RangeType); + + QDeclarativeDebugTiming(); +private: + void addEventImpl(EventType); + void startRangeImpl(RangeType); + void endRangeImpl(RangeType); + QElapsedTimer m_timer; +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QDECLARATIVEDEBUGTIMING_P_H + diff --git a/src/declarative/qml/qdeclarativecomponent.cpp b/src/declarative/qml/qdeclarativecomponent.cpp index 7aa17e8..2dc2d2d 100644 --- a/src/declarative/qml/qdeclarativecomponent.cpp +++ b/src/declarative/qml/qdeclarativecomponent.cpp @@ -53,6 +53,7 @@ #include "private/qdeclarativebinding_p_p.h" #include "private/qdeclarativeglobal_p.h" #include "private/qdeclarativescriptparser_p.h" +#include "private/qdeclarativedebugtiming_p.h" #include #include @@ -693,6 +694,10 @@ QDeclarativeComponentPrivate::beginCreate(QDeclarativeContextData *context, cons QDeclarativeEnginePrivate *ep = QDeclarativeEnginePrivate::get(engine); + bool isRoot = !ep->inBeginCreate; + if (isRoot) + QDeclarativeDebugTiming::startRange(QDeclarativeDebugTiming::Creating); + QDeclarativeContextData *ctxt = new QDeclarativeContextData; ctxt->isInternal = true; ctxt->url = cc->url; @@ -839,6 +844,7 @@ void QDeclarativeComponentPrivate::complete(QDeclarativeEnginePrivate *enginePri enginePriv->erroredBindings->removeError(); } } + } } @@ -860,6 +866,8 @@ void QDeclarativeComponentPrivate::completeCreate() if (state.completePending) { QDeclarativeEnginePrivate *ep = QDeclarativeEnginePrivate::get(engine); complete(ep, &state); + + QDeclarativeDebugTiming::endRange(QDeclarativeDebugTiming::Creating); } } diff --git a/src/declarative/util/qdeclarativeview.cpp b/src/declarative/util/qdeclarativeview.cpp index b7ce9c9..d2dab76 100644 --- a/src/declarative/util/qdeclarativeview.cpp +++ b/src/declarative/util/qdeclarativeview.cpp @@ -45,11 +45,11 @@ #include #include #include -#include -#include #include #include +#include + #include #include #include @@ -66,66 +66,64 @@ #include #include #include +#include #include QT_BEGIN_NAMESPACE DEFINE_BOOL_CONFIG_OPTION(frameRateDebug, QML_SHOW_FRAMERATE) -class QDeclarativeViewDebugServer; -class FrameBreakAnimation : public QAbstractAnimation +class QDeclarativeScene : public QGraphicsScene { public: - FrameBreakAnimation(QDeclarativeViewDebugServer *s) - : QAbstractAnimation((QObject*)s), server(s) - { - start(); - } + QDeclarativeScene(); - virtual int duration() const { return -1; } - virtual void updateCurrentTime(int msecs); +protected: + virtual void keyPressEvent(QKeyEvent *); + virtual void keyReleaseEvent(QKeyEvent *); -private: - QDeclarativeViewDebugServer *server; + virtual void mouseMoveEvent(QGraphicsSceneMouseEvent *); + virtual void mousePressEvent(QGraphicsSceneMouseEvent *); + virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *); }; -class QDeclarativeViewDebugServer : public QDeclarativeDebugService +QDeclarativeScene::QDeclarativeScene() { -public: - QDeclarativeViewDebugServer(QObject *parent = 0) : QDeclarativeDebugService(QLatin1String("CanvasFrameRate"), parent), breaks(0) - { - timer.start(); - new FrameBreakAnimation(this); - } +} - void addTiming(int pe, int tbf) - { - if (!isEnabled()) - return; - - bool isFrameBreak = breaks > 1; - breaks = 0; - int e = timer.elapsed(); - QByteArray data; - QDataStream ds(&data, QIODevice::WriteOnly); - ds << (int)pe << (int)tbf << (int)e - << (bool)isFrameBreak; - sendMessage(data); - } +void QDeclarativeScene::keyPressEvent(QKeyEvent *e) +{ + QDeclarativeDebugTiming::addEvent(QDeclarativeDebugTiming::Key); - void frameBreak() { ++breaks; } + QGraphicsScene::keyPressEvent(e); +} -private: - QElapsedTimer timer; - int breaks; -}; +void QDeclarativeScene::keyReleaseEvent(QKeyEvent *e) +{ + QDeclarativeDebugTiming::addEvent(QDeclarativeDebugTiming::Key); -Q_GLOBAL_STATIC(QDeclarativeViewDebugServer, qfxViewDebugServer); + QGraphicsScene::keyReleaseEvent(e); +} -void FrameBreakAnimation::updateCurrentTime(int msecs) +void QDeclarativeScene::mouseMoveEvent(QGraphicsSceneMouseEvent *e) { - Q_UNUSED(msecs); - server->frameBreak(); + QDeclarativeDebugTiming::addEvent(QDeclarativeDebugTiming::Mouse); + + QGraphicsScene::mouseMoveEvent(e); +} + +void QDeclarativeScene::mousePressEvent(QGraphicsSceneMouseEvent *e) +{ + QDeclarativeDebugTiming::addEvent(QDeclarativeDebugTiming::Mouse); + + QGraphicsScene::mousePressEvent(e); +} + +void QDeclarativeScene::mouseReleaseEvent(QGraphicsSceneMouseEvent *e) +{ + QDeclarativeDebugTiming::addEvent(QDeclarativeDebugTiming::Mouse); + + QGraphicsScene::mouseReleaseEvent(e); } class QDeclarativeViewPrivate : public QGraphicsViewPrivate, public QDeclarativeItemChangeListener @@ -156,7 +154,7 @@ public: void init(); - QGraphicsScene scene; + QDeclarativeScene scene; }; void QDeclarativeViewPrivate::execute() @@ -676,12 +674,18 @@ void QDeclarativeView::resizeEvent(QResizeEvent *e) void QDeclarativeView::paintEvent(QPaintEvent *event) { Q_D(QDeclarativeView); + + QDeclarativeDebugTiming::addEvent(QDeclarativeDebugTiming::FramePaint); + QDeclarativeDebugTiming::startRange(QDeclarativeDebugTiming::Painting); + int time = 0; - if (frameRateDebug() || QDeclarativeViewDebugServer::isDebuggingEnabled()) + if (frameRateDebug()) time = d->frameTimer.restart(); + QGraphicsView::paintEvent(event); - if (QDeclarativeViewDebugServer::isDebuggingEnabled()) - qfxViewDebugServer()->addTiming(d->frameTimer.elapsed(), time); + + QDeclarativeDebugTiming::endRange(QDeclarativeDebugTiming::Painting); + if (frameRateDebug()) qDebug() << "paintEvent:" << d->frameTimer.elapsed() << "time since last frame:" << time; } -- cgit v0.12 From 7cc8e62f74f66f20c216a8bc8c3187c989a3dcb4 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Thu, 27 May 2010 09:08:14 +0200 Subject: Optimize initialization of QStaticText Since QStaticText would be created once and used often, not much thought was put into optimizing its initialization. For simplicity, the code would do two drawText() passes. Since this was an unnecessary overhead, the extra pass has been removed and replaced by memmoves instead. Initialization is now twice as fast. Reviewed-by: Samuel --- src/gui/text/qstatictext.cpp | 163 +++++++++++++++++++++++-------------------- src/gui/text/qstatictext_p.h | 19 +++-- 2 files changed, 101 insertions(+), 81 deletions(-) diff --git a/src/gui/text/qstatictext.cpp b/src/gui/text/qstatictext.cpp index c7817c6..2889a96 100644 --- a/src/gui/text/qstatictext.cpp +++ b/src/gui/text/qstatictext.cpp @@ -363,23 +363,24 @@ QSizeF QStaticText::size() const } QStaticTextPrivate::QStaticTextPrivate() - : textWidth(-1.0), items(0), itemCount(0), glyphPool(0), positionPool(0), + : textWidth(-1.0), items(0), itemCount(0), glyphPool(0), positionPool(0), charPool(0), needsRelayout(true), useBackendOptimizations(false), textFormat(Qt::AutoText) { } QStaticTextPrivate::QStaticTextPrivate(const QStaticTextPrivate &other) : text(other.text), font(other.font), textWidth(other.textWidth), matrix(other.matrix), - items(0), itemCount(0), glyphPool(0), positionPool(0), needsRelayout(true), + items(0), itemCount(0), glyphPool(0), positionPool(0), charPool(0), needsRelayout(true), useBackendOptimizations(other.useBackendOptimizations), textFormat(other.textFormat) { } QStaticTextPrivate::~QStaticTextPrivate() { - delete[] items; + delete[] items; delete[] glyphPool; delete[] positionPool; + delete[] charPool; } QStaticTextPrivate *QStaticTextPrivate::get(const QStaticText *q) @@ -395,15 +396,8 @@ namespace { class DrawTextItemRecorder: public QPaintEngine { public: - DrawTextItemRecorder(int expectedItemCount, QStaticTextItem *items, - int expectedGlyphCount, QFixedPoint *positionPool, glyph_t *glyphPool) - : m_items(items), - m_itemCount(0), m_glyphCount(0), - m_expectedItemCount(expectedItemCount), - m_expectedGlyphCount(expectedGlyphCount), - m_glyphPool(glyphPool), - m_positionPool(positionPool), - m_dirtyPen(false) + DrawTextItemRecorder(bool useBackendOptimizations, int numChars) + : m_dirtyPen(false), m_useBackendOptimizations(useBackendOptimizations) { } @@ -415,26 +409,19 @@ namespace { virtual void drawTextItem(const QPointF &position, const QTextItem &textItem) { - const QTextItemInt &ti = static_cast(textItem); - - m_itemCount++; - m_glyphCount += ti.glyphs.numGlyphs; - if (m_items == 0) - return; - - Q_ASSERT(m_itemCount <= m_expectedItemCount); - Q_ASSERT(m_glyphCount <= m_expectedGlyphCount); - - QStaticTextItem *currentItem = (m_items + (m_itemCount - 1)); - currentItem->fontEngine = ti.fontEngine; - currentItem->font = ti.font(); - currentItem->chars = ti.chars; - currentItem->numChars = ti.num_chars; - currentItem->numGlyphs = ti.glyphs.numGlyphs; - currentItem->glyphs = m_glyphPool; - currentItem->glyphPositions = m_positionPool; + const QTextItemInt &ti = static_cast(textItem); + + QStaticTextItem currentItem; + currentItem.fontEngine = ti.fontEngine; + currentItem.font = ti.font(); + currentItem.charOffset = m_chars.size(); + currentItem.numChars = ti.num_chars; + currentItem.numGlyphs = ti.glyphs.numGlyphs; + currentItem.glyphOffset = m_glyphs.size(); // Store offset into glyph pool + currentItem.positionOffset = m_glyphs.size(); // Offset into position pool + currentItem.useBackendOptimizations = m_useBackendOptimizations; if (m_dirtyPen) - currentItem->color = state->pen().color(); + currentItem.color = state->pen().color(); QTransform matrix = state->transform(); matrix.translate(position.x(), position.y()); @@ -447,13 +434,21 @@ namespace { Q_ASSERT(size == ti.glyphs.numGlyphs); Q_ASSERT(size == positions.size()); - memmove(currentItem->glyphs, glyphs.constData(), sizeof(glyph_t) * size); - memmove(currentItem->glyphPositions, positions.constData(), sizeof(QFixedPoint) * size); + m_glyphs.resize(m_glyphs.size() + size); + m_positions.resize(m_glyphs.size()); + m_chars.resize(m_chars.size() + ti.num_chars); - m_glyphPool += size; - m_positionPool += size; - } + glyph_t *glyphsDestination = m_glyphs.data() + currentItem.glyphOffset; + memmove(glyphsDestination, glyphs.constData(), sizeof(glyph_t) * currentItem.numGlyphs); + QFixedPoint *positionsDestination = m_positions.data() + currentItem.positionOffset; + memmove(positionsDestination, positions.constData(), sizeof(QFixedPoint) * currentItem.numGlyphs); + + QChar *charsDestination = m_chars.data() + currentItem.charOffset; + memmove(charsDestination, ti.chars, sizeof(QChar) * currentItem.numChars); + + m_items.append(currentItem); + } virtual bool begin(QPaintDevice *) { return true; } virtual bool end() { return true; } @@ -463,38 +458,42 @@ namespace { return User; } - int itemCount() const + QVector items() const { - return m_itemCount; + return m_items; } - int glyphCount() const + QVector positions() const { - return m_glyphCount; + return m_positions; } - private: - QStaticTextItem *m_items; - int m_itemCount; - int m_glyphCount; - int m_expectedItemCount; - int m_expectedGlyphCount; + QVector glyphs() const + { + return m_glyphs; + } + + QVector chars() const + { + return m_chars; + } - glyph_t *m_glyphPool; - QFixedPoint *m_positionPool; + private: + QVector m_items; + QVector m_positions; + QVector m_glyphs; + QVector m_chars; bool m_dirtyPen; + bool m_useBackendOptimizations; }; class DrawTextItemDevice: public QPaintDevice { public: - DrawTextItemDevice(int expectedItemCount = -1, QStaticTextItem *items = 0, - int expectedGlyphCount = -1, QFixedPoint *positionPool = 0, - glyph_t *glyphPool = 0) + DrawTextItemDevice(bool useBackendOptimizations, int numChars) { - m_paintEngine = new DrawTextItemRecorder(expectedItemCount, items, - expectedGlyphCount, positionPool, glyphPool); + m_paintEngine = new DrawTextItemRecorder(useBackendOptimizations, numChars); } ~DrawTextItemDevice() @@ -538,14 +537,24 @@ namespace { return m_paintEngine; } - int itemCount() const + QVector glyphs() const { - return m_paintEngine->itemCount(); + return m_paintEngine->glyphs(); } - int glyphCount() const + QVector positions() const { - return m_paintEngine->glyphCount(); + return m_paintEngine->positions(); + } + + QVector items() const + { + return m_paintEngine->items(); + } + + QVector chars() const + { + return m_paintEngine->chars(); } private: @@ -616,42 +625,42 @@ void QStaticTextPrivate::init() delete[] items; delete[] glyphPool; delete[] positionPool; + delete[] charPool; position = QPointF(0, 0); - // Draw once to count number of items and glyphs, so that we can use as little memory - // as possible to store the data - DrawTextItemDevice counterDevice; + DrawTextItemDevice device(useBackendOptimizations, text.size()); { - QPainter painter(&counterDevice); + QPainter painter(&device); painter.setFont(font); painter.setTransform(matrix); paintText(QPointF(0, 0), &painter); - } - itemCount = counterDevice.itemCount(); + QVector deviceItems = device.items(); + QVector positions = device.positions(); + QVector glyphs = device.glyphs(); + QVector chars = device.chars(); + + itemCount = deviceItems.size(); items = new QStaticTextItem[itemCount]; - if (useBackendOptimizations) { - for (int i=0; i Date: Thu, 27 May 2010 09:52:25 +0200 Subject: Fixed compilation of QtOpenGL. Reviewed-by: Eskil --- src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp | 2 +- src/opengl/qpaintengine_opengl.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp index 4461358..5758b25 100644 --- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp +++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp @@ -1401,7 +1401,7 @@ void QGL2PaintEngineEx::drawTextItem(const QPointF &p, const QTextItem &textItem { QStaticTextItem staticTextItem; - staticTextItem.chars = ti.chars; + staticTextItem.chars = const_cast(ti.chars); staticTextItem.fontEngine = ti.fontEngine; staticTextItem.glyphs = glyphs.data(); staticTextItem.numChars = ti.num_chars; diff --git a/src/opengl/qpaintengine_opengl.cpp b/src/opengl/qpaintengine_opengl.cpp index 28d37bc..12c487d 100644 --- a/src/opengl/qpaintengine_opengl.cpp +++ b/src/opengl/qpaintengine_opengl.cpp @@ -4999,7 +4999,7 @@ void QOpenGLPaintEngine::drawTextItem(const QPointF &p, const QTextItem &textIte { QStaticTextItem staticTextItem; - staticTextItem.chars = ti.chars; + staticTextItem.chars = const_cast(ti.chars); staticTextItem.fontEngine = ti.fontEngine; staticTextItem.glyphs = glyphs.data(); staticTextItem.numChars = ti.num_chars; -- cgit v0.12 From 1f40fe507e6b6c74144cbb998cc91f88f9e33168 Mon Sep 17 00:00:00 2001 From: Kent Hansen Date: Wed, 26 May 2010 15:11:34 +0200 Subject: Ensure that activation object has been created before popping scope of native context One shouldn't have to call activationObject() or scopeChain() before calling popScope(); the scope chain should always have 2 items (activation and global object) before we start popping anything from the internal chain. Task-number: QTBUG-11020 Reviewed-by: Olivier Goffart --- src/script/api/qscriptcontext.cpp | 1 + tests/auto/qscriptcontext/tst_qscriptcontext.cpp | 45 ++++++++++++++++++++++++ 2 files changed, 46 insertions(+) diff --git a/src/script/api/qscriptcontext.cpp b/src/script/api/qscriptcontext.cpp index 639af80..3f08e74 100644 --- a/src/script/api/qscriptcontext.cpp +++ b/src/script/api/qscriptcontext.cpp @@ -742,6 +742,7 @@ void QScriptContext::pushScope(const QScriptValue &object) */ QScriptValue QScriptContext::popScope() { + activationObject(); //ensure the creation of the normal scope for native context JSC::CallFrame *frame = QScriptEnginePrivate::frameForContext(this); JSC::ScopeChainNode *scope = frame->scopeChain(); Q_ASSERT(scope != 0); diff --git a/tests/auto/qscriptcontext/tst_qscriptcontext.cpp b/tests/auto/qscriptcontext/tst_qscriptcontext.cpp index 100e195..617c183 100644 --- a/tests/auto/qscriptcontext/tst_qscriptcontext.cpp +++ b/tests/auto/qscriptcontext/tst_qscriptcontext.cpp @@ -84,6 +84,7 @@ private slots: void jsActivationObject(); void qobjectAsActivationObject(); void parentContextCallee_QT2270(); + void popNativeContextScope(); }; tst_QScriptContext::tst_QScriptContext() @@ -539,6 +540,50 @@ void tst_QScriptContext::pushAndPopContext() } } +void tst_QScriptContext::popNativeContextScope() +{ + QScriptEngine eng; + QScriptContext *ctx = eng.pushContext(); + QVERIFY(ctx->popScope().isObject()); // the activation object + + QCOMPARE(ctx->scopeChain().size(), 1); + QVERIFY(ctx->scopeChain().at(0).strictlyEquals(eng.globalObject())); + // This was different in 4.5: scope and activation were decoupled + QVERIFY(ctx->activationObject().strictlyEquals(eng.globalObject())); + + QVERIFY(!eng.evaluate("var foo = 123; function bar() {}").isError()); + QVERIFY(eng.globalObject().property("foo").isNumber()); + QVERIFY(eng.globalObject().property("bar").isFunction()); + + QScriptValue customScope = eng.newObject(); + ctx->pushScope(customScope); + QCOMPARE(ctx->scopeChain().size(), 2); + QVERIFY(ctx->scopeChain().at(0).strictlyEquals(customScope)); + QVERIFY(ctx->scopeChain().at(1).strictlyEquals(eng.globalObject())); + QVERIFY(ctx->activationObject().strictlyEquals(eng.globalObject())); + ctx->setActivationObject(customScope); + QVERIFY(ctx->activationObject().strictlyEquals(customScope)); + QCOMPARE(ctx->scopeChain().size(), 2); + QVERIFY(ctx->scopeChain().at(0).strictlyEquals(customScope)); + QEXPECT_FAIL("", "QTBUG-11012", Continue); + QVERIFY(ctx->scopeChain().at(1).strictlyEquals(eng.globalObject())); + + QVERIFY(!eng.evaluate("baz = 456; var foo = 789; function barbar() {}").isError()); + QEXPECT_FAIL("", "QTBUG-11012", Continue); + QVERIFY(eng.globalObject().property("baz").isNumber()); + QVERIFY(customScope.property("foo").isNumber()); + QVERIFY(customScope.property("barbar").isFunction()); + + QVERIFY(ctx->popScope().strictlyEquals(customScope)); + QCOMPARE(ctx->scopeChain().size(), 1); + QEXPECT_FAIL("", "QTBUG-11012", Continue); + QVERIFY(ctx->scopeChain().at(0).strictlyEquals(eng.globalObject())); + + // Need to push another object, otherwise we crash in popContext() (QTBUG-11012) + ctx->pushScope(customScope); + eng.popContext(); +} + void tst_QScriptContext::lineNumber() { QScriptEngine eng; -- cgit v0.12 From ea68e4ddcf903bde74ded9d588a09863491d1d56 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Thu, 27 May 2010 10:28:52 +0200 Subject: Replace memmove with memcpy qMemCopy is faster than memmove, and there's no chance of overlapping source and destination memory in these cases. Reviewed-by: Samuel --- src/gui/text/qstatictext.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/gui/text/qstatictext.cpp b/src/gui/text/qstatictext.cpp index 2889a96..84c1d96 100644 --- a/src/gui/text/qstatictext.cpp +++ b/src/gui/text/qstatictext.cpp @@ -439,13 +439,13 @@ namespace { m_chars.resize(m_chars.size() + ti.num_chars); glyph_t *glyphsDestination = m_glyphs.data() + currentItem.glyphOffset; - memmove(glyphsDestination, glyphs.constData(), sizeof(glyph_t) * currentItem.numGlyphs); + qMemCopy(glyphsDestination, glyphs.constData(), sizeof(glyph_t) * currentItem.numGlyphs); QFixedPoint *positionsDestination = m_positions.data() + currentItem.positionOffset; - memmove(positionsDestination, positions.constData(), sizeof(QFixedPoint) * currentItem.numGlyphs); + qMemCopy(positionsDestination, positions.constData(), sizeof(QFixedPoint) * currentItem.numGlyphs); QChar *charsDestination = m_chars.data() + currentItem.charOffset; - memmove(charsDestination, ti.chars, sizeof(QChar) * currentItem.numChars); + qMemCopy(charsDestination, ti.chars, sizeof(QChar) * currentItem.numChars); m_items.append(currentItem); } @@ -647,13 +647,13 @@ void QStaticTextPrivate::init() items = new QStaticTextItem[itemCount]; glyphPool = new glyph_t[glyphs.size()]; - memmove(glyphPool, glyphs.constData(), glyphs.size() * sizeof(glyph_t)); + qMemCopy(glyphPool, glyphs.constData(), glyphs.size() * sizeof(glyph_t)); positionPool = new QFixedPoint[positions.size()]; - memmove(positionPool, positions.constData(), positions.size() * sizeof(QFixedPoint)); + qMemCopy(positionPool, positions.constData(), positions.size() * sizeof(QFixedPoint)); charPool = new QChar[chars.size()]; - memmove(charPool, chars.constData(), chars.size() * sizeof(QChar)); + qMemCopy(charPool, chars.constData(), chars.size() * sizeof(QChar)); for (int i=0; i Date: Wed, 26 May 2010 16:09:49 +0200 Subject: Added support for Indonesian language on Symbian. We have support for ELangIndonesian, but we also need to support new ELangIndonesian_Apac which has appeared in Symbian^3. Task-number: QT-3369 Reviewed-by: trustme --- src/corelib/tools/qlocale_symbian.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/corelib/tools/qlocale_symbian.cpp b/src/corelib/tools/qlocale_symbian.cpp index 1e674af..458bb2a 100644 --- a/src/corelib/tools/qlocale_symbian.cpp +++ b/src/corelib/tools/qlocale_symbian.cpp @@ -159,8 +159,9 @@ static const symbianToISO symbian_to_iso_list[] = { { ELangEnglish_Prc, "en_CN" }, // 159 ### Not supported by CLDR { ELangEnglish_Japan, "en_JP"}, // 160 ### Not supported by CLDR { ELangEnglish_Thailand, "en_TH" }, // 161 ### Not supported by CLDR - { ELangMalay_Apac, "ms" } // 326 + { ELangMalay_Apac, "ms" }, // 326 #endif + { 327/*ELangIndonesian_Apac*/,"id_ID" } // 327 - appeared in Symbian^3 }; /*! -- cgit v0.12 From ddf119a57001edd71eb6b84dffc7cda4a8ca2c0e Mon Sep 17 00:00:00 2001 From: Anders Bakken Date: Thu, 27 May 2010 10:50:40 +0200 Subject: Fix a bug in QDirectFBPixmapData::fromImage MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Every image that was converted with flags & Qt::NoOpaqueDetection would be considered to have an alpha channel. This patch fixes that and simplifies the code a little. Merge-request: 637 Reviewed-by: Samuel Rødal --- .../gfxdrivers/directfb/qdirectfbpixmap.cpp | 25 +++++++++------------- src/plugins/gfxdrivers/directfb/qdirectfbpixmap.h | 2 +- 2 files changed, 11 insertions(+), 16 deletions(-) diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp index 80366d1..f704432 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp +++ b/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp @@ -91,6 +91,7 @@ void QDirectFBPixmapData::resize(int width, int height) setSerialNumber(++global_ser_no); } +#ifdef QT_DIRECTFB_OPAQUE_DETECTION // mostly duplicated from qimage.cpp (QImageData::checkForAlphaPixels) static bool checkForAlphaPixels(const QImage &img) { @@ -160,12 +161,16 @@ static bool checkForAlphaPixels(const QImage &img) return false; } +#endif // QT_DIRECTFB_OPAQUE_DETECTION -bool QDirectFBPixmapData::hasAlphaChannel(const QImage &img) +bool QDirectFBPixmapData::hasAlphaChannel(const QImage &img, Qt::ImageConversionFlags flags) { -#ifndef QT_NO_DIRECTFB_OPAQUE_DETECTION - return checkForAlphaPixels(img); + if (img.depth() == 1) + return true; +#ifdef QT_DIRECTFB_OPAQUE_DETECTION + return ((flags & Qt::NoOpaqueDetection) ? img.hasAlphaChannel() : checkForAlphaPixels(img)); #else + Q_UNUSED(flags); return img.hasAlphaChannel(); #endif } @@ -287,19 +292,9 @@ bool QDirectFBPixmapData::fromDataBufferDescription(const DFBDataBufferDescripti #endif -void QDirectFBPixmapData::fromImage(const QImage &img, - Qt::ImageConversionFlags flags) +void QDirectFBPixmapData::fromImage(const QImage &img, Qt::ImageConversionFlags flags) { - if (img.depth() == 1) { - alpha = true; -#ifndef QT_NO_DIRECTFB_OPAQUE_DETECTION - } else if (flags & Qt::NoOpaqueDetection || QDirectFBPixmapData::hasAlphaChannel(img)) { - alpha = true; -#else - } else if (img.hasAlphaChannel()) { - alpha = true; -#endif - } + alpha = QDirectFBPixmapData::hasAlphaChannel(img, flags); imageFormat = alpha ? screen->alphaPixmapFormat() : screen->pixelFormat(); QImage image; if ((flags & ~Qt::NoOpaqueDetection) != Qt::AutoColor) { diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.h b/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.h index da6edc6..343b26e 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.h +++ b/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.h @@ -86,8 +86,8 @@ public: virtual int metric(QPaintDevice::PaintDeviceMetric m) const { return QDirectFBPaintDevice::metric(m); } inline QImage::Format pixelFormat() const { return imageFormat; } - static bool hasAlphaChannel(const QImage &img); inline bool hasAlphaChannel() const { return alpha; } + static bool hasAlphaChannel(const QImage &img, Qt::ImageConversionFlags flags = Qt::AutoColor); private: #ifdef QT_DIRECTFB_IMAGEPROVIDER bool fromDataBufferDescription(const DFBDataBufferDescription &dataBuffer); -- cgit v0.12 From bc5e4da28c1ffbc0da1cbfcaa1e6236ff4c2d4e3 Mon Sep 17 00:00:00 2001 From: Jens Bache-Wiig Date: Thu, 27 May 2010 12:15:54 +0200 Subject: Fixed a crash when creating QGtkStyle before QApplication Task-number: QTBUG-10758 Reviewed-by: ogoffart --- src/gui/styles/qgtkstyle.cpp | 2 ++ src/gui/styles/qgtkstyle_p.cpp | 2 -- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gui/styles/qgtkstyle.cpp b/src/gui/styles/qgtkstyle.cpp index 6c8d561..9d6dc9a 100644 --- a/src/gui/styles/qgtkstyle.cpp +++ b/src/gui/styles/qgtkstyle.cpp @@ -325,6 +325,7 @@ void QGtkStyle::polish(QApplication *app) qt_filedialog_save_filename_hook = &QGtkStylePrivate::saveFilename; qt_filedialog_open_filenames_hook = &QGtkStylePrivate::openFilenames; qt_filedialog_existing_directory_hook = &QGtkStylePrivate::openDirectory; + qApp->installEventFilter(&d->filter); } } } @@ -345,6 +346,7 @@ void QGtkStyle::unpolish(QApplication *app) qt_filedialog_save_filename_hook = 0; qt_filedialog_open_filenames_hook = 0; qt_filedialog_existing_directory_hook = 0; + qApp->removeEventFilter(&d->filter); } } diff --git a/src/gui/styles/qgtkstyle_p.cpp b/src/gui/styles/qgtkstyle_p.cpp index 3c6a1ef..4ed0fab 100644 --- a/src/gui/styles/qgtkstyle_p.cpp +++ b/src/gui/styles/qgtkstyle_p.cpp @@ -285,8 +285,6 @@ void QGtkStylePrivate::init() { resolveGtk(); initGtkWidgets(); - if (isThemeAvailable()) - qApp->installEventFilter(&filter); } GtkWidget* QGtkStylePrivate::gtkWidget(const QHashableLatin1Literal &path) -- cgit v0.12 From 975dbe047590253e9d4433030d76ab26969f621f Mon Sep 17 00:00:00 2001 From: "Bradley T. Hughes" Date: Thu, 27 May 2010 13:37:58 +0200 Subject: Update documentation for the -font command line option This option is ignored when Qt is built with fontconfig support, make sure it is documented. Task-number: QTBUG-3671 --- src/gui/kernel/qapplication.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/gui/kernel/qapplication.cpp b/src/gui/kernel/qapplication.cpp index 57c4c99..0d11b27 100644 --- a/src/gui/kernel/qapplication.cpp +++ b/src/gui/kernel/qapplication.cpp @@ -666,7 +666,8 @@ void QApplicationPrivate::process_cmdline() \o -geometry \e geometry, sets the client geometry of the first window that is shown. \o -fn or \c -font \e font, defines the application font. The font - should be specified using an X logical font description. + should be specified using an X logical font description. Note that + this option is ignored when Qt is built with fontconfig support enabled. \o -bg or \c -background \e color, sets the default background color and an application palette (light and dark shades are calculated). \o -fg or \c -foreground \e color, sets the default foreground color. -- cgit v0.12 From 773cfe5b87e8f92aba1e5648dc57f559c6e43741 Mon Sep 17 00:00:00 2001 From: kh1 Date: Thu, 27 May 2010 14:41:12 +0200 Subject: Remove superfluous forward declaration. Task-number: QTBUG-11049 Reviewed-by: ck --- tools/assistant/lib/qhelpsearchindexreader_default_p.h | 3 --- 1 file changed, 3 deletions(-) diff --git a/tools/assistant/lib/qhelpsearchindexreader_default_p.h b/tools/assistant/lib/qhelpsearchindexreader_default_p.h index b30fa4b..27764db 100644 --- a/tools/assistant/lib/qhelpsearchindexreader_default_p.h +++ b/tools/assistant/lib/qhelpsearchindexreader_default_p.h @@ -61,9 +61,6 @@ QT_BEGIN_NAMESPACE -struct Entry; -struct PosEntry; - namespace fulltextsearch { namespace std { -- cgit v0.12 From 5f66639e069f276a20f27373a0c2e7dd9d94f390 Mon Sep 17 00:00:00 2001 From: Alan Alpert Date: Thu, 27 May 2010 15:35:17 +0200 Subject: Tweak aesthetics of QML viewer inside QtDemo Make the UX more controlled from QML, and tweak the frame to be better. Blur mechanism has been reworked, but still disabled by default. --- demos/qtdemo/MagicAnim.qml | 60 --------------- demos/qtdemo/colors.cpp | 2 +- demos/qtdemo/mainwindow.cpp | 12 +-- demos/qtdemo/menumanager.cpp | 35 ++++----- demos/qtdemo/menumanager.h | 3 +- demos/qtdemo/qmlShell.qml | 177 +++++++++++++++++++++++-------------------- demos/qtdemo/qtdemo.pro | 3 +- demos/qtdemo/qtdemo.qrc | 1 - 8 files changed, 118 insertions(+), 175 deletions(-) delete mode 100644 demos/qtdemo/MagicAnim.qml diff --git a/demos/qtdemo/MagicAnim.qml b/demos/qtdemo/MagicAnim.qml deleted file mode 100644 index 7ac3e1c..0000000 --- a/demos/qtdemo/MagicAnim.qml +++ /dev/null @@ -1,60 +0,0 @@ -/**************************************************************************** -** -** 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 demonstration applications 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$ -** -****************************************************************************/ - -import Qt 4.7 - -//Emulates the in animation of the menu elements -SequentialAnimation{ - id: main; - property Item target - property int from: 0 - property int to: 100 - property int duration: 1000 - property string properties: "y" - PauseAnimation { duration: main.duration*0.20 } - NumberAnimation { target: main.target; properties: main.properties; from: main.from; to: main.to + 40; duration: main.duration*0.30 } - NumberAnimation { target: main.target; properties: main.properties; from: main.to + 40; to: main.to; duration: main.duration*0.10 } - NumberAnimation { target: main.target; properties: main.properties; from: main.to; to: main.to + 20; duration: main.duration*0.10 } - NumberAnimation { target: main.target; properties: main.properties; from: main.to + 20; to: main.to; duration: main.duration*0.10 } - NumberAnimation { target: main.target; properties: main.properties; from: main.to; to: main.to + 8; duration: main.duration*0.10 } - NumberAnimation { target: main.target; properties: main.properties; from: main.to + 8; to: main.to; duration: main.duration*0.10 } -} - diff --git a/demos/qtdemo/colors.cpp b/demos/qtdemo/colors.cpp index 07cf162..b352e3d 100644 --- a/demos/qtdemo/colors.cpp +++ b/demos/qtdemo/colors.cpp @@ -270,7 +270,7 @@ void Colors::parseArgs(int argc, char *argv[]) else if (s.startsWith("-h") || s.startsWith("-help")){ QMessageBox::warning(0, "Arguments", QString("Usage: qtdemo [-verbose] [-no-adapt] [-opengl] [-software] [-fullscreen] [-ticker[0|1]] ") - + "[-animations[0|1]] [-no-blending] [-no-sync] [-use-timer-update[0|1]] [-pause[0|1]] " + + "[-animations[0|1]] [-no-blending] [-use-blur] [-no-sync] [-use-timer-update[0|1]] [-pause[0|1]] " + "[-use-window-mask] [-no-rescale] " + "[-use-pixmaps] [-show-fps] [-show-br] [-8bit[0|1]] [-menu] [-use-loop] [-use-balls] " + "[-animation-speed] [-fps] " diff --git a/demos/qtdemo/mainwindow.cpp b/demos/qtdemo/mainwindow.cpp index 45ec9a6..753014a 100644 --- a/demos/qtdemo/mainwindow.cpp +++ b/demos/qtdemo/mainwindow.cpp @@ -266,7 +266,7 @@ void MainWindow::setupSceneItems() { if (Colors::showFps){ this->fpsLabel = new DemoTextItem(QString("FPS: --"), Colors::buttonFont(), Qt::white, -1, this->scene, 0, DemoTextItem::DYNAMIC_TEXT); - this->fpsLabel->setZValue(100); + this->fpsLabel->setZValue(1000); this->fpsLabel->setPos(Colors::stageStartX, 600 - QFontMetricsF(Colors::buttonFont()).height() - 5); } @@ -311,15 +311,9 @@ void MainWindow::checkAdapt() } //Note: Because we don't adapt later in the program, if blur makes FPS plummet then we won't catch it - if (!Colors::noBlur && MenuManager::instance()->mainSceneBlur && this->mainSceneRoot){ + if (!Colors::noBlur && MenuManager::instance()->declarativeEngine && this->mainSceneRoot){ Colors::noBlur = true; - this->mainSceneRoot->setGraphicsEffect(0); - MenuManager::instance()->mainSceneBlur = 0; - if(MenuManager::instance()->qmlRoot){ - MenuManager::instance()->qmlRoot->setGraphicsEffect(0); - MenuManager::instance()->declarativeEngine->rootContext()->setContextProperty("realBlur", 0); - } - MenuManager::instance()->qmlShadow = 0; + MenuManager::instance()->declarativeEngine->rootContext()->setContextProperty("useBlur", false); if (Colors::verbose) qDebug() << "- benchmark adaption: removed blur (fps < 30)"; } diff --git a/demos/qtdemo/menumanager.cpp b/demos/qtdemo/menumanager.cpp index 9eb5664..9e2ba6b 100644 --- a/demos/qtdemo/menumanager.cpp +++ b/demos/qtdemo/menumanager.cpp @@ -59,8 +59,6 @@ MenuManager::MenuManager() this->tickerInAnim = 0; this->upButton = 0; this->downButton = 0; - this->mainSceneBlur = 0; - this->qmlShadow = 0; this->helpEngine = 0; this->score = new Score(); this->currentMenu = QLatin1String("[no menu visible]"); @@ -381,8 +379,14 @@ void MenuManager::launchQmlExample(const QString &name) } } + QPainter painter(qmlBgImage); + this->window->fpsLabel->setOpacity(0); + this->window->render(&painter); + this->window->fpsLabel->setOpacity(1.0); + Qt::ImageConversionFlags convFlags = Qt::AvoidDither | Qt::NoOpaqueDetection; + this->declarativeEngine->rootContext()->setContextProperty("bgAppPixmap", QVariant(QPixmap::fromImage(*qmlBgImage, convFlags))); qmlRoot->setProperty("show", QVariant(true)); - qmlRoot->setProperty("source", file.fileName()); + qmlRoot->setProperty("qmlFile", QUrl::fromLocalFile(file.fileName())); } void MenuManager::exampleFinished() @@ -401,15 +405,6 @@ void MenuManager::init(MainWindow *window) { this->window = window; - //Create blur for later use - // Note that blur is DISABLED by default because it's too slow, even on Desktop machines - if(!Colors::noBlur){ - this->mainSceneBlur = new QGraphicsBlurEffect(this); - this->mainSceneBlur->setEnabled(false); - this->mainSceneBlur->setBlurRadius(0); - this->window->mainSceneRoot->setGraphicsEffect(mainSceneBlur); - } - // Create div: this->createTicker(); this->createUpnDownButtons(); @@ -439,8 +434,15 @@ void MenuManager::init(MainWindow *window) // Create QML Loader qmlRegisterType("Effects", 1, 0, "Blur"); + qmlRegisterType("Effects", 1, 0, "DropShadow"); declarativeEngine = new QDeclarativeEngine(this); - MenuManager::instance()->declarativeEngine->rootContext()->setContextProperty("realBlur", this->mainSceneBlur); + + // Note that we paint the background into a static image for a theorized performance improvement when blurring + // It has not yet been determined what, if any, speed up this gives (but is left in 'cause the QML expects it now) + this->qmlBgImage = new QImage(window->sceneRect().size().toSize(), QImage::Format_ARGB32); + this->qmlBgImage->fill(0); + declarativeEngine->rootContext()->setContextProperty("useBlur", !Colors::noBlur); + declarativeEngine->rootContext()->setContextProperty("bgAppPixmap", QVariant(QPixmap::fromImage(*qmlBgImage))); QDeclarativeComponent component(declarativeEngine, QUrl("qrc:qml/qmlShell.qml"), this); qmlRoot = 0; if(component.isReady()) @@ -450,14 +452,9 @@ void MenuManager::init(MainWindow *window) if(qmlRoot){ qmlRoot->setHeight(this->window->scene->sceneRect().height()); qmlRoot->setWidth(this->window->scene->sceneRect().width()); - qmlRoot->setZValue(1000);//Above other items + qmlRoot->setZValue(101);//Above other items qmlRoot->setCursor(Qt::ArrowCursor); window->scene->addItem(qmlRoot); - if(!Colors::noBlur){ - qmlShadow = new QGraphicsDropShadowEffect(this); - qmlShadow->setOffset(4); - qmlRoot->setGraphicsEffect(qmlShadow); - } //Note that QML adds key handling to the app. window->viewport()->setFocusPolicy(Qt::NoFocus);//Correct keyboard focus handling diff --git a/demos/qtdemo/menumanager.h b/demos/qtdemo/menumanager.h index 3524081..e90e02c 100644 --- a/demos/qtdemo/menumanager.h +++ b/demos/qtdemo/menumanager.h @@ -85,8 +85,7 @@ public: QDeclarativeEngine* declarativeEngine; QDeclarativeItem *qmlRoot; - QGraphicsBlurEffect *mainSceneBlur; - QGraphicsDropShadowEffect *qmlShadow; + QImage *qmlBgImage; private slots: void exampleFinished(); diff --git a/demos/qtdemo/qmlShell.qml b/demos/qtdemo/qmlShell.qml index eb155c4..b9021e8 100644 --- a/demos/qtdemo/qmlShell.qml +++ b/demos/qtdemo/qmlShell.qml @@ -42,117 +42,132 @@ import Qt 4.7 import Effects 1.0 +/* Vars exposed from C++ + pixmap bgAppPixmap + bool useBlur (to turn on, pass -use-blur on the cmd line. Off by default 'cause it's too slow) +*/ Item { id: main - property alias source: loader.source + //height and width set by program to fill window + //below properties are sometimes set from C++ + property url qmlFile: '' property bool show: false - x: 0 - y: -500 //height and width set by program - opacity: 0 - property QtObject blurEffect: realBlur == null ? dummyBlur : realBlur //Is there a better way to lose those error messages? - Loader{//Automatic FocusScope - focus: true - clip: true - id: loader //source set by program - anchors.centerIn: parent - onStatusChanged: if(status == Loader.Ready) { + Image{ + id: bg + opacity: 0 + anchors.fill: parent + z: -1 + pixmap: bgAppPixmap + effect: Blur { id: blurEffect; enabled: useBlur; blurRadius: 8;} + } + + Item{ id:embeddedViewer + width: parent.width + height: parent.height + opacity: 0; + z: 10 + Loader{ + id: loader + z: 10 + focus: true //Automatic FocusScope + clip: true + source: qmlFile + anchors.centerIn: parent + onStatusChanged: if(status == Loader.Ready) { if(loader.item.width > 640) loader.item.width = 640; if(loader.item.height > 480) loader.item.height = 480; - } + } - } - Rectangle{ - z: -1 - anchors.fill: loader.status == Loader.Ready ? loader : errorTxt - anchors.margins: -10 - radius: 12 - smooth: true - gradient: Gradient{ - GradientStop{ position: 0.0; color: "#14FFFFFF" } - GradientStop{ position: 1.0; color: "#5AFFFFFF" } } - MouseArea{ - anchors.fill: parent - onClicked: loader.focus=true;/* and don't propogate to the 'exit' area*/ + Rectangle{ id: frame + z: 9 + anchors.fill: loader.status == Loader.Ready ? loader : errorTxt + anchors.margins: -8 + radius: 4 + smooth: true + border.color: "#88aaaaaa" + gradient: Gradient{ + GradientStop{ position: 0.0; color: "#14FFFFFF" } + GradientStop{ position: 1.0; color: "#5AFFFFFF" } + } + MouseArea{ + anchors.fill: parent + onClicked: loader.focus=true;/* and don't propogate to the 'exit' area*/ + } + + Rectangle{ id: innerFrame + anchors.margins: 7 + anchors.bottomMargin: 8 + anchors.rightMargin: 8 + color: "black" + border.color: "#44000000" + anchors.fill:parent + } + + effect: DropShadow { + enabled: useBlur; + blurRadius: 9; + color: "#88000000"; + xOffset:0 + yOffset:0 + } } + Text{ + id: errorTxt + z: 10 + anchors.centerIn: parent + color: 'white' + smooth: true + visible: loader.status == Loader.Error + textFormat: Text.RichText + //Note that if loader is Error, it is because the file was found but there was an error creating the component + //This means either we have a bug in our demos, or the required modules (which ship with Qt) did not deploy correctly + text: "The example has failed to load.
If you installed Qt's QML modules this is a bug!
" + + 'Report it at
http://bugreports.qt.nokia.com'; + onLinkActivated: Qt.openUrlExternally(link); + } + } + Rectangle{ id: blackout //Maybe use a colorize effect instead? + z: 8 + anchors.fill: parent + color: "#000000" + opacity: 0 } - MouseArea{ - z: -2 - hoverEnabled: true //To steal from the buttons + z: 8 + enabled: main.show + hoverEnabled: true //To steal focus from the buttons anchors.fill: parent onClicked: main.show=false; } - Text{ - id: errorTxt - anchors.centerIn: parent - color: 'white' - smooth: true - visible: loader.status == Loader.Error - textFormat: Text.RichText //includes link for bugreport - //Note that if loader is Error, it is because the file was found but there was an error creating the component - //This means either we have a bug in our demos, or the required modules (which ship with Qt) did not deploy correctly - text: 'The example has failed to load. This is a bug!
' - +'Report it at http://bugreports.qt.nokia.com'; - onLinkActivated: Qt.openUrlExternally(link); - } - - states: [ State { name: "show" when: show == true PropertyChanges { - target: main + target: embeddedViewer + opacity: 1 + } + PropertyChanges { + target: bg opacity: 1 - y: 0 } PropertyChanges { - target: blurEffect - enabled: true - blurRadius: 8 - blurHints: Blur.AnimationHint | Blur.PerformanceHint + target: blackout + opacity: 0.5 } } ] - MagicAnim{ id: magicAnim; target: main; from: -500; to: 0 } - transitions: [ - Transition { from: ""; to: "show" - SequentialAnimation{ - ScriptAction{ script: magicAnim.start() } - NumberAnimation{ properties: "opacity,blurRadius"; easing.type: Easing.OutCubic; duration: 1000} - PropertyAnimation{ target: main; property: "y"} - } - - }, - Transition { from: "show"; to: "" //Addtionally, unload the item + transitions: [//Should not be too long, because the component has already started running + Transition { from: ''; to: "show"; reversible: true SequentialAnimation{ - NumberAnimation{ properties: "y,opacity,blurRadius";duration: 500 } - ScriptAction{ script: loader.source = ''; } + PropertyAction { target: bg; property: useBlur?"y":"opacity";}//fade in blurred background only if blurred + NumberAnimation{ properties: "opacity"; easing.type: Easing.InQuad; duration: 500} } - /*Attempt to copy the exeunt animation. Looks bad - SequentialAnimation{ - ParallelAnimation{ - NumberAnimation{ properties: "opacity,blurRadius"; easing.type: Easing.InCubic; duration: 1000 } - SequentialAnimation{ - NumberAnimation{ target: main; property: 'y'; to: 3.2*height/5; duration: 500} - ParallelAnimation{ - NumberAnimation{ target: main; property: 'y'; to: 3.0*height/5; duration: 100} - NumberAnimation{ target: main; property: 'x'; to: 3.0*width/5; duration: 100} - } - NumberAnimation{ target: main; property: 'x'; to: 700; duration: 400} - } - } - ScriptAction{ script: loader.source = ''; } - PropertyAction{ properties: "x,y";} - } - */ } ] - Item{ Blur{id: dummyBlur } } - } diff --git a/demos/qtdemo/qtdemo.pro b/demos/qtdemo/qtdemo.pro index 5e64e1c..4d4177e 100644 --- a/demos/qtdemo/qtdemo.pro +++ b/demos/qtdemo/qtdemo.pro @@ -75,5 +75,4 @@ sources.files = $$SOURCES $$HEADERS $$FORMS $$RESOURCES qtdemo.pro images xml *. sources.path = $$[QT_INSTALL_DEMOS]/qtdemo OTHER_FILES += \ - qmlShell.qml \ - MagicAnim.qml + qmlShell.qml diff --git a/demos/qtdemo/qtdemo.qrc b/demos/qtdemo/qtdemo.qrc index 7682ab5..c18420f 100644 --- a/demos/qtdemo/qtdemo.qrc +++ b/demos/qtdemo/qtdemo.qrc @@ -7,6 +7,5 @@ qmlShell.qml - MagicAnim.qml -- cgit v0.12 From 2c54f49584023633c5992579d23dc6819ec79c9e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Nilsen?= Date: Thu, 27 May 2010 15:28:26 +0200 Subject: Wrong QGraphicsItem::childrenBoundingRect() when applying effects. Problem was that we used the children's raw bounding rect instead of using their effective bounding rect when calculating the bounds. Auto test included. Task-number: QTBUG-10756 --- src/gui/graphicsview/qgraphicsitem.cpp | 6 +++--- tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp | 29 ++++++++++++++++++++++++++ 2 files changed, 32 insertions(+), 3 deletions(-) diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp index db6c4c5..36d21a6 100644 --- a/src/gui/graphicsview/qgraphicsitem.cpp +++ b/src/gui/graphicsview/qgraphicsitem.cpp @@ -1275,14 +1275,14 @@ void QGraphicsItemPrivate::childrenBoundingRectHelper(QTransform *x, QRectF *rec QTransform matrix = childd->transformToParent(); if (x) matrix *= *x; - *rect |= matrix.mapRect(child->boundingRect()); + *rect |= matrix.mapRect(child->d_ptr->effectiveBoundingRect()); if (!childd->children.isEmpty()) childd->childrenBoundingRectHelper(&matrix, rect); } else { if (x) - *rect |= x->mapRect(child->boundingRect()); + *rect |= x->mapRect(child->d_ptr->effectiveBoundingRect()); else - *rect |= child->boundingRect(); + *rect |= child->d_ptr->effectiveBoundingRect(); if (!childd->children.isEmpty()) childd->childrenBoundingRectHelper(x, rect); } diff --git a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp index 300afc3..5547b02 100644 --- a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp +++ b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp @@ -348,6 +348,7 @@ private slots: void childrenBoundingRect2(); void childrenBoundingRect3(); void childrenBoundingRect4(); + void childrenBoundingRect5(); void group(); void setGroup(); void setGroup2(); @@ -3369,6 +3370,34 @@ void tst_QGraphicsItem::childrenBoundingRect4() QCOMPARE(rect2->childrenBoundingRect(), rect3->boundingRect()); } +void tst_QGraphicsItem::childrenBoundingRect5() +{ + QGraphicsScene scene; + + QGraphicsRectItem *parent = scene.addRect(QRectF(0, 0, 100, 100)); + QGraphicsRectItem *child = scene.addRect(QRectF(0, 0, 100, 100)); + child->setParentItem(parent); + + QGraphicsView view(&scene); + view.show(); + + QTest::qWaitForWindowShown(&view); + + // Try to mess up the cached bounding rect. + QRectF expectedChildrenBoundingRect = parent->boundingRect(); + QCOMPARE(parent->childrenBoundingRect(), expectedChildrenBoundingRect); + + // Apply some effects. + QGraphicsDropShadowEffect *dropShadow = new QGraphicsDropShadowEffect; + dropShadow->setOffset(25, 25); + child->setGraphicsEffect(dropShadow); + parent->setGraphicsEffect(new QGraphicsOpacityEffect); + + QVERIFY(parent->childrenBoundingRect() != expectedChildrenBoundingRect); + expectedChildrenBoundingRect |= dropShadow->boundingRect(); + QCOMPARE(parent->childrenBoundingRect(), expectedChildrenBoundingRect); +} + void tst_QGraphicsItem::group() { QGraphicsScene scene; -- cgit v0.12 From 7fbd0a170a90f8fba8e81abb964ec06702f25448 Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Thu, 27 May 2010 16:35:28 +0200 Subject: Upgrade harfbuzz to the latest version Merge the folling changes from harfbuzz: commit 85ad0ddd092522b4cff251f324128662f100991f Author: Lars Knoll Date: Thu May 27 16:05:00 2010 +0200 use unsigned char instead of unsigned in the bitfield. This saves significant memory, as the HB_CharAttributes and HB_GlyphAttributes structures are not 4 byte aligned anymore, by aligned to 1 resp. 2 bytes. The change is not compliant with ISO C, but accepted by almost all compilers. commit 30f0e6c3d0aa67ab9ff95c60903fe28c4df80fbc Author: Behdad Esfahbod Date: Mon May 17 15:43:46 2010 -0400 [hangul] Fix typo Reviewed-By: Thiago Macieira --- src/3rdparty/harfbuzz/src/harfbuzz-hangul.c | 2 +- src/3rdparty/harfbuzz/src/harfbuzz-shaper.h | 36 +++++++++++++++++++---------- 2 files changed, 25 insertions(+), 13 deletions(-) diff --git a/src/3rdparty/harfbuzz/src/harfbuzz-hangul.c b/src/3rdparty/harfbuzz/src/harfbuzz-hangul.c index a819dac..6f89ed6 100644 --- a/src/3rdparty/harfbuzz/src/harfbuzz-hangul.c +++ b/src/3rdparty/harfbuzz/src/harfbuzz-hangul.c @@ -130,7 +130,7 @@ static int hangul_nextSyllableBoundary(const HB_UChar16 *s, int start, int end) static const HB_OpenTypeFeature hangul_features [] = { { HB_MAKE_TAG('c', 'c', 'm', 'p'), CcmpProperty }, { HB_MAKE_TAG('l', 'j', 'm', 'o'), CcmpProperty }, - { HB_MAKE_TAG('j', 'j', 'm', 'o'), CcmpProperty }, + { HB_MAKE_TAG('v', 'j', 'm', 'o'), CcmpProperty }, { HB_MAKE_TAG('t', 'j', 'm', 'o'), CcmpProperty }, { 0, 0 } }; diff --git a/src/3rdparty/harfbuzz/src/harfbuzz-shaper.h b/src/3rdparty/harfbuzz/src/harfbuzz-shaper.h index f7c7714..470e27b 100644 --- a/src/3rdparty/harfbuzz/src/harfbuzz-shaper.h +++ b/src/3rdparty/harfbuzz/src/harfbuzz-shaper.h @@ -34,6 +34,18 @@ HB_BEGIN_HEADER +/* + using anything else than signed or unsigned for bitfields in C is non standard, + but accepted by almost all compilers. And it gives a significant reduction in + memory consumption as HB_CharAttributes and HB_GlyphAttributes will not have + a 4 byte alignment +*/ +#ifdef __xlC__ +typedef unsigned hb_bitfield; +#else +typedef hb_uint8 hb_bitfield; +#endif + typedef enum { HB_Script_Common, HB_Script_Greek, @@ -123,12 +135,12 @@ typedef enum { typedef struct { - /*HB_LineBreakType*/ unsigned lineBreakType :2; - /*HB_Bool*/ unsigned whiteSpace :1; /* A unicode whitespace character, except NBSP, ZWNBSP */ - /*HB_Bool*/ unsigned charStop :1; /* Valid cursor position (for left/right arrow) */ - /*HB_Bool*/ unsigned wordBoundary :1; - /*HB_Bool*/ unsigned sentenceBoundary :1; - unsigned unused :2; + /*HB_LineBreakType*/ hb_bitfield lineBreakType :2; + /*HB_Bool*/ hb_bitfield whiteSpace :1; /* A unicode whitespace character, except NBSP, ZWNBSP */ + /*HB_Bool*/ hb_bitfield charStop :1; /* Valid cursor position (for left/right arrow) */ + /*HB_Bool*/ hb_bitfield wordBoundary :1; + /*HB_Bool*/ hb_bitfield sentenceBoundary :1; + hb_bitfield unused :2; } HB_CharAttributes; void HB_GetCharAttributes(const HB_UChar16 *string, hb_uint32 stringLength, @@ -181,12 +193,12 @@ typedef enum { * it like that. If this is a problem please tell Trolltech :) */ typedef struct { - unsigned justification :4; /* Justification class */ - unsigned clusterStart :1; /* First glyph of representation of cluster */ - unsigned mark :1; /* needs to be positioned around base char */ - unsigned zeroWidth :1; /* ZWJ, ZWNJ etc, with no width */ - unsigned dontPrint :1; - unsigned combiningClass :8; + hb_bitfield justification :4; /* Justification class */ + hb_bitfield clusterStart :1; /* First glyph of representation of cluster */ + hb_bitfield mark :1; /* needs to be positioned around base char */ + hb_bitfield zeroWidth :1; /* ZWJ, ZWNJ etc, with no width */ + hb_bitfield dontPrint :1; + hb_bitfield combiningClass :8; } HB_GlyphAttributes; typedef struct HB_FaceRec_ { -- cgit v0.12 From 19c2aef89f7a8748c11161ffab9765313d0e2e7d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thorbj=C3=B8rn=20Lindeijer?= Date: Thu, 27 May 2010 16:36:19 +0200 Subject: Removed unused variable Reviewed-by: Olivier Goffart --- src/gui/itemviews/qitemdelegate.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/gui/itemviews/qitemdelegate.cpp b/src/gui/itemviews/qitemdelegate.cpp index d5f6fd2..9bbfc23 100644 --- a/src/gui/itemviews/qitemdelegate.cpp +++ b/src/gui/itemviews/qitemdelegate.cpp @@ -667,7 +667,6 @@ void QItemDelegate::drawDisplay(QPainter *painter, const QStyleOptionViewItem &o { Q_D(const QItemDelegate); - QPen pen = painter->pen(); QPalette::ColorGroup cg = option.state & QStyle::State_Enabled ? QPalette::Normal : QPalette::Disabled; if (cg == QPalette::Normal && !(option.state & QStyle::State_Active)) -- cgit v0.12 From c3d652967c313cdc1853e9d905440ddf645c49f4 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Thu, 27 May 2010 15:42:10 +0200 Subject: fix & unify path separator escaping Reviewed-by: mauricek --- configure.exe | Bin 1316864 -> 1317888 bytes tools/configure/configureapp.cpp | 104 +++++++++++++++++++++------------------ tools/configure/configureapp.h | 3 +- 3 files changed, 58 insertions(+), 49 deletions(-) diff --git a/configure.exe b/configure.exe index a19f515..1fddc81 100755 Binary files a/configure.exe and b/configure.exe differ diff --git a/tools/configure/configureapp.cpp b/tools/configure/configureapp.cpp index ee49bbf..c2b3a57 100644 --- a/tools/configure/configureapp.cpp +++ b/tools/configure/configureapp.cpp @@ -392,11 +392,19 @@ Configure::~Configure() } } -QString Configure::fixSeparators(QString somePath) +QString Configure::fixSeparators(const QString &somePath, bool escape) { - return useUnixSeparators ? - QDir::fromNativeSeparators(somePath) : - QDir::toNativeSeparators(somePath); + if (useUnixSeparators) + return QDir::fromNativeSeparators(somePath); + QString ret = QDir::toNativeSeparators(somePath); + return escape ? escapeSeparators(ret) : ret; +} + +QString Configure::escapeSeparators(const QString &somePath) +{ + QString out = somePath; + out.replace(QLatin1Char('\\'), QLatin1String("\\\\")); + return out; } // We could use QDir::homePath() + "/.qt-license", but @@ -2573,10 +2581,10 @@ void Configure::generateOutputVars() qtConfig += "accessibility"; if( !qmakeLibs.isEmpty() ) - qmakeVars += "LIBS += " + qmakeLibs.join( " " ); + qmakeVars += "LIBS += " + escapeSeparators(qmakeLibs.join( " " )); if( !dictionary["QT_LFLAGS_SQLITE"].isEmpty() ) - qmakeVars += "QT_LFLAGS_SQLITE += " + dictionary["QT_LFLAGS_SQLITE"]; + qmakeVars += "QT_LFLAGS_SQLITE += " + escapeSeparators(dictionary["QT_LFLAGS_SQLITE"]); if (dictionary[ "QT3SUPPORT" ] == "yes") qtConfig += "qt3support"; @@ -2721,14 +2729,14 @@ void Configure::generateOutputVars() if(dictionary.contains("XQMAKESPEC") && dictionary[ "XQMAKESPEC" ].startsWith("linux")) dictionary[ "QMAKE_RPATHDIR" ] = dictionary[ "QT_INSTALL_LIBS" ]; - qmakeVars += QString("OBJECTS_DIR = ") + fixSeparators( "tmp/obj/" + dictionary[ "QMAKE_OUTDIR" ] ); - qmakeVars += QString("MOC_DIR = ") + fixSeparators( "tmp/moc/" + dictionary[ "QMAKE_OUTDIR" ] ); - qmakeVars += QString("RCC_DIR = ") + fixSeparators("tmp/rcc/" + dictionary["QMAKE_OUTDIR"]); + qmakeVars += QString("OBJECTS_DIR = ") + fixSeparators("tmp/obj/" + dictionary[ "QMAKE_OUTDIR" ], true); + qmakeVars += QString("MOC_DIR = ") + fixSeparators("tmp/moc/" + dictionary[ "QMAKE_OUTDIR" ], true); + qmakeVars += QString("RCC_DIR = ") + fixSeparators("tmp/rcc/" + dictionary["QMAKE_OUTDIR"], true); if (!qmakeDefines.isEmpty()) qmakeVars += QString("DEFINES += ") + qmakeDefines.join( " " ); if (!qmakeIncludes.isEmpty()) - qmakeVars += QString("INCLUDEPATH += ") + qmakeIncludes.join( " " ); + qmakeVars += QString("INCLUDEPATH += ") + escapeSeparators(qmakeIncludes.join( " " )); if (!opensslLibs.isEmpty()) qmakeVars += opensslLibs; else if (dictionary[ "OPENSSL" ] == "linked") { @@ -2800,27 +2808,27 @@ void Configure::generateCachefile() QString targetSpec = dictionary.contains("XQMAKESPEC") ? dictionary[ "XQMAKESPEC" ] : dictionary[ "QMAKESPEC" ]; QString mkspec_path = fixSeparators(sourcePath + "/mkspecs/" + targetSpec); if(QFile::exists(mkspec_path)) - cacheStream << "QMAKESPEC = " << mkspec_path << endl; + cacheStream << "QMAKESPEC = " << escapeSeparators(mkspec_path) << endl; else - cacheStream << "QMAKESPEC = " << fixSeparators(targetSpec) << endl; - cacheStream << "ARCH = " << fixSeparators(dictionary[ "ARCHITECTURE" ]) << endl; - cacheStream << "QT_BUILD_TREE = " << fixSeparators(dictionary[ "QT_BUILD_TREE" ]) << endl; - cacheStream << "QT_SOURCE_TREE = " << fixSeparators(dictionary[ "QT_SOURCE_TREE" ]) << endl; + cacheStream << "QMAKESPEC = " << fixSeparators(targetSpec, true) << endl; + cacheStream << "ARCH = " << dictionary[ "ARCHITECTURE" ] << endl; + cacheStream << "QT_BUILD_TREE = " << fixSeparators(dictionary[ "QT_BUILD_TREE" ], true) << endl; + cacheStream << "QT_SOURCE_TREE = " << fixSeparators(dictionary[ "QT_SOURCE_TREE" ], true) << endl; if (dictionary["QT_EDITION"] != "QT_EDITION_OPENSOURCE") cacheStream << "DEFINES *= QT_EDITION=QT_EDITION_DESKTOP" << endl; //so that we can build without an install first (which would be impossible) - cacheStream << "QMAKE_MOC = $$QT_BUILD_TREE" << fixSeparators("/bin/moc.exe") << endl; - cacheStream << "QMAKE_UIC = $$QT_BUILD_TREE" << fixSeparators("/bin/uic.exe") << endl; - cacheStream << "QMAKE_UIC3 = $$QT_BUILD_TREE" << fixSeparators("/bin/uic3.exe") << endl; - cacheStream << "QMAKE_RCC = $$QT_BUILD_TREE" << fixSeparators("/bin/rcc.exe") << endl; - cacheStream << "QMAKE_DUMPCPP = $$QT_BUILD_TREE" << fixSeparators("/bin/dumpcpp.exe") << endl; - cacheStream << "QMAKE_INCDIR_QT = $$QT_BUILD_TREE" << fixSeparators("/include") << endl; - cacheStream << "QMAKE_LIBDIR_QT = $$QT_BUILD_TREE" << fixSeparators("/lib") << endl; + cacheStream << "QMAKE_MOC = $$QT_BUILD_TREE" << fixSeparators("/bin/moc.exe", true) << endl; + cacheStream << "QMAKE_UIC = $$QT_BUILD_TREE" << fixSeparators("/bin/uic.exe", true) << endl; + cacheStream << "QMAKE_UIC3 = $$QT_BUILD_TREE" << fixSeparators("/bin/uic3.exe", true) << endl; + cacheStream << "QMAKE_RCC = $$QT_BUILD_TREE" << fixSeparators("/bin/rcc.exe", true) << endl; + cacheStream << "QMAKE_DUMPCPP = $$QT_BUILD_TREE" << fixSeparators("/bin/dumpcpp.exe", true) << endl; + cacheStream << "QMAKE_INCDIR_QT = $$QT_BUILD_TREE" << fixSeparators("/include", true) << endl; + cacheStream << "QMAKE_LIBDIR_QT = $$QT_BUILD_TREE" << fixSeparators("/lib", true) << endl; if (dictionary["CETEST"] == "yes") { - cacheStream << "QT_CE_RAPI_INC = " << fixSeparators(dictionary[ "QT_CE_RAPI_INC" ]) << endl; - cacheStream << "QT_CE_RAPI_LIB = " << fixSeparators(dictionary[ "QT_CE_RAPI_LIB" ]) << endl; + cacheStream << "QT_CE_RAPI_INC = " << fixSeparators(dictionary[ "QT_CE_RAPI_INC" ], true) << endl; + cacheStream << "QT_CE_RAPI_LIB = " << fixSeparators(dictionary[ "QT_CE_RAPI_LIB" ], true) << endl; } // embedded @@ -2896,7 +2904,7 @@ void Configure::generateCachefile() << "QT_PATCH_VERSION = " << dictionary["VERSION_PATCH"] << endl; configStream << "#Qt for Windows CE c-runtime deployment" << endl - << "QT_CE_C_RUNTIME = " << fixSeparators(dictionary[ "CE_CRT" ]) << endl; + << "QT_CE_C_RUNTIME = " << fixSeparators(dictionary[ "CE_CRT" ], true) << endl; if(dictionary["CE_SIGNATURE"] != QLatin1String("no")) configStream << "DEFAULT_SIGNATURE=" << dictionary["CE_SIGNATURE"] << endl; @@ -3213,32 +3221,32 @@ void Configure::generateConfigfiles() << endl; if(!dictionary[ "QT_HOST_PREFIX" ].isNull()) tmpStream << "#if !defined(QT_BOOTSTRAPPED) && !defined(QT_BUILD_QMAKE)" << endl; - tmpStream << "static const char qt_configure_prefix_path_str [512 + 12] = \"qt_prfxpath=" << QString(dictionary["QT_INSTALL_PREFIX"]).replace( "\\", "\\\\" ) << "\";" << endl - << "static const char qt_configure_documentation_path_str[512 + 12] = \"qt_docspath=" << QString(dictionary["QT_INSTALL_DOCS"]).replace( "\\", "\\\\" ) << "\";" << endl - << "static const char qt_configure_headers_path_str [512 + 12] = \"qt_hdrspath=" << QString(dictionary["QT_INSTALL_HEADERS"]).replace( "\\", "\\\\" ) << "\";" << endl - << "static const char qt_configure_libraries_path_str [512 + 12] = \"qt_libspath=" << QString(dictionary["QT_INSTALL_LIBS"]).replace( "\\", "\\\\" ) << "\";" << endl - << "static const char qt_configure_binaries_path_str [512 + 12] = \"qt_binspath=" << QString(dictionary["QT_INSTALL_BINS"]).replace( "\\", "\\\\" ) << "\";" << endl - << "static const char qt_configure_plugins_path_str [512 + 12] = \"qt_plugpath=" << QString(dictionary["QT_INSTALL_PLUGINS"]).replace( "\\", "\\\\" ) << "\";" << endl - << "static const char qt_configure_imports_path_str [512 + 12] = \"qt_impspath=" << QString(dictionary["QT_INSTALL_IMPORTS"]).replace( "\\", "\\\\" ) << "\";" << endl - << "static const char qt_configure_data_path_str [512 + 12] = \"qt_datapath=" << QString(dictionary["QT_INSTALL_DATA"]).replace( "\\", "\\\\" ) << "\";" << endl - << "static const char qt_configure_translations_path_str [512 + 12] = \"qt_trnspath=" << QString(dictionary["QT_INSTALL_TRANSLATIONS"]).replace( "\\", "\\\\" ) << "\";" << endl - << "static const char qt_configure_examples_path_str [512 + 12] = \"qt_xmplpath=" << QString(dictionary["QT_INSTALL_EXAMPLES"]).replace( "\\", "\\\\" ) << "\";" << endl - << "static const char qt_configure_demos_path_str [512 + 12] = \"qt_demopath=" << QString(dictionary["QT_INSTALL_DEMOS"]).replace( "\\", "\\\\" ) << "\";" << endl - //<< "static const char qt_configure_settings_path_str [256] = \"qt_stngpath=" << QString(dictionary["QT_INSTALL_SETTINGS"]).replace( "\\", "\\\\" ) << "\";" << endl + tmpStream << "static const char qt_configure_prefix_path_str [512 + 12] = \"qt_prfxpath=" << escapeSeparators(dictionary["QT_INSTALL_PREFIX"]) << "\";" << endl + << "static const char qt_configure_documentation_path_str[512 + 12] = \"qt_docspath=" << escapeSeparators(dictionary["QT_INSTALL_DOCS"]) << "\";" << endl + << "static const char qt_configure_headers_path_str [512 + 12] = \"qt_hdrspath=" << escapeSeparators(dictionary["QT_INSTALL_HEADERS"]) << "\";" << endl + << "static const char qt_configure_libraries_path_str [512 + 12] = \"qt_libspath=" << escapeSeparators(dictionary["QT_INSTALL_LIBS"]) << "\";" << endl + << "static const char qt_configure_binaries_path_str [512 + 12] = \"qt_binspath=" << escapeSeparators(dictionary["QT_INSTALL_BINS"]) << "\";" << endl + << "static const char qt_configure_plugins_path_str [512 + 12] = \"qt_plugpath=" << escapeSeparators(dictionary["QT_INSTALL_PLUGINS"]) << "\";" << endl + << "static const char qt_configure_imports_path_str [512 + 12] = \"qt_impspath=" << escapeSeparators(dictionary["QT_INSTALL_IMPORTS"]) << "\";" << endl + << "static const char qt_configure_data_path_str [512 + 12] = \"qt_datapath=" << escapeSeparators(dictionary["QT_INSTALL_DATA"]) << "\";" << endl + << "static const char qt_configure_translations_path_str [512 + 12] = \"qt_trnspath=" << escapeSeparators(dictionary["QT_INSTALL_TRANSLATIONS"]) << "\";" << endl + << "static const char qt_configure_examples_path_str [512 + 12] = \"qt_xmplpath=" << escapeSeparators(dictionary["QT_INSTALL_EXAMPLES"]) << "\";" << endl + << "static const char qt_configure_demos_path_str [512 + 12] = \"qt_demopath=" << escapeSeparators(dictionary["QT_INSTALL_DEMOS"]) << "\";" << endl + //<< "static const char qt_configure_settings_path_str [256] = \"qt_stngpath=" << escapeSeparators(dictionary["QT_INSTALL_SETTINGS"]) << "\";" << endl ; if(!dictionary[ "QT_HOST_PREFIX" ].isNull()) { tmpStream << "#else" << endl - << "static const char qt_configure_prefix_path_str [512 + 12] = \"qt_prfxpath=" << QString(dictionary[ "QT_HOST_PREFIX" ]).replace( "\\", "\\\\" ) << "\";" << endl - << "static const char qt_configure_documentation_path_str[512 + 12] = \"qt_docspath=" << fixSeparators(dictionary[ "QT_HOST_PREFIX" ] + "/doc").replace( "\\", "\\\\" ) <<"\";" << endl - << "static const char qt_configure_headers_path_str [512 + 12] = \"qt_hdrspath=" << fixSeparators(dictionary[ "QT_HOST_PREFIX" ] + "/include").replace( "\\", "\\\\" ) <<"\";" << endl - << "static const char qt_configure_libraries_path_str [512 + 12] = \"qt_libspath=" << fixSeparators(dictionary[ "QT_HOST_PREFIX" ] + "/lib").replace( "\\", "\\\\" ) <<"\";" << endl - << "static const char qt_configure_binaries_path_str [512 + 12] = \"qt_binspath=" << fixSeparators(dictionary[ "QT_HOST_PREFIX" ] + "/bin").replace( "\\", "\\\\" ) <<"\";" << endl - << "static const char qt_configure_plugins_path_str [512 + 12] = \"qt_plugpath=" << fixSeparators(dictionary[ "QT_HOST_PREFIX" ] + "/plugins").replace( "\\", "\\\\" ) <<"\";" << endl - << "static const char qt_configure_imports_path_str [512 + 12] = \"qt_impspath=" << fixSeparators(dictionary[ "QT_HOST_PREFIX" ] + "/imports").replace( "\\", "\\\\" ) <<"\";" << endl - << "static const char qt_configure_data_path_str [512 + 12] = \"qt_datapath=" << fixSeparators(dictionary[ "QT_HOST_PREFIX" ]).replace( "\\", "\\\\" ) <<"\";" << endl - << "static const char qt_configure_translations_path_str [512 + 12] = \"qt_trnspath=" << fixSeparators(dictionary[ "QT_HOST_PREFIX" ] + "/translations").replace( "\\", "\\\\" ) <<"\";" << endl - << "static const char qt_configure_examples_path_str [512 + 12] = \"qt_xmplpath=" << fixSeparators(dictionary[ "QT_HOST_PREFIX" ] + "/example").replace( "\\", "\\\\" ) <<"\";" << endl - << "static const char qt_configure_demos_path_str [512 + 12] = \"qt_demopath=" << fixSeparators(dictionary[ "QT_HOST_PREFIX" ] + "/demos").replace( "\\", "\\\\" ) <<"\";" << endl + << "static const char qt_configure_prefix_path_str [512 + 12] = \"qt_prfxpath=" << escapeSeparators(dictionary[ "QT_HOST_PREFIX" ]) << "\";" << endl + << "static const char qt_configure_documentation_path_str[512 + 12] = \"qt_docspath=" << fixSeparators(dictionary[ "QT_HOST_PREFIX" ] + "/doc", true) <<"\";" << endl + << "static const char qt_configure_headers_path_str [512 + 12] = \"qt_hdrspath=" << fixSeparators(dictionary[ "QT_HOST_PREFIX" ] + "/include", true) <<"\";" << endl + << "static const char qt_configure_libraries_path_str [512 + 12] = \"qt_libspath=" << fixSeparators(dictionary[ "QT_HOST_PREFIX" ] + "/lib", true) <<"\";" << endl + << "static const char qt_configure_binaries_path_str [512 + 12] = \"qt_binspath=" << fixSeparators(dictionary[ "QT_HOST_PREFIX" ] + "/bin", true) <<"\";" << endl + << "static const char qt_configure_plugins_path_str [512 + 12] = \"qt_plugpath=" << fixSeparators(dictionary[ "QT_HOST_PREFIX" ] + "/plugins", true) <<"\";" << endl + << "static const char qt_configure_imports_path_str [512 + 12] = \"qt_impspath=" << fixSeparators(dictionary[ "QT_HOST_PREFIX" ] + "/imports", true) <<"\";" << endl + << "static const char qt_configure_data_path_str [512 + 12] = \"qt_datapath=" << fixSeparators(dictionary[ "QT_HOST_PREFIX" ], true) <<"\";" << endl + << "static const char qt_configure_translations_path_str [512 + 12] = \"qt_trnspath=" << fixSeparators(dictionary[ "QT_HOST_PREFIX" ] + "/translations", true) <<"\";" << endl + << "static const char qt_configure_examples_path_str [512 + 12] = \"qt_xmplpath=" << fixSeparators(dictionary[ "QT_HOST_PREFIX" ] + "/example", true) <<"\";" << endl + << "static const char qt_configure_demos_path_str [512 + 12] = \"qt_demopath=" << fixSeparators(dictionary[ "QT_HOST_PREFIX" ] + "/demos", true) <<"\";" << endl << "#endif //QT_BOOTSTRAPPED" << endl; } tmpStream << "/* strlen( \"qt_lcnsxxxx\" ) == 12 */" << endl diff --git a/tools/configure/configureapp.h b/tools/configure/configureapp.h index c441129..6c10dd8 100644 --- a/tools/configure/configureapp.h +++ b/tools/configure/configureapp.h @@ -147,7 +147,8 @@ private: int outputWidth; bool useUnixSeparators; - QString fixSeparators(QString somePath); + QString fixSeparators(const QString &somePath, bool escape = false); + QString escapeSeparators(const QString &somePath); bool filesDiffer(const QString &file1, const QString &file2); bool findFile(const QString &fileName); -- cgit v0.12 From c86bb735e9b783b03010bc830c2a7a2fbcdb71b7 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Thu, 27 May 2010 16:31:57 +0200 Subject: escape backslashes in QMAKE_PRL_LIBS they may contain (absolute) windows paths, which need escaping now. Reviewed-by: mauricek --- qmake/generators/makefile.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qmake/generators/makefile.cpp b/qmake/generators/makefile.cpp index 4c4f5bc..d6b3e09 100644 --- a/qmake/generators/makefile.cpp +++ b/qmake/generators/makefile.cpp @@ -972,7 +972,7 @@ MakefileGenerator::writePrlFile(QTextStream &t) libs << "QMAKE_LIBS_PRIVATE"; t << "QMAKE_PRL_LIBS = "; for(QStringList::Iterator it = libs.begin(); it != libs.end(); ++it) - t << project->values((*it)).join(" ") << " "; + t << project->values((*it)).join(" ").replace('\\', "\\\\") << " "; t << endl; } } -- cgit v0.12 From f399b0deede15c7c5cb1108db261b77452afb394 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Thu, 27 May 2010 16:39:11 +0200 Subject: fix escaping - by not using eval the left-hand-side of qmake assignments is expanded, so there is no need to use eval. --- mkspecs/features/incredibuild_xge.prf | 6 +++--- src/src.pro | 16 ++++++++-------- src/tools/tools.pro | 16 ++++++++-------- 3 files changed, 19 insertions(+), 19 deletions(-) diff --git a/mkspecs/features/incredibuild_xge.prf b/mkspecs/features/incredibuild_xge.prf index b8ca571..a81a0cc 100644 --- a/mkspecs/features/incredibuild_xge.prf +++ b/mkspecs/features/incredibuild_xge.prf @@ -1,11 +1,11 @@ contains(TEMPLATE, "vc.*")|contains(TEMPLATE_PREFIX, "vc") { - EOC = \$\$escape_expand(\\\\n\\\\t) + EOC = $$escape_expand(\\n\\t) # The VCPROJ generator will replace the \r\h with the coded \r\n: # No other generator understands the \h - win32-msvc2*|wince*msvc*: EOC = \$\$escape_expand(\\\\r\\\\h) + win32-msvc2*|wince*msvc*: EOC = $$escape_expand(\\r\\h) for(xge, INCREDIBUILD_XGE) { - eval($${xge}.commands = Rem IncrediBuild_AllowRemote $$EOC Rem IncrediBuild_OutputFile $$replace($${xge}.output,/,\\) $$EOC $$eval($${xge}.commands)) + $${xge}.commands = Rem IncrediBuild_AllowRemote $$EOC Rem IncrediBuild_OutputFile $$replace($${xge}.output,/,\\) $$EOC $$eval($${xge}.commands) } } diff --git a/src/src.pro b/src/src.pro index 7574796..5436c4a 100644 --- a/src/src.pro +++ b/src/src.pro @@ -157,24 +157,24 @@ for(subname, SRC_SUBDIRS) { SUB_TEMPLATE = $$list($$fromfile($$subpro, TEMPLATE)) !isEqual(subname, src_tools_bootstrap):if(isEqual($$SUB_TEMPLATE, lib) | isEqual($$SUB_TEMPLATE, subdirs) | isEqual(subname, src_tools_idc) | isEqual(subname, src_tools_uic3)):!separate_debug_info { #debug - eval(debug-$${subtarget}.depends = $${subdir}\$${QMAKE_DIR_SEP}$(MAKEFILE) $$EXTRA_DEBUG_TARGETS) - eval(debug-$${subtarget}.commands = (cd $$subdir && $(MAKE) -f $(MAKEFILE) debug)) + debug-$${subtarget}.depends = $${subdir}$${QMAKE_DIR_SEP}$(MAKEFILE) $$EXTRA_DEBUG_TARGETS + debug-$${subtarget}.commands = (cd $$subdir && $(MAKE) -f $(MAKEFILE) debug) EXTRA_DEBUG_TARGETS += debug-$${subtarget} QMAKE_EXTRA_TARGETS += debug-$${subtarget} #release - eval(release-$${subtarget}.depends = $${subdir}\$${QMAKE_DIR_SEP}$(MAKEFILE) $$EXTRA_RELEASE_TARGETS) - eval(release-$${subtarget}.commands = (cd $$subdir && $(MAKE) -f $(MAKEFILE) release)) + release-$${subtarget}.depends = $${subdir}$${QMAKE_DIR_SEP}$(MAKEFILE) $$EXTRA_RELEASE_TARGETS + release-$${subtarget}.commands = (cd $$subdir && $(MAKE) -f $(MAKEFILE) release) EXTRA_RELEASE_TARGETS += release-$${subtarget} QMAKE_EXTRA_TARGETS += release-$${subtarget} } else { #do not have a real debug target/release #debug - eval(debug-$${subtarget}.depends = $${subdir}\$${QMAKE_DIR_SEP}$(MAKEFILE) $$EXTRA_DEBUG_TARGETS) - eval(debug-$${subtarget}.commands = (cd $$subdir && $(MAKE) -f $(MAKEFILE) first)) + debug-$${subtarget}.depends = $${subdir}$${QMAKE_DIR_SEP}$(MAKEFILE) $$EXTRA_DEBUG_TARGETS + debug-$${subtarget}.commands = (cd $$subdir && $(MAKE) -f $(MAKEFILE) first) EXTRA_DEBUG_TARGETS += debug-$${subtarget} QMAKE_EXTRA_TARGETS += debug-$${subtarget} #release - eval(release-$${subtarget}.depends = $${subdir}\$${QMAKE_DIR_SEP}$(MAKEFILE) $$EXTRA_RELEASE_TARGETS) - eval(release-$${subtarget}.commands = (cd $$subdir && $(MAKE) -f $(MAKEFILE) first)) + release-$${subtarget}.depends = $${subdir}$${QMAKE_DIR_SEP}$(MAKEFILE) $$EXTRA_RELEASE_TARGETS + release-$${subtarget}.commands = (cd $$subdir && $(MAKE) -f $(MAKEFILE) first) EXTRA_RELEASE_TARGETS += release-$${subtarget} QMAKE_EXTRA_TARGETS += release-$${subtarget} } diff --git a/src/tools/tools.pro b/src/tools/tools.pro index 1ecb944..4736d09 100644 --- a/src/tools/tools.pro +++ b/src/tools/tools.pro @@ -45,24 +45,24 @@ EXTRA_RELEASE_TARGETS = SUB_TEMPLATE = $$list($$fromfile($$subpro, TEMPLATE)) !isEqual(subname, src_tools_bootstrap):if(isEqual($$SUB_TEMPLATE, lib) | isEqual($$SUB_TEMPLATE, subdirs) | isEqual(subname, src_tools_idc) | isEqual(subname, src_tools_uic3)):!separate_debug_info { #debug - eval(debug-$${subtarget}.depends = $${subdir}\$${QMAKE_DIR_SEP}$(MAKEFILE) $$EXTRA_DEBUG_TARGETS) - eval(debug-$${subtarget}.commands = (cd $$subdir && $(MAKE) -f $(MAKEFILE) debug)) + debug-$${subtarget}.depends = $${subdir}$${QMAKE_DIR_SEP}$(MAKEFILE) $$EXTRA_DEBUG_TARGETS + debug-$${subtarget}.commands = (cd $$subdir && $(MAKE) -f $(MAKEFILE) debug) EXTRA_DEBUG_TARGETS += debug-$${subtarget} QMAKE_EXTRA_TARGETS += debug-$${subtarget} #release - eval(release-$${subtarget}.depends = $${subdir}\$${QMAKE_DIR_SEP}$(MAKEFILE) $$EXTRA_RELEASE_TARGETS) - eval(release-$${subtarget}.commands = (cd $$subdir && $(MAKE) -f $(MAKEFILE) release)) + release-$${subtarget}.depends = $${subdir}$${QMAKE_DIR_SEP}$(MAKEFILE) $$EXTRA_RELEASE_TARGETS + release-$${subtarget}.commands = (cd $$subdir && $(MAKE) -f $(MAKEFILE) release) EXTRA_RELEASE_TARGETS += release-$${subtarget} QMAKE_EXTRA_TARGETS += release-$${subtarget} } else { #do not have a real debug target/release #debug - eval(debug-$${subtarget}.depends = $${subdir}\$${QMAKE_DIR_SEP}$(MAKEFILE) $$EXTRA_DEBUG_TARGETS) - eval(debug-$${subtarget}.commands = (cd $$subdir && $(MAKE) -f $(MAKEFILE) first)) + debug-$${subtarget}.depends = $${subdir}$${QMAKE_DIR_SEP}$(MAKEFILE) $$EXTRA_DEBUG_TARGETS + debug-$${subtarget}.commands = (cd $$subdir && $(MAKE) -f $(MAKEFILE) first) EXTRA_DEBUG_TARGETS += debug-$${subtarget} QMAKE_EXTRA_TARGETS += debug-$${subtarget} #release - eval(release-$${subtarget}.depends = $${subdir}\$${QMAKE_DIR_SEP}$(MAKEFILE) $$EXTRA_RELEASE_TARGETS) - eval(release-$${subtarget}.commands = (cd $$subdir && $(MAKE) -f $(MAKEFILE) first)) + release-$${subtarget}.depends = $${subdir}$${QMAKE_DIR_SEP}$(MAKEFILE) $$EXTRA_RELEASE_TARGETS + release-$${subtarget}.commands = (cd $$subdir && $(MAKE) -f $(MAKEFILE) first) EXTRA_RELEASE_TARGETS += release-$${subtarget} QMAKE_EXTRA_TARGETS += release-$${subtarget} } -- cgit v0.12 From 5f8312f82ac9ef77c89ef363d9c2e0246b398d20 Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Fri, 28 May 2010 12:53:39 +1000 Subject: Use QElapsedTimer rather than QTime::elapsed() --- .../graphicsitems/qdeclarativeflickable.cpp | 11 ++-- .../graphicsitems/qdeclarativeflickable_p_p.h | 6 +-- src/declarative/graphicsitems/qdeclarativeitem.cpp | 59 ++++++++++++++-------- src/declarative/graphicsitems/qdeclarativeitem_p.h | 11 ++-- .../graphicsitems/qdeclarativepathview.cpp | 10 ++-- .../graphicsitems/qdeclarativepathview_p_p.h | 3 +- 6 files changed, 58 insertions(+), 42 deletions(-) diff --git a/src/declarative/graphicsitems/qdeclarativeflickable.cpp b/src/declarative/graphicsitems/qdeclarativeflickable.cpp index 1dde510..10dc0f8 100644 --- a/src/declarative/graphicsitems/qdeclarativeflickable.cpp +++ b/src/declarative/graphicsitems/qdeclarativeflickable.cpp @@ -160,6 +160,7 @@ void QDeclarativeFlickablePrivate::init() q->setFiltersChildEvents(true); QDeclarativeItemPrivate *viewportPrivate = static_cast(QGraphicsItemPrivate::get(viewport)); viewportPrivate->addItemChangeListener(this, QDeclarativeItemPrivate::Geometry); + lastPosTime.invalidate(); } /* @@ -656,7 +657,7 @@ void QDeclarativeFlickablePrivate::handleMousePressEvent(QGraphicsSceneMouseEven void QDeclarativeFlickablePrivate::handleMouseMoveEvent(QGraphicsSceneMouseEvent *event) { Q_Q(QDeclarativeFlickable); - if (!interactive || lastPosTime.isNull()) + if (!interactive || !lastPosTime.isValid()) return; bool rejectY = false; bool rejectX = false; @@ -752,7 +753,7 @@ void QDeclarativeFlickablePrivate::handleMouseReleaseEvent(QGraphicsSceneMouseEv stealMouse = false; q->setKeepMouseGrab(false); pressed = false; - if (lastPosTime.isNull()) + if (!lastPosTime.isValid()) return; if (QDeclarativeItemPrivate::elapsed(lastPosTime) > 100) { @@ -780,7 +781,7 @@ void QDeclarativeFlickablePrivate::handleMouseReleaseEvent(QGraphicsSceneMouseEv fixupX(); } - lastPosTime = QTime(); + lastPosTime.invalidate(); if (!timeline.isActive()) q->movementEnding(); @@ -1218,8 +1219,8 @@ bool QDeclarativeFlickable::sendMouseEvent(QGraphicsSceneMouseEvent *event) } return stealThisEvent || d->delayedPressEvent; - } else if (!d->lastPosTime.isNull()) { - d->lastPosTime = QTime(); + } else if (d->lastPosTime.isValid()) { + d->lastPosTime.invalidate(); } if (mouseEvent.type() == QEvent::GraphicsSceneMouseRelease) { d->clearDelayedPress(); diff --git a/src/declarative/graphicsitems/qdeclarativeflickable_p_p.h b/src/declarative/graphicsitems/qdeclarativeflickable_p_p.h index b467ed2..66d2678 100644 --- a/src/declarative/graphicsitems/qdeclarativeflickable_p_p.h +++ b/src/declarative/graphicsitems/qdeclarativeflickable_p_p.h @@ -140,13 +140,13 @@ public: bool stealMouse : 1; bool pressed : 1; bool interactive : 1; - QTime lastPosTime; + QElapsedTimer lastPosTime; QPointF lastPos; QPointF pressPos; - QTime pressTime; + QElapsedTimer pressTime; qreal deceleration; qreal maxVelocity; - QTime velocityTime; + QElapsedTimer velocityTime; QPointF lastFlickablePosition; qreal reportedVelocitySmoothing; QGraphicsSceneMouseEvent *delayedPressEvent; diff --git a/src/declarative/graphicsitems/qdeclarativeitem.cpp b/src/declarative/graphicsitems/qdeclarativeitem.cpp index 2841ac3..7bd08ce 100644 --- a/src/declarative/graphicsitems/qdeclarativeitem.cpp +++ b/src/declarative/graphicsitems/qdeclarativeitem.cpp @@ -3145,41 +3145,56 @@ QDebug operator<<(QDebug debug, QDeclarativeItem *item) return debug; } -int QDeclarativeItemPrivate::consistentTime = -1; -void QDeclarativeItemPrivate::setConsistentTime(int t) +qint64 QDeclarativeItemPrivate::consistentTime = -1; +void QDeclarativeItemPrivate::setConsistentTime(qint64 t) { consistentTime = t; } -QTime QDeclarativeItemPrivate::currentTime() +class QElapsedTimerConsistentTimeHack { - if (consistentTime == -1) - return QTime::currentTime(); - else - return QTime(0, 0).addMSecs(consistentTime); -} +public: + void start() { + t1 = QDeclarativeItemPrivate::consistentTime; + t2 = 0; + } + qint64 elapsed() { + return QDeclarativeItemPrivate::consistentTime - t1; + } + qint64 restart() { + qint64 val = QDeclarativeItemPrivate::consistentTime - t1; + t1 = QDeclarativeItemPrivate::consistentTime; + t2 = 0; + return val; + } -void QDeclarativeItemPrivate::start(QTime &t) +private: + qint64 t1; + qint64 t2; +}; + +void QDeclarativeItemPrivate::start(QElapsedTimer &t) { - t = currentTime(); + if (QDeclarativeItemPrivate::consistentTime == -1) + t.start(); + else + ((QElapsedTimerConsistentTimeHack*)&t)->start(); } -int QDeclarativeItemPrivate::elapsed(QTime &t) +qint64 QDeclarativeItemPrivate::elapsed(QElapsedTimer &t) { - int n = t.msecsTo(currentTime()); - if (n < 0) // passed midnight - n += 86400 * 1000; - return n; + if (QDeclarativeItemPrivate::consistentTime == -1) + return t.elapsed(); + else + return ((QElapsedTimerConsistentTimeHack*)&t)->elapsed(); } -int QDeclarativeItemPrivate::restart(QTime &t) +qint64 QDeclarativeItemPrivate::restart(QElapsedTimer &t) { - QTime time = currentTime(); - int n = t.msecsTo(time); - if (n < 0) // passed midnight - n += 86400*1000; - t = time; - return n; + if (QDeclarativeItemPrivate::consistentTime == -1) + return t.restart(); + else + return ((QElapsedTimerConsistentTimeHack*)&t)->restart(); } QT_END_NAMESPACE diff --git a/src/declarative/graphicsitems/qdeclarativeitem_p.h b/src/declarative/graphicsitems/qdeclarativeitem_p.h index 15b34f0..184d6f1 100644 --- a/src/declarative/graphicsitems/qdeclarativeitem_p.h +++ b/src/declarative/graphicsitems/qdeclarativeitem_p.h @@ -305,12 +305,11 @@ public: virtual void focusChanged(bool); - static int consistentTime; - static QTime currentTime(); - static void setConsistentTime(int t); - static void start(QTime &); - static int elapsed(QTime &); - static int restart(QTime &); + static qint64 consistentTime; + static void setConsistentTime(qint64 t); + static void start(QElapsedTimer &); + static qint64 elapsed(QElapsedTimer &); + static qint64 restart(QElapsedTimer &); }; /* diff --git a/src/declarative/graphicsitems/qdeclarativepathview.cpp b/src/declarative/graphicsitems/qdeclarativepathview.cpp index 3a69f44..448ec06 100644 --- a/src/declarative/graphicsitems/qdeclarativepathview.cpp +++ b/src/declarative/graphicsitems/qdeclarativepathview.cpp @@ -948,7 +948,7 @@ void QDeclarativePathView::mousePressEvent(QGraphicsSceneMouseEvent *event) void QDeclarativePathView::mouseMoveEvent(QGraphicsSceneMouseEvent *event) { Q_D(QDeclarativePathView); - if (!d->interactive || d->lastPosTime.isNull()) + if (!d->interactive || !d->lastPosTime.isValid()) return; if (!d->stealMouse) { @@ -982,7 +982,7 @@ void QDeclarativePathView::mouseReleaseEvent(QGraphicsSceneMouseEvent *) Q_D(QDeclarativePathView); d->stealMouse = false; setKeepMouseGrab(false); - if (!d->interactive || d->lastPosTime.isNull()) + if (!d->interactive || !d->lastPosTime.isValid()) return; qreal elapsed = qreal(d->lastElapsed + QDeclarativeItemPrivate::elapsed(d->lastPosTime)) / 1000.; @@ -1017,7 +1017,7 @@ void QDeclarativePathView::mouseReleaseEvent(QGraphicsSceneMouseEvent *) d->fixOffset(); } - d->lastPosTime = QTime(); + d->lastPosTime.invalidate(); ungrabMouse(); } @@ -1059,8 +1059,8 @@ bool QDeclarativePathView::sendMouseEvent(QGraphicsSceneMouseEvent *event) grabMouse(); return d->stealMouse; - } else if (!d->lastPosTime.isNull()) { - d->lastPosTime = QTime(); + } else if (d->lastPosTime.isValid()) { + d->lastPosTime.invalidate(); } return false; } diff --git a/src/declarative/graphicsitems/qdeclarativepathview_p_p.h b/src/declarative/graphicsitems/qdeclarativepathview_p_p.h index 3abb2f4..a0d2610 100644 --- a/src/declarative/graphicsitems/qdeclarativepathview_p_p.h +++ b/src/declarative/graphicsitems/qdeclarativepathview_p_p.h @@ -97,6 +97,7 @@ public: q->setFlag(QGraphicsItem::ItemIsFocusScope); q->setFiltersChildEvents(true); q->connect(&tl, SIGNAL(updated()), q, SLOT(ticked())); + lastPosTime.invalidate(); } void itemGeometryChanged(QDeclarativeItem *item, const QRectF &newGeometry, const QRectF &oldGeometry) { @@ -154,7 +155,7 @@ public: bool autoHighlight : 1; bool highlightUp : 1; bool layoutScheduled : 1; - QTime lastPosTime; + QElapsedTimer lastPosTime; QPointF lastPos; qreal dragMargin; qreal deceleration; -- cgit v0.12 From 0da153d47da2dcc59b33bc47ea949ceaf3189579 Mon Sep 17 00:00:00 2001 From: Joona Petrell Date: Fri, 28 May 2010 14:06:41 +1000 Subject: Active window focus gain should not open virtual keypad Task-number: Reviewed-by: Martin Jones --- src/declarative/QmlChanges.txt | 3 +++ src/declarative/graphicsitems/qdeclarativetextedit.cpp | 2 +- src/declarative/graphicsitems/qdeclarativetextinput.cpp | 2 +- .../qdeclarativetextedit/tst_qdeclarativetextedit.cpp | 13 +++++++++++-- .../qdeclarativetextinput/tst_qdeclarativetextinput.cpp | 13 +++++++++++-- 5 files changed, 27 insertions(+), 6 deletions(-) diff --git a/src/declarative/QmlChanges.txt b/src/declarative/QmlChanges.txt index 3eed8d6..142920c 100644 --- a/src/declarative/QmlChanges.txt +++ b/src/declarative/QmlChanges.txt @@ -1,6 +1,9 @@ ============================================================================= The changes below are pre Qt 4.7.0 RC +TextInput and TextEdit: + - showInputPanelOnFocus property added + - openSoftwareInputPanel() and closeSoftwareInputPanel() functions added Flickable: - overShoot is replaced by boundsBehavior enumeration - flickingHorizontally and flickingVertically properties added diff --git a/src/declarative/graphicsitems/qdeclarativetextedit.cpp b/src/declarative/graphicsitems/qdeclarativetextedit.cpp index 167db77..9ccb8d2 100644 --- a/src/declarative/graphicsitems/qdeclarativetextedit.cpp +++ b/src/declarative/graphicsitems/qdeclarativetextedit.cpp @@ -1335,7 +1335,7 @@ void QDeclarativeTextEdit::setShowInputPanelOnFocus(bool showOnFocus) void QDeclarativeTextEdit::focusInEvent(QFocusEvent *event) { Q_D(const QDeclarativeTextEdit); - if (d->showInputPanelOnFocus && !isReadOnly()) { + if (d->showInputPanelOnFocus && !isReadOnly() && event->reason() != Qt::ActiveWindowFocusReason) { openSoftwareInputPanel(); } QDeclarativePaintedItem::focusInEvent(event); diff --git a/src/declarative/graphicsitems/qdeclarativetextinput.cpp b/src/declarative/graphicsitems/qdeclarativetextinput.cpp index 18e3595..9c70ea9 100644 --- a/src/declarative/graphicsitems/qdeclarativetextinput.cpp +++ b/src/declarative/graphicsitems/qdeclarativetextinput.cpp @@ -1282,7 +1282,7 @@ void QDeclarativeTextInput::setShowInputPanelOnFocus(bool showOnFocus) void QDeclarativeTextInput::focusInEvent(QFocusEvent *event) { Q_D(const QDeclarativeTextInput); - if (d->showInputPanelOnFocus && !isReadOnly()) { + if (d->showInputPanelOnFocus && !isReadOnly() && event->reason() != Qt::ActiveWindowFocusReason) { openSoftwareInputPanel(); } QDeclarativePaintedItem::focusInEvent(event); diff --git a/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp b/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp index 0df28d0..d3e3c3a 100644 --- a/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp +++ b/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp @@ -915,9 +915,18 @@ void tst_qdeclarativetextedit::sendRequestSoftwareInputPanelEvent() edit.setFocus(false); QCOMPARE(ic.openInputPanelReceived, false); QCOMPARE(ic.closeInputPanelReceived, true); + ic.closeInputPanelReceived = false; + + // active window focus reason should not cause input panel to open + QGraphicsObject * editObject = qobject_cast(&edit); + editObject->setFocus(Qt::ActiveWindowFocusReason); + QCOMPARE(ic.openInputPanelReceived, false); + QCOMPARE(ic.closeInputPanelReceived, false); + + // and input panel should not open if focus has already been set edit.setFocus(true); - QCOMPARE(ic.openInputPanelReceived, true); - QCOMPARE(ic.closeInputPanelReceived, true); + QCOMPARE(ic.openInputPanelReceived, false); + QCOMPARE(ic.closeInputPanelReceived, false); edit.setShowInputPanelOnFocus(true); QCOMPARE(inputPanelonFocusSpy.count(),2); diff --git a/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp b/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp index 155223d..c01cfa5 100644 --- a/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp +++ b/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp @@ -819,9 +819,18 @@ void tst_qdeclarativetextinput::sendRequestSoftwareInputPanelEvent() input.setFocus(false); QCOMPARE(ic.openInputPanelReceived, false); QCOMPARE(ic.closeInputPanelReceived, true); + ic.closeInputPanelReceived = false; + + // active window focus reason should not cause input panel to open + QGraphicsObject * inputObject = qobject_cast(&input); + inputObject->setFocus(Qt::ActiveWindowFocusReason); + QCOMPARE(ic.openInputPanelReceived, false); + QCOMPARE(ic.closeInputPanelReceived, false); + + // and input panel should not open if focus has already been set input.setFocus(true); - QCOMPARE(ic.openInputPanelReceived, true); - QCOMPARE(ic.closeInputPanelReceived, true); + QCOMPARE(ic.openInputPanelReceived, false); + QCOMPARE(ic.closeInputPanelReceived, false); input.setShowInputPanelOnFocus(true); QCOMPARE(inputPanelonFocusSpy.count(),2); -- cgit v0.12 From 71425f24893fecb15cd4d01e6dc3d391051e9d6b Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Fri, 28 May 2010 11:27:27 +0200 Subject: fix visibility detection for g++ with a qualified binary name it may be called g++-4.4 (versioned) or x86_64-pc-linux-gnu-g++ (cross-compiler), so make the pattern just match anything with g++. it may also be aliased to "c++", so catch that as well. otoh, "gcc" would be a poor choice for QMAKE_CXX, so don't recognize that. Reviewed-by: thiago Task-number: QTBUG-11065 --- config.tests/unix/fvisibility.test | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config.tests/unix/fvisibility.test b/config.tests/unix/fvisibility.test index 99e6fbe..27c6841 100755 --- a/config.tests/unix/fvisibility.test +++ b/config.tests/unix/fvisibility.test @@ -34,7 +34,7 @@ EOF case "$COMPILER" in -gcc|g++) +*g++*|*c++*) CMDLINE="-fvisibility=hidden" RunCompileTest ;; -- cgit v0.12 From b0b4ca6547807fc602176c1ad262f15f6858116a Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Fri, 28 May 2010 15:17:04 +0200 Subject: qdoc: Fixed the model/view programming page; tried a style change. --- .../model-view-programming.qdoc | 463 +++++++-------------- doc/src/template/style/style.css | 7 +- tools/qdoc3/doc.cpp | 12 - tools/qdoc3/htmlgenerator.cpp | 3 + 4 files changed, 166 insertions(+), 319 deletions(-) diff --git a/doc/src/frameworks-technologies/model-view-programming.qdoc b/doc/src/frameworks-technologies/model-view-programming.qdoc index 7568981..3bac8ce 100644 --- a/doc/src/frameworks-technologies/model-view-programming.qdoc +++ b/doc/src/frameworks-technologies/model-view-programming.qdoc @@ -46,71 +46,13 @@ /*! \page model-view-programming.html - \nextpage An Introduction to Model/View Programming - \startpage index.html Qt Reference Documentation \title Model/View Programming - \brief A guide to the extensible model/view architecture used by Qt's - item view classes. + \brief A guide to Qt's extensible model/view architecture. - \ingroup frameworks-technologies + \section1 Introduction to Model/View Programming - \list - \o \l{An Introduction to Model/View Programming} - \tableofcontents{1 An Introduction to Model/View Programming} - \o \l{Using Models and Views} - \tableofcontents{1 Using Models and Views} - \o \l{Model Classes} - \tableofcontents{1 Model Classes} - \o \l{Creating New Models} - \tableofcontents{1 Creating New Models} - \o \l{View Classes} - \tableofcontents{1 View Classes} - \o \l{Handling Selections in Item Views} - \tableofcontents{1 Handling Selections in Item Views} - \o \l{Delegate Classes} - \tableofcontents{1 Delegate Classes} - \o \l{Item View Convenience Classes} - \tableofcontents{1 Item View Convenience Classes} - \o \l{Using Drag and Drop with Item Views} - \tableofcontents{1 Using Drag and Drop with Item Views} - \o \l{Proxy Models} - \tableofcontents{1 Proxy Models} - \o \l{Model Subclassing Reference} - \tableofcontents{1 Model Subclassing Reference} - \endlist - - \keyword Model/View Classes - \section1 All Model/View Classes - - These classes use the model/view design pattern in which the - underlying data (in the model) is kept separate from the way the data - is presented and manipulated by the user (in the view). - - \annotatedlist model-view - - \section1 Related Examples - - \list - \o \l{itemviews/dirview}{Dir View} - \o \l{itemviews/spinboxdelegate}{Spin Box Delegate} - \o \l{itemviews/pixelator}{Pixelator} - \o \l{itemviews/simpletreemodel}{Simple Tree Model} - \o \l{itemviews/chart}{Chart} - \endlist -*/ - -/*! - \page model-view-introduction.html - \previouspage Model/View Programming - \nextpage Using Models and Views - \startpage index.html Qt Reference Documentation - - \title An Introduction to Model/View Programming - - \tableofcontents - - Qt 4 introduces a new set of item view classes that use a model/view + Qt 4 introduced a new set of item view classes that use a model/view architecture to manage the relationship between data and the way it is presented to the user. The separation of functionality introduced by this architecture gives developers greater flexibility to customize the @@ -121,7 +63,7 @@ view system. Each of the components in the architecture is explained, and examples are given that show how to use the classes provided. - \section1 The Model/View Architecture + \section2 The model/view architecture Model-View-Controller (MVC) is a design pattern originating from Smalltalk that is often used when building user interfaces. @@ -185,7 +127,7 @@ model and view about the state of the editor. \endlist - \section2 Models + \section3 Models All item models are based on the QAbstractItemModel class. This class defines an interface that is used by views and delegates to access data. @@ -225,7 +167,7 @@ QAbstractItemModel, QAbstractListModel, or QAbstractTableModel to create your own custom models. - \section2 Views + \section3 Views Complete implementations are provided for different kinds of views: QListView displays a list of items, QTableView displays data @@ -237,7 +179,7 @@ The available views are examined in the section on \l{View Classes}. - \section2 Delegates + \section3 Delegates QAbstractItemDelegate is the abstract base class for delegates in the model/view framework. Since Qt 4.4, the default delegate implementation is @@ -251,7 +193,7 @@ Delegates are described in the section on \l{Delegate Classes}. - \section2 Sorting + \section3 Sorting There are two ways of approaching sorting in the model/view architecture; which approach to choose depends on your underlying @@ -272,7 +214,7 @@ before presenting the data in the view. This is covered in detail in the section on \l {Proxy Models}. - \section2 Convenience Classes + \section3 Convenience classes A number of \e convenience classes are derived from the standard view classes for the benefit of applications that rely on Qt's item-based @@ -293,24 +235,13 @@ classes, such as QListView, QTableView, and QTreeView with QStandardItemModel. - \section1 The Model/View Components + \section1 Using models and views - The following sections describe the way in which the model/view pattern - is used in Qt. Each section provides an example of use, and is followed - by a section showing how you can create new components. -*/ - -/*! - \page model-view-using.html - \contentspage model-view-programming.html Contents - \previouspage An Introduction to Model/View Programming - \nextpage Model Classes + The following sections explain how to use the model/view pattern + in Qt. Each section includes an an example and is followed by a + section showing how to create new components. - \title Using Models and Views - - \tableofcontents - - \section1 Introduction + \section2 Two models included in Qt Two of the standard models provided by Qt are QStandardItemModel and QFileSystemModel. QStandardItemModel is a multi-purpose model that can be @@ -325,7 +256,7 @@ to set up a model for use with ready-made views, and explore how to manipulate data using model indexes. - \section1 Using Views with an Existing Model + \section2 Using views with an existing model The QListView and QTreeView classes are the most suitable views to use with QFileSystemModel. The example presented below displays the @@ -361,7 +292,7 @@ The \c index() function used in this case is unique to QFileSystemModel; we supply it with a directory and it returns a model index. Model indexes are - discussed in the \l{Model Classes} chapter. + discussed in \l{Model Classes}. The rest of the function just displays the views within a splitter widget, and runs the application's event loop: @@ -369,23 +300,15 @@ \snippet doc/src/snippets/shareddirmodel/main.cpp 8 In the above example, we neglected to mention how to handle selections - of items. This subject is covered in more detail in the chapter on - \l{Handling Selections in Item Views}. Before examining how selections - are handled, you may find it useful to read the \l{Model Classes} chapter - which describes the concepts used in the model/view framework. -*/ + of items. This subject is covered in more detail in the section about + \l{Handling Selections in Item Views}. -/*! - \page model-view-model.html - \contentspage model-view-programming.html Contents - \previouspage Using Models and Views - \nextpage Creating New Models - - \title Model Classes + \section1 Model classes - \tableofcontents + Before examining how selections are handled, you may find it + useful to examine the concepts used in the model/view framework. - \section1 Basic Concepts + \section2 Basic concepts In the model/view architecture, the model provides a standard interface that views and delegates use to access data. In Qt, the standard @@ -401,11 +324,11 @@ Models also notify any attached views about changes to data through the signals and slots mechanism. - This chapter describes some basic concepts that are central to the way + This section describes some basic concepts that are central to the way item of data are accessed by other components via a model class. More - advanced concepts are discussed in later chapters. + advanced concepts are discussed in later sections. - \section2 Model Indexes + \section3 Model indexes To ensure that the representation of the data is kept separate from the way it is accessed, the concept of a \e{model index} is introduced. Each @@ -435,7 +358,7 @@ and the model index of a parent item. The following sections describe and explain these properties in detail. - \section2 Rows and Columns + \section3 Rows and columns In its most basic form, a model can be accessed as a simple table in which items are located by their row and column numbers. \e{This does not mean @@ -468,7 +391,7 @@ section. \endtable - \section2 Parents of Items + \section3 Parents of items The table-like interface to item data provided by models is ideal when using data in a table or list view; the row and column number system maps @@ -501,7 +424,7 @@ \snippet doc/src/snippets/code/doc_src_model-view-programming.qdoc 5 \endtable - \section2 Item Roles + \section3 Item roles Items in a model can perform various \e roles for other components, allowing different kinds of data to be supplied for different situations. @@ -534,7 +457,7 @@ interpret or ignore this information as required. It is also possible to define additional roles for application-specific purposes. - \section2 Summary of Concepts + \section3 Summary \list \o Model indexes give views and delegates information about the location @@ -546,17 +469,16 @@ components, such as views and delegates. \o If a valid model index is specified for the parent item when an index is requested using \l{QAbstractItemModel::index()}{index()}, the index - returned will refer to an item beneath that parent item in the - model. + returned refers to an item beneath that parent item in the model. The index obtained refers to a child of that item. \o If an invalid model index is specified for the parent item when an index is requested using \l{QAbstractItemModel::index()}{index()}, the index - returned will refer to a top-level item in the model. + returned refers to a top-level item in the model. \o The \l{Qt::ItemDataRole}{role} distinguishes between the different kinds of data associated with an item. \endlist - \section2 Using Model Indexes + \section2 Using model indexes To demonstrate how data can be retrieved from a model, using model indexes, we set up a QFileSystemModel without a view and display the @@ -610,26 +532,16 @@ to the model. \endlist + \section2 Further reading - \section1 Further Reading - - New models can be created by implementing the standard interface provided - by QAbstractItemModel. In the \l{Creating New Models} chapter, we will - demonstrate this by creating a convenient ready-to-use model for holding - lists of strings. -*/ - -/*! - \page model-view-view.html - \contentspage model-view-programming.html Contents - \previouspage Creating New Models - \nextpage Handling Selections in Item Views + New models can be created by implementing the standard interface + provided by QAbstractItemModel. In the \l{Creating New Models} + section, we demonstrate this by creating a convenient ready-to-use + model for holding lists of strings. - \title View Classes + \section1 View classes - \tableofcontents - - \section1 Concepts + \section2 Concepts In the model/view architecture, the view obtains items of data from the model and presents them to the user. The way that the data is @@ -668,7 +580,7 @@ subclassed from the QHeaderView class to provide more specialized labels for views. - \section1 Using an Existing View + \section2 Using an existing view Qt provides three ready-to-use view classes that present data from models in ways that are familiar to most users. @@ -686,7 +598,7 @@ facilities, and can be customized to suit the needs of more specialized user interfaces. - \section2 Using a Model + \section3 Using a model We take the string list model that \l{Creating New Models}{we created as an example model}, set it up with some data, and construct a view to @@ -697,8 +609,8 @@ Note that the \c StringListModel is declared as a \l QAbstractItemModel. This allows us to use the abstract interface to the model, and - ensures that the code will still work even if we replace the string list - model with a different model in the future. + ensures that the code still works, even if we replace the string list + model with a different model. The list view provided by \l QListView is sufficient for presenting the items in the string list model. We construct the view, and set up @@ -721,7 +633,7 @@ list model. Since the model is editable, the view automatically allows each item in the list to be edited using the default delegate. - \section2 Using Multiple Views onto the Same Model + \section3 Using multiple views of a model Providing multiple views onto the same model is simply a matter of setting the same model for each view. In the following code we create @@ -745,7 +657,7 @@ selection model. This can be useful in certain situations but, for many applications, a shared selection model is desirable. - \section1 Handling Selections of Items + \section2 Handling selections of items The mechanism for handling selections of items within views is provided by the \l QItemSelectionModel class. All of the standard views construct @@ -758,13 +670,12 @@ when we want to provide multiple consistent views onto the same model data. - Generally, unless you are subclassing a model or view, you will not - need to manipulate the contents of selections directly. However, the - interface to the selection model can be accessed, if required, and - this is explored in the chapter on - \l{Handling Selections in Item Views}. + Generally, unless you are subclassing a model or view, you don't + need to manipulate the contents of selections directly. However, + the interface to the selection model can be accessed, if required, + and this is explored in \l{Handling Selections in Item Views}. - \section2 Sharing Selections Between Views + \section3 Sharing selections among views Although it is convenient that the view classes provide their own selection models by default, when we use more than one view onto the @@ -788,19 +699,9 @@ each view; for example, a contiguous selection in a table view can be represented as a fragmented set of highlighted items in a tree view. -*/ - -/*! - \page model-view-delegate.html - \contentspage model-view-programming.html Contents - \previouspage Handling Selections in Item Views - \nextpage Item View Convenience Classes - - \title Delegate Classes - - \tableofcontents + \section1 Delegate classes - \section1 Concepts + \section2 Concepts Unlike the Model-View-Controller pattern, the model/view design does not include a completely separate component for managing interaction with @@ -821,13 +722,13 @@ Editors for delegates can be implemented either by using widgets to manage the editing process or by handling events directly. - The first approach is covered later in this chapter, and it is also + The first approach is covered later in this section, and it is also shown in the \l{Spin Box Delegate Example}{Spin Box Delegate} example. The \l{Pixelator Example}{Pixelator} example shows how to create a custom delegate that performs specialized rendering for a table view. - \section1 Using an Existing Delegate + \section2 Using an existing delegate The standard views provided with Qt use instances of \l QItemDelegate to provide editing facilities. This default implementation of the @@ -845,15 +746,15 @@ necessary to use this function when setting the delegate for a custom view. - \section1 A Simple Delegate + \section2 A simple delegate - The delegate implemented here uses a \l QSpinBox to provide editing - facilities, and is mainly intended for use with models that display - integers. Although we set up a custom integer-based table model for - this purpose, we could easily have used \l QStandardItemModel instead - since the custom delegate will control data entry. We construct a - table view to display the contents of the model, and this will use - the custom delegate for editing. + The delegate implemented here uses a \l QSpinBox to provide + editing facilities, and is mainly intended for use with models + that display integers. Although we set up a custom integer-based + table model for this purpose, we could easily have used \l + QStandardItemModel instead, since the custom delegate controls + data entry. We construct a table view to display the contents of + the model, and this will use the custom delegate for editing. \img spinboxdelegate-example.png @@ -866,7 +767,7 @@ Note that no editor widgets are set up when the delegate is constructed. We only construct an editor widget when it is needed. - \section2 Providing an Editor + \section3 Providing an editor In this example, when the table view needs to provide an editor, it asks the delegate to provide an editor widget that is appropriate @@ -906,7 +807,7 @@ the model, in which case we would need to cast the widget to the appropriate type before accessing its member functions. - \section2 Submitting Data to the Model + \section3 Submitting data to the model When the user has finished editing the value in the spin box, the view asks the delegate to store the edited value in the model by calling the @@ -935,7 +836,7 @@ delegate with different kinds of models because \l{QVariant} provides sensible default values for unexpected data. - \section2 Updating the Editor's Geometry + \section3 Updating the editor's geometry It is the responsibility of the delegate to manage the editor's geometry. The geometry must be set when the editor is created, and @@ -951,7 +852,7 @@ position the editor in relation to the other elements in the item. \target EditingHints - \section2 Editing Hints + \section3 Editing hints After editing, delegates should provide hints to the other components about the result of the editing process, and provide hints that will @@ -982,19 +883,10 @@ Delegates do not have to emit these hints, but those that do not will be less integrated into applications, and will be less usable than those that emit hints to support common editing actions. -*/ - -/*! - \page model-view-selection.html - \contentspage model-view-programming.html Contents - \previouspage View Classes - \nextpage Delegate Classes - \title Handling Selections in Item Views + \section1 Handling selections in item views - \tableofcontents - - \section1 Concepts + \section2 Concepts The selection model used in the item view classes offers many improvements over the selection model used in Qt 3. It provides a more general @@ -1022,8 +914,7 @@ after its application through the use of certain types of selection commands. These are discussed later in this section. - - \section2 Current Item and Selected Items + \section3 Current item & selected items In a view, there is always a current item and a selected item - two independent states. An item can be the current item and selected at the @@ -1068,8 +959,7 @@ be informed of changes to the selection model via the signals and slots mechanism. - - \section1 Using a Selection Model + \section2 Using a selection model The standard view classes provide default selection models that can be used in most applications. A selection model belonging to one view @@ -1088,8 +978,7 @@ each having a different effect on the selections already present in the selection model. - - \section2 Selecting Items + \section3 Selecting items To demonstrate some of the principal features of selections, we construct an instance of a custom table model with 32 items in total, and open a @@ -1122,12 +1011,12 @@ The selection of items can be modified using various operations that are defined by the selection flags. The selection that results from - these operations may have a complex structure, but will be represented + these operations may have a complex structure, but it is represented efficiently by the selection model. The use of different selection flags to manipulate the selected items is described when we examine how to update a selection. - \section2 Reading the Selection State + \section3 Reading the selection state The model indexes stored in the selection model can be read using the \l{QItemSelectionModel::selectedIndexes()}{selectedIndexes()} @@ -1176,7 +1065,7 @@ Monitoring selections made by the user is straightforward with these signals, but we can also update the selection model directly. - \section2 Updating a Selection + \section3 Updating a selection Selection commands are provided by a combination of selection flags, defined by \l{QItemSelectionModel::SelectionFlag}. @@ -1215,7 +1104,7 @@ with a command that is a combination of \l{QItemSelectionModel::SelectionFlag}{Select} and \l{QItemSelectionModel::SelectionFlag}{Rows}, the - entire row containing the item referred to will be selected. + entire row containing the item referred to is selected. The following code demonstrates the use of the \l{QItemSelectionModel::SelectionFlag}{Rows} and \l{QItemSelectionModel::SelectionFlag}{Columns} flags: @@ -1248,7 +1137,7 @@ has the effect of resetting the selection model's collection of model indexes. - \section2 Selecting All Items in a Model + \section3 Selecting all items in a model To select all items in a model, it is necessary to create a selection for each level of the model that covers all items in that @@ -1271,19 +1160,8 @@ \l{QAbstractItemModel::hasChildren()}{hasChildren()} function is used to determine whether any given item is the parent of another level of items. -*/ - -/*! - \page model-view-creating-models.html - \contentspage model-view-programming.html Contents - \previouspage Model Classes - \nextpage View Classes - - \title Creating New Models - \tableofcontents - - \section1 Introduction + \section1 Creating new models The separation of functionality between the model/view components allows models to be created that can take advantage of existing views. This @@ -1301,9 +1179,9 @@ for interfaces to simpler non-hierarchical data structures, and are easier to use as a starting point for simple list and table models. - In this chapter, we create a simple read-only model to explore + In this section, we create a simple read-only model to explore the basic principles of the model/view architecture. Later in this - chapter, we will adapt this simple model so that items can be modified + section, we adapt this simple model so that items can be modified by the user. For an example of a more complex model, see the @@ -1312,21 +1190,21 @@ The requirements of QAbstractItemModel subclasses is described in more detail in the \l{Model Subclassing Reference} document. - \section1 Designing a Model + \section2 Designing a model - When creating a new model for an existing data structure, it is important - to consider which type of model should be used to provide an interface - onto the data. If the data structure can be represented as a - list or table of items, you can subclass QAbstractListModel or - QAbstractTableModel since these classes provide suitable default - implementations for many functions. + When creating a new model for an existing data structure, it is + important to consider which type of model should be used to + provide an interface onto the data. If the data structure can be + represented as a list or table of items, you can subclass + QAbstractListModel or QAbstractTableModel since these classes + provide suitable default implementations for many functions. - However, if the underlying data structure can only be represented by a - hierarchical tree structure, it is necessary to subclass + However, if the underlying data structure can only be represented + by a hierarchical tree structure, it is necessary to subclass QAbstractItemModel. This approach is taken in the \l{itemviews/simpletreemodel}{Simple Tree Model} example. - In this chapter, we will implement a simple model based on a list of + In this section, we implement a simple model based on a list of strings, so the QAbstractListModel provides an ideal base class on which to build. @@ -1338,7 +1216,7 @@ interact with it using the standard API. The model described below provides a custom constructor for just this purpose. - \section1 A Read-Only Example Model + \section2 A read-only example model The model implemented here is a simple, non-hierarchical, read-only data model based on the standard QStringListModel class. It has a \l QStringList @@ -1355,7 +1233,6 @@ functions as there are default implementations for most of the interface. The class declaration is as follows: - \snippet doc/src/snippets/stringlistmodel/model.h 0 \snippet doc/src/snippets/stringlistmodel/model.h 1 \codeline @@ -1379,7 +1256,7 @@ The list of strings is stored internally in the \c stringList private member variable. - \section2 Dimensions of The Model + \section3 Dimensions of the model We want the number of rows in the model to be the same as the number of strings in the string list. We implement the @@ -1394,7 +1271,7 @@ reimplement the \l{QAbstractItemModel::columnCount()}{columnCount()} function. - \section2 Model Headers and Data + \section3 Model headers & data For items in the view, we want to return the strings in the string list. The \l{QAbstractItemModel::data()}{data()} function is responsible for @@ -1433,7 +1310,7 @@ \l{Qt::ItemDataRole}{ToolTipRole} that views can use to display information about items in a tooltip. - \section1 An Editable Model + \section2 An editable model The read-only model shows how simple choices could be presented to the user but, for many applications, an editable list model is much more @@ -1447,7 +1324,7 @@ \snippet doc/src/snippets/stringlistmodel/model.h 2 \snippet doc/src/snippets/stringlistmodel/model.h 3 - \section2 Making the Model Editable + \section3 Making the model editable A delegate checks whether an item is editable before creating an editor. The model must let the delegate know that its items are @@ -1473,7 +1350,7 @@ \l{Qt::ItemDataRole}{EditRole} since this is the role used by the standard item delegate. For boolean values, however, you can use Qt::CheckStateRole and set the Qt::ItemIsUserCheckable flag; a - checkbox will then be used for editing the value. The underlying + checkbox is then used for editing the value. The underlying data in this model is the same for all roles, so this detail just makes it easier to integrate the model with standard components. @@ -1487,7 +1364,7 @@ \snippet doc/src/snippets/stringlistmodel/model.cpp 1 - \section2 Inserting and Removing Rows + \section3 Inserting & removing rows It is possible to change the number of rows and columns in a model. In the string list model it only makes sense to change the number of rows, so we @@ -1536,39 +1413,29 @@ operation and let other components know that the dimensions of the model have changed. - \section1 Next Steps + \section2 Next steps We can display the data provided by this model, or any other model, using the \l QListView class to present the model's items in the form of a vertical list. For the string list model, this view also provides a default editor so that the items can be manipulated. We examine the possibilities made available by - the standard view classes in the chapter on \l{View Classes}. + the standard view classes in \l{View Classes}. The \l{Model Subclassing Reference} document discusses the requirements of QAbstractItemModel subclasses in more detail, and provides a guide to the virtual functions that must be implemented to enable various features in different types of models. -*/ - -/*! - \page model-view-convenience.html - \contentspage model-view-programming.html Contents - \previouspage Delegate Classes - \nextpage Using Drag and Drop with Item Views - - \title Item View Convenience Classes - \tableofcontents + \section1 Item view convenience classes - \section1 Overview - - Alongside the model/view classes, Qt 4 also includes standard widgets to - provide classic item-based container widgets. These behave in a similar - way to the item view classes in Qt 3, but have been rewritten to use the - underlying model/view framework for performance and maintainability. The - old item view classes are still available in the compatibility library - (see the \l{porting4.html}{Porting Guide} for more information). + Qt 4 also introduced some standard widgets to provide classic + item-based container widgets. These behave in a similar way to the + item view classes in Qt 3, but have been rewritten to use the + underlying model/view framework for performance and + maintainability. The old item view classes are still available in + the compatibility library (see the \l{porting4.html}{Porting + Guide} for more information). The item-based widgets have been given names which reflect their uses: \c QListWidget provides a list of items, \c QTreeWidget displays a @@ -1577,7 +1444,7 @@ class which implements common behavior for item selection and header management. - \section1 List Widgets + \section2 List widgets Single level lists of items are typically displayed using a \c QListWidget and a number of \c{QListWidgetItem}s. A list widget is constructed in the @@ -1612,8 +1479,7 @@ \snippet doc/src/snippets/qlistwidget-using/mainwindow.cpp 4 \snippet doc/src/snippets/qlistwidget-using/mainwindow.cpp 5 - - \section1 Tree Widgets + \section2 Tree widgets Trees or hierarchical lists of items are provided by the \c QTreeWidget and \c QTreeWidgetItem classes. Each item in the tree widget can have @@ -1668,8 +1534,7 @@ \snippet doc/src/snippets/qtreewidget-using/mainwindow.cpp 8 \snippet doc/src/snippets/qtreewidget-using/mainwindow.cpp 9 - - \section1 Table Widgets + \section2 Table widgets Tables of items similar to those found in spreadsheet applications are constructed with the \c QTableWidget and \c QTableWidgetItem. These @@ -1693,7 +1558,7 @@ Note that the rows and columns in the table begin at zero. - \section1 Common Features + \section2 Common features There are a number of item-based features common to each of the convenience classes that are available through the same interfaces @@ -1702,7 +1567,7 @@ Look at the list of \l{Model/View Classes} for each of the widgets for more details about the use of each function used. - \section2 Hidden Items + \section3 Hidden items It is sometimes useful to be able to hide items in an item view widget rather than remove them. Items for all of the above widgets can be @@ -1713,7 +1578,7 @@ Since this operation is item-based, the same function is available for all three convenience classes. - \section2 Selections + \section3 Selections The way items are selected is controlled by the widget's selection mode (\l{QAbstractItemView::SelectionMode}). @@ -1764,7 +1629,7 @@ current item may not lie within the selection, depending on the way the user formed the selection. - \section2 Searching + \section3 Searching It is often useful to be able to find items within an item view widget, either as a developer or as a service to present to users. All three @@ -1782,19 +1647,8 @@ The above code causes items in a tree widget to be selected if they contain the text given in the search string. This pattern can also be used in the list and table widgets. -*/ - -/*! - \page model-view-dnd.html - \contentspage model-view-programming.html Contents - \previouspage Item View Convenience Classes - \nextpage Proxy Models - \title Using Drag and Drop with Item Views - - \tableofcontents - - \section1 Overview + \section1 Using drag & drop with item views Qt's drag and drop infrastructure is fully supported by the model/view framework. Items in lists, tables, and trees can be dragged within the views, and data can be @@ -1813,7 +1667,7 @@ See also the \l{Model Subclassing Reference} for more information about enabling drag and drop support in new models. - \section1 Using Convenience Views + \section2 Using convenience views Each of the types of item used with QListWidget, QTableWidget, and QTreeWidget is configured to use a different set of flags by default. For example, each @@ -1852,7 +1706,7 @@ \snippet doc/src/snippets/qlistwidget-dnd/mainwindow.cpp 1 - \section1 Using Model/View Classes + \section2 Using model/view classes Setting up a view for drag and drop follows the same pattern used with the convenience views. For example, a QListView can be set up in the same way as a @@ -1874,7 +1728,7 @@ of QAbstractItemModel::removeRows(), either directly or by inheriting the implementation from its base class. - \section2 Enabling Drag and Drop for Items + \section3 Enabling drag & drop for items Models indicate to views which items can be dragged, and which will accept drops, by reimplementing the QAbstractItemModel::flags() function to provide suitable @@ -1894,7 +1748,7 @@ obtain a default set of flags by calling its implementation of the flags() function. - \section2 Encoding Exported Data + \section3 Encoding exported data When items of data are exported from a model in a drag and drop operation, they are encoded into an appropriate format corresponding to one or more MIME types. @@ -1923,7 +1777,7 @@ and that stream operators must be implemented for them. See the QMetaObject class description for details. - \section2 Inserting Dropped Data into a Model + \section3 Inserting dropped data into a model The way that any given model handles dropped data depends on both its type (list, table, or tree) and the way its contents is likely to be presented to @@ -1988,7 +1842,7 @@ example shown here, the model only has one level, so this approach is not appropriate. - \section2 Decoding Imported Data + \section3 Decoding imported data Each implementation of \l{QAbstractItemModel::dropMimeData()}{dropMimeData()} must also decode the data and insert it into the model's underlying data structure. @@ -2007,19 +1861,8 @@ QAbstractItemModel::insertRows() and QAbstractItemModel::setData() functions. \sa {Item Views Puzzle Example} -*/ - -/*! - \page model-view-proxy-models.html - \contentspage model-view-programming.html Contents - \previouspage Using Drag and Drop with Item Views - \nextpage Model Subclassing Reference - \title Proxy Models - - \tableofcontents - - \section1 Overview + \section1 Proxy models In the model/view framework, items of data supplied by a single model can be shared by any number of views, and each of these can possibly represent the same information @@ -2042,7 +1885,7 @@ framework ensure that each view is updated appropriately no matter how many proxy models are placed between itself and the source model. - \section1 Using Proxy Models + \section2 Using proxy models Proxy models can be inserted between an existing model and any number of views. Qt is supplied with a standard proxy model, QSortFilterProxyModel, that is usually @@ -2061,7 +1904,7 @@ in applications. More specialized proxy models can be created by subclassing this classes and implementing the required comparison operations. - \section1 Customizing Proxy Models + \section2 Customizing proxy models Generally, the type of processing used in a proxy model involves mapping each item of data from its original location in the source model to either a different location in @@ -2074,7 +1917,7 @@ being supplied to views, and also allows the contents of a source model to be supplied to views as pre-sorted data. - \section2 Custom Filtering Models + \section3 Custom filtering models The QSortFilterProxyModel class provides a filtering model that is fairly versatile, and which can be used in a variety of common situations. For advanced users, @@ -2095,7 +1938,7 @@ return true to ensure that all items are passed through to views; reimplementations of these functions should return false to filter out individual rows and columns. - \section2 Custom Sorting Models + \section3 Custom sorting models QSortFilterProxyModel instances use Qt's built-in qStableSort() function to set up mappings between items in the source model and those in the proxy model, allowing a @@ -2103,18 +1946,8 @@ source model. To provide custom sorting behavior, reimplement the \l{QSortFilterProxyModel::lessThan()}{lessThan()} function to perform custom comparisons. -*/ - -/*! - \page model-view-model-subclassing.html - \contentspage model-view-programming.html Contents - \previouspage Proxy Models - - \title Model Subclassing Reference - \tableofcontents - - \section1 Introduction + \section1 Model subclassing reference Model subclasses need to provide implementations of many of the virtual functions defined in the QAbstractItemModel base class. The number of these functions that need @@ -2143,13 +1976,13 @@ For more information, see the \l {"Item View Classes" Chapter of C++ GUI Programming with Qt 4}. - \section1 Item Data Handling + \section2 Item data handling Models can provide varying levels of access to the data they provide: They can be simple read-only components, some models may support resizing operations, and others may allow items to be edited. - \section2 Read-Only Access + \section2 Read-Only access To provide read-only access to data provided by a model, the following functions \e{must} be implemented in the model's subclass: @@ -2185,7 +2018,7 @@ provide this function because it is already implemented in QAbstractListModel. \endtable - \section2 Editable Items + \section3 Editable items Editable models allow items of data to be modified, and may also provide functions to allow rows and columns to be inserted and removed. To enable @@ -2211,7 +2044,7 @@ signal to inform other components of the change. \endtable - \section2 Resizable Models + \section3 Resizable models All types of model can support the insertion and removal of rows. Table models and hierarchical models can also support the insertion and removal of columns. @@ -2271,7 +2104,7 @@ it is necessary to emit the \l{QAbstractItemModel::layoutChanged()}{layoutChanged()} signal to cause any attached views to be updated. - \section2 Lazy Population of Model Data + \section3 Lazy population of model data Lazy population of model data effectively allows requests for information about the model to be deferred until it is actually needed by views. @@ -2305,13 +2138,12 @@ children may be displayed incorrectly in some views until the user attempts to view the non-existent child items. - - \section1 Navigation and Model Index Creation + \section2 Navigation & model index creation Hierarchical models need to provide functions that views can call to navigate the tree-like structures they expose, and obtain model indexes for items. - \section2 Parents and Children + \section3 Parents & children Since the structure exposed to views is determined by the underlying data structure, it is up to each model subclass to create its own model indexes @@ -2335,7 +2167,7 @@ models to supply some unique identifier to this function to ensure that the model index can be re-associated with its corresponding item later on. - \section1 Drag and Drop Support and MIME Type Handling + \section2 Drag & drop support and MIME type handling The model/view classes support drag and drop operations, providing default behavior that is sufficient for many applications. However, it is also possible to customize @@ -2347,7 +2179,7 @@ The \l{#Convenience Views}{Convenience Views} section provides an overview of this behavior. - \section2 MIME Data + \section3 MIME data By default, the built-in models and views use an internal MIME type (\c{application/x-qabstractitemmodeldatalist}) to pass around information about @@ -2394,7 +2226,7 @@ the QMimeData::setImageData(), QMimeData::setColorData(), and QMimeData::setHtml() functions. - \section2 Accepting Dropped Data + \section3 Accepting dropped data When a drag and drop operation is performed over a view, the underlying model is queried to determine which types of operation it supports and the MIME types @@ -2466,7 +2298,7 @@ For more information about drag and drop with item views, refer to \l{Using Drag and Drop with Item Views}. - \section2 Convenience Views + \section3 Convenience views The convenience views (QListWidget, QTableWidget, and QTreeWidget) override the default drag and drop functionality to provide less flexible, but more @@ -2477,7 +2309,7 @@ into the model. For more information on drag and drop in convenience views, you can see \l{Using Drag and Drop with Item Views}. - \section1 Performance Optimization for Large Amounts of Data + \section2 Performance optimization for large amounts of data The \l{QAbstractItemModel::}{canFetchMore()} function checks if the parent has more data available and returns true or false accordingly. The @@ -2498,4 +2330,23 @@ \l{QAbstractItemModel::}{canFetchMore()} and \l{QAbstractItemModel::} {fetchMore()} must be reimplemented as their default implementation returns false and does nothing. + + \keyword Model/View Classes + \section1 The model/view classes + + These classes use the model/view design pattern in which the + underlying data (in the model) is kept separate from the way the + data is presented and manipulated by the user (in the view). + + \annotatedlist model-view + + \section1 Related examples + + \list + \o \l{itemviews/dirview}{Dir View} + \o \l{itemviews/spinboxdelegate}{Spin Box Delegate} + \o \l{itemviews/pixelator}{Pixelator} + \o \l{itemviews/simpletreemodel}{Simple Tree Model} + \o \l{itemviews/chart}{Chart} + \endlist */ diff --git a/doc/src/template/style/style.css b/doc/src/template/style/style.css index c155d9b..47fe2e0 100755 --- a/doc/src/template/style/style.css +++ b/doc/src/template/style/style.css @@ -39,7 +39,7 @@ h1, h2, h3, h4, h5, h6 { font-size: 100%; - font-weight: normal; +/* font-weight: normal; */ } q:before, q:after { @@ -949,6 +949,11 @@ margin-left: 15px; } + .wrap .content .toc .level3 + { + margin-left: 30px; + } + .content .toc li { font: normal 10px/1.2 Verdana; diff --git a/tools/qdoc3/doc.cpp b/tools/qdoc3/doc.cpp index 5716626..280f055 100644 --- a/tools/qdoc3/doc.cpp +++ b/tools/qdoc3/doc.cpp @@ -2746,18 +2746,6 @@ Doc::SectioningUnit Doc::granularity() const } } -#if notyet // ### -Doc::SectioningUnit Doc::sectioningUnit() const -{ - if (priv == 0 || priv->extra == 0) { - return DocPrivateExtra().sectioningUnit; - } - else { - return priv->extra->sectioningUnit; - } -} -#endif - const QSet &Doc::parameterNames() const { return priv == 0 ? *null_Set_QString() : priv->params; diff --git a/tools/qdoc3/htmlgenerator.cpp b/tools/qdoc3/htmlgenerator.cpp index 16df0c0..b103981 100644 --- a/tools/qdoc3/htmlgenerator.cpp +++ b/tools/qdoc3/htmlgenerator.cpp @@ -4060,10 +4060,13 @@ int HtmlGenerator::hOffset(const Node *node) case Node::Class: return 2; case Node::Fake: + return 1; +#if 0 if (node->doc().briefText().isEmpty()) return 1; else return 2; +#endif case Node::Enum: case Node::Typedef: case Node::Function: -- cgit v0.12