summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Brasser <michael.brasser@nokia.com>2009-07-29 23:27:45 (GMT)
committerMichael Brasser <michael.brasser@nokia.com>2009-07-29 23:27:45 (GMT)
commit8000255dafcee42bd1074a683d7344eca5d83cac (patch)
tree1e284fae94221c0e016952249157a2e18a7249f7
parentef0f2901d4055bf53ac2bebb7fe2d5681900db19 (diff)
parent1fc6939211c028af3805901293808721ad743c37 (diff)
downloadQt-8000255dafcee42bd1074a683d7344eca5d83cac.zip
Qt-8000255dafcee42bd1074a683d7344eca5d83cac.tar.gz
Qt-8000255dafcee42bd1074a683d7344eca5d83cac.tar.bz2
Merge branch 'kinetic-declarativeui' of git@scm.dev.nokia.troll.no:qt/kinetic into kinetic-declarativeui
-rw-r--r--demos/declarative/flickr/content/MediaLineEdit.qml2
-rw-r--r--demos/declarative/samegame/SameGame.qml13
-rwxr-xr-xdemos/declarative/samegame/content/samegame.js4
-rw-r--r--demos/declarative/webbrowser/webbrowser.qml2
-rw-r--r--src/declarative/fx/qfxkeyactions.h2
-rw-r--r--src/declarative/fx/qfxlayouts.cpp32
-rw-r--r--src/gui/graphicsview/qgraphicsitem.h7
-rw-r--r--src/gui/graphicsview/qgraphicsscene.cpp11
-rw-r--r--src/gui/kernel/qt_cocoa_helpers_mac.mm9
-rw-r--r--src/qt3support/sql/q3sqlcursor.cpp2
-rw-r--r--src/sql/drivers/db2/qsql_db2.cpp4
-rw-r--r--tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp69
-rw-r--r--tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp11
-rw-r--r--tests/auto/qsqldatabase/tst_databases.h10
-rw-r--r--tools/qmlviewer/qmlviewer.cpp6
15 files changed, 149 insertions, 35 deletions
diff --git a/demos/declarative/flickr/content/MediaLineEdit.qml b/demos/declarative/flickr/content/MediaLineEdit.qml
index a02f92d..b8d30ce 100644
--- a/demos/declarative/flickr/content/MediaLineEdit.qml
+++ b/demos/declarative/flickr/content/MediaLineEdit.qml
@@ -104,6 +104,6 @@ Item {
}
KeyActions {
id: ReturnKey
- return: "Container.state = ''"
+ keyReturn: "Container.state = ''"
}
}
diff --git a/demos/declarative/samegame/SameGame.qml b/demos/declarative/samegame/SameGame.qml
index 3b80692..9e1b1ae 100644
--- a/demos/declarative/samegame/SameGame.qml
+++ b/demos/declarative/samegame/SameGame.qml
@@ -9,7 +9,9 @@ Rect {
Rect {
id: gameCanvas
property int score: 0
- z:20; y:20; width:400; height:600; color: "white"; pen.width: 1
+ z:20; y:20; color: "white"; pen.width: 1
+ width:parent.width - tileSize - (parent.width % tileSize);
+ height:parent.height - tileSize - (parent.height % tileSize);
anchors.horizontalCenter: parent.horizontalCenter
Image { id:background;
source: "content/pics/background.png"
@@ -29,13 +31,4 @@ Rect {
text: "Score: " + gameCanvas.score; width:100; font.size:14
anchors.top: gameCanvas.bottom; anchors.topMargin: 4; anchors.right: gameCanvas.right;
}
- Text {
- text: "Just over 300 lines of QML/JS code!"
- anchors.horizontalCenter: parent.horizontalCenter
- anchors.bottom: parent.bottom; anchors.bottomMargin: 16;
- opacity: SequentialAnimation{ running: true; repeat: true;
- NumberAnimation { from: 0; to: 1; duration: 1000; easing: "easeInQuad" }
- NumberAnimation { from: 1; to: 0; duration: 1000; easing: "easeInQuad" }
- }
- }
}
diff --git a/demos/declarative/samegame/content/samegame.js b/demos/declarative/samegame/content/samegame.js
index a7dd82b..f04fb4c 100755
--- a/demos/declarative/samegame/content/samegame.js
+++ b/demos/declarative/samegame/content/samegame.js
@@ -21,6 +21,10 @@ function initBoard()
board[i].destroy();
}
+ maxX = Math.floor(gameCanvas.width/tileSize);
+ maxY = Math.floor(gameCanvas.height/tileSize);
+ maxIndex = maxY*maxX;
+
//Initialize Board
board = new Array(maxIndex);
gameCanvas.score = 0;
diff --git a/demos/declarative/webbrowser/webbrowser.qml b/demos/declarative/webbrowser/webbrowser.qml
index d3a65db..28e5f16 100644
--- a/demos/declarative/webbrowser/webbrowser.qml
+++ b/demos/declarative/webbrowser/webbrowser.qml
@@ -126,7 +126,7 @@ Item {
}
KeyActions {
id: keyActions
- return: "WebBrowser.url = EditUrl.text; proxy.focus=false;"
+ keyReturn: "WebBrowser.url = EditUrl.text; proxy.focus=false;"
}
*/
TextEdit {
diff --git a/src/declarative/fx/qfxkeyactions.h b/src/declarative/fx/qfxkeyactions.h
index 91c2806..d679d46 100644
--- a/src/declarative/fx/qfxkeyactions.h
+++ b/src/declarative/fx/qfxkeyactions.h
@@ -101,7 +101,7 @@ class Q_DECLARATIVE_EXPORT QFxKeyActions : public QFxItem
Q_PROPERTY(QString digit9 READ key_9 WRITE setKey_9)
Q_PROPERTY(QString asterisk READ key_Asterisk WRITE setKey_Asterisk)
Q_PROPERTY(QString escape READ key_Escape WRITE setKey_Escape)
- Q_PROPERTY(QString return READ key_Return WRITE setKey_Return)
+ Q_PROPERTY(QString keyReturn READ key_Return WRITE setKey_Return)
Q_PROPERTY(QString enter READ key_Enter WRITE setKey_Enter)
Q_PROPERTY(QString delete READ key_Delete WRITE setKey_Delete)
Q_PROPERTY(QString space READ key_Space WRITE setKey_Space)
diff --git a/src/declarative/fx/qfxlayouts.cpp b/src/declarative/fx/qfxlayouts.cpp
index 0546845..da34b8c 100644
--- a/src/declarative/fx/qfxlayouts.cpp
+++ b/src/declarative/fx/qfxlayouts.cpp
@@ -354,11 +354,14 @@ void QFxBaseLayout::preLayout()
d->_animated.clear();
doLayout();
//Set the layout's size to be the rect containing all children
- //Also set the margin
+ //d->aut determines whether a dimension is sum or max
+ //Also sets the margin
qreal width=0;
qreal height=0;
+ qreal maxWidth=0;
+ qreal maxHeight=0;
foreach(QFxItem *item, d->_items){
- if (item->opacity() == 0.0){
+ if (item->opacity() != 0.0){
if (!d->_animated.contains(item)){
setMovingItem(item);
QPointF p(item->x(), item->y());
@@ -369,6 +372,8 @@ void QFxBaseLayout::preLayout()
item->setPos(p);
setMovingItem(0);
}
+ maxWidth = qMax(maxWidth, item->width());
+ maxHeight = qMax(maxHeight, item->height());
width = qMax(width, item->x() + item->width());
height = qMax(height, item->y() + item->height());
}
@@ -376,14 +381,19 @@ void QFxBaseLayout::preLayout()
width += d->_margin;
height+= d->_margin;
- if (d->aut & Horizontal)
- setWidth(int(width));
- else if (parentItem())
- setImplicitWidth(parentItem()->width());
- if (d->aut & Vertical)
- setHeight(int(height));
- else if (parentItem())
- setImplicitHeight(parentItem()->height());
+ if(d->aut & Both){
+ setImplicitHeight(int(height));
+ setImplicitWidth(int(width));
+ }else if (d->aut & Horizontal){
+ setImplicitWidth(int(width));
+ setImplicitHeight(int(maxHeight));
+ } else if (d->aut & Vertical){
+ setImplicitHeight(int(height));
+ setImplicitWidth(int(maxWidth));
+ }else{
+ setImplicitHeight(int(maxHeight));
+ setImplicitWidth(int(maxWidth));
+ }
setLayoutItem(0);
}
@@ -656,7 +666,6 @@ void QFxVerticalLayout::doLayout()
}
finishApplyTransitions();
setMovingItem(this);
- setHeight(voffset);
setMovingItem(0);
}
@@ -823,7 +832,6 @@ void QFxHorizontalLayout::doLayout()
hoffset += spacing();
}
finishApplyTransitions();
- setWidth(hoffset);
}
QML_DEFINE_TYPE(Qt,4,6,(QT_VERSION&0x00ff00)>>8,GridLayout,QFxGridLayout)
diff --git a/src/gui/graphicsview/qgraphicsitem.h b/src/gui/graphicsview/qgraphicsitem.h
index c6bd0cd..c9a581c 100644
--- a/src/gui/graphicsview/qgraphicsitem.h
+++ b/src/gui/graphicsview/qgraphicsitem.h
@@ -517,6 +517,13 @@ class Q_GUI_EXPORT QGraphicsObject : public QObject, public QGraphicsItem
public:
QGraphicsObject(QGraphicsItem *parent = 0);
+ // ### Qt 5: Disambiguate
+#ifdef Q_NO_USING_KEYWORD
+ const QObjectList &children() const { return QObject::children(); }
+#else
+ using QObject::children;
+#endif
+
Q_SIGNALS:
void parentChanged();
void opacityChanged();
diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp
index 9d8781b..d35ecb6 100644
--- a/src/gui/graphicsview/qgraphicsscene.cpp
+++ b/src/gui/graphicsview/qgraphicsscene.cpp
@@ -2356,6 +2356,10 @@ void QGraphicsScene::addItem(QGraphicsItem *item)
// Deliver post-change notification
item->itemChange(QGraphicsItem::ItemSceneHasChanged, newSceneVariant);
+ // Auto-activate the first inactive window if the scene is active.
+ if (d->activationRefCount > 0 && !d->activeWindow && item->isWindow())
+ setActiveWindow(static_cast<QGraphicsWidget *>(item));
+
// Ensure that newly added items that have subfocus set, gain
// focus automatically if there isn't a focus item already.
if (!d->focusItem && item->focusItem())
@@ -3693,6 +3697,13 @@ void QGraphicsScene::keyReleaseEvent(QKeyEvent *keyEvent)
void QGraphicsScene::mousePressEvent(QGraphicsSceneMouseEvent *mouseEvent)
{
Q_D(QGraphicsScene);
+ if (d->mouseGrabberItems.isEmpty()) {
+ // Dispatch hover events
+ QGraphicsSceneHoverEvent hover;
+ _q_hoverFromMouseEvent(&hover, mouseEvent);
+ d->dispatchHoverEvent(&hover);
+ }
+
d->mousePressEventHandler(mouseEvent);
}
diff --git a/src/gui/kernel/qt_cocoa_helpers_mac.mm b/src/gui/kernel/qt_cocoa_helpers_mac.mm
index 1c4177e..3104083 100644
--- a/src/gui/kernel/qt_cocoa_helpers_mac.mm
+++ b/src/gui/kernel/qt_cocoa_helpers_mac.mm
@@ -1211,7 +1211,10 @@ void qt_mac_menu_collapseSeparators(void */*NSMenu **/ theMenu, bool collapse)
if (collapse) {
bool previousIsSeparator = true; // setting to true kills all the separators placed at the top.
NSMenuItem *previousItem = nil;
- for (NSMenuItem *item in [menu itemArray]) {
+
+ NSArray *itemArray = [menu itemArray];
+ for (unsigned int i = 0; i < [itemArray count]; ++i) {
+ NSMenuItem *item = reinterpret_cast<NSMenuItem *>([itemArray objectAtIndex:i]);
if ([item isSeparatorItem]) {
[item setHidden:previousIsSeparator];
}
@@ -1226,7 +1229,9 @@ void qt_mac_menu_collapseSeparators(void */*NSMenu **/ theMenu, bool collapse)
if (previousItem && previousIsSeparator)
[previousItem setHidden:YES];
} else {
- for (NSMenuItem *item in [menu itemArray]) {
+ NSArray *itemArray = [menu itemArray];
+ for (unsigned int i = 0; i < [itemArray count]; ++i) {
+ NSMenuItem *item = reinterpret_cast<NSMenuItem *>([itemArray objectAtIndex:i]);
if (QAction *action = reinterpret_cast<QAction *>([item tag]))
[item setHidden:!action->isVisible()];
}
diff --git a/src/qt3support/sql/q3sqlcursor.cpp b/src/qt3support/sql/q3sqlcursor.cpp
index 6b0c69f..aa6aae2 100644
--- a/src/qt3support/sql/q3sqlcursor.cpp
+++ b/src/qt3support/sql/q3sqlcursor.cpp
@@ -879,7 +879,7 @@ QString Q3SqlCursor::toString(const QString& prefix, QSqlField* field, const QSt
{
QString f;
if (field && driver()) {
- f = (prefix.length() > 0 ? prefix + QLatin1Char('.') : QString()) + field->name();
+ f = (prefix.length() > 0 ? prefix + QLatin1Char('.') : QString()) + driver()->escapeIdentifier(field->name(), QSqlDriver::FieldName);
f += QLatin1Char(' ') + fieldSep + QLatin1Char(' ');
if (field->isNull()) {
f += QLatin1String("NULL");
diff --git a/src/sql/drivers/db2/qsql_db2.cpp b/src/sql/drivers/db2/qsql_db2.cpp
index 474c53d..a32b3aa 100644
--- a/src/sql/drivers/db2/qsql_db2.cpp
+++ b/src/sql/drivers/db2/qsql_db2.cpp
@@ -868,11 +868,13 @@ bool QDB2Result::fetch(int i)
SQL_FETCH_ABSOLUTE,
actualIdx);
}
- if (r != SQL_SUCCESS && r != SQL_SUCCESS_WITH_INFO) {
+ if (r != SQL_SUCCESS && r != SQL_SUCCESS_WITH_INFO && r != SQL_NO_DATA) {
setLastError(qMakeError(QCoreApplication::translate("QDB2Result",
"Unable to fetch record %1").arg(i), QSqlError::StatementError, d));
return false;
}
+ else if (r == SQL_NO_DATA)
+ return false;
setAt(i);
return true;
}
diff --git a/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp b/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp
index f7ea4ce..4ef1cdd 100644
--- a/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp
+++ b/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp
@@ -255,6 +255,7 @@ private slots:
void sendEvent();
void inputMethod_data();
void inputMethod();
+ void dispatchHoverOnPress();
// task specific tests below me
void task139710_bspTreeCrash();
@@ -3719,5 +3720,73 @@ void tst_QGraphicsScene::inputMethod()
QCOMPARE(item->queryCalls, 0);
}
+void tst_QGraphicsScene::dispatchHoverOnPress()
+{
+ QGraphicsScene scene;
+ EventTester *tester1 = new EventTester;
+ tester1->setAcceptHoverEvents(true);
+ EventTester *tester2 = new EventTester;
+ tester2->setAcceptHoverEvents(true);
+ tester2->setPos(30, 30);
+ scene.addItem(tester1);
+ scene.addItem(tester2);
+
+ tester1->eventTypes.clear();
+ tester2->eventTypes.clear();
+
+ {
+ QGraphicsSceneMouseEvent me(QEvent::GraphicsSceneMousePress);
+ me.setButton(Qt::LeftButton);
+ me.setButtons(Qt::LeftButton);
+ QGraphicsSceneMouseEvent me2(QEvent::GraphicsSceneMouseRelease);
+ me2.setButton(Qt::LeftButton);
+ qApp->sendEvent(&scene, &me);
+ qApp->sendEvent(&scene, &me2);
+ QCOMPARE(tester1->eventTypes, QList<QEvent::Type>()
+ << QEvent::GraphicsSceneHoverEnter
+ << QEvent::GraphicsSceneHoverMove
+ << QEvent::GrabMouse
+ << QEvent::GraphicsSceneMousePress
+ << QEvent::UngrabMouse);
+ tester1->eventTypes.clear();
+ qApp->sendEvent(&scene, &me);
+ qApp->sendEvent(&scene, &me2);
+ QCOMPARE(tester1->eventTypes, QList<QEvent::Type>()
+ << QEvent::GraphicsSceneHoverMove
+ << QEvent::GrabMouse
+ << QEvent::GraphicsSceneMousePress
+ << QEvent::UngrabMouse);
+ }
+ {
+ QGraphicsSceneMouseEvent me(QEvent::GraphicsSceneMousePress);
+ me.setScenePos(QPointF(30, 30));
+ me.setButton(Qt::LeftButton);
+ me.setButtons(Qt::LeftButton);
+ QGraphicsSceneMouseEvent me2(QEvent::GraphicsSceneMouseRelease);
+ me2.setScenePos(QPointF(30, 30));
+ me2.setButton(Qt::LeftButton);
+ tester1->eventTypes.clear();
+ qApp->sendEvent(&scene, &me);
+ qApp->sendEvent(&scene, &me2);
+ qDebug() << tester1->eventTypes;
+ QCOMPARE(tester1->eventTypes, QList<QEvent::Type>()
+ << QEvent::GraphicsSceneHoverLeave);
+ QCOMPARE(tester2->eventTypes, QList<QEvent::Type>()
+ << QEvent::GraphicsSceneHoverEnter
+ << QEvent::GraphicsSceneHoverMove
+ << QEvent::GrabMouse
+ << QEvent::GraphicsSceneMousePress
+ << QEvent::UngrabMouse);
+ tester2->eventTypes.clear();
+ qApp->sendEvent(&scene, &me);
+ qApp->sendEvent(&scene, &me2);
+ QCOMPARE(tester2->eventTypes, QList<QEvent::Type>()
+ << QEvent::GraphicsSceneHoverMove
+ << QEvent::GrabMouse
+ << QEvent::GraphicsSceneMousePress
+ << QEvent::UngrabMouse);
+ }
+}
+
QTEST_MAIN(tst_QGraphicsScene)
#include "tst_qgraphicsscene.moc"
diff --git a/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp b/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp
index 78d13d3..2cfedb1 100644
--- a/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp
+++ b/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp
@@ -1315,6 +1315,12 @@ void tst_QGraphicsWidget::focusNextPrevChild()
void tst_QGraphicsWidget::verifyFocusChain()
{
QGraphicsScene scene;
+ QGraphicsView view(&scene);
+ view.show();
+#ifdef Q_WS_X11
+ qt_x11_wait_for_window_manager(&view);
+#endif
+ QTest::qWait(250);
{
// parent/child focus
SubQGraphicsWidget *w = new SubQGraphicsWidget(0, Qt::Window);
@@ -1448,6 +1454,11 @@ void tst_QGraphicsWidget::updateFocusChainWhenChildDie()
QGraphicsScene scene;
QGraphicsView view(&scene);
view.show();
+#ifdef Q_WS_X11
+ qt_x11_wait_for_window_manager(&view);
+#endif
+ QTest::qWait(250);
+
// delete item in focus chain with no focus and verify chain
SubQGraphicsWidget *parent = new SubQGraphicsWidget(0, Qt::Window);
SubQGraphicsWidget *w = new SubQGraphicsWidget(0, Qt::Window);
diff --git a/tests/auto/qsqldatabase/tst_databases.h b/tests/auto/qsqldatabase/tst_databases.h
index 9c8c313..8253541 100644
--- a/tests/auto/qsqldatabase/tst_databases.h
+++ b/tests/auto/qsqldatabase/tst_databases.h
@@ -335,7 +335,7 @@ public:
if(table2.compare(table.section('.', -1, -1), Qt::CaseInsensitive) == 0) {
table=db.driver()->escapeIdentifier(table2, QSqlDriver::TableName);
wasDropped = q.exec( "drop table " + table);
- dbtables.removeAll(table);
+ dbtables.removeAll(table2);
}
}
}
@@ -430,8 +430,8 @@ public:
return "IDENTITY";
/* if ( db.driverName().startsWith( "QPSQL" ) )
return "SERIAL";*/
- if ( db.driverName().startsWith( "QDB2" ) )
- return "GENERATED BY DEFAULT AS IDENTITY";
+// if ( db.driverName().startsWith( "QDB2" ) )
+// return "GENERATED BY DEFAULT AS IDENTITY";
return QString();
}
@@ -483,6 +483,10 @@ public:
{
return db.driverName().startsWith("QMYSQL") || (db.driverName().startsWith("QODBC") && db.databaseName().contains("MySQL") );
}
+ static bool isDB2( QSqlDatabase db )
+ {
+ return db.driverName().startsWith("QDB2") || (db.driverName().startsWith("QODBC") && db.databaseName().contains("db2") );
+ }
// -1 on fail, else Oracle version
static int getOraVersion( QSqlDatabase db )
diff --git a/tools/qmlviewer/qmlviewer.cpp b/tools/qmlviewer/qmlviewer.cpp
index f20e8eb..d7d8b82 100644
--- a/tools/qmlviewer/qmlviewer.cpp
+++ b/tools/qmlviewer/qmlviewer.cpp
@@ -130,9 +130,9 @@ void PreviewDeviceSkin::slotPopupMenu()
static struct { const char *name, *args; } ffmpegprofiles[] = {
{"Maximum Quality", "-sameq"},
- {"High Quality", "-qcomp 0.75"},
- {"Medium Quality", "-qcomp 0.5"},
- {"Low Quality", "-qcomp 0.2"},
+ {"High Quality", "-qmax 2"},
+ {"Medium Quality", "-qmax 6"},
+ {"Low Quality", "-qmax 16"},
{"Custom ffmpeg arguments", ""},
{0,0}
};