From 18c0fec3afba909faa341c766f31d679892021db Mon Sep 17 00:00:00 2001 From: Bill King Date: Thu, 17 Sep 2009 13:15:40 +1000 Subject: Fixes issue of forward only datasets failing when not set so. Previously you had to set forward only on non-scrollable datasets explicitly. This queries ODBC, to determine if it's a scrollable dataset, and sets forwardOnly to false if it isn't. Task-number: QT-353 Reviewed-by: Justin McPherson --- src/sql/drivers/odbc/qsql_odbc.cpp | 10 +++++++++ tests/auto/qsqlquery/tst_qsqlquery.cpp | 38 ++++++++++++++++++++++++++++++++++ 2 files changed, 48 insertions(+) diff --git a/src/sql/drivers/odbc/qsql_odbc.cpp b/src/sql/drivers/odbc/qsql_odbc.cpp index a5c713d..6a33d1e 100644 --- a/src/sql/drivers/odbc/qsql_odbc.cpp +++ b/src/sql/drivers/odbc/qsql_odbc.cpp @@ -781,6 +781,11 @@ bool QODBCResult::reset (const QString& query) return false; } + SQLINTEGER isScrollable, bufferLength; + r = SQLGetStmtAttr(d->hStmt, SQL_ATTR_CURSOR_SCROLLABLE, &isScrollable, SQL_IS_INTEGER, &bufferLength); + if(r == SQL_SUCCESS || r == SQL_SUCCESS_WITH_INFO) + setForwardOnly(isScrollable==SQL_NONSCROLLABLE); + SQLSMALLINT count; SQLNumResultCols(d->hStmt, &count); if (count) { @@ -1407,6 +1412,11 @@ bool QODBCResult::exec() return false; } + SQLINTEGER isScrollable, bufferLength; + r = SQLGetStmtAttr(d->hStmt, SQL_ATTR_CURSOR_SCROLLABLE, &isScrollable, SQL_IS_INTEGER, &bufferLength); + if(r == SQL_SUCCESS || r == SQL_SUCCESS_WITH_INFO) + setForwardOnly(isScrollable==SQL_NONSCROLLABLE); + SQLSMALLINT count; SQLNumResultCols(d->hStmt, &count); if (count) { diff --git a/tests/auto/qsqlquery/tst_qsqlquery.cpp b/tests/auto/qsqlquery/tst_qsqlquery.cpp index 1595f33..3463153 100644 --- a/tests/auto/qsqlquery/tst_qsqlquery.cpp +++ b/tests/auto/qsqlquery/tst_qsqlquery.cpp @@ -191,6 +191,9 @@ private slots: void task_233829_data() { generic_data("QPSQL"); } void task_233829(); + void sqlServerReturn0_data() { generic_data(); } + void sqlServerReturn0(); + private: // returns all database connections @@ -310,6 +313,13 @@ void tst_QSqlQuery::dropTestTables( QSqlDatabase db ) tablenames << qTableName( "task_250026" ); + if (tst_Databases::isSqlServer( db )) { + QSqlQuery q( db ); + q.exec("DROP PROCEDURE " + qTableName("test141895_proc")); + } + + tablenames << qTableName("test141895"); + tst_Databases::safeDropTables( db, tablenames ); } @@ -2842,5 +2852,33 @@ void tst_QSqlQuery::task_233829() QVERIFY_SQL(q,exec()); } +void tst_QSqlQuery::sqlServerReturn0() +{ + QFETCH( QString, dbName ); + QSqlDatabase db = QSqlDatabase::database( dbName ); + CHECK_DATABASE( db ); + if (!tst_Databases::isSqlServer( db )) + QSKIP("SQL Server specific test", SkipSingle); + + QString tableName(qTableName("test141895")), procName(qTableName("test141895_proc")); + QSqlQuery q( db ); + q.exec("DROP TABLE " + tableName); + q.exec("DROP PROCEDURE " + procName); + QVERIFY_SQL(q, exec("CREATE TABLE "+tableName+" (id integer)")); + QVERIFY_SQL(q, exec("INSERT INTO "+tableName+" (id) VALUES (1)")); + QVERIFY_SQL(q, exec("INSERT INTO "+tableName+" (id) VALUES (2)")); + QVERIFY_SQL(q, exec("INSERT INTO "+tableName+" (id) VALUES (2)")); + QVERIFY_SQL(q, exec("INSERT INTO "+tableName+" (id) VALUES (3)")); + QVERIFY_SQL(q, exec("INSERT INTO "+tableName+" (id) VALUES (1)")); + QVERIFY_SQL(q, exec("CREATE PROCEDURE "+procName+ + " AS " + "SELECT * FROM "+tableName+" WHERE ID = 2 " + "RETURN 0")); + + QVERIFY_SQL(q, exec("{CALL "+procName+"}")); + + QVERIFY_SQL(q, next()); +} + QTEST_MAIN( tst_QSqlQuery ) #include "tst_qsqlquery.moc" -- cgit v0.12 From 9cef27f506e15681f9935a1c00c9df3c6271d5f2 Mon Sep 17 00:00:00 2001 From: Jarek Kobus Date: Thu, 17 Sep 2009 09:56:01 +0200 Subject: Update qt eclipse integration version number in docs, fix paths. --- tools/qdoc3/test/eclipse-integration.qdocconf | 6 +++--- tools/qdoc3/test/standalone-eclipse-integration.qdocconf | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tools/qdoc3/test/eclipse-integration.qdocconf b/tools/qdoc3/test/eclipse-integration.qdocconf index aadaae6..13d8ab9 100644 --- a/tools/qdoc3/test/eclipse-integration.qdocconf +++ b/tools/qdoc3/test/eclipse-integration.qdocconf @@ -2,9 +2,9 @@ include(qt.qdocconf) headerdirs = sourcedirs = -sourcedirs = $QTDIR/../qteclipsetools/main/doc -imagedirs = $QTDIR/../qteclipsetools/main/doc -outputdir = $QTDIR/../qteclipsetools/main/doc/html +sourcedirs = $QTDIR/../qteclipsetools/eclipse_patched/doc +imagedirs = $QTDIR/../qteclipsetools/eclipse_patched/doc +outputdir = $QTDIR/../qteclipsetools/eclipse_patched/doc/html project = Qt Eclipse Integration description = "Qt Eclipse Integration" diff --git a/tools/qdoc3/test/standalone-eclipse-integration.qdocconf b/tools/qdoc3/test/standalone-eclipse-integration.qdocconf index d61db54..b96c541 100644 --- a/tools/qdoc3/test/standalone-eclipse-integration.qdocconf +++ b/tools/qdoc3/test/standalone-eclipse-integration.qdocconf @@ -7,5 +7,5 @@ HTML.footer = "


\n" \ "\n" \ "\n" \ "\n" \ - "\n" \ + "\n" \ "
Copyright © 2009 Nokia Corporation and/or its subsidiary(-ies)Trademarks
Qt Eclipse Integration 1.5.2
Qt Eclipse Integration 1.5.3
" -- cgit v0.12 From 603c423fc2ee2b9393e3c288e76354de0e0c1cc7 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Thu, 17 Sep 2009 10:21:49 +0200 Subject: Fix crash or painting error when drawing dashed lines with penWidth > 1 Since the width is multiplied into the dash, it needs to be divided out, otherwise you can get a dashOffset which is greater than the pattern at the index, and the dash can become negative. This will in turn lead to passing a negative width to the rasterizer, which at some point will get cast to an unsigned int and overflow. Depending on the position of the line and size of the buffer, this will either crash or produce garbled output. Task-number: QT-4444 Reviewed-by: Samuel --- src/gui/painting/qpaintengine_raster.cpp | 2 +- src/gui/painting/qrasterizer.cpp | 4 +++- tests/auto/qpainter/tst_qpainter.cpp | 25 +++++++++++++++++++++++++ 3 files changed, 29 insertions(+), 2 deletions(-) diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp index bd12fdb..bcea1ec 100644 --- a/src/gui/painting/qpaintengine_raster.cpp +++ b/src/gui/painting/qpaintengine_raster.cpp @@ -3564,7 +3564,7 @@ void QRasterPaintEnginePrivate::rasterizeLine_dashed(QLineF line, if (dash >= length) { dash = length; - *dashOffset += dash; + *dashOffset += dash / width; length = 0; } else { *dashOffset = 0; diff --git a/src/gui/painting/qrasterizer.cpp b/src/gui/painting/qrasterizer.cpp index 4500756..2b6791d 100644 --- a/src/gui/painting/qrasterizer.cpp +++ b/src/gui/painting/qrasterizer.cpp @@ -706,10 +706,12 @@ void QRasterizer::rasterizeLine(const QPointF &a, const QPointF &b, qreal width, if (a == b || width == 0 || d->clipRect.isEmpty()) return; + Q_ASSERT(width > 0.0); + QPointF pa = a; QPointF pb = b; - QPointF offs = QPointF(qAbs(b.y() - a.y()), qAbs(b.x() - a.x())) * width * 0.5; + QPointF offs = QPointF(qAbs(b.y() - a.y()), qAbs(b.x() - a.x())) * width * 0.5; if (squareCap) offs += QPointF(offs.y(), offs.x()); const QRectF clip(d->clipRect.topLeft() - offs, d->clipRect.bottomRight() + QPoint(1, 1) + offs); diff --git a/tests/auto/qpainter/tst_qpainter.cpp b/tests/auto/qpainter/tst_qpainter.cpp index e434ed6..c0eac21 100644 --- a/tests/auto/qpainter/tst_qpainter.cpp +++ b/tests/auto/qpainter/tst_qpainter.cpp @@ -230,6 +230,8 @@ private slots: void zeroOpacity(); void emptyClip(); + void taskQT4444_dontOverflowDashOffset(); + private: void fillData(); QColor baseColor( int k, int intensity=255 ); @@ -4239,5 +4241,28 @@ void tst_QPainter::emptyClip() p.fillPath(path, Qt::green); } +void tst_QPainter::taskQT4444_dontOverflowDashOffset() +{ + QPainter p; + + QPen pen; + pen.setWidth(2); + pen.setStyle(Qt::DashDotLine); + + QPointF point[4]; + point[0] = QPointF(182.50868749707968,347.78457234212630); + point[1] = QPointF(182.50868749707968,107.22501998401277); + point[2] = QPointF(182.50868749707968,107.22501998401277); + point[3] = QPointF(520.46600762283651,107.22501998401277); + + QImage crashImage(QSize(1000, 120), QImage::Format_ARGB32_Premultiplied); + p.begin(&crashImage); + p.setPen(pen); + p.drawLines(point, 2); + p.end(); + + QVERIFY(true); // Don't crash +} + QTEST_MAIN(tst_QPainter) #include "tst_qpainter.moc" -- cgit v0.12 From 36ec74d84b3403cc930a8296226ea921a62a277b Mon Sep 17 00:00:00 2001 From: Alexis Menard Date: Thu, 17 Sep 2009 11:30:36 +0200 Subject: Revert "Added autotest to demonstrate clipping path problem" This reverts commit e7042dea2431b8f64574d4e97eb896285b328c8b. Alexis : This should never have been here. E-mail is invalid. --- tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp | 32 -------------------------- 1 file changed, 32 deletions(-) diff --git a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp index 391ccf8..d6605db 100644 --- a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp +++ b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp @@ -194,7 +194,6 @@ private slots: void itemClipsToShape(); void itemClipsChildrenToShape(); void itemClipsChildrenToShape2(); - void itemClipsChildrenToShape3(); void itemClipsTextChildToShape(); void itemClippingDiscovery(); void ancestorFlags(); @@ -4692,37 +4691,6 @@ void tst_QGraphicsItem::itemClipsChildrenToShape2() #endif } -void tst_QGraphicsItem::itemClipsChildrenToShape3() -{ - // Construct a scene with nested children, each 50 pixels offset from the elder. - // Set a top-level clipping flag - QGraphicsScene scene; - QGraphicsRectItem *parent = scene.addRect( 0, 0, 150, 150 ); - QGraphicsRectItem *child = scene.addRect( 0, 0, 150, 150 ); - QGraphicsRectItem *grandchild = scene.addRect( 0, 0, 150, 150 ); - child->setParentItem(parent); - grandchild->setParentItem(child); - child->setPos( 50, 50 ); - grandchild->setPos( 50, 50 ); - parent->setFlag(QGraphicsItem::ItemClipsChildrenToShape); - - QCOMPARE(scene.itemAt(25,25), (QGraphicsItem *)parent); - QCOMPARE(scene.itemAt(75,75), (QGraphicsItem *)child); - QCOMPARE(scene.itemAt(125,125), (QGraphicsItem *)grandchild); - QCOMPARE(scene.itemAt(175,175), (QGraphicsItem *)0); - - // Move child to fully overlap the parent. The grandchild should - // now occupy two-thirds of the scene - child->prepareGeometryChange(); - child->setPos( 0, 0 ); - - QCOMPARE(scene.itemAt(25,25), (QGraphicsItem *)child); - QCOMPARE(scene.itemAt(75,75), (QGraphicsItem *)grandchild); - QCOMPARE(scene.itemAt(125,125), (QGraphicsItem *)grandchild); - QCOMPARE(scene.itemAt(175,175), (QGraphicsItem *)0); -} - - void tst_QGraphicsItem::itemClipsTextChildToShape() { // Construct a scene with a rect that clips its children, with one text -- cgit v0.12 From ddf9e97d6700b78711632d352f84c469d000f97b Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Thu, 17 Sep 2009 13:53:36 +0200 Subject: Designer: tab order in DeviceProfileDialog corrected Reviewed-by: Friedemann Kleint --- .../components/formeditor/deviceprofiledialog.ui | 84 ++++++++++++---------- 1 file changed, 46 insertions(+), 38 deletions(-) diff --git a/tools/designer/src/components/formeditor/deviceprofiledialog.ui b/tools/designer/src/components/formeditor/deviceprofiledialog.ui index 3186c57..17ee966 100644 --- a/tools/designer/src/components/formeditor/deviceprofiledialog.ui +++ b/tools/designer/src/components/formeditor/deviceprofiledialog.ui @@ -1,7 +1,8 @@ - - DeviceProfileDialog - - + + + dialog + + 0 0 @@ -9,78 +10,78 @@ 209 - + - - - - - + + + + + &Family - + m_systemFontComboBox - - + + - - - + + + &Point Size - + m_systemFontSizeCombo - - + + - - - + + + Style - + m_styleCombo - - + + - - - + + + Device DPI - - + + - - - + + + Name - - + + - - + + Qt::Horizontal - + QDialogButtonBox::Cancel|QDialogButtonBox::Ok|QDialogButtonBox::Open|QDialogButtonBox::Save @@ -95,6 +96,13 @@ 1 + + m_nameLineEdit + m_systemFontComboBox + m_systemFontSizeCombo + m_styleCombo + buttonBox + -- cgit v0.12 From 5a29ceba42840add7a1dcf205c76e39065bee18d Mon Sep 17 00:00:00 2001 From: Takumi ASAKI Date: Thu, 17 Sep 2009 13:30:18 +0200 Subject: compile fix for embedded Linux and defined QT_COORD_TYPE If we define QT_COORD_TYPE, src/testlib doesn't compile for embedded Linux. Reviewed-By: joerg --- src/testlib/qtestcase.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/testlib/qtestcase.h b/src/testlib/qtestcase.h index edc6219..4f11f66 100644 --- a/src/testlib/qtestcase.h +++ b/src/testlib/qtestcase.h @@ -218,7 +218,7 @@ namespace QTest template bool qCompare(T1 const &, T2 const &, const char *, const char *, const char *, int); -#if defined(QT_ARCH_WINDOWSCE) && defined(QT_COORD_TYPE) +#if defined(QT_COORD_TYPE) && (defined(QT_ARCH_ARM) || defined(QT_NO_FPU) || defined(QT_ARCH_WINDOWSCE)) template <> inline bool qCompare(qreal const &t1, float const &t2, const char *actual, const char *expected, const char *file, int line) -- cgit v0.12 From a62506aae40ede3fd8030312321759f669458909 Mon Sep 17 00:00:00 2001 From: Tom Cooksey Date: Thu, 17 Sep 2009 15:39:59 +0200 Subject: Make the PowerVR screen driver for QWS compile against shipped headers MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The pvr2d.h/wsegl.h headers we ship with Qt (in src/3rdparty/powervr) are meant for the PowerVR SGX. However, we use an MBX-specific define in the powervr driver. Reviewed-by: Jørgen Lind --- src/plugins/gfxdrivers/powervr/QWSWSEGL/pvrqwswsegl.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/gfxdrivers/powervr/QWSWSEGL/pvrqwswsegl.c b/src/plugins/gfxdrivers/powervr/QWSWSEGL/pvrqwswsegl.c index cc180f9..b26938b 100644 --- a/src/plugins/gfxdrivers/powervr/QWSWSEGL/pvrqwswsegl.c +++ b/src/plugins/gfxdrivers/powervr/QWSWSEGL/pvrqwswsegl.c @@ -50,8 +50,8 @@ /* Capability information for the display */ static WSEGLCaps const wseglDisplayCaps[] = { - {WSEGL_CAP_WINDOWS_USE_MBX_SYNC, 1}, - {WSEGL_CAP_PIXMAPS_USE_MBX_SYNC, 1}, + {WSEGL_CAP_WINDOWS_USE_HW_SYNC, 1}, + {WSEGL_CAP_PIXMAPS_USE_HW_SYNC, 1}, {WSEGL_NO_CAPS, 0} }; -- cgit v0.12 From 9a712c48fb8047c3ed833db7d47382eb072711d6 Mon Sep 17 00:00:00 2001 From: Rhys Weatherley Date: Fri, 18 Sep 2009 08:09:53 +1000 Subject: Fix compilation for systems with MBX PowerVR headers. Reviewed-by: trustme --- src/plugins/gfxdrivers/powervr/QWSWSEGL/pvrqwswsegl.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/plugins/gfxdrivers/powervr/QWSWSEGL/pvrqwswsegl.c b/src/plugins/gfxdrivers/powervr/QWSWSEGL/pvrqwswsegl.c index b26938b..253f39f 100644 --- a/src/plugins/gfxdrivers/powervr/QWSWSEGL/pvrqwswsegl.c +++ b/src/plugins/gfxdrivers/powervr/QWSWSEGL/pvrqwswsegl.c @@ -48,6 +48,13 @@ #define WSEGL_UNUSED(x) (void)x; +// If the PVR2D version is not specified, then assume MBX-style headers. +// If the version is defined, then we assume that we have SGX-style headers. +#if !defined(PVR2D_REV_MAJOR) +#define WSEGL_CAP_WINDOWS_USE_HW_SYNC WSEGL_CAP_WINDOWS_USE_MBX_SYNC +#define WSEGL_CAP_PIXMAPS_USE_HW_SYNC WSEGL_CAP_PIXMAPS_USE_MBX_SYNC +#endif + /* Capability information for the display */ static WSEGLCaps const wseglDisplayCaps[] = { {WSEGL_CAP_WINDOWS_USE_HW_SYNC, 1}, -- cgit v0.12 From 39ec3f66db65684b32b8c5f35311d6045135c4d0 Mon Sep 17 00:00:00 2001 From: Rhys Weatherley Date: Fri, 18 Sep 2009 08:33:22 +1000 Subject: Fix broken .ui file - class name was not specified correctly. Reviewed-by: trustme --- tools/designer/src/components/formeditor/deviceprofiledialog.ui | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/designer/src/components/formeditor/deviceprofiledialog.ui b/tools/designer/src/components/formeditor/deviceprofiledialog.ui index 17ee966..d7a298c 100644 --- a/tools/designer/src/components/formeditor/deviceprofiledialog.ui +++ b/tools/designer/src/components/formeditor/deviceprofiledialog.ui @@ -1,6 +1,6 @@ - dialog + DeviceProfileDialog -- cgit v0.12 From faec535829a0e454a6784b0c5c37cb63e7da8f73 Mon Sep 17 00:00:00 2001 From: Prasanth Ullattil Date: Fri, 18 Sep 2009 13:38:26 +0200 Subject: Application crashes when a menu is inserted twice on a menubar (Cocoa). Cocoa does not allow NSMenu to have multiple supermenu's. If a menu is added again as submenu, Qt will now disable the menu item or the menu will not be added at all if it is added again to the menubar. Task-number: 258822 Reviewed-by: MortenS --- src/gui/widgets/qmenu.cpp | 5 +++++ src/gui/widgets/qmenu_mac.mm | 15 +++++++++++++-- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/src/gui/widgets/qmenu.cpp b/src/gui/widgets/qmenu.cpp index 5acf134..f329555 100644 --- a/src/gui/widgets/qmenu.cpp +++ b/src/gui/widgets/qmenu.cpp @@ -1302,6 +1302,11 @@ void QMenu::initStyleOption(QStyleOptionMenuItem *option, const QAction *action) do not support the signals: aboutToHide (), aboutToShow () and hovered (). It is not possible to display an icon in a native menu on Windows Mobile. + \section1 QMenu on Mac OS X with Qt build against Cocoa + + QMenu can be inserted only once in a menu/menubar. Subsequent insertions will + have no effect or will result in a disabled menu item. + See the \l{mainwindows/menus}{Menus} example for an example of how to use QMenuBar and QMenu in your application. diff --git a/src/gui/widgets/qmenu_mac.mm b/src/gui/widgets/qmenu_mac.mm index 264d6d3..354161d 100644 --- a/src/gui/widgets/qmenu_mac.mm +++ b/src/gui/widgets/qmenu_mac.mm @@ -1412,7 +1412,15 @@ QMenuPrivate::QMacMenuPrivate::syncAction(QMacMenuAction *action) GetMenuItemProperty(action->menu, 0, kMenuCreatorQt, kMenuPropertyQWidget, sizeof(caused), 0, &caused); SetMenuItemProperty(data.submenuHandle, 0, kMenuCreatorQt, kMenuPropertyCausedQWidget, sizeof(caused), &caused); #else - [item setSubmenu:static_cast(action->action->menu()->macMenu())]; + NSMenu *subMenu = static_cast(action->action->menu()->macMenu()); + if ([subMenu supermenu] != nil) { + // The menu is already a sub-menu of another one. Cocoa will throw an exception, + // in such cases. For the time being, a new QMenu with same set of actions is the + // only workaround. + action->action->setEnabled(false); + } else { + [item setSubmenu:subMenu]; + } #endif } else { //respect some other items #ifndef QT_MAC_USE_COCOA @@ -1678,7 +1686,10 @@ QMenuBarPrivate::QMacMenuBarPrivate::syncAction(QMacMenuAction *action) GetMenuItemProperty(action->menu, 0, kMenuCreatorQt, kMenuPropertyQWidget, sizeof(caused), 0, &caused); SetMenuItemProperty(submenu, 0, kMenuCreatorQt, kMenuPropertyCausedQWidget, sizeof(caused), &caused); #else - [item setSubmenu:submenu]; + if ([submenu supermenu] != nil) + return; + else + [item setSubmenu:submenu]; #endif } #ifndef QT_MAC_USE_COCOA -- cgit v0.12