summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWarwick Allison <warwick.allison@nokia.com>2010-05-26 05:16:51 (GMT)
committerWarwick Allison <warwick.allison@nokia.com>2010-05-26 05:16:51 (GMT)
commit3449d4594f312728926ac83ae8453bba40434bbd (patch)
treed8eea1b22ed4e577c9a0d8248dd2f173b298c8c6
parente9a25332df933227c6b71a1654260d8421f56415 (diff)
parentef2bc487ab9b66e052920b671e947abc4a6d8ef4 (diff)
downloadQt-3449d4594f312728926ac83ae8453bba40434bbd.zip
Qt-3449d4594f312728926ac83ae8453bba40434bbd.tar.gz
Qt-3449d4594f312728926ac83ae8453bba40434bbd.tar.bz2
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/qt-qml into 4.7
-rw-r--r--demos/declarative/minehunt/MinehuntCore/qmldir2
-rw-r--r--demos/declarative/minehunt/minehunt.pro6
-rw-r--r--doc/src/snippets/declarative/gradient.qml2
-rw-r--r--examples/declarative/cppextensions/imageprovider/ImageProviderCore/qmldir2
-rw-r--r--examples/declarative/cppextensions/imageprovider/imageprovider.pro18
-rw-r--r--examples/declarative/cppextensions/plugins/com/nokia/TimeExample/qmldir2
-rw-r--r--examples/declarative/cppextensions/plugins/plugin.cpp2
-rw-r--r--examples/declarative/cppextensions/plugins/plugins.pro16
-rw-r--r--examples/declarative/cppextensions/qwidgets/QWidgets/qmldir2
-rw-r--r--examples/declarative/cppextensions/qwidgets/qwidgets.cpp2
-rw-r--r--examples/declarative/cppextensions/qwidgets/qwidgets.pro16
-rw-r--r--examples/declarative/toys/tic-tac-toe/content/Button.qml34
-rw-r--r--examples/declarative/toys/tic-tac-toe/content/tic-tac-toe.js144
-rw-r--r--examples/declarative/toys/tic-tac-toe/tic-tac-toe.qml109
-rw-r--r--examples/declarative/tutorials/extending/chapter5-plugins/chapter5-plugins.pro8
-rw-r--r--src/declarative/graphicsitems/qdeclarativeanchors.cpp34
-rw-r--r--src/declarative/graphicsitems/qdeclarativeanchors_p_p.h2
-rw-r--r--src/declarative/graphicsitems/qdeclarativerectangle.cpp6
-rw-r--r--src/declarative/graphicsitems/qdeclarativetextedit.cpp131
-rw-r--r--src/declarative/graphicsitems/qdeclarativetextedit_p.h10
-rw-r--r--src/declarative/graphicsitems/qdeclarativetextedit_p_p.h8
-rw-r--r--src/declarative/graphicsitems/qdeclarativetextinput.cpp131
-rw-r--r--src/declarative/graphicsitems/qdeclarativetextinput_p.h10
-rw-r--r--src/declarative/graphicsitems/qdeclarativetextinput_p_p.h4
-rw-r--r--src/declarative/util/qdeclarativeview.cpp4
-rw-r--r--src/imports/gestures/gestures.pro4
-rw-r--r--src/imports/gestures/plugin.cpp2
-rw-r--r--src/imports/gestures/qmldir2
-rw-r--r--src/imports/particles/particles.cpp2
-rw-r--r--src/imports/particles/particles.pro4
-rw-r--r--src/imports/particles/qmldir2
-rw-r--r--src/imports/webkit/plugin.cpp2
-rw-r--r--src/imports/webkit/qmldir2
-rw-r--r--src/imports/webkit/webkit.pro4
-rw-r--r--tests/auto/declarative/qdeclarativeanchors/data/hvCenter.qml11
-rw-r--r--tests/auto/declarative/qdeclarativeanchors/tst_qdeclarativeanchors.cpp14
-rw-r--r--tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp85
-rw-r--r--tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp86
-rw-r--r--tools/qml/qmlruntime.cpp4
39 files changed, 666 insertions, 263 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/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/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 945a301..f218c30 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 = qmlimageproviderplugin
-# Input
SOURCES += imageprovider.cpp
sources.files = $$SOURCES imageprovider.qml imageprovider.pro
@@ -18,8 +16,14 @@ ImageProviderCore_sources.files = \
ImageProviderCore/qmldir
ImageProviderCore_sources.path = $$[QT_INSTALL_EXAMPLES]/declarative/imageprovider/ImageProviderCore
+INSTALLS = sources ImageProviderCore_sources target
+
symbian:{
- TARGET.EPOCALLOWDLLDATA=1
-}
+ load(data_caging_paths)
+ include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri)
+ TARGET.EPOCALLOWDLLDATA = 1
-INSTALLS = sources ImageProviderCore_sources target
+ 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 b501ae3..b7610a8 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 = qmlqtimeexampleplugin
+
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/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 37f313d..8d87804 100644
--- a/examples/declarative/cppextensions/qwidgets/qwidgets.pro
+++ b/examples/declarative/cppextensions/qwidgets/qwidgets.pro
@@ -1,21 +1,25 @@
TEMPLATE = lib
-DESTDIR = QWidgets
-TARGET = qwidgetsplugin
CONFIG += qt plugin
QT += declarative
+DESTDIR = QWidgets
+TARGET = qmlqwidgetsplugin
+
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:{
+ 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/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 76a6a3b..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,75 +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
+ 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 }
+ }
+ }
}
}
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
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/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
*/
diff --git a/src/declarative/graphicsitems/qdeclarativetextedit.cpp b/src/declarative/graphicsitems/qdeclarativetextedit.cpp
index f105171..348a8bd 100644
--- a/src/declarative/graphicsitems/qdeclarativetextedit.cpp
+++ b/src/declarative/graphicsitems/qdeclarativetextedit.cpp
@@ -962,7 +962,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) {
@@ -972,8 +971,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())
@@ -987,11 +984,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);
@@ -1230,4 +1222,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<QGraphicsView*>(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<QGraphicsView*>(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 51bb974..47174f4 100644
--- a/src/declarative/graphicsitems/qdeclarativetextedit_p.h
+++ b/src/declarative/graphicsitems/qdeclarativetextedit_p.h
@@ -86,6 +86,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)
@@ -119,6 +120,9 @@ public:
Wrap = QTextOption::WrapAtWordBoundaryOrAnywhere
};
+ Q_INVOKABLE void openSoftwareInputPanel();
+ Q_INVOKABLE void closeSoftwareInputPanel();
+
QString text() const;
void setText(const QString &);
@@ -166,6 +170,9 @@ public:
bool focusOnPress() const;
void setFocusOnPress(bool on);
+ bool showInputPanelOnFocus() const;
+ void setShowInputPanelOnFocus(bool showOnFocus);
+
bool persistentSelection() const;
void setPersistentSelection(bool on);
@@ -214,6 +221,7 @@ Q_SIGNALS:
void persistentSelectionChanged(bool isPersistentSelection);
void textMarginChanged(qreal textMargin);
void selectByMouseChanged(bool selectByMouse);
+ void showInputPanelOnFocusChanged(bool showOnFocus);
public Q_SLOTS:
void selectAll();
@@ -235,6 +243,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<QGraphicsView*>(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<QGraphicsView*>(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/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();
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
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<QDeclarativeRectangle>(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"));
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 <qtest.h>
+#include <QtTest/QSignalSpy>
#include "../../../shared/util.h"
#include "../shared/testhttpserver.h"
#include <math.h>
@@ -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<QWidget *>(&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 <qtest.h>
+#include <QtTest/QSignalSpy>
#include "../../../shared/util.h"
#include <QtDeclarative/qdeclarativeengine.h>
#include <QFile>
@@ -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<QWidget *>(&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
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()));
+ }
}
}
}