From 7f243aa938498837e32b318a38d81d9cca4b8fe0 Mon Sep 17 00:00:00 2001 From: Rhys Weatherley Date: Fri, 5 Mar 2010 10:08:52 +1000 Subject: When using OpenVG alpha mask, turn off scissor-as-mask Task-number: QT-3033 Reviewed-by: Julian de Bhal --- src/openvg/qpaintengine_vg.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/openvg/qpaintengine_vg.cpp b/src/openvg/qpaintengine_vg.cpp index da47f06..c46bc27 100644 --- a/src/openvg/qpaintengine_vg.cpp +++ b/src/openvg/qpaintengine_vg.cpp @@ -2062,6 +2062,7 @@ void QVGPaintEngine::clip(const QPainterPath &path, Qt::ClipOperation op) void QVGPaintEnginePrivate::ensureMask (QVGPaintEngine *engine, int width, int height) { + scissorMask = false; if (maskIsSet) { vgMask(VG_INVALID_HANDLE, VG_FILL_MASK, 0, 0, width, height); maskRect = QRect(); -- cgit v0.12 From 2f8141dc3c922619bbe577902c2ef8a9e2195d70 Mon Sep 17 00:00:00 2001 From: Rhys Weatherley Date: Fri, 5 Mar 2010 11:52:10 +1000 Subject: Image drawing in OpenVG was off by 0.5 of a pixel Path transforms need to be adjusted by 0.5 for the difference in OpenVG and Qt co-ordinate systems. Image transforms do not need to be adjusted because OpenVG implicitly adjusts by 0.5. Task-number: QT-2999 Reviewed-by: Sarah Smith --- src/openvg/qpaintengine_vg.cpp | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/src/openvg/qpaintengine_vg.cpp b/src/openvg/qpaintengine_vg.cpp index c46bc27..4a97a6f 100644 --- a/src/openvg/qpaintengine_vg.cpp +++ b/src/openvg/qpaintengine_vg.cpp @@ -516,14 +516,11 @@ void QVGPaintEnginePrivate::updateTransform(QPaintDevice *pdev) 0.0f, -1.0f, 0.0f, 0.5f, devh + 0.5f, 1.0f); - // The image transform is always the full transformation, - // because it can be projective. - imageTransform = transform * viewport; - - // Determine if the transformation is projective. - bool projective = (imageTransform.m13() != 0.0f || - imageTransform.m23() != 0.0f || - imageTransform.m33() != 1.0f); + // Compute the path transform and determine if it is projective. + pathTransform = transform * viewport; + bool projective = (pathTransform.m13() != 0.0f || + pathTransform.m23() != 0.0f || + pathTransform.m33() != 1.0f); if (projective) { // The engine cannot do projective path transforms for us, // so we will have to convert the co-ordinates ourselves. @@ -531,11 +528,19 @@ void QVGPaintEnginePrivate::updateTransform(QPaintDevice *pdev) pathTransform = viewport; simpleTransform = false; } else { - pathTransform = imageTransform; simpleTransform = true; } pathTransformSet = false; + // The image transform is always the full transformation, + // because it can be projective. It also does not need the + // (0.5, -0.5) translation because vgDrawImage() implicitly + // adds 0.5 to each co-ordinate. + QTransform viewport2(1.0f, 0.0f, 0.0f, + 0.0f, -1.0f, 0.0f, + 0.0f, devh, 1.0f); + imageTransform = transform * viewport2; + // Calculate the scaling factor to use for turning cosmetic pens // into ordinary non-cosmetic pens. qt_scaleForTransform(transform, &penScale); -- cgit v0.12 From 57c847ed2c0b4116ea791828c41db5edc40fe2f2 Mon Sep 17 00:00:00 2001 From: Rhys Weatherley Date: Fri, 5 Mar 2010 12:39:17 +1000 Subject: Make the star example recreate its path if the VG context is destroyed. Task-number: QT-2809 Reviewed-by: trustme --- examples/openvg/star/starwidget.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/examples/openvg/star/starwidget.cpp b/examples/openvg/star/starwidget.cpp index bde0719..794ede9 100644 --- a/examples/openvg/star/starwidget.cpp +++ b/examples/openvg/star/starwidget.cpp @@ -93,8 +93,9 @@ void StarWidget::paintEvent(QPaintEvent *) // and prepare to perform raw OpenVG calls. painter.beginNativePainting(); - // Cache the path if we haven't already. - if (path == VG_INVALID_HANDLE) { + // Cache the path if we haven't already or if the path has + // become invalid because the window's context has changed. + if (path == VG_INVALID_HANDLE || !vgGetPathCapabilities(path)) { path = vgCreatePath(VG_PATH_FORMAT_STANDARD, VG_PATH_DATATYPE_F, 1.0f, // scale -- cgit v0.12 From 3e6a330d2aa6f139347fe29947721368a5186cc3 Mon Sep 17 00:00:00 2001 From: Bill King Date: Fri, 5 Mar 2010 13:09:08 +1000 Subject: Update documentation with warning about setForwardOnly Task-number: QTBUG-8752 --- src/sql/kernel/qsqlquery.cpp | 3 +++ src/sql/kernel/qsqlresult.cpp | 3 +++ 2 files changed, 6 insertions(+) diff --git a/src/sql/kernel/qsqlquery.cpp b/src/sql/kernel/qsqlquery.cpp index 430cf1a..f253c82 100644 --- a/src/sql/kernel/qsqlquery.cpp +++ b/src/sql/kernel/qsqlquery.cpp @@ -822,6 +822,9 @@ bool QSqlQuery::isForwardOnly() const scrollable. isForwardOnly() will always return the correct status of the result set. + \note Calling setForwardOnly after execution of the query will result + in unexpected results at best, and crashes at worst. + \sa isForwardOnly(), next(), seek(), QSqlResult::setForwardOnly() */ void QSqlQuery::setForwardOnly(bool forward) diff --git a/src/sql/kernel/qsqlresult.cpp b/src/sql/kernel/qsqlresult.cpp index 0c0c31c..6382b42 100644 --- a/src/sql/kernel/qsqlresult.cpp +++ b/src/sql/kernel/qsqlresult.cpp @@ -564,6 +564,9 @@ bool QSqlResult::isForwardOnly() const scrollable. isForwardOnly() will always return the correct status of the result set. + \note Calling setForwardOnly after execution of the query will result + in unexpected results at best, and crashes at worst. + \sa isForwardOnly(), fetchNext(), QSqlQuery::setForwardOnly() */ void QSqlResult::setForwardOnly(bool forward) -- cgit v0.12 From b837e7024afcf4597082998f97dcc663c13c6380 Mon Sep 17 00:00:00 2001 From: Janne Anttila Date: Thu, 4 Mar 2010 15:45:33 +0200 Subject: Fixed crash in Symbian when having empty QMenu in menubar. Typically cascade menus in Symbian/S60 are created from resources. When cascade menus are defined in resources the RestoreMenuL is responsible for instantiating the cascade menu item array and items. In Qt for Symbian the menus need to be created dynamically from QActions, that's why RestoreMenuL is reimplemeted in Qt for Symbian to dynamically init the menu pane content. Adding a first dynamic item to cascase menu pane creates the CEikMenuPane internal item array. In case where empty QMenu was added to QMenubar, the item array for cascade menupane was never constructed. Then later on CEikMenuPane code assumes that item array exist. To avoid access violation crash we now create the item array manually when building submenu. Task-number: QTBUG-4897 Reviewed-by: Jason Barron --- src/gui/widgets/qmenu_symbian.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/gui/widgets/qmenu_symbian.cpp b/src/gui/widgets/qmenu_symbian.cpp index eae97a6..e46688c 100644 --- a/src/gui/widgets/qmenu_symbian.cpp +++ b/src/gui/widgets/qmenu_symbian.cpp @@ -256,6 +256,14 @@ void qt_symbian_show_submenu( CEikMenuPane* menuPane, int id) { SymbianMenuItem* menu = qt_symbian_find_menu(id, symbianMenus); if (menu) { + // Normally first AddMenuItemL call for menuPane will create the item array. + // However if we don't have any items, we still need the item array. Otherwise + // menupane will crash. That's why we create item array here manually, and + // AddMenuItemL will then use the existing array. + CEikMenuPane::CItemArray* itemArray = q_check_ptr(new CEikMenuPane::CItemArray); + menuPane->SetItemArray(itemArray); + menuPane->SetItemArrayOwnedExternally(EFalse); + for (int i = 0; i < menu->children.count(); ++i) QT_TRAP_THROWING(menuPane->AddMenuItemL(menu->children.at(i)->menuItemData)); } -- cgit v0.12 From 46d5f85a03bd87708152baba2674f2e5f36afe22 Mon Sep 17 00:00:00 2001 From: Bill King Date: Fri, 5 Mar 2010 16:53:54 +1000 Subject: Fixes: Mysql truncation of integer values + some autotest cleanup Task-number: QTBUG-5765 --- src/sql/drivers/mysql/qsql_mysql.cpp | 17 ++++++ tests/auto/qsqlquery/tst_qsqlquery.cpp | 101 ++++++++++++++++++++++++++++----- 2 files changed, 103 insertions(+), 15 deletions(-) diff --git a/src/sql/drivers/mysql/qsql_mysql.cpp b/src/sql/drivers/mysql/qsql_mysql.cpp index c0f866e..2261887 100644 --- a/src/sql/drivers/mysql/qsql_mysql.cpp +++ b/src/sql/drivers/mysql/qsql_mysql.cpp @@ -320,6 +320,16 @@ static bool qIsBlob(int t) || t == MYSQL_TYPE_LONG_BLOB; } +static bool qIsInteger(int t) +{ + return t == MYSQL_TYPE_TINY + || t == MYSQL_TYPE_SHORT + || t == MYSQL_TYPE_LONG + || t == MYSQL_TYPE_LONGLONG + || t == MYSQL_TYPE_INT24; +} + + void QMYSQLResultPrivate::bindBlobs() { int i; @@ -368,6 +378,13 @@ bool QMYSQLResultPrivate::bindInValues() fieldInfo->length = 0; hasBlobs = true; } else { + // fieldInfo->length specifies the display width, which may be too + // small to hold valid integer values (see + // http://dev.mysql.com/doc/refman/5.0/en/numeric-types.html ), so + // always use the MAX_BIGINT_WIDTH for integer types + if (qIsInteger(fieldInfo->type)) { + fieldInfo->length = MAX_BIGINT_WIDTH; + } fieldInfo->type = MYSQL_TYPE_STRING; } bind = &inBinds[i]; diff --git a/tests/auto/qsqlquery/tst_qsqlquery.cpp b/tests/auto/qsqlquery/tst_qsqlquery.cpp index 41b9734..5339132 100644 --- a/tests/auto/qsqlquery/tst_qsqlquery.cpp +++ b/tests/auto/qsqlquery/tst_qsqlquery.cpp @@ -205,6 +205,13 @@ private slots: void QTBUG_6618(); void QTBUG_6852_data() { generic_data("QMYSQL"); } void QTBUG_6852(); + void QTBUG_5765_data() { generic_data("QMYSQL"); } + void QTBUG_5765(); + +#if 0 + void benchmark_data() { generic_data(); } + void benchmark(); +#endif private: // returns all database connections @@ -309,7 +316,14 @@ void tst_QSqlQuery::dropTestTables( QSqlDatabase db ) << qTableName( "blobstest" ) << qTableName( "oraRowId" ) << qTableName( "qtest_batch" ) - << qTableName(QLatin1String("bug6421")).toUpper(); + << qTableName("bug6421").toUpper() + << qTableName("bug5765") + << qTableName("bug6852") + << qTableName( "qtest_lockedtable" ) + << qTableName( "Planet" ) + << qTableName( "task_250026" ) + << qTableName( "task_234422" ) + << qTableName("test141895"); if ( db.driverName().startsWith("QPSQL") ) tablenames << qTableName("task_233829"); @@ -320,19 +334,11 @@ void tst_QSqlQuery::dropTestTables( QSqlDatabase db ) if ( tst_Databases::isSqlServer( db ) || db.driverName().startsWith( "QOCI" ) ) tablenames << qTableName( "qtest_longstr" ); - tablenames << qTableName( "qtest_lockedtable" ); - - tablenames << qTableName( "Planet" ); + if (tst_Databases::isSqlServer( db )) + db.exec("DROP PROCEDURE " + qTableName("test141895_proc")); - tablenames << qTableName( "task_250026" ); - tablenames << qTableName( "task_234422" ); - - if (tst_Databases::isSqlServer( db )) { - QSqlQuery q( db ); - q.exec("DROP PROCEDURE " + qTableName("test141895_proc")); - } - - tablenames << qTableName("test141895"); + if (tst_Databases::isMySQL( db )) + db.exec("DROP PROCEDURE IF EXISTS "+qTableName("bug6852_proc")); tst_Databases::safeDropTables( db, tablenames ); @@ -2996,10 +3002,9 @@ void tst_QSqlQuery::QTBUG_6852() QSKIP( "Test requires MySQL >= 5.0", SkipSingle ); QSqlQuery q(db); - QString tableName(qTableName(QLatin1String("bug6421"))), procName(qTableName(QLatin1String("bug6421_proc"))); + QString tableName(qTableName(QLatin1String("bug6852"))), procName(qTableName(QLatin1String("bug6852_proc"))); QVERIFY_SQL(q, exec("DROP PROCEDURE IF EXISTS "+procName)); - tst_Databases::safeDropTable(db, tableName); QVERIFY_SQL(q, exec("CREATE TABLE "+tableName+"(\n" "MainKey INT NOT NULL,\n" "OtherTextCol VARCHAR(45) NOT NULL,\n" @@ -3022,6 +3027,72 @@ void tst_QSqlQuery::QTBUG_6852() QCOMPARE(q.value(1).toString(), QLatin1String("Disabled")); } +void tst_QSqlQuery::QTBUG_5765() +{ + QFETCH( QString, dbName ); + QSqlDatabase db = QSqlDatabase::database( dbName ); + CHECK_DATABASE( db ); + if ( tst_Databases::getMySqlVersion( db ).section( QChar('.'), 0, 1 ).toFloat()<4.1 ) + QSKIP( "Test requires MySQL >= 4.1", SkipSingle ); + + QSqlQuery q(db); + QString tableName(qTableName(QLatin1String("bug5765"))); + + QVERIFY_SQL(q, exec("CREATE TABLE "+tableName+"(testval TINYINT(1) DEFAULT 0)")); + q.prepare("INSERT INTO "+tableName+" SET testval = :VALUE"); + q.bindValue(":VALUE", 1); + QVERIFY_SQL(q, exec()); + q.bindValue(":VALUE", 12); + QVERIFY_SQL(q, exec()); + q.bindValue(":VALUE", 123); + QVERIFY_SQL(q, exec()); + QString sql="select testval from "+tableName; + QVERIFY_SQL(q, exec(sql)); + QVERIFY_SQL(q, next()); + QCOMPARE(q.value(0).toInt(), 1); + QVERIFY_SQL(q, next()); + QCOMPARE(q.value(0).toInt(), 12); + QVERIFY_SQL(q, next()); + QCOMPARE(q.value(0).toInt(), 123); + QVERIFY_SQL(q, prepare(sql)); + QVERIFY_SQL(q, exec()); + QVERIFY_SQL(q, next()); + QCOMPARE(q.value(0).toInt(), 1); + QVERIFY_SQL(q, next()); + QCOMPARE(q.value(0).toInt(), 12); + QVERIFY_SQL(q, next()); + QCOMPARE(q.value(0).toInt(), 123); +} + +#if 0 +void tst_QSqlQuery::benchmark() +{ + QFETCH( QString, dbName ); + QSqlDatabase db = QSqlDatabase::database( dbName ); + CHECK_DATABASE( db ); + if ( tst_Databases::getMySqlVersion( db ).section( QChar('.'), 0, 0 ).toInt()<5 ) + QSKIP( "Test requires MySQL >= 5.0", SkipSingle ); + + QSqlQuery q(db); + QString tableName(qTableName(QLatin1String("benchmark"))); + + tst_Databases::safeDropTable( db, tableName ); + + QVERIFY_SQL(q, exec("CREATE TABLE "+tableName+"(\n" + "MainKey INT NOT NULL,\n" + "OtherTextCol VARCHAR(45) NOT NULL,\n" + "PRIMARY KEY(`MainKey`))")); + + int i=1; + + QBENCHMARK { + QVERIFY_SQL(q, exec("INSERT INTO "+tableName+" VALUES("+QString::number(i)+", \"Value"+QString::number(i)+"\")")); + i++; + } + + tst_Databases::safeDropTable( db, tableName ); +} +#endif QTEST_MAIN( tst_QSqlQuery ) #include "tst_qsqlquery.moc" -- cgit v0.12 From 92c42901344ae654d8bc102e566d47d735cb3954 Mon Sep 17 00:00:00 2001 From: Janne Anttila Date: Wed, 3 Mar 2010 16:15:22 +0200 Subject: Tab to space fixes to qdilaog.cpp Reviewed-By: TrustMe --- src/gui/dialogs/qdialog.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/gui/dialogs/qdialog.cpp b/src/gui/dialogs/qdialog.cpp index 9ff2ad8..d86d63e 100644 --- a/src/gui/dialogs/qdialog.cpp +++ b/src/gui/dialogs/qdialog.cpp @@ -807,11 +807,11 @@ void QDialog::setVisible(bool visible) void QDialog::showEvent(QShowEvent *event) { if (!event->spontaneous() && !testAttribute(Qt::WA_Moved)) { - Qt::WindowStates state = windowState(); + Qt::WindowStates state = windowState(); adjustPosition(parentWidget()); setAttribute(Qt::WA_Moved, false); // not really an explicit position - if (state != windowState()) - setWindowState(state); + if (state != windowState()) + setWindowState(state); } } -- cgit v0.12 From aff7468baf9a27fad9fa8a180b90d2a0db8b8c10 Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Fri, 5 Mar 2010 09:09:56 +0100 Subject: Updated WebKit from /home/shausman/src/webkit/trunk to qtwebkit/qtwebkit-4.6 ( f3110d2f94c825477afac054ed448e45d47f5670 ) Changes in WebKit/qt since the last update: ++ b/WebKit/qt/ChangeLog 2010-03-04 Simon Hausmann Reviewed by Kenneth Rohde Christiansen. [Qt] qwebelement.h does not include QtCore headers correctly https://bugs.webkit.org/show_bug.cgi?id=35748 The header files of QtCore must be included as QtCore/foo.h. See also http://bugreports.qt.nokia.com/browse/QTBUG-8661 * Api/qwebelement.h: --- src/3rdparty/webkit/VERSION | 2 +- src/3rdparty/webkit/WebCore/WebCore.pro | 2 +- src/3rdparty/webkit/WebCore/platform/qt/PopupMenuQt.cpp | 2 +- src/3rdparty/webkit/WebKit/qt/Api/qwebelement.h | 10 +++++----- src/3rdparty/webkit/WebKit/qt/ChangeLog | 13 +++++++++++++ 5 files changed, 21 insertions(+), 8 deletions(-) diff --git a/src/3rdparty/webkit/VERSION b/src/3rdparty/webkit/VERSION index cc0e04f..6a2e75f 100644 --- a/src/3rdparty/webkit/VERSION +++ b/src/3rdparty/webkit/VERSION @@ -8,4 +8,4 @@ The commit imported was from the and has the sha1 checksum - ffae5e11181a3961193fa21ea405851cad714d4b + f3110d2f94c825477afac054ed448e45d47f5670 diff --git a/src/3rdparty/webkit/WebCore/WebCore.pro b/src/3rdparty/webkit/WebCore/WebCore.pro index c9b622a..5654a18 100644 --- a/src/3rdparty/webkit/WebCore/WebCore.pro +++ b/src/3rdparty/webkit/WebCore/WebCore.pro @@ -26,7 +26,7 @@ symbian: { # RO text (code) section in qtwebkit.dll exceeds allocated space for gcce udeb target. # Move RW-section base address to start from 0xE00000 instead of the toolchain default 0x400000. - QMAKE_LFLAGS.ARMCC += --rw-base 0xE00000 + MMP_RULES += "LINKEROPTION armcc --rw-base 0xE00000" } include($$PWD/../WebKit.pri) diff --git a/src/3rdparty/webkit/WebCore/platform/qt/PopupMenuQt.cpp b/src/3rdparty/webkit/WebCore/platform/qt/PopupMenuQt.cpp index 714cac9..d13c9a9 100644 --- a/src/3rdparty/webkit/WebCore/platform/qt/PopupMenuQt.cpp +++ b/src/3rdparty/webkit/WebCore/platform/qt/PopupMenuQt.cpp @@ -39,7 +39,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebelement.h b/src/3rdparty/webkit/WebKit/qt/Api/qwebelement.h index 3833070..13c341c 100644 --- a/src/3rdparty/webkit/WebKit/qt/Api/qwebelement.h +++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebelement.h @@ -20,11 +20,11 @@ #ifndef QWEBELEMENT_H #define QWEBELEMENT_H -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include #include "qwebkitglobal.h" namespace WebCore { diff --git a/src/3rdparty/webkit/WebKit/qt/ChangeLog b/src/3rdparty/webkit/WebKit/qt/ChangeLog index 1026ac5..e54c176 100644 --- a/src/3rdparty/webkit/WebKit/qt/ChangeLog +++ b/src/3rdparty/webkit/WebKit/qt/ChangeLog @@ -1,3 +1,16 @@ +2010-03-04 Simon Hausmann + + Reviewed by Kenneth Rohde Christiansen. + + [Qt] qwebelement.h does not include QtCore headers correctly + https://bugs.webkit.org/show_bug.cgi?id=35748 + + The header files of QtCore must be included as QtCore/foo.h. + + See also http://bugreports.qt.nokia.com/browse/QTBUG-8661 + + * Api/qwebelement.h: + 2010-01-28 Kenneth Rohde Christiansen Reviewed by Simon Hausmann. -- cgit v0.12 From 0f89d7ef7b5e961cfc6ee7960ad6bf07eff71691 Mon Sep 17 00:00:00 2001 From: Gabriel de Dietrich Date: Thu, 4 Mar 2010 17:00:46 +0100 Subject: Wrong dirty region after row selection in right-to-left mode in QTableView When computing the region from the selection range, we didn't take care of the actual position of the cells, which is reverted when in RtoL mode. Also gets fixed a 2-pixel error introduced in commit 718905c097a7f3bbf9805a2561cd855a0b2d8f59, and that was responsible for (potentialy) painting more cells than needed. Auto-test included. Reviewed-by: Olivier Task-number: QTBUG-7774 --- src/gui/itemviews/qtableview.cpp | 14 +++++++++++--- tests/auto/qtableview/tst_qtableview.cpp | 26 ++++++++++++++++++++++++++ 2 files changed, 37 insertions(+), 3 deletions(-) diff --git a/src/gui/itemviews/qtableview.cpp b/src/gui/itemviews/qtableview.cpp index 3111896..cf1b542 100644 --- a/src/gui/itemviews/qtableview.cpp +++ b/src/gui/itemviews/qtableview.cpp @@ -1908,6 +1908,7 @@ QRegion QTableView::visualRegionForSelection(const QItemSelection &selection) co width, rowHeight(r))); } } else { // nothing moved + const int gridAdjust = showGrid() ? 1 : 0; for (int i = 0; i < selection.count(); ++i) { QItemSelectionRange range = selection.at(i); if (range.parent() != d->root || !range.isValid()) @@ -1916,9 +1917,16 @@ QRegion QTableView::visualRegionForSelection(const QItemSelection &selection) co const int rtop = rowViewportPosition(range.top()); const int rbottom = rowViewportPosition(range.bottom()) + rowHeight(range.bottom()); - const int rleft = columnViewportPosition(range.left()); - const int rright = columnViewportPosition(range.right()) + columnWidth(range.right()); - selectionRegion += QRect(QPoint(rleft, rtop), QPoint(rright, rbottom)); + int rleft; + int rright; + if (isLeftToRight()) { + rleft = columnViewportPosition(range.left()); + rright = columnViewportPosition(range.right()) + columnWidth(range.right()); + } else { + rleft = columnViewportPosition(range.right()); + rright = columnViewportPosition(range.left()) + columnWidth(range.left()); + } + selectionRegion += QRect(QPoint(rleft, rtop), QPoint(rright - 1 - gridAdjust, rbottom - 1 - gridAdjust)); if (d->hasSpans()) { foreach (QSpanCollection::Span *s, d->spans.spansInRect(range.left(), range.top(), range.width(), range.height())) { diff --git a/tests/auto/qtableview/tst_qtableview.cpp b/tests/auto/qtableview/tst_qtableview.cpp index a5cbbd4..35fba52 100644 --- a/tests/auto/qtableview/tst_qtableview.cpp +++ b/tests/auto/qtableview/tst_qtableview.cpp @@ -200,6 +200,7 @@ private slots: void taskQTBUG_4516_clickOnRichTextLabel(); void taskQTBUG_5237_wheelEventOnHeader(); void taskQTBUG_8585_crashForNoGoodReason(); + void taskQTBUG_7774_RtoLVisualRegionForSelection(); void mouseWheel_data(); void mouseWheel(); @@ -3994,5 +3995,30 @@ void tst_QTableView::taskQTBUG_8585_crashForNoGoodReason() } +class TableView7774 : public QTableView +{ +public: + QRegion visualRegionForSelection(const QItemSelection &selection) const + { + return QTableView::visualRegionForSelection(selection); + } +}; + +void tst_QTableView::taskQTBUG_7774_RtoLVisualRegionForSelection() +{ + TableView7774 view; + QStandardItemModel model(5,5); + view.setModel(&model); + view.setLayoutDirection(Qt::RightToLeft); + view.show(); + QTest::qWaitForWindowShown(&view); + + QItemSelectionRange range(model.index(2, 0), model.index(2, model.columnCount() - 1)); + QItemSelection selection; + selection << range; + QRegion region = view.visualRegionForSelection(selection); + QCOMPARE(region.rects().at(0), view.visualRect(range.topLeft()) | view.visualRect(range.bottomRight())); +} + QTEST_MAIN(tst_QTableView) #include "tst_qtableview.moc" -- cgit v0.12 From 68eea46d309ff82e45c243a7689013f36454c85b Mon Sep 17 00:00:00 2001 From: Sami Merila Date: Fri, 5 Mar 2010 11:05:54 +0200 Subject: QMessageBox is not stretched to screen width if the content is narrow Currently; If content of QMessageBox in S60 is less than messagebox's softlimit, messagebox is not stretched to screen width. http://bugreports.qt.nokia.com/browse/QTBUG-5539 Fix: Regardless of content width, messagebox is stretched to screen width. Task-number: QTBUG-5539 Reviewed-by: Janne Anttila --- src/gui/dialogs/qmessagebox.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/dialogs/qmessagebox.cpp b/src/gui/dialogs/qmessagebox.cpp index d1b2e3f..bd2df9c 100644 --- a/src/gui/dialogs/qmessagebox.cpp +++ b/src/gui/dialogs/qmessagebox.cpp @@ -314,6 +314,7 @@ void QMessageBoxPrivate::updateSize() } width = hardLimit; } + } #ifdef Q_WS_S60 // in S60 portait messageBoxes should always occupy maximum width if (QApplication::desktop()->size().height() > QApplication::desktop()->size().width()){ @@ -323,7 +324,6 @@ void QMessageBoxPrivate::updateSize() width = qMin(QApplication::desktop()->size().height(), hardLimit); } #endif - } if (informativeLabel) { label->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored); -- cgit v0.12 From a0d7a5cf999fe3adac2b2166085194cf93a4a424 Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Fri, 5 Mar 2010 11:10:57 +0200 Subject: Fixed crash at application exit when QProcess was used in Symbian QProcessManagerMediator and QProcessActive were not properly canceled in their destructors, causing crash when global static QProcessManager was deleted. Task-number: QTBUG-7735 Reviewed-by: Janne Anttila --- src/corelib/io/qprocess_symbian.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/corelib/io/qprocess_symbian.cpp b/src/corelib/io/qprocess_symbian.cpp index 75cde51..e37bdda 100644 --- a/src/corelib/io/qprocess_symbian.cpp +++ b/src/corelib/io/qprocess_symbian.cpp @@ -371,6 +371,7 @@ QProcessActive::QProcessActive() // Called from ProcessManagerThread QProcessActive::~QProcessActive() { + Cancel(); process = NULL; pproc = NULL; } @@ -477,6 +478,7 @@ QProcessManagerMediator::QProcessManagerMediator() // Called from ProcessManagerThread QProcessManagerMediator::~QProcessManagerMediator() { + Cancel(); processManagerThread.Close(); currentCommand = ENoCommand; currentObserver = NULL; -- cgit v0.12 From ab12c1c804ee40931515a0d53e5dc70db373f3bd Mon Sep 17 00:00:00 2001 From: Jani Hautakangas Date: Fri, 5 Mar 2010 11:22:12 +0200 Subject: Fix for QTBUG-8762 QApplication::setGraphicsSystem("raster") crashes. QRasterGraphicsSystem tries to create QRasterPixmapData and QRasterWindowSurface if QApplication::setGraphicsSystem("raster") is used. On Symbian it should create QS60PixmapData and QS60WindowSurface. Task-number: QTBUG-8762 Reviewed-by: Jason Barron --- src/gui/painting/qgraphicssystem_raster.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/gui/painting/qgraphicssystem_raster.cpp b/src/gui/painting/qgraphicssystem_raster.cpp index f90aea0..909508e 100644 --- a/src/gui/painting/qgraphicssystem_raster.cpp +++ b/src/gui/painting/qgraphicssystem_raster.cpp @@ -41,19 +41,32 @@ #include "qgraphicssystem_raster_p.h" +#ifdef Q_OS_SYMBIAN +#include "private/qpixmap_s60_p.h" +#include "private/qwindowsurface_s60_p.h" +#else #include "private/qpixmap_raster_p.h" #include "private/qwindowsurface_raster_p.h" +#endif QT_BEGIN_NAMESPACE QPixmapData *QRasterGraphicsSystem::createPixmapData(QPixmapData::PixelType type) const { +#ifdef Q_OS_SYMBIAN + return new QS60PixmapData(type); +#else return new QRasterPixmapData(type); +#endif } QWindowSurface *QRasterGraphicsSystem::createWindowSurface(QWidget *widget) const { +#ifdef Q_OS_SYMBIAN + return new QS60WindowSurface(widget); +#else return new QRasterWindowSurface(widget); +#endif } QT_END_NAMESPACE -- cgit v0.12 From d80b0e347bb01d039c0104e857674bb2cf0adc0f Mon Sep 17 00:00:00 2001 From: Sami Merila Date: Fri, 5 Mar 2010 11:48:35 +0200 Subject: QS60Style ignores widget palette when drawing highlighted widget text Currently: QS60Style does not polish widgets with highlight colors. Instead it fetches color information from native theme side and uses that color for drawing the text. http://bugreports.qt.nokia.com/browse/QTBUG-8704 Fix: All widgets with highlighted text (lists, tables, headers, tabs, radiobuttons and checkboxes) polish their palette. This palette value is then used in the drawing code. Earlier it was not possible for developers to define their own highlight text color, now it is possible. Task-number: QTBUG-8704 Reviewed-by: Janne Anttila --- src/gui/styles/qs60style.cpp | 48 ++++++++++++++++++++++++++++++++------------ 1 file changed, 35 insertions(+), 13 deletions(-) diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp index 565cc2c..bf5a62e 100644 --- a/src/gui/styles/qs60style.cpp +++ b/src/gui/styles/qs60style.cpp @@ -759,13 +759,29 @@ void QS60StylePrivate::setThemePaletteHash(QPalette *palette) const QApplication::setPalette(widgetPalette, "QMenuBar"); widgetPalette = *palette; + widgetPalette.setColor(QPalette::Text, + s60Color(QS60StyleEnums::CL_QsnTextColors, 22, 0)); + widgetPalette.setColor(QPalette::HighlightedText, + s60Color(QS60StyleEnums::CL_QsnTextColors, 11, 0)); + QApplication::setPalette(widgetPalette, "QMenu"); + widgetPalette = *palette; + widgetPalette.setColor(QPalette::WindowText, s60Color(QS60StyleEnums::CL_QsnTextColors, 4, 0)); + widgetPalette.setColor(QPalette::HighlightedText, + s60Color(QS60StyleEnums::CL_QsnTextColors, 3, 0)); QApplication::setPalette(widgetPalette, "QTabBar"); widgetPalette = *palette; + widgetPalette.setColor(QPalette::HighlightedText, + s60Color(QS60StyleEnums::CL_QsnTextColors, 10, 0)); + QApplication::setPalette(widgetPalette, "QListView"); + widgetPalette = *palette; + widgetPalette.setColor(QPalette::Text, s60Color(QS60StyleEnums::CL_QsnTextColors, 22, 0)); + widgetPalette.setColor(QPalette::HighlightedText, + s60Color(QS60StyleEnums::CL_QsnTextColors, 11, 0)); QApplication::setPalette(widgetPalette, "QTableView"); widgetPalette = *palette; @@ -789,6 +805,8 @@ void QS60StylePrivate::setThemePaletteHash(QPalette *palette) const widgetPalette = *palette; widgetPalette.setColor(QPalette::WindowText, s60Color(QS60StyleEnums::CL_QsnTextColors, 7, 0)); + widgetPalette.setColor(QPalette::HighlightedText, + s60Color(QS60StyleEnums::CL_QsnTextColors, 11, 0)); QApplication::setPalette(widgetPalette, "QRadioButton"); QApplication::setPalette(widgetPalette, "QCheckBox"); widgetPalette = *palette; @@ -1241,6 +1259,8 @@ void QS60Style::drawControl(ControlElement element, const QStyleOption *option, case CE_RadioButton: if (const QStyleOptionButton *btn = qstyleoption_cast(option)) { bool isRadio = (element == CE_RadioButton); + QStyleOptionButton subopt = *btn; + // Highlight needs to be drawn first, as it goes "underneath" the text and indicator. if (btn->state & State_HasFocus) { QStyleOptionFocusRect fropt; @@ -1248,8 +1268,10 @@ void QS60Style::drawControl(ControlElement element, const QStyleOption *option, fropt.rect = subElementRect(isRadio ? SE_RadioButtonFocusRect : SE_CheckBoxFocusRect, btn, widget); drawPrimitive(PE_FrameFocusRect, &fropt, painter, widget); + + subopt.palette.setColor(QPalette::Active, QPalette::WindowText, + subopt.palette.highlightedText().color()); } - QStyleOptionButton subopt = *btn; subopt.rect = subElementRect(isRadio ? SE_RadioButtonIndicator : SE_CheckBoxIndicator, btn, widget); @@ -1408,7 +1430,7 @@ void QS60Style::drawControl(ControlElement element, const QStyleOption *option, } else { QCommonStyle::drawPrimitive(PE_PanelItemViewItem, &voptAdj, painter, widget);} // draw the focus rect - if (isSelected | hasFocus) { + if (isSelected || hasFocus ) { QRect highlightRect = option->rect.adjusted(1,1,-1,-1); QAbstractItemView::SelectionBehavior selectionBehavior = itemView ? itemView->selectionBehavior() : QAbstractItemView::SelectItems; @@ -1480,15 +1502,10 @@ void QS60Style::drawControl(ControlElement element, const QStyleOption *option, // draw the text if (!voptAdj.text.isEmpty()) { - if (isSelected) { - if (qobject_cast(widget)) - voptAdj.palette.setColor( - QPalette::Text, QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnTextColors, 11, 0)); - else - voptAdj.palette.setColor( - QPalette::Text, QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnTextColors, 10, 0)); - } - painter->setPen(voptAdj.palette.text().color()); + if (isSelected || hasFocus ) + painter->setPen(voptAdj.palette.highlightedText().color()); + else + painter->setPen(voptAdj.palette.text().color()); d->viewItemDrawText(painter, &voptAdj, textRect); } painter->restore(); @@ -1590,7 +1607,7 @@ void QS60Style::drawControl(ControlElement element, const QStyleOption *option, const bool selected = optionTab.state & State_Selected; if (selected) optionTab.palette.setColor(QPalette::Active, QPalette::WindowText, - QS60StylePrivate::s60Color(QS60StyleEnums::CL_QsnTextColors, 3, option)); + optionTab.palette.highlightedText().color()); const bool verticalTabs = optionTab.shape == QTabBar::RoundedEast || optionTab.shape == QTabBar::RoundedWest @@ -1723,7 +1740,8 @@ void QS60Style::drawControl(ControlElement element, const QStyleOption *option, if (!styleHint(SH_UnderlineShortcut, menuItem, widget)) text_flags |= Qt::TextHideMnemonic; - if ((option->state & State_Selected) && (option->state & State_Enabled)) + const bool selected = (option->state & State_Selected) && (option->state & State_Enabled); + if (selected) QS60StylePrivate::drawSkinElement(QS60StylePrivate::SE_ListHighlight, painter, option->rect, flags); QRect iconRect = subElementRect(SE_ItemViewItemDecoration, &optionMenuItem, widget); @@ -1793,6 +1811,10 @@ void QS60Style::drawControl(ControlElement element, const QStyleOption *option, painter->save(); painter->setOpacity(0.5); } + if (selected) + optionMenuItem.palette.setColor( + QPalette::Active, QPalette::Text, optionMenuItem.palette.highlightedText().color()); + QCommonStyle::drawItemText(painter, textRect, text_flags, optionMenuItem.palette, enabled, optionMenuItem.text, QPalette::Text); -- cgit v0.12 From 3fdad84b40b62979844c2d37d16093a0b67222df Mon Sep 17 00:00:00 2001 From: Carlos Manuel Duclos Vergara Date: Fri, 5 Mar 2010 11:53:39 +0100 Subject: QPrintPreviewDialog number of pages is partially blocked from view in OSX The problem here is caused by the FormLayout. This patch queries the widget for its sizeHint and then forces it to resize to that size. Once that is done, we add the widget to the layout. Code is #ifdef protected so other platforms are not affected by it. Task-number: QTBUG-7760 Reviewed-by: Trond --- src/gui/dialogs/qprintpreviewdialog.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/gui/dialogs/qprintpreviewdialog.cpp b/src/gui/dialogs/qprintpreviewdialog.cpp index 6723b53..f21343e 100644 --- a/src/gui/dialogs/qprintpreviewdialog.cpp +++ b/src/gui/dialogs/qprintpreviewdialog.cpp @@ -273,7 +273,20 @@ void QPrintPreviewDialogPrivate::init(QPrinter *_printer) QWidget *pageEdit = new QWidget(toolbar); QVBoxLayout *vboxLayout = new QVBoxLayout; vboxLayout->setContentsMargins(0, 0, 0, 0); +#ifdef Q_WS_MAC + // We query the widgets about their size and then we fix the size. + // This should do the trick for the laying out part... + QSize pageNumEditSize, pageNumLabelSize; + pageNumEditSize = pageNumEdit->minimumSizeHint(); + pageNumLabelSize = pageNumLabel->minimumSizeHint(); + pageNumEdit->resize(pageNumEditSize); + pageNumLabel->resize(pageNumLabelSize); +#endif QFormLayout *formLayout = new QFormLayout; +#ifdef Q_WS_MAC + // We have to change the growth policy in Mac. + formLayout->setFieldGrowthPolicy(QFormLayout::AllNonFixedFieldsGrow); +#endif formLayout->setWidget(0, QFormLayout::LabelRole, pageNumEdit); formLayout->setWidget(0, QFormLayout::FieldRole, pageNumLabel); vboxLayout->addLayout(formLayout); -- cgit v0.12 From 1a802007ca53aa0bd5fa5e474700660df6edf97b Mon Sep 17 00:00:00 2001 From: ninerider Date: Fri, 5 Mar 2010 13:37:17 +0100 Subject: Compile fix for Windows Mobile and OpenGLES2 The native device is now the default screen device. --- src/gui/egl/qegl_wince.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/gui/egl/qegl_wince.cpp b/src/gui/egl/qegl_wince.cpp index dfef39f..87ec648 100644 --- a/src/gui/egl/qegl_wince.cpp +++ b/src/gui/egl/qegl_wince.cpp @@ -89,9 +89,7 @@ EGLSurface QEglContext::createSurface(QPaintDevice *device, const QEglProperties EGLNativeDisplayType QEglContext::nativeDisplay() { - //HWND win = (static_cast(device))->winId(); - //HDC myDc = GetDC(win); - HDC myDc = GetWindowDC(0); + HDC myDc = GetDC(0); if (!myDc) { qWarning("QEglContext::nativeDisplay(): WinCE display is not open"); -- cgit v0.12 From 4b3b9b792dfe2d25a271f042f23df22e8b9684f6 Mon Sep 17 00:00:00 2001 From: Peter Hartmann Date: Fri, 5 Mar 2010 11:28:32 +0100 Subject: QDom: prevent infinite loop when cloning a DTD we forgot to advance the pointer to the current node. Reviewed-by: Frans Englich Task-number: QTBUG-8398 --- src/xml/dom/qdom.cpp | 1 + tests/auto/qdom/tst_qdom.cpp | 25 +++++++++++++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/src/xml/dom/qdom.cpp b/src/xml/dom/qdom.cpp index 8d9ae4f..0150515 100644 --- a/src/xml/dom/qdom.cpp +++ b/src/xml/dom/qdom.cpp @@ -3487,6 +3487,7 @@ QDomDocumentTypePrivate::QDomDocumentTypePrivate(QDomDocumentTypePrivate* n, boo if (p->isNotation()) // Dont use normal insert function since we would create infinite recursion notations->map.insertMulti(p->nodeName(), p); + p = p->next; } } diff --git a/tests/auto/qdom/tst_qdom.cpp b/tests/auto/qdom/tst_qdom.cpp index d1b2ea5..caf08d6 100644 --- a/tests/auto/qdom/tst_qdom.cpp +++ b/tests/auto/qdom/tst_qdom.cpp @@ -131,6 +131,7 @@ private slots: void setContentWhitespace_data() const; void taskQTBUG4595_dontAssertWhenDocumentSpecifiesUnknownEncoding() const; + void cloneDTD_QTBUG8398() const; void cleanupTestCase() const; @@ -1912,5 +1913,29 @@ void tst_QDom::taskQTBUG4595_dontAssertWhenDocumentSpecifiesUnknownEncoding() co QVERIFY(true); } +void tst_QDom::cloneDTD_QTBUG8398() const +{ + QString dtd("\n" + "\n" + "\n" + "]>\n" + "\n"); + QDomDocument domDocument; + QVERIFY(domDocument.setContent(dtd)); + QDomDocument domDocument2 = domDocument.cloneNode(true).toDocument(); + + // for some reason, our DOM implementation reverts the order of entities + QString expected("\n" + "\n" + "\n" + "]>\n" + "\n"); + QString output; + QTextStream stream(&output); + domDocument2.save(stream, 0); + QCOMPARE(output, expected); +} QTEST_MAIN(tst_QDom) #include "tst_qdom.moc" -- cgit v0.12 From 856f76e44a00a710b1c34eddee5a893a3c0ada6a Mon Sep 17 00:00:00 2001 From: Denis Dzyubenko Date: Fri, 5 Mar 2010 11:08:33 +0100 Subject: Fixed key mappings on X11 Merge request #1742 (6c8c1c5322a26d789165783d7df3e29c672690cb) changed the behavior of one of the keys on X11, this fixes it back and documents that on X11 the key binding is a bit weird - XF86XK_MyComputer is mapped to Qt::Key_Launch0, XF86XK_Launch0 is mapped to Qt::Key_Launch3 and so on. Task-number: QTBUG-7063 Reviewed-by: Marius Storm-Olsen --- src/corelib/global/qnamespace.qdoc | 34 +++++++++++++++++----------------- src/gui/kernel/qkeymapper_x11.cpp | 6 +++--- 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/src/corelib/global/qnamespace.qdoc b/src/corelib/global/qnamespace.qdoc index 6968773..a756565 100644 --- a/src/corelib/global/qnamespace.qdoc +++ b/src/corelib/global/qnamespace.qdoc @@ -1622,22 +1622,22 @@ \value Key_OpenUrl \value Key_LaunchMail \value Key_LaunchMedia - \value Key_Launch0 - \value Key_Launch1 - \value Key_Launch2 - \value Key_Launch3 - \value Key_Launch4 - \value Key_Launch5 - \value Key_Launch6 - \value Key_Launch7 - \value Key_Launch8 - \value Key_Launch9 - \value Key_LaunchA - \value Key_LaunchB - \value Key_LaunchC - \value Key_LaunchD - \value Key_LaunchE - \value Key_LaunchF + \value Key_Launch0 On X11 this key is mapped to "My Computer" (XF86XK_MyComputer) key for legacy reasons. + \value Key_Launch1 On X11 this key is mapped to "Calculator" (XF86XK_Calculator) key for legacy reasons. + \value Key_Launch2 On X11 this key is mapped to XF86XK_Launch0 key for legacy reasons. + \value Key_Launch3 On X11 this key is mapped to XF86XK_Launch1 key for legacy reasons. + \value Key_Launch4 On X11 this key is mapped to XF86XK_Launch2 key for legacy reasons. + \value Key_Launch5 On X11 this key is mapped to XF86XK_Launch3 key for legacy reasons. + \value Key_Launch6 On X11 this key is mapped to XF86XK_Launch4 key for legacy reasons. + \value Key_Launch7 On X11 this key is mapped to XF86XK_Launch5 key for legacy reasons. + \value Key_Launch8 On X11 this key is mapped to XF86XK_Launch6 key for legacy reasons. + \value Key_Launch9 On X11 this key is mapped to XF86XK_Launch7 key for legacy reasons. + \value Key_LaunchA On X11 this key is mapped to XF86XK_Launch8 key for legacy reasons. + \value Key_LaunchB On X11 this key is mapped to XF86XK_Launch9 key for legacy reasons. + \value Key_LaunchC On X11 this key is mapped to XF86XK_LaunchA key for legacy reasons. + \value Key_LaunchD On X11 this key is mapped to XF86XK_LaunchB key for legacy reasons. + \value Key_LaunchE On X11 this key is mapped to XF86XK_LaunchC key for legacy reasons. + \value Key_LaunchF On X11 this key is mapped to XF86XK_LaunchD key for legacy reasons. \value Key_MonBrightnessUp \value Key_MonBrightnessDown \value Key_KeyboardLightOnOff @@ -1663,7 +1663,7 @@ \value Key_ApplicationRight \value Key_Book \value Key_CD - \value Key_Calculator + \value Key_Calculator On X11 this key is not mapped for legacy reasons. Use Qt::Key_Launch1 instead. \value Key_ToDoList \value Key_ClearGrab \value Key_Close diff --git a/src/gui/kernel/qkeymapper_x11.cpp b/src/gui/kernel/qkeymapper_x11.cpp index 4e6c847..b32b626 100644 --- a/src/gui/kernel/qkeymapper_x11.cpp +++ b/src/gui/kernel/qkeymapper_x11.cpp @@ -1073,8 +1073,8 @@ static const unsigned int KeyTbl[] = { XF86XK_AudioNext, Qt::Key_MediaNext, XF86XK_AudioRecord, Qt::Key_MediaRecord, XF86XK_Mail, Qt::Key_LaunchMail, - XF86XK_MyComputer, Qt::Key_Launch0, - XF86XK_Calculator, Qt::Key_Calculator, + XF86XK_MyComputer, Qt::Key_Launch0, // ### Qt 5: remap properly + XF86XK_Calculator, Qt::Key_Launch1, XF86XK_Memo, Qt::Key_Memo, XF86XK_ToDoList, Qt::Key_ToDoList, XF86XK_Calendar, Qt::Key_Calendar, @@ -1172,7 +1172,7 @@ static const unsigned int KeyTbl[] = { XF86XK_Bluetooth, Qt::Key_Bluetooth, XF86XK_Suspend, Qt::Key_Suspend, XF86XK_Hibernate, Qt::Key_Hibernate, - XF86XK_Launch0, Qt::Key_Launch2, + XF86XK_Launch0, Qt::Key_Launch2, // ### Qt 5: remap properly XF86XK_Launch1, Qt::Key_Launch3, XF86XK_Launch2, Qt::Key_Launch4, XF86XK_Launch3, Qt::Key_Launch5, -- cgit v0.12 From 3d51d223bee55011876d12011970a5ad15c4acd0 Mon Sep 17 00:00:00 2001 From: Aleksandar Sasha Babic Date: Fri, 5 Mar 2010 14:43:34 +0100 Subject: If no IAP defined force IAP dialog Using TCommDbConnPref to force IAP dialog when IAP is not defined Reviewed-by: TrustMe --- examples/network/qftp/sym_iap_util.h | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/examples/network/qftp/sym_iap_util.h b/examples/network/qftp/sym_iap_util.h index 41e43a9..445036a 100644 --- a/examples/network/qftp/sym_iap_util.h +++ b/examples/network/qftp/sym_iap_util.h @@ -60,6 +60,7 @@ //#include _LIT(KIapNameSetting, "IAP\\Name"); // text - mandatory +_LIT(KIapTableIdField, "IAP\Id"); _LIT(KIapDialogPref, "IAP\\DialogPref"); // TUnit32 - optional _LIT(KIapService, "IAP\\IAPService"); // TUnit32 - mandatory _LIT(KIapServiceType, "IAP\\IAPServiceType"); // text - mandatory @@ -367,20 +368,25 @@ static QString qt_OfferIapDialog() { CleanupClosePushL(connection); socketServ.Connect(); + + TCommDbConnPref prefs; + prefs.SetDialogPreference(ECommDbDialogPrefPrompt); + connection.Open(socketServ); - connection.Start(); + connection.Start(prefs); connection.GetDesSetting(TPtrC(KIapNameSetting), iapName); - //connection.Stop(); iapName.ZeroTerminate(); QString strIapName((char*)iapName.Ptr()); int error = 0; - if(!qt_SetDefaultIapName(strIapName, error)) { - //printf("failed setdefaultif @ %i with %s and errno = %d \n", __LINE__, strIapName.toUtf8().data(), error); - strIapName = QString(""); + if(!strIapName.isEmpty()) { + if(!qt_SetDefaultIapName(strIapName, error)) { + //printf("failed setdefaultif @ %i with %s and errno = %d \n", __LINE__, strIapName.toUtf8().data(), error); + strIapName = QString(""); + } } CleanupStack::PopAndDestroy(&connection); -- cgit v0.12 From 8428a5e9dbe8f872ba229aad360c8579638479ae Mon Sep 17 00:00:00 2001 From: Jani Hautakangas Date: Fri, 5 Mar 2010 16:40:04 +0200 Subject: Fix for QTBUG-6659 Parent window accepts pointer events wrongly Parent window accepted pointer events even though the child was modal. That was because closing popup didn't restore pointer grab for modal window. Task-number: QTBUG-6659 Reviewed-by: axis --- src/gui/kernel/qapplication_s60.cpp | 3 +++ src/gui/kernel/qwidget_s60.cpp | 6 ++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp index 2a90ba6..395ceca 100644 --- a/src/gui/kernel/qapplication_s60.cpp +++ b/src/gui/kernel/qapplication_s60.cpp @@ -1473,6 +1473,9 @@ void QApplicationPrivate::closePopup(QWidget *popup) QWidget *fw = QApplicationPrivate::active_window ? QApplicationPrivate::active_window->focusWidget() : q_func()->focusWidget(); if (fw) { + if(fw->window()->isModal()) // restore pointer capture for modal window + fw->effectiveWinId()->SetPointerCapture(true); + if (fw != q_func()->focusWidget()) { fw->setFocus(Qt::PopupFocusReason); } else { diff --git a/src/gui/kernel/qwidget_s60.cpp b/src/gui/kernel/qwidget_s60.cpp index 7bbc142..7fb21d2 100644 --- a/src/gui/kernel/qwidget_s60.cpp +++ b/src/gui/kernel/qwidget_s60.cpp @@ -1237,8 +1237,10 @@ void QWidget::releaseMouse() { if (!qt_nograb() && QWidgetPrivate::mouseGrabber == this) { Q_ASSERT(testAttribute(Qt::WA_WState_Created)); - WId id = effectiveWinId(); - id->SetPointerCapture(false); + if(!window()->isModal()) { + WId id = effectiveWinId(); + id->SetPointerCapture(false); + } QWidgetPrivate::mouseGrabber = 0; #ifndef QT_NO_CURSOR QApplication::restoreOverrideCursor(); -- cgit v0.12 From ddaa4643c1ee96c9dfc16b1c247481a240e2e16b Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Fri, 5 Mar 2010 15:59:37 +0100 Subject: fix "using namespace" recursion crash Task-number: QTBUG-8360 --- .../lupdate/testdata/good/namespaces/main.cpp | 60 ++++++++++++++++++++++ .../testdata/good/namespaces/project.ts.result | 24 +++++++++ tools/linguist/lupdate/cpp.cpp | 28 +++++++--- 3 files changed, 104 insertions(+), 8 deletions(-) diff --git a/tests/auto/linguist/lupdate/testdata/good/namespaces/main.cpp b/tests/auto/linguist/lupdate/testdata/good/namespaces/main.cpp index 42cc55b..a5b36ca 100644 --- a/tests/auto/linguist/lupdate/testdata/good/namespaces/main.cpp +++ b/tests/auto/linguist/lupdate/testdata/good/namespaces/main.cpp @@ -135,4 +135,64 @@ Q_OBJECT } }; +// QTBUG-8360 +namespace A { + +void foo() +{ + using namespace A; +} + +void goo() +{ + return QObject::tr("Bla"); +} + +} + + +namespace AA { +namespace B { + +using namespace AA; + +namespace C { + +class Test : public QObject { + Q_OBJECT +}; + +} + +} + +using namespace B; +using namespace C; + +void goo() +{ + AA::Test::tr("howdy?"); +} + +} + + +namespace A1 { +namespace B { + +class Test : public QObject { + Q_OBJECT +}; + +using namespace A1; + +void foo() +{ + B::B::B::Test::tr("yeeee-ha!"); +} + +} +} + + #include "main.moc" diff --git a/tests/auto/linguist/lupdate/testdata/good/namespaces/project.ts.result b/tests/auto/linguist/lupdate/testdata/good/namespaces/project.ts.result index c1a34bd..94df9d3 100644 --- a/tests/auto/linguist/lupdate/testdata/good/namespaces/project.ts.result +++ b/tests/auto/linguist/lupdate/testdata/good/namespaces/project.ts.result @@ -2,6 +2,22 @@ + A1::B::Test + + + yeeee-ha! + + + + + AA::B::C::Test + + + howdy? + + + + Class @@ -79,4 +95,12 @@ + + QObject + + + Bla + + + diff --git a/tools/linguist/lupdate/cpp.cpp b/tools/linguist/lupdate/cpp.cpp index 6bd9108..2d5620e 100644 --- a/tools/linguist/lupdate/cpp.cpp +++ b/tools/linguist/lupdate/cpp.cpp @@ -260,6 +260,8 @@ private: bool qualifyOneCallbackOwn(const Namespace *ns, void *context) const; bool qualifyOneCallbackUsing(const Namespace *ns, void *context) const; bool qualifyOne(const NamespaceList &namespaces, int nsCnt, const HashString &segment, + NamespaceList *resolved, QSet *visitedUsings) const; + bool qualifyOne(const NamespaceList &namespaces, int nsCnt, const HashString &segment, NamespaceList *resolved) const; bool fullyQualify(const NamespaceList &namespaces, int nsCnt, const QList &segments, bool isDeclaration, @@ -1036,15 +1038,16 @@ QStringList CppParser::stringListifySegments(const QList &segments) } struct QualifyOneData { - QualifyOneData(const NamespaceList &ns, int nsc, const HashString &seg, NamespaceList *rslvd) - : namespaces(ns), nsCount(nsc), segment(seg), resolved(rslvd) + QualifyOneData(const NamespaceList &ns, int nsc, const HashString &seg, NamespaceList *rslvd, + QSet *visited) + : namespaces(ns), nsCount(nsc), segment(seg), resolved(rslvd), visitedUsings(visited) {} const NamespaceList &namespaces; int nsCount; const HashString &segment; NamespaceList *resolved; - QSet visitedUsings; + QSet *visitedUsings; }; bool CppParser::qualifyOneCallbackOwn(const Namespace *ns, void *context) const @@ -1078,18 +1081,19 @@ bool CppParser::qualifyOneCallbackUsing(const Namespace *ns, void *context) cons { QualifyOneData *data = (QualifyOneData *)context; foreach (const HashStringList &use, ns->usings) - if (!data->visitedUsings.contains(use)) { - data->visitedUsings.insert(use); - if (qualifyOne(use.value(), use.value().count(), data->segment, data->resolved)) + if (!data->visitedUsings->contains(use)) { + data->visitedUsings->insert(use); + if (qualifyOne(use.value(), use.value().count(), data->segment, data->resolved, + data->visitedUsings)) return true; } return false; } bool CppParser::qualifyOne(const NamespaceList &namespaces, int nsCnt, const HashString &segment, - NamespaceList *resolved) const + NamespaceList *resolved, QSet *visitedUsings) const { - QualifyOneData data(namespaces, nsCnt, segment, resolved); + QualifyOneData data(namespaces, nsCnt, segment, resolved, visitedUsings); if (visitNamespace(namespaces, nsCnt, &CppParser::qualifyOneCallbackOwn, &data)) return true; @@ -1097,6 +1101,14 @@ bool CppParser::qualifyOne(const NamespaceList &namespaces, int nsCnt, const Has return visitNamespace(namespaces, nsCnt, &CppParser::qualifyOneCallbackUsing, &data); } +bool CppParser::qualifyOne(const NamespaceList &namespaces, int nsCnt, const HashString &segment, + NamespaceList *resolved) const +{ + QSet visitedUsings; + + return qualifyOne(namespaces, nsCnt, segment, resolved, &visitedUsings); +} + bool CppParser::fullyQualify(const NamespaceList &namespaces, int nsCnt, const QList &segments, bool isDeclaration, NamespaceList *resolved, QStringList *unresolved) const -- cgit v0.12 From a4a1cfe900ab06ff1f8dbe30d73476937a122582 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Fri, 5 Mar 2010 14:57:01 +0100 Subject: Reset the byte order in the iconv codec after using it. Otherwise, if you try run QString(QChar(0xfffe)).toLocal8Bit() iconv will be left in byte-swapping mode. Reviewed-by: Denis Dzyubenko --- src/corelib/codecs/qiconvcodec.cpp | 41 +++++++++++++++++++++++++++----------- 1 file changed, 29 insertions(+), 12 deletions(-) diff --git a/src/corelib/codecs/qiconvcodec.cpp b/src/corelib/codecs/qiconvcodec.cpp index 0f73d9b..0fcdf96 100644 --- a/src/corelib/codecs/qiconvcodec.cpp +++ b/src/corelib/codecs/qiconvcodec.cpp @@ -299,6 +299,32 @@ QString QIconvCodec::convertToUnicode(const char* chars, int len, ConverterState Q_GLOBAL_STATIC(QThreadStorage, fromUnicodeState) +static bool setByteOrder(iconv_t cd) +{ +#if !defined(NO_BOM) + // give iconv() a BOM + char buf[4]; + ushort bom[] = { QChar::ByteOrderMark }; + + char *outBytes = buf; + char *inBytes = reinterpret_cast(bom); + size_t outBytesLeft = sizeof buf; + size_t inBytesLeft = sizeof bom; + +#if defined(GNU_LIBICONV) + const char **inBytesPtr = const_cast(&inBytes); +#else + char **inBytesPtr = &inBytes; +#endif + + if (iconv(cd, inBytesPtr, &inBytesLeft, &outBytes, &outBytesLeft) == (size_t) -1) { + return false; + } +#endif // NO_BOM + + return true; +} + QByteArray QIconvCodec::convertFromUnicode(const QChar *uc, int len, ConverterState *convState) const { char *inBytes; @@ -325,17 +351,8 @@ QByteArray QIconvCodec::convertFromUnicode(const QChar *uc, int len, ConverterSt IconvState *&state = ts->localData(); if (!state) { state = new IconvState(QIconvCodec::createIconv_t(0, UTF16)); - if (state->cd != reinterpret_cast(-1)) { - size_t outBytesLeft = len + 3; // +3 for the BOM - QByteArray ba(outBytesLeft, Qt::Uninitialized); - outBytes = ba.data(); - -#if !defined(NO_BOM) - // give iconv() a BOM - QChar bom[] = { QChar(QChar::ByteOrderMark) }; - inBytes = reinterpret_cast(bom); - inBytesLeft = sizeof(bom); - if (iconv(state->cd, inBytesPtr, &inBytesLeft, &outBytes, &outBytesLeft) == (size_t) -1) { + if (state->cd == reinterpret_cast(-1)) { + if (!setByteOrder(state->cd)) { perror("QIconvCodec::convertFromUnicode: using ASCII for conversion, iconv failed for BOM"); iconv_close(state->cd); @@ -343,7 +360,6 @@ QByteArray QIconvCodec::convertFromUnicode(const QChar *uc, int len, ConverterSt return QString(uc, len).toAscii(); } -#endif // NO_BOM } } if (state->cd == reinterpret_cast(-1)) { @@ -422,6 +438,7 @@ QByteArray QIconvCodec::convertFromUnicode(const QChar *uc, int len, ConverterSt // reset to initial state iconv(state->cd, 0, &inBytesLeft, 0, &outBytesLeft); + setByteOrder(state->cd); ba.resize(ba.size() - outBytesLeft); -- cgit v0.12 From e0534e6cb81894e1fb69ab5c1855aee09db31ead Mon Sep 17 00:00:00 2001 From: Bernhard Rosenkraenzer Date: Fri, 5 Mar 2010 17:06:36 +0100 Subject: Fix build with Mesa 7.8's EGL implementatioon Without this change, when Mesa 7.8 is used, qtextstream.h (included by qdebug.h) complains that it has to be included before any header that defines Status Merge-request: 483 Reviewed-by: Thiago Macieira --- src/gui/egl/qeglproperties.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/gui/egl/qeglproperties.cpp b/src/gui/egl/qeglproperties.cpp index 236ec37..d0d5de7 100644 --- a/src/gui/egl/qeglproperties.cpp +++ b/src/gui/egl/qeglproperties.cpp @@ -39,13 +39,13 @@ ** ****************************************************************************/ +#include +#include + #include "qeglproperties_p.h" QT_BEGIN_NAMESPACE -#include -#include - #include "qegl_p.h" -- cgit v0.12 From 4a72e2f1994324198d1a2c79382185dcca41a576 Mon Sep 17 00:00:00 2001 From: Anders Bakken Date: Fri, 5 Mar 2010 10:00:01 -0800 Subject: Add some warnings when using DISABLE/WARN in DFB If you specify an operation that is not recognized in QT_DIRECTFB_WARN_ON_RASTERFALLBACKS or QT_DIRECTFB_DISABLE_RASTERFALLBACKS Reviewed-by: muthu --- .../gfxdrivers/directfb/qdirectfbpaintengine.cpp | 23 ++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp index 537baf5..e79dceb 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp +++ b/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp @@ -204,21 +204,36 @@ static void initRasterFallbacksMasks(int *warningMask, int *disableMask) { 0, ALL } }; - const QStringList warning = QString::fromLatin1(qgetenv("QT_DIRECTFB_WARN_ON_RASTERFALLBACKS")).toUpper().split(QLatin1Char('|')); - const QStringList disable = QString::fromLatin1(qgetenv("QT_DIRECTFB_DISABLE_RASTERFALLBACKS")).toUpper().split(QLatin1Char('|')); + QStringList warning = QString::fromLatin1(qgetenv("QT_DIRECTFB_WARN_ON_RASTERFALLBACKS")).toUpper().split(QLatin1Char('|'), + QString::SkipEmptyParts); + QStringList disable = QString::fromLatin1(qgetenv("QT_DIRECTFB_DISABLE_RASTERFALLBACKS")).toUpper().split(QLatin1Char('|'), + QString::SkipEmptyParts); *warningMask = 0; *disableMask = 0; if (!warning.isEmpty() || !disable.isEmpty()) { for (int i=0; operations[i].name; ++i) { const QString name = QString::fromLatin1(operations[i].name); - if (warning.contains(name)) { + int idx = warning.indexOf(name); + if (idx != -1) { *warningMask |= operations[i].operation; + warning.remove(warning.begin() + idx); } - if (disable.contains(name)) { + idx = disable.indexOf(name); + if (idx != -1) { *disableMask |= operations[i].operation; + disable.remove(disable.begin() + idx); } } } + if (!warning.isEmpty()) { + qWarning("QDirectFBPaintEngine QT_DIRECTFB_WARN_ON_RASTERFALLBACKS Unknown operation(s): %s", + qPrintable(warning.join(QLatin1String("|")))); + } + if (!disable.isEmpty()) { + qWarning("QDirectFBPaintEngine QT_DIRECTFB_DISABLE_RASTERFALLBACKS Unknown operation(s): %s", + qPrintable(disable.join(QLatin1String("|")))); + } + } #endif -- cgit v0.12 From 2dd029993b16b8c696de61a0ead5a417d1f778f9 Mon Sep 17 00:00:00 2001 From: Anders Bakken Date: Fri, 5 Mar 2010 10:17:59 -0800 Subject: QDirectFBPaintEngine optimization If you call fillRect(QBrush(QColor())); we should short-circuit before falling back to the raster engine. Reviewed-by: muthu --- src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp index e79dceb..1bd6dce 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp +++ b/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp @@ -805,13 +805,14 @@ void QDirectFBPaintEngine::fillRect(const QRectF &rect, const QBrush &brush) if (d->clipType != QDirectFBPaintEnginePrivate::ComplexClip) { switch (brush.style()) { case Qt::SolidPattern: { + const QColor color = brush.color(); + if (!color.isValid()) + return; + if (d->transformationType & QDirectFBPaintEnginePrivate::Matrix_RectsUnsupported || !(d->compositionModeStatus & QDirectFBPaintEnginePrivate::PorterDuff_Supported)) { break; } - const QColor color = brush.color(); - if (!color.isValid()) - return; d->setDFBColor(color); const QRect r = state()->matrix.mapRect(rect).toRect(); CLIPPED_PAINT(d->surface->FillRectangle(d->surface, r.x(), r.y(), r.width(), r.height())); -- cgit v0.12 From 888e05cc903c4a03a6571bb0e0befb86fd9443d5 Mon Sep 17 00:00:00 2001 From: Anders Bakken Date: Fri, 5 Mar 2010 11:37:04 -0800 Subject: Compile with DirectFB version >= 1.2.0 && < 1.2.9 DSPF_DST was added in 1.2.9, not in 1.2.0 Reviewed-by: muthu --- src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp index 1bd6dce..7dce516 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp +++ b/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp @@ -1005,7 +1005,7 @@ void QDirectFBPaintEnginePrivate::setCompositionMode(QPainter::CompositionMode m case QPainter::CompositionMode_DestinationOut: surface->SetPorterDuff(surface, DSPD_DST_OUT); break; -#if (Q_DIRECTFB_VERSION >= 0x010200) +#if (Q_DIRECTFB_VERSION >= 0x010209) case QPainter::CompositionMode_Destination: surface->SetPorterDuff(surface, DSPD_DST); break; -- cgit v0.12 From 7142fbe52cfca2887cb8ee083d4d91c35ef249f8 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Mon, 8 Mar 2010 03:28:01 +0100 Subject: QTableView: fix navigating with keyboard with spans not scrolling We cannot use isIndexHidden in ScrollTo because that would return true if the index is in a span. Task-number: QTBUG-8777 Reviewed-by: Markus Goetz --- src/gui/itemviews/qtableview.cpp | 2 +- tests/auto/qtableview/tst_qtableview.cpp | 16 +++++++++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/src/gui/itemviews/qtableview.cpp b/src/gui/itemviews/qtableview.cpp index cf1b542..c824a8a 100644 --- a/src/gui/itemviews/qtableview.cpp +++ b/src/gui/itemviews/qtableview.cpp @@ -2554,7 +2554,7 @@ void QTableView::scrollTo(const QModelIndex &index, ScrollHint hint) // check if we really need to do anything if (!d->isIndexValid(index) || (d->model->parent(index) != d->root) - || isIndexHidden(index)) + || isRowHidden(index.row()) || isColumnHidden(index.column())) return; QSpanCollection::Span span; diff --git a/tests/auto/qtableview/tst_qtableview.cpp b/tests/auto/qtableview/tst_qtableview.cpp index 35fba52..54e32218 100644 --- a/tests/auto/qtableview/tst_qtableview.cpp +++ b/tests/auto/qtableview/tst_qtableview.cpp @@ -201,6 +201,7 @@ private slots: void taskQTBUG_5237_wheelEventOnHeader(); void taskQTBUG_8585_crashForNoGoodReason(); void taskQTBUG_7774_RtoLVisualRegionForSelection(); + void taskQTBUG_8777_scrollToSpans(); void mouseWheel_data(); void mouseWheel(); @@ -3994,7 +3995,6 @@ void tst_QTableView::taskQTBUG_8585_crashForNoGoodReason() } } - class TableView7774 : public QTableView { public: @@ -4020,5 +4020,19 @@ void tst_QTableView::taskQTBUG_7774_RtoLVisualRegionForSelection() QCOMPARE(region.rects().at(0), view.visualRect(range.topLeft()) | view.visualRect(range.bottomRight())); } +void tst_QTableView::taskQTBUG_8777_scrollToSpans() +{ + QTableWidget table(75,5); + for (int i=0; i<50; i++) + table.setSpan(2+i, 0, 1, 5); + table.setCurrentCell(0,2); + table.show(); + + for (int i = 0; i < 45; ++i) + QTest::keyClick(&table, Qt::Key_Down); + + QVERIFY(table.verticalScrollBar()->value() > 10); +} + QTEST_MAIN(tst_QTableView) #include "tst_qtableview.moc" -- cgit v0.12 From ff9f3fc24c57254b150c1afba2e5883da8ed2b83 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Mon, 8 Mar 2010 11:52:20 +0100 Subject: Prevent QRegion from crashing on large coordinates. Since we don't clip the x-coordinates that end up in the edge table of the QRegion rasterizer, we need to extend the coordinate range. Task-number: QTBUG-7699 Reviewed-by: Gunnar Sletta --- src/gui/painting/qregion.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gui/painting/qregion.cpp b/src/gui/painting/qregion.cpp index 614d2c0..bea2b6e 100644 --- a/src/gui/painting/qregion.cpp +++ b/src/gui/painting/qregion.cpp @@ -3134,8 +3134,8 @@ SOFTWARE. ************************************************************************/ /* $XFree86: xc/lib/X11/PolyReg.c,v 1.1.1.2.8.2 1998/10/04 15:22:49 hohndel Exp $ */ -#define LARGE_COORDINATE 1000000 -#define SMALL_COORDINATE -LARGE_COORDINATE +#define LARGE_COORDINATE INT_MAX +#define SMALL_COORDINATE INT_MIN /* * InsertEdgeInET -- cgit v0.12 From 41437f55f911b32d17ed153a14eb1b1673f17c86 Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Mon, 8 Mar 2010 14:07:32 +0100 Subject: Fix undocked widgets not being restored correctly as part of the layout Task-number: QTBUG-7921 Reviewed-by: ogoffart --- src/gui/widgets/qdockarealayout.cpp | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/gui/widgets/qdockarealayout.cpp b/src/gui/widgets/qdockarealayout.cpp index 0c39f42..794863b 100644 --- a/src/gui/widgets/qdockarealayout.cpp +++ b/src/gui/widgets/qdockarealayout.cpp @@ -1990,16 +1990,19 @@ bool QDockAreaLayoutInfo::restoreState(QDataStream &stream, QList #ifdef QT_NO_TABBAR const int tabBarShape = 0; #endif - QDockAreaLayoutInfo *info = new QDockAreaLayoutInfo(sep, dockPos, o, - tabBarShape, mainWindow); - QDockAreaLayoutItem item(info); + QDockAreaLayoutItem item(new QDockAreaLayoutInfo(sep, dockPos, o, + tabBarShape, mainWindow)); stream >> item.pos >> item.size >> dummy >> dummy; - if (!info->restoreState(stream, widgets, testing)) + //we need to make sure the element is in the list so the dock widget can eventually be docked correctly + if (!testing) + item_list.append(item); + + //here we need to make sure we change the item in the item_list + QDockAreaLayoutItem &lastItem = testing ? item : item_list.last(); + + if (!lastItem.subinfo->restoreState(stream, widgets, testing)) return false; - if (!testing) { - item_list.append(item); - } } else { return false; } -- cgit v0.12 From b1c6482eaa8edd01077ac79ba390389bf6f8c71f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Trond=20Kjern=C3=A5sen?= Date: Mon, 8 Mar 2010 15:14:18 +0100 Subject: Updated the QCursor docs regarding XOR'ed cursors. XOR'ed cursors under X11 or Mac OS X have never been supported by Qt, and the doc updates done some time ago where not correct. Task-number: related to QTBUG-1838 Reviewed-by: Gunnar --- src/gui/kernel/qcursor.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/gui/kernel/qcursor.cpp b/src/gui/kernel/qcursor.cpp index 0f0470c..6b21d56 100644 --- a/src/gui/kernel/qcursor.cpp +++ b/src/gui/kernel/qcursor.cpp @@ -342,7 +342,8 @@ QCursor::QCursor(const QPixmap &pixmap, int hotX, int hotY) \o B=1 and M=1 gives black. \o B=0 and M=1 gives white. \o B=0 and M=0 gives transparent. - \o B=1 and M=0 gives an XOR'd result. + \o B=1 and M=0 gives an XOR'd result under Windows, undefined + results on all other platforms. \endlist Use the global Qt color Qt::color0 to draw 0-pixels and Qt::color1 to -- cgit v0.12 From 298e91f240a3bc9db9450bf9b1ce7606531853ff Mon Sep 17 00:00:00 2001 From: Markus Goetz Date: Mon, 8 Mar 2010 16:21:56 +0100 Subject: QHostInfo: Compile fix Reviewed-by: TrustMe --- src/network/kernel/qhostinfo.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/network/kernel/qhostinfo.cpp b/src/network/kernel/qhostinfo.cpp index 9092ad6..7150fb7 100644 --- a/src/network/kernel/qhostinfo.cpp +++ b/src/network/kernel/qhostinfo.cpp @@ -639,7 +639,7 @@ void qt_qhostinfo_clear_cache() } } -void Q_NETWORK_EXPORT qt_qhostinfo_enable_cache(bool e) +void Q_AUTOTEST_EXPORT qt_qhostinfo_enable_cache(bool e) { QHostInfoLookupManager* manager = theHostInfoLookupManager(); if (manager) { -- cgit v0.12 From 623e87d880812c848a8b438a2410b2f95cbeca1f Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Mon, 8 Mar 2010 17:18:45 +0100 Subject: remove unneeded function pointer in qmenu_wince.cpp Reviewed-by: mauricek --- src/gui/widgets/qmenu_wince.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/gui/widgets/qmenu_wince.cpp b/src/gui/widgets/qmenu_wince.cpp index 28b6b8b..edef466 100644 --- a/src/gui/widgets/qmenu_wince.cpp +++ b/src/gui/widgets/qmenu_wince.cpp @@ -101,7 +101,6 @@ struct qt_SHMENUBARINFO COLORREF clrBk; }; -typedef int (WINAPI *superfunc)(int, int); typedef BOOL (WINAPI *AygCreateMenuBar)(qt_SHMENUBARINFO*); typedef HRESULT (WINAPI *AygEnableSoftKey)(HWND,UINT,BOOL,BOOL); -- cgit v0.12 From db20aff5bf81a6a935fbb89bf103351dc7a9215d Mon Sep 17 00:00:00 2001 From: Peter Hartmann Date: Wed, 24 Feb 2010 16:45:30 +0100 Subject: QXmlSchema internals: include/import/redefine schemas only once According to the Schema standard, loading a schema needs only be done once for each schema location. Currently, there was a problem with indirect includes (and imports/redefines): a In this scenario, schema a would only remember to have loaded / \ b, but not d, which resulted in an error when c was loading d b c again and the types in d were redefined. | | d d Reviewed-by: Tobias Koenig Task-number: QTBUG-8394 --- src/xmlpatterns/schema/qxsdschemaparser.cpp | 48 ++++++++++++++++++++-- src/xmlpatterns/schema/qxsdschemaparser_p.h | 22 +++++++++- .../files/indirect-datatype.xsd | 6 +++ .../files/indirect-import-a.xsd | 5 +++ .../files/indirect-import-b.xsd | 4 ++ .../files/indirect-import-c.xsd | 4 ++ .../files/indirect-include-a.xsd | 5 +++ .../files/indirect-include-b.xsd | 4 ++ .../files/indirect-include-c.xsd | 4 ++ .../files/indirect-redefine-a.xsd | 5 +++ .../files/indirect-redefine-b.xsd | 4 ++ .../files/indirect-redefine-c.xsd | 4 ++ .../tst_xmlpatternsvalidator.cpp | 15 +++++++ 13 files changed, 124 insertions(+), 6 deletions(-) create mode 100644 tests/auto/xmlpatternsvalidator/files/indirect-datatype.xsd create mode 100644 tests/auto/xmlpatternsvalidator/files/indirect-import-a.xsd create mode 100644 tests/auto/xmlpatternsvalidator/files/indirect-import-b.xsd create mode 100644 tests/auto/xmlpatternsvalidator/files/indirect-import-c.xsd create mode 100644 tests/auto/xmlpatternsvalidator/files/indirect-include-a.xsd create mode 100644 tests/auto/xmlpatternsvalidator/files/indirect-include-b.xsd create mode 100644 tests/auto/xmlpatternsvalidator/files/indirect-include-c.xsd create mode 100644 tests/auto/xmlpatternsvalidator/files/indirect-redefine-a.xsd create mode 100644 tests/auto/xmlpatternsvalidator/files/indirect-redefine-b.xsd create mode 100644 tests/auto/xmlpatternsvalidator/files/indirect-redefine-c.xsd diff --git a/src/xmlpatterns/schema/qxsdschemaparser.cpp b/src/xmlpatterns/schema/qxsdschemaparser.cpp index 6ed28af..fd0b95c 100644 --- a/src/xmlpatterns/schema/qxsdschemaparser.cpp +++ b/src/xmlpatterns/schema/qxsdschemaparser.cpp @@ -264,16 +264,31 @@ XsdSchemaParser::XsdSchemaParser(const XsdSchemaContext::Ptr &context, const Xsd setupBuiltinTypeNames(); } +void XsdSchemaParser::addIncludedSchemas(const NamespaceSet &schemas) +{ + m_includedSchemas += schemas; +} + void XsdSchemaParser::setIncludedSchemas(const NamespaceSet &schemas) { m_includedSchemas = schemas; } +void XsdSchemaParser::addImportedSchemas(const NamespaceSet &schemas) +{ + m_importedSchemas += schemas; +} + void XsdSchemaParser::setImportedSchemas(const NamespaceSet &schemas) { m_importedSchemas = schemas; } +void XsdSchemaParser::addRedefinedSchemas(const NamespaceSet &schemas) +{ + m_redefinedSchemas += schemas; +} + void XsdSchemaParser::setRedefinedSchemas(const NamespaceSet &schemas) { m_redefinedSchemas = schemas; @@ -297,6 +312,7 @@ void XsdSchemaParser::setDocumentURI(const QUrl &uri) // prevent to get included/imported/redefined twice m_includedSchemas.insert(uri); m_importedSchemas.insert(uri); + m_redefinedSchemas.insert(uri); } QUrl XsdSchemaParser::documentURI() const @@ -594,8 +610,14 @@ void XsdSchemaParser::parseInclude() parser.setIncludedSchemas(m_includedSchemas); parser.setImportedSchemas(m_importedSchemas); parser.setRedefinedSchemas(m_redefinedSchemas); - if (!parser.parse(XsdSchemaParser::IncludeParser)) + if (!parser.parse(XsdSchemaParser::IncludeParser)) { return; + } else { + // add indirectly loaded schemas to the list of already loaded ones + addIncludedSchemas(parser.m_includedSchemas); + addImportedSchemas(parser.m_importedSchemas); + addRedefinedSchemas(parser.m_redefinedSchemas); + } } } @@ -684,8 +706,14 @@ void XsdSchemaParser::parseImport() parser.setIncludedSchemas(m_includedSchemas); parser.setImportedSchemas(m_importedSchemas); parser.setRedefinedSchemas(m_redefinedSchemas); - if (!parser.parse(XsdSchemaParser::ImportParser)) + if (!parser.parse(XsdSchemaParser::ImportParser)) { return; + } else { + // add indirectly loaded schemas to the list of already loaded ones + addIncludedSchemas(parser.m_includedSchemas); + addImportedSchemas(parser.m_importedSchemas); + addRedefinedSchemas(parser.m_redefinedSchemas); + } } } } else { @@ -702,8 +730,14 @@ void XsdSchemaParser::parseImport() parser.setIncludedSchemas(m_includedSchemas); parser.setImportedSchemas(m_importedSchemas); parser.setRedefinedSchemas(m_redefinedSchemas); - if (!parser.parse(XsdSchemaParser::ImportParser)) + if (!parser.parse(XsdSchemaParser::ImportParser)) { return; + } else { + // add indirectly loaded schemas to the list of already loaded ones + addIncludedSchemas(parser.m_includedSchemas); + addImportedSchemas(parser.m_importedSchemas); + addRedefinedSchemas(parser.m_redefinedSchemas); + } } } } else { @@ -839,8 +873,14 @@ void XsdSchemaParser::parseRedefine() parser.setIncludedSchemas(m_includedSchemas); parser.setImportedSchemas(m_importedSchemas); parser.setRedefinedSchemas(m_redefinedSchemas); - if (!parser.parse(XsdSchemaParser::RedefineParser)) + if (!parser.parse(XsdSchemaParser::RedefineParser)) { return; + } else { + // add indirectly loaded schemas to the list of already loaded ones + addIncludedSchemas(parser.m_includedSchemas); + addImportedSchemas(parser.m_importedSchemas); + addRedefinedSchemas(parser.m_redefinedSchemas); + } delete reply; } diff --git a/src/xmlpatterns/schema/qxsdschemaparser_p.h b/src/xmlpatterns/schema/qxsdschemaparser_p.h index ad5e9ce..80d44a5 100644 --- a/src/xmlpatterns/schema/qxsdschemaparser_p.h +++ b/src/xmlpatterns/schema/qxsdschemaparser_p.h @@ -120,20 +120,38 @@ namespace QPatternist typedef QSet NamespaceSet; /** + * Adds @p schemas to the list of already included schemas, so the parser + * can detect multiple includes of the same schema. + */ + void addIncludedSchemas(const NamespaceSet &schemas); + + /** * Sets which @p schemas have been included already, so the parser - * can detect circular includes. + * can detect multiple includes of the same schema. */ void setIncludedSchemas(const NamespaceSet &schemas); /** + * Adds @p schemas to the list of already imported schemas, so the parser + * can detect multiple imports of the same schema. + */ + void addImportedSchemas(const NamespaceSet &schemas); + + /** * Sets which @p schemas have been imported already, so the parser * can detect circular imports. */ void setImportedSchemas(const NamespaceSet &schemas); /** + * Adds @p schemas to the list of already redefined schemas, so the parser + * can detect multiple redefines of the same schema. + */ + void addRedefinedSchemas(const NamespaceSet &schemas); + + /** * Sets which @p schemas have been redefined already, so the parser - * can detect circular redefines. + * can detect multiple redefines of the same schema. */ void setRedefinedSchemas(const NamespaceSet &schemas); diff --git a/tests/auto/xmlpatternsvalidator/files/indirect-datatype.xsd b/tests/auto/xmlpatternsvalidator/files/indirect-datatype.xsd new file mode 100644 index 0000000..60f3e4f --- /dev/null +++ b/tests/auto/xmlpatternsvalidator/files/indirect-datatype.xsd @@ -0,0 +1,6 @@ + + + + + + diff --git a/tests/auto/xmlpatternsvalidator/files/indirect-import-a.xsd b/tests/auto/xmlpatternsvalidator/files/indirect-import-a.xsd new file mode 100644 index 0000000..e6da433 --- /dev/null +++ b/tests/auto/xmlpatternsvalidator/files/indirect-import-a.xsd @@ -0,0 +1,5 @@ + + + + + diff --git a/tests/auto/xmlpatternsvalidator/files/indirect-import-b.xsd b/tests/auto/xmlpatternsvalidator/files/indirect-import-b.xsd new file mode 100644 index 0000000..88be377 --- /dev/null +++ b/tests/auto/xmlpatternsvalidator/files/indirect-import-b.xsd @@ -0,0 +1,4 @@ + + + + diff --git a/tests/auto/xmlpatternsvalidator/files/indirect-import-c.xsd b/tests/auto/xmlpatternsvalidator/files/indirect-import-c.xsd new file mode 100644 index 0000000..88be377 --- /dev/null +++ b/tests/auto/xmlpatternsvalidator/files/indirect-import-c.xsd @@ -0,0 +1,4 @@ + + + + diff --git a/tests/auto/xmlpatternsvalidator/files/indirect-include-a.xsd b/tests/auto/xmlpatternsvalidator/files/indirect-include-a.xsd new file mode 100644 index 0000000..02ca5c5 --- /dev/null +++ b/tests/auto/xmlpatternsvalidator/files/indirect-include-a.xsd @@ -0,0 +1,5 @@ + + + + + diff --git a/tests/auto/xmlpatternsvalidator/files/indirect-include-b.xsd b/tests/auto/xmlpatternsvalidator/files/indirect-include-b.xsd new file mode 100644 index 0000000..efaba74 --- /dev/null +++ b/tests/auto/xmlpatternsvalidator/files/indirect-include-b.xsd @@ -0,0 +1,4 @@ + + + + diff --git a/tests/auto/xmlpatternsvalidator/files/indirect-include-c.xsd b/tests/auto/xmlpatternsvalidator/files/indirect-include-c.xsd new file mode 100644 index 0000000..efaba74 --- /dev/null +++ b/tests/auto/xmlpatternsvalidator/files/indirect-include-c.xsd @@ -0,0 +1,4 @@ + + + + diff --git a/tests/auto/xmlpatternsvalidator/files/indirect-redefine-a.xsd b/tests/auto/xmlpatternsvalidator/files/indirect-redefine-a.xsd new file mode 100644 index 0000000..4f0804c --- /dev/null +++ b/tests/auto/xmlpatternsvalidator/files/indirect-redefine-a.xsd @@ -0,0 +1,5 @@ + + + + + diff --git a/tests/auto/xmlpatternsvalidator/files/indirect-redefine-b.xsd b/tests/auto/xmlpatternsvalidator/files/indirect-redefine-b.xsd new file mode 100644 index 0000000..019a127 --- /dev/null +++ b/tests/auto/xmlpatternsvalidator/files/indirect-redefine-b.xsd @@ -0,0 +1,4 @@ + + + + diff --git a/tests/auto/xmlpatternsvalidator/files/indirect-redefine-c.xsd b/tests/auto/xmlpatternsvalidator/files/indirect-redefine-c.xsd new file mode 100644 index 0000000..019a127 --- /dev/null +++ b/tests/auto/xmlpatternsvalidator/files/indirect-redefine-c.xsd @@ -0,0 +1,4 @@ + + + + diff --git a/tests/auto/xmlpatternsvalidator/tst_xmlpatternsvalidator.cpp b/tests/auto/xmlpatternsvalidator/tst_xmlpatternsvalidator.cpp index 6d4ed69..7aab47f 100644 --- a/tests/auto/xmlpatternsvalidator/tst_xmlpatternsvalidator.cpp +++ b/tests/auto/xmlpatternsvalidator/tst_xmlpatternsvalidator.cpp @@ -196,6 +196,21 @@ void tst_XmlPatternsValidator::xsdSupport_data() const << 1 << (QStringList() << QLatin1String("files/instance.xml")) << QString(); + + QTest::newRow("A schema with an indirectly included type") + << 0 + << (QStringList() << QLatin1String("files/indirect-include-a.xsd")) + << QString(); + + QTest::newRow("A schema with an indirectly imported type") + << 0 + << (QStringList() << QLatin1String("files/indirect-import-a.xsd")) + << QString(); + + QTest::newRow("A schema with an indirectly redefined type") + << 0 + << (QStringList() << QLatin1String("files/indirect-redefine-a.xsd")) + << QString(); } QTEST_MAIN(tst_XmlPatternsValidator) -- cgit v0.12 From acd2e59f6b414d8bf2236c8059a8cf7f4b54998a Mon Sep 17 00:00:00 2001 From: Anders Bakken Date: Mon, 8 Mar 2010 13:13:27 -0800 Subject: Don't use DirectFB for non-existing pixmaps DirectFB will print a warning for this since the file doesn't exist but we might as well not try when we know the file doesn't exist. Reviewed-by: Donald Carr --- src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp index b5ac67d..4219f6f 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp +++ b/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp @@ -174,6 +174,8 @@ bool QDirectFBPixmapData::hasAlphaChannel(const QImage &img) bool QDirectFBPixmapData::fromFile(const QString &filename, const char *format, Qt::ImageConversionFlags flags) { + if (!QFile::exists(filename)) + return false; if (flags == Qt::AutoColor) { if (filename.startsWith(QLatin1Char(':'))) { // resource QFile file(filename); -- cgit v0.12 From 82a1fc3d05e794d7717006f2152ffa388d8538b8 Mon Sep 17 00:00:00 2001 From: Jason McDonald Date: Tue, 9 Mar 2010 16:08:44 +1000 Subject: Fix obsolete URL's. Task-number: QT-3051 Reviewed-by: Trust Me --- dist/changes-4.5.4 | 10 +++++----- translations/qtconfig_ru.ts | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/dist/changes-4.5.4 b/dist/changes-4.5.4 index abaf4f0..ac91edb 100644 --- a/dist/changes-4.5.4 +++ b/dist/changes-4.5.4 @@ -9,12 +9,12 @@ The Qt version 4.5 series is binary compatible with the 4.4.x series. Applications compiled for 4.4 will continue to run with 4.5. Some of the changes listed in this file include issue tracking numbers -corresponding to tasks in the Task Tracker: +corresponding to tasks in the Qt Bug Tracker, the (now obsolete) Task +Tracker, or the Merge Request queue of the public source repository. - http://www.qtsoftware.com/developer/task-tracker - -Each of these identifiers can be entered in the task tracker to obtain more -information about a particular change. +Qt Bug Tracker: http://bugreports.qt.nokia.com +Task Tracker: http://qt.nokia.com/developer/task-tracker +Merge Request: http://qt.gitorious.org **************************************************************************** * General * diff --git a/translations/qtconfig_ru.ts b/translations/qtconfig_ru.ts index 334a801..7be0f04 100644 --- a/translations/qtconfig_ru.ts +++ b/translations/qtconfig_ru.ts @@ -892,7 +892,7 @@ p, li { white-space: pre-wrap; } <a href="http://www.kde.org">http://www.kde.org</a> </p> <p> -<a href="http://qtsoftware.com">http://qtsoftware.com</a> +<a href="http://qt.nokia.com">http://qt.nokia.com</a> </p> <p> <a href="http://www.kde.org">http://www.kde.org</a> -- cgit v0.12 From d27163a7a8e81f05dae2e975e4d59d8226dbd9ec Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Tue, 9 Mar 2010 12:07:09 +0100 Subject: QGraphicsSceneEvent: add Q_DISABLE_COPY Add Q_DISABLE_COPY to QGraphicsSceneEvent and all the sublasses The code would anyway not compile before as the QScopedPointer does not know QGraphicsSceneEventPrivate in use code. But now we have better error reporting. Reviewed-by: Thierry Task-number: QTBUG-8803 (related) --- src/gui/graphicsview/qgraphicssceneevent.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/gui/graphicsview/qgraphicssceneevent.h b/src/gui/graphicsview/qgraphicssceneevent.h index 033a996..c8a0028 100644 --- a/src/gui/graphicsview/qgraphicssceneevent.h +++ b/src/gui/graphicsview/qgraphicssceneevent.h @@ -77,6 +77,8 @@ protected: QGraphicsSceneEvent(QGraphicsSceneEventPrivate &dd, Type type = None); QScopedPointer d_ptr; Q_DECLARE_PRIVATE(QGraphicsSceneEvent) +private: + Q_DISABLE_COPY(QGraphicsSceneEvent) }; class QGraphicsSceneMouseEventPrivate; @@ -124,6 +126,7 @@ public: private: Q_DECLARE_PRIVATE(QGraphicsSceneMouseEvent) + Q_DISABLE_COPY(QGraphicsSceneMouseEvent) }; class QGraphicsSceneWheelEventPrivate; @@ -156,6 +159,7 @@ public: private: Q_DECLARE_PRIVATE(QGraphicsSceneWheelEvent) + Q_DISABLE_COPY(QGraphicsSceneWheelEvent) }; class QGraphicsSceneContextMenuEventPrivate; @@ -184,6 +188,7 @@ public: private: Q_DECLARE_PRIVATE(QGraphicsSceneContextMenuEvent) + Q_DISABLE_COPY(QGraphicsSceneContextMenuEvent) }; class QGraphicsSceneHoverEventPrivate; @@ -216,6 +221,7 @@ public: private: Q_DECLARE_PRIVATE(QGraphicsSceneHoverEvent) + Q_DISABLE_COPY(QGraphicsSceneHoverEvent) }; class QGraphicsSceneHelpEventPrivate; @@ -233,6 +239,7 @@ public: private: Q_DECLARE_PRIVATE(QGraphicsSceneHelpEvent) + Q_DISABLE_COPY(QGraphicsSceneHelpEvent) }; class QGraphicsSceneDragDropEventPrivate; @@ -275,12 +282,14 @@ public: private: Q_DECLARE_PRIVATE(QGraphicsSceneDragDropEvent) + Q_DISABLE_COPY(QGraphicsSceneDragDropEvent) }; class QGraphicsSceneResizeEventPrivate; class Q_GUI_EXPORT QGraphicsSceneResizeEvent : public QGraphicsSceneEvent { Q_DECLARE_PRIVATE(QGraphicsSceneResizeEvent) + Q_DISABLE_COPY(QGraphicsSceneResizeEvent) public: QGraphicsSceneResizeEvent(); ~QGraphicsSceneResizeEvent(); @@ -296,6 +305,7 @@ class QGraphicsSceneMoveEventPrivate; class Q_GUI_EXPORT QGraphicsSceneMoveEvent : public QGraphicsSceneEvent { Q_DECLARE_PRIVATE(QGraphicsSceneMoveEvent) + Q_DISABLE_COPY(QGraphicsSceneMoveEvent) public: QGraphicsSceneMoveEvent(); ~QGraphicsSceneMoveEvent(); -- cgit v0.12 From 1517456a6be97260286faa10fd8263440c7b62a4 Mon Sep 17 00:00:00 2001 From: Pierre Rossi Date: Tue, 9 Mar 2010 15:24:19 +0100 Subject: Get the printDialog to check for default paperSize via CUPS Task-number: QTBUG-6471 Reviewed-by: Trond --- src/gui/dialogs/qprintdialog_unix.cpp | 38 ++++++++++++++++++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) diff --git a/src/gui/dialogs/qprintdialog_unix.cpp b/src/gui/dialogs/qprintdialog_unix.cpp index 23f5831..00dc3e6 100644 --- a/src/gui/dialogs/qprintdialog_unix.cpp +++ b/src/gui/dialogs/qprintdialog_unix.cpp @@ -154,6 +154,9 @@ public: bool checkFields(); void setupPrinter(); void setOptionsPane(QPrintDialogPrivate *pane); +#if !defined(QT_NO_CUPS) && !defined(QT_NO_LIBRARY) + void setCupsProperties(); +#endif // slots void _q_printerChanged(int index); @@ -942,7 +945,7 @@ bool QUnixPrintWidgetPrivate::checkFields() void QUnixPrintWidgetPrivate::_q_btnPropertiesClicked() { - if (propertiesDialog == 0) { + if (!propertiesDialog) { propertiesDialog = new QPrintPropertiesDialog(q); propertiesDialog->setResult(QDialog::Rejected); } @@ -962,6 +965,35 @@ void QUnixPrintWidgetPrivate::_q_btnPropertiesClicked() propertiesDialog->exec(); } +#if !defined(QT_NO_CUPS) && !defined(QT_NO_LIBRARY) +void QUnixPrintWidgetPrivate::setCupsProperties() +{ + if (cups && QCUPSSupport::isAvailable()) { + QPrintEngine *engine = printer->printEngine(); + const ppd_option_t* pageSizes = cups->pageSizes(); + QByteArray cupsPageSize; + for (int i = 0; i < pageSizes->num_choices; ++i) { + if (static_cast(pageSizes->choices[i].marked) == 1) + cupsPageSize = pageSizes->choices[i].choice; + } + engine->setProperty(PPK_CupsStringPageSize, QString::fromLatin1(cupsPageSize)); + engine->setProperty(PPK_CupsOptions, cups->options()); + + QRect pageRect = cups->pageRect(cupsPageSize); + engine->setProperty(PPK_CupsPageRect, pageRect); + + QRect paperRect = cups->paperRect(cupsPageSize); + engine->setProperty(PPK_CupsPaperRect, paperRect); + + for (int ps = 0; ps < QPrinter::NPaperSize; ++ps) { + QPdf::PaperSize size = QPdf::paperSize(QPrinter::PaperSize(ps)); + if (size.width == paperRect.width() && size.height == paperRect.height()) + printer->setPaperSize(static_cast(ps)); + } + } +} +#endif + void QUnixPrintWidgetPrivate::setupPrinter() { const int printerCount = widget.printers->count(); @@ -986,6 +1018,10 @@ void QUnixPrintWidgetPrivate::setupPrinter() if (propertiesDialog && propertiesDialog->result() == QDialog::Accepted) propertiesDialog->setupPrinter(); +#if !defined(QT_NO_CUPS) && !defined(QT_NO_LIBRARY) + if (!propertiesDialog) + setCupsProperties(); +#endif } -- cgit v0.12 From 42b69b1383375a52818758bf89198e8dc97902d3 Mon Sep 17 00:00:00 2001 From: Gabriel de Dietrich Date: Tue, 9 Mar 2010 15:39:40 +0100 Subject: Cursor would remain in a non-focused QLineEdit after clearing its selection QLineEditPrivate::_q_selectionChanged() did not take into account whether the widget had focus. Reviewed-by: Olivier Task-number: QTBUG-8634 --- src/gui/widgets/qlineedit_p.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/widgets/qlineedit_p.cpp b/src/gui/widgets/qlineedit_p.cpp index 2c76a5c..468c111 100644 --- a/src/gui/widgets/qlineedit_p.cpp +++ b/src/gui/widgets/qlineedit_p.cpp @@ -134,7 +134,7 @@ void QLineEditPrivate::_q_selectionChanged() q->initStyleOption(&opt); bool showCursor = control->hasSelectedText() ? q->style()->styleHint(QStyle::SH_BlinkCursorWhenTextSelected, &opt, q): - true; + q->hasFocus(); setCursorVisible(showCursor); } -- cgit v0.12 From efd43128848e4b0898a828e7441ebdfcfb5c30b1 Mon Sep 17 00:00:00 2001 From: Markus Goetz Date: Tue, 9 Mar 2010 15:53:26 +0100 Subject: Added very simple JPEG loading benchmark (using QImageReader) Reviewed-by: joao --- .../benchmarks/plugins/imageformats/jpeg/jpeg.cpp | 92 +++++++++++++++++++++ .../benchmarks/plugins/imageformats/jpeg/jpeg.pro | 18 ++++ .../benchmarks/plugins/imageformats/jpeg/n900.jpeg | Bin 0 -> 19016 bytes 3 files changed, 110 insertions(+) create mode 100644 tests/benchmarks/plugins/imageformats/jpeg/jpeg.cpp create mode 100644 tests/benchmarks/plugins/imageformats/jpeg/jpeg.pro create mode 100644 tests/benchmarks/plugins/imageformats/jpeg/n900.jpeg diff --git a/tests/benchmarks/plugins/imageformats/jpeg/jpeg.cpp b/tests/benchmarks/plugins/imageformats/jpeg/jpeg.cpp new file mode 100644 index 0000000..2cb9421 --- /dev/null +++ b/tests/benchmarks/plugins/imageformats/jpeg/jpeg.cpp @@ -0,0 +1,92 @@ +/**************************************************************************** +** +** 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 test suite 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 +#include +#include +#include +#include +#include +#include +#include + +#if defined(Q_OS_SYMBIAN) +# define SRCDIR "" +#endif + +class tst_jpeg : public QObject +{ + Q_OBJECT +private slots: + void jpegDecodingQtWebkitStyle(); +}; + +void tst_jpeg::jpegDecodingQtWebkitStyle() +{ + // QtWebkit currently calls size() to get the image size for layouting purposes. + // Then when it is in the viewport (we assume that here) it actually gets decoded. + QFile inputJpeg(SRCDIR "n900.jpeg"); + QVERIFY(inputJpeg.exists()); + inputJpeg.open(QIODevice::ReadOnly); + QByteArray imageData = inputJpeg.readAll(); + QBuffer buffer; + buffer.setData(imageData); + buffer.open(QBuffer::ReadOnly); + QCOMPARE(buffer.size(), qint64(19016)); + + + QBENCHMARK{ + for (int i = 0; i < 50; i++) { + QImageReader reader(&buffer, "jpeg"); + QSize size = reader.size(); + QVERIFY(!size.isNull()); + QByteArray format = reader.format(); + QVERIFY(!format.isEmpty()); + QImage img = reader.read(); + QVERIFY(!img.isNull()); + buffer.reset(); + } + } +} + +QTEST_MAIN(tst_jpeg) + +#include "jpeg.moc" diff --git a/tests/benchmarks/plugins/imageformats/jpeg/jpeg.pro b/tests/benchmarks/plugins/imageformats/jpeg/jpeg.pro new file mode 100644 index 0000000..e106f3e --- /dev/null +++ b/tests/benchmarks/plugins/imageformats/jpeg/jpeg.pro @@ -0,0 +1,18 @@ +load(qttest_p4) +TEMPLATE = app +TARGET = jpeg +DEPENDPATH += . +INCLUDEPATH += . + +CONFIG += release + +wince*: { + DEFINES += SRCDIR=\\\"\\\" +} else:symbian { + # SRCDIR and SVGFILE defined in code in symbian +}else { + DEFINES += SRCDIR=\\\"$$PWD/\\\" +} + +# Input +SOURCES += jpeg.cpp diff --git a/tests/benchmarks/plugins/imageformats/jpeg/n900.jpeg b/tests/benchmarks/plugins/imageformats/jpeg/n900.jpeg new file mode 100644 index 0000000..681989a Binary files /dev/null and b/tests/benchmarks/plugins/imageformats/jpeg/n900.jpeg differ -- cgit v0.12 From 95dd8a45b0da50fb32843dd275b2028ce77b2492 Mon Sep 17 00:00:00 2001 From: Gabriel de Dietrich Date: Tue, 9 Mar 2010 17:16:02 +0100 Subject: Memory leak! Multiple insertions of the same (key, value) pair in a QMultiHash. Reviewed-by: Olivier Task-number: QTBUG-8862 --- src/gui/text/qtextformat.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/gui/text/qtextformat.cpp b/src/gui/text/qtextformat.cpp index dca2da5..140cf43 100644 --- a/src/gui/text/qtextformat.cpp +++ b/src/gui/text/qtextformat.cpp @@ -3085,7 +3085,8 @@ int QTextFormatCollection::indexForFormat(const QTextFormat &format) f.d = new QTextFormatPrivate; f.d->resolveFont(defaultFnt); - hashes.insert(hash, idx); + if (!hashes.contains(hash, idx)) + hashes.insert(hash, idx); } QT_CATCH(...) { formats.pop_back(); -- cgit v0.12 From dac32b0d5ac4ed79584aba23134849956c787f75 Mon Sep 17 00:00:00 2001 From: Anders Bakken Date: Tue, 9 Mar 2010 09:49:31 -0800 Subject: Improve scrolling in DirectFB Since DirectFB always uses the front buffer of a double buffered surface as the source when blitting we needed to make sure that the front buffer was valid and hence we called Flip for each scroll. This had negative performance impacts since you could end up with various parts of a window being updated at different times. With this patch we store whether the front-buffer is up to date inside the window surface and only call Flip in scroll if it's not. Reviewed-by: Jervey Kong --- .../gfxdrivers/directfb/qdirectfbwindowsurface.cpp | 29 +++++++++------------- .../gfxdrivers/directfb/qdirectfbwindowsurface.h | 1 + 2 files changed, 13 insertions(+), 17 deletions(-) diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp index a8bdb65..51969fc 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp +++ b/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp @@ -61,6 +61,7 @@ QDirectFBWindowSurface::QDirectFBWindowSurface(DFBSurfaceFlipFlags flip, QDirect #endif , flipFlags(flip) , boundingRectFlip(scr->directFBFlags() & QDirectFBScreen::BoundingRectFlip) + , flushPending(false) { #ifdef QT_NO_DIRECTFB_WM mode = Offscreen; @@ -80,6 +81,7 @@ QDirectFBWindowSurface::QDirectFBWindowSurface(DFBSurfaceFlipFlags flip, QDirect #endif , flipFlags(flip) , boundingRectFlip(scr->directFBFlags() & QDirectFBScreen::BoundingRectFlip) + , flushPending(false) { SurfaceFlags flags = 0; if (!widget || widget->window()->windowOpacity() == 0xff) @@ -299,28 +301,19 @@ void QDirectFBWindowSurface::setPermanentState(const QByteArray &state) } } -static inline void scrollSurface(IDirectFBSurface *surface, const QRect &r, int dx, int dy) -{ - const DFBRectangle rect = { r.x(), r.y(), r.width(), r.height() }; - surface->Blit(surface, surface, &rect, r.x() + dx, r.y() + dy); - const DFBRegion region = { rect.x + dx, rect.y + dy, r.right() + dx, r.bottom() + dy }; - surface->Flip(surface, ®ion, DSFLIP_BLIT); -} - bool QDirectFBWindowSurface::scroll(const QRegion ®ion, int dx, int dy) { - if (!dfbSurface || !(flipFlags & DSFLIP_BLIT) || region.isEmpty()) + if (!dfbSurface || !(flipFlags & DSFLIP_BLIT) || region.rectCount() != 1) return false; - dfbSurface->SetBlittingFlags(dfbSurface, DSBLIT_NOFX); - if (region.rectCount() == 1) { - scrollSurface(dfbSurface, region.boundingRect(), dx, dy); + if (flushPending) { + dfbSurface->Flip(dfbSurface, 0, DSFLIP_BLIT); } else { - const QVector rects = region.rects(); - const int n = rects.size(); - for (int i=0; iSetBlittingFlags(dfbSurface, DSBLIT_NOFX); + const QRect r = region.boundingRect(); + const DFBRectangle rect = { r.x(), r.y(), r.width(), r.height() }; + dfbSurface->Blit(dfbSurface, dfbSurface, &rect, r.x() + dx, r.y() + dy); return true; } @@ -384,6 +377,7 @@ void QDirectFBWindowSurface::flush(QWidget *widget, const QRegion ®ion, timer.restart(); } #endif + flushPending = false; } void QDirectFBWindowSurface::beginPaint(const QRegion &) @@ -391,6 +385,7 @@ void QDirectFBWindowSurface::beginPaint(const QRegion &) if (!engine) { engine = new QDirectFBPaintEngine(this); } + flushPending = true; } void QDirectFBWindowSurface::endPaint(const QRegion &) diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.h b/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.h index a6138f6..4370a8f 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.h +++ b/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.h @@ -114,6 +114,7 @@ private: DFBSurfaceFlipFlags flipFlags; bool boundingRectFlip; + bool flushPending; #ifdef QT_DIRECTFB_TIMING int frames; QTime timer; -- cgit v0.12 From 6b69385a53d39961225a45f09b3353dc95508a78 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Tue, 9 Mar 2010 20:18:20 +0100 Subject: fix qm file installation from shadow build --- translations/translations.pro | 1 + 1 file changed, 1 insertion(+) diff --git a/translations/translations.pro b/translations/translations.pro index f1b9c99..8f37451 100644 --- a/translations/translations.pro +++ b/translations/translations.pro @@ -42,5 +42,6 @@ isEmpty(vcproj) { translations.path = $$[QT_INSTALL_TRANSLATIONS] translations.files = $$TRANSLATIONS translations.files ~= s,\\.ts$,.qm,g +translations.files ~= s,^,$$OUT_PWD/,g translations.CONFIG += no_check_exist INSTALLS += translations -- cgit v0.12 From a90117092e4bc5ecc1cb1640a16c70569a342759 Mon Sep 17 00:00:00 2001 From: Anders Bakken Date: Tue, 9 Mar 2010 14:35:51 -0800 Subject: Compile without QT3_SUPPORT QList::remove() is QT3_SUPPORT, replace with erase(). Reviewed-by: Jervey Kong --- src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp index 7dce516..b76c6a7 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp +++ b/src/plugins/gfxdrivers/directfb/qdirectfbpaintengine.cpp @@ -216,12 +216,12 @@ static void initRasterFallbacksMasks(int *warningMask, int *disableMask) int idx = warning.indexOf(name); if (idx != -1) { *warningMask |= operations[i].operation; - warning.remove(warning.begin() + idx); + warning.erase(warning.begin() + idx); } idx = disable.indexOf(name); if (idx != -1) { *disableMask |= operations[i].operation; - disable.remove(disable.begin() + idx); + disable.erase(disable.begin() + idx); } } } -- cgit v0.12