From 1b6c1054c1ad8f99665ceaa958da01b1383a3e34 Mon Sep 17 00:00:00 2001 From: Janne Anttila Date: Wed, 2 Dec 2009 10:19:41 +0200 Subject: Fixed "illegal empty declaration" warning from \tools\xmlpatterns The following warning was reported by Symbian compilers: tools\xmlpatterns\main.cpp:83: warning: illegal empty declaration Reviewed-by: TrustMe --- tools/xmlpatterns/main.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/xmlpatterns/main.cpp b/tools/xmlpatterns/main.cpp index a930b70..604523b 100644 --- a/tools/xmlpatterns/main.cpp +++ b/tools/xmlpatterns/main.cpp @@ -80,14 +80,14 @@ QT_USE_NAMESPACE Represents the name and value found in "-param name=value". */ typedef QPair Parameter; -Q_DECLARE_METATYPE(Parameter); +Q_DECLARE_METATYPE(Parameter) /*! \internal \since 4.4 For the -output switch. */ -Q_DECLARE_METATYPE(QIODevice *); +Q_DECLARE_METATYPE(QIODevice *) /*! \class PatternistApplicationParser -- cgit v0.12 From 7c70e69511817127aa4691339af4a6aa07c1502a Mon Sep 17 00:00:00 2001 From: Janne Anttila Date: Wed, 2 Dec 2009 12:40:50 +0200 Subject: Fixed crash on Symbian when using QProgressDialog::setCancelButton(0). The crash occured since d->cancelAction is child of d->cancelButton, which is essentially same as d->cancel pointer. Due to parent/child relationship, deleting d->cancel deleted also chilren including cancelAction. Then explicitly deleting already deleted d->cancelAction (dangling pointer) caused KERN-EXEC 3 crash. There is no need to delete d->cancelAction since it is deleted via parent/child relationship. Task-number: QTBUG-6109 Reviewed-by: Miikka Heikkinen --- src/gui/dialogs/qprogressdialog.cpp | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/gui/dialogs/qprogressdialog.cpp b/src/gui/dialogs/qprogressdialog.cpp index f5024bb..98b15e9 100644 --- a/src/gui/dialogs/qprogressdialog.cpp +++ b/src/gui/dialogs/qprogressdialog.cpp @@ -424,10 +424,6 @@ void QProgressDialog::setCancelButton(QPushButton *cancelButton) { Q_D(QProgressDialog); delete d->cancel; -#ifdef QT_SOFTKEYS_ENABLED - delete d->cancelAction; - d->cancelAction = 0; -#endif d->cancel = cancelButton; if (cancelButton) { if (cancelButton->parentWidget() == this) { -- cgit v0.12 From 855d2702ffff37452ff3bc0e1576d1d17fdb76c2 Mon Sep 17 00:00:00 2001 From: Janne Anttila Date: Wed, 2 Dec 2009 15:08:53 +0200 Subject: Fixed softkey merging/traversing over window boundaries. If current dialog implementation had parent and no softkeys set, the dialog got softkeys from parent. This commit changes the behaviour so that softkeys are not traversed over window boundaries. Also added autotest for the bug report. Task-number: QTBUG-6163 Reviewed-by: Jason Barron --- src/gui/kernel/qsoftkeymanager.cpp | 2 +- tests/auto/qsoftkeymanager/tst_qsoftkeymanager.cpp | 62 ++++++++++++++++++++++ 2 files changed, 63 insertions(+), 1 deletion(-) diff --git a/src/gui/kernel/qsoftkeymanager.cpp b/src/gui/kernel/qsoftkeymanager.cpp index 775d773..1acc9b3 100644 --- a/src/gui/kernel/qsoftkeymanager.cpp +++ b/src/gui/kernel/qsoftkeymanager.cpp @@ -190,7 +190,7 @@ bool QSoftKeyManager::event(QEvent *e) } QWidget *parent = source->parentWidget(); - if (parent && softKeys.isEmpty()) + if (parent && softKeys.isEmpty() && !source->isWindow()) source = parent; else break; diff --git a/tests/auto/qsoftkeymanager/tst_qsoftkeymanager.cpp b/tests/auto/qsoftkeymanager/tst_qsoftkeymanager.cpp index 87e0533..f923739 100644 --- a/tests/auto/qsoftkeymanager/tst_qsoftkeymanager.cpp +++ b/tests/auto/qsoftkeymanager/tst_qsoftkeymanager.cpp @@ -73,6 +73,7 @@ private slots: void updateSoftKeysCompressed(); void handleCommand(); void checkSoftkeyEnableStates(); + void noMergingOverWindowBoundary(); private: // utils inline void simulateSymbianCommand(int command) @@ -235,5 +236,66 @@ void tst_QSoftKeyManager::checkSoftkeyEnableStates() QCOMPARE(spy1.count(), 5); } +/* + This tests that the softkeys are not merged over window boundaries. I.e. dialogs + don't get softkeys of base widget by default - QTBUG-6163. +*/ +void tst_QSoftKeyManager::noMergingOverWindowBoundary() +{ + // Create base window against which the dialog softkeys will ve verified + QWidget base; + + QAction* baseLeft = new QAction(tr("BaseLeft"), &base); + baseLeft->setSoftKeyRole(QAction::PositiveSoftKey); + base.addAction(baseLeft); + + QAction* baseRight = new QAction(tr("BaseRight"), &base); + baseRight->setSoftKeyRole(QAction::NegativeSoftKey); + base.addAction(baseRight); + + base.showMaximized(); + QApplication::processEvents(); + + QSignalSpy baseLeftSpy(baseLeft, SIGNAL(triggered())); + QSignalSpy baseRightSpy(baseRight, SIGNAL(triggered())); + + //Verify that both base softkeys emit triggered signals + simulateSymbianCommand(s60CommandStart); + simulateSymbianCommand(s60CommandStart + 1); + + QCOMPARE(baseLeftSpy.count(), 1); + QCOMPARE(baseRightSpy.count(), 1); + baseLeftSpy.clear(); + baseRightSpy.clear(); + + // Verify that no softkey merging when using dialog without parent + QDialog dlg; + dlg.show(); + + QApplication::processEvents(); + + simulateSymbianCommand(s60CommandStart); + simulateSymbianCommand(s60CommandStart + 1); + + QCOMPARE(baseLeftSpy.count(), 0); + QCOMPARE(baseRightSpy.count(), 0); + + // Ensure base view has focus again + dlg.hide(); + base.showMaximized(); + + // Verify that no softkey merging when using dialog with parent + QDialog dlg2(&base); + dlg2.show(); + + QApplication::processEvents(); + + simulateSymbianCommand(s60CommandStart); + simulateSymbianCommand(s60CommandStart + 1); + + QCOMPARE(baseLeftSpy.count(), 0); + QCOMPARE(baseRightSpy.count(), 0); +} + QTEST_MAIN(tst_QSoftKeyManager) #include "tst_qsoftkeymanager.moc" -- cgit v0.12 From ccde429536ba29dceb1576b6b981a812b0b846fc Mon Sep 17 00:00:00 2001 From: Yoann Lopes Date: Wed, 2 Dec 2009 15:31:09 +0100 Subject: Fixes transformation problems with QGraphicsProxyWidget. In the paintEvent of the widget used in a QGraphicsProxyWidget, the worldMatrix was wrongly used by the painter instead of the deviceMatrix. Similar problem in the WindowsXP Style, the worldMatrix was used instead of the deviceMatrix for determining if the widget is transformed (reviewed by eblomfel). Task-number: QTBUG-5939 Reviewed-by: bnilsen Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/gui/painting/qpainter.cpp | 2 +- src/gui/styles/qwindowsxpstyle.cpp | 3 +- tests/auto/qpainter/tst_qpainter.cpp | 58 +++++++++++++++++++++++++++++++++++- 3 files changed, 59 insertions(+), 4 deletions(-) diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp index 443c9c5..30f8c9e 100644 --- a/src/gui/painting/qpainter.cpp +++ b/src/gui/painting/qpainter.cpp @@ -284,7 +284,7 @@ bool QPainterPrivate::attachPainterPrivate(QPainter *q, QPaintDevice *pdev) // Update matrix. if (q->d_ptr->state->WxF) { - q->d_ptr->state->redirectionMatrix *= q->d_ptr->state->worldMatrix; + q->d_ptr->state->redirectionMatrix = q->d_ptr->state->matrix; q->d_ptr->state->redirectionMatrix.translate(-offset.x(), -offset.y()); q->d_ptr->state->worldMatrix = QTransform(); q->d_ptr->state->WxF = false; diff --git a/src/gui/styles/qwindowsxpstyle.cpp b/src/gui/styles/qwindowsxpstyle.cpp index fe7f5d7..0767083 100644 --- a/src/gui/styles/qwindowsxpstyle.cpp +++ b/src/gui/styles/qwindowsxpstyle.cpp @@ -623,8 +623,7 @@ void QWindowsXPStylePrivate::drawBackground(XPThemeData &themeData) painter->save(); - QMatrix m = painter->matrix(); - bool complexXForm = m.m11() != 1.0 || m.m22() != 1.0 || m.m12() != 0.0 || m.m21() != 0.0; + bool complexXForm = painter->deviceTransform().type() > QTransform::TxTranslate; bool translucentToplevel = false; QPaintDevice *pdev = painter->device(); diff --git a/tests/auto/qpainter/tst_qpainter.cpp b/tests/auto/qpainter/tst_qpainter.cpp index 8b71349..67d1972 100644 --- a/tests/auto/qpainter/tst_qpainter.cpp +++ b/tests/auto/qpainter/tst_qpainter.cpp @@ -41,7 +41,7 @@ #include - +#include "../../shared/util.h" #include #include @@ -67,6 +67,11 @@ #include +#include +#include +#include +#include + #if defined(Q_OS_SYMBIAN) # define SRCDIR "." #endif @@ -244,6 +249,8 @@ private slots: void setPenColorOnImage(); void setPenColorOnPixmap(); + void QTBUG5939_attachPainterPrivate(); + private: void fillData(); void setPenColor(QPainter& p); @@ -4404,6 +4411,55 @@ void tst_QPainter::setPenColorOnPixmap() setPenColor(p); } +class TestProxy : public QGraphicsProxyWidget +{ +public: + TestProxy() : QGraphicsProxyWidget() {} + void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) + { + QGraphicsProxyWidget::paint(painter, option, widget); + deviceTransform = painter->deviceTransform(); + } + QTransform deviceTransform; +}; + +class TestWidget : public QWidget +{ +Q_OBJECT +public: + TestWidget() : QWidget(), painted(false) {} + void paintEvent(QPaintEvent *) + { + QPainter p(this); + deviceTransform = p.deviceTransform(); + worldTransform = p.worldTransform(); + painted = true; + } + QTransform deviceTransform; + QTransform worldTransform; + bool painted; +}; + +void tst_QPainter::QTBUG5939_attachPainterPrivate() +{ + QWidget *w = new QWidget(); + QGraphicsScene *scene = new QGraphicsScene(); + QGraphicsView *view = new QGraphicsView(scene, w); + view->move(50 ,50); + TestProxy *proxy = new TestProxy(); + TestWidget *widget = new TestWidget(); + proxy->setWidget(widget); + scene->addItem(proxy); + proxy->rotate(45); + w->resize(scene->sceneRect().size().toSize()); + + w->show(); + QTRY_VERIFY(widget->painted); + + QVERIFY(widget->worldTransform.isIdentity()); + QCOMPARE(widget->deviceTransform, proxy->deviceTransform); +} + QTEST_MAIN(tst_QPainter) #include "tst_qpainter.moc" -- cgit v0.12 From bc49609893d79dc12af459dad8750530da37e5ec Mon Sep 17 00:00:00 2001 From: Aleksandar Sasha Babic Date: Wed, 2 Dec 2009 15:26:21 +0100 Subject: qreal-ization Adding more wrapper math related functions. This should enable us to have more control over which calls are actually made. Don't worry too much for some "if" statements, the compiler is smart enough to make direct calls to specific math functions. Task-number: QTBUG-4894 Reviewed-by: axis --- src/corelib/kernel/qmath.h | 57 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) diff --git a/src/corelib/kernel/qmath.h b/src/corelib/kernel/qmath.h index a9e4378..820f424 100644 --- a/src/corelib/kernel/qmath.h +++ b/src/corelib/kernel/qmath.h @@ -76,6 +76,16 @@ inline int qFloor(qreal v) return int(floor(v)); } +inline qreal qFabs(qreal v) +{ +#ifdef QT_USE_MATH_H_FLOATS + if(sizeof(qreal) == sizeof(float)) + return fabsf(float(v)); + else +#endif + return fabs(v); +} + inline qreal qSin(qreal v) { #ifdef QT_USE_MATH_H_FLOATS @@ -96,6 +106,16 @@ inline qreal qCos(qreal v) return cos(v); } +inline qreal qTan(qreal v) +{ +#ifdef QT_USE_MATH_H_FLOATS + if (sizeof(qreal) == sizeof(float)) + return tanf(float(v)); + else +#endif + return tan(v); +} + inline qreal qAcos(qreal v) { #ifdef QT_USE_MATH_H_FLOATS @@ -106,6 +126,36 @@ inline qreal qAcos(qreal v) return acos(v); } +inline qreal qAsin(qreal v) +{ +#ifdef QT_USE_MATH_H_FLOATS + if (sizeof(qreal) == sizeof(float)) + return asinf(float(v)); + else +#endif + return asin(v); +} + +inline qreal qAtan(qreal v) +{ +#ifdef QT_USE_MATH_H_FLOATS + if(sizeof(qreal) == sizeof(float)) + return atanf(float(v)); + else +#endif + return atan(v); +} + +inline qreal qAtan2(qreal x, qreal y) +{ +#ifdef QT_USE_MATH_H_FLOATS + if(sizeof(qreal) == sizeof(float)) + return atan2f(float(x), float(y)); + else +#endif + return atan2(x, y); +} + inline qreal qSqrt(qreal v) { #ifdef QT_USE_MATH_H_FLOATS @@ -126,6 +176,13 @@ inline qreal qLn(qreal v) return log(v); } +inline qreal qExp(qreal v) +{ + // only one signature + // exists, exp(double) + return exp(v); +} + inline qreal qPow(qreal x, qreal y) { #ifdef QT_USE_MATH_H_FLOATS -- cgit v0.12 From ac94288ba71722981894fc7577b781aa76d5f7de Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Wed, 2 Dec 2009 16:27:00 +0100 Subject: Fix tst_QSystemLock::processes Paths were not correct --- tests/auto/qsharedmemory/qsystemlock/tst_qsystemlock.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/auto/qsharedmemory/qsystemlock/tst_qsystemlock.cpp b/tests/auto/qsharedmemory/qsystemlock/tst_qsystemlock.cpp index 35f05d1..518cdbf 100644 --- a/tests/auto/qsharedmemory/qsystemlock/tst_qsystemlock.cpp +++ b/tests/auto/qsharedmemory/qsystemlock/tst_qsystemlock.cpp @@ -202,9 +202,9 @@ void tst_QSystemLock::processes() QStringList scripts; for (int i = 0; i < readOnly; ++i) - scripts.append(QFileInfo(SRCDIR "lackey/scripts/ systemlock_read.js").absoluteFilePath() ); + scripts.append(QFileInfo(SRCDIR "/../lackey/scripts/systemlock_read.js").absoluteFilePath() ); for (int i = 0; i < readWrite; ++i) - scripts.append(QFileInfo(SRCDIR "lackey/scripts/systemlock_readwrite.js").absoluteFilePath()); + scripts.append(QFileInfo(SRCDIR "/../lackey/scripts/systemlock_readwrite.js").absoluteFilePath()); QList consumers; unsigned int failedProcesses = 0; @@ -213,8 +213,8 @@ void tst_QSystemLock::processes() QStringList arguments = QStringList() << scripts.at(i); QProcess *p = new QProcess; p->setProcessChannelMode(QProcess::ForwardedChannels); - - p->start(QFileInfo(SRCDIR "lackey/lackey").absoluteFilePath(), arguments); + + p->start("../lackey/lackey", arguments); // test, if the process could be started. if (p->waitForStarted(2000)) -- cgit v0.12 From 78b2e552cca92859b2c126751ca5fc6fd83dd5cf Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Wed, 2 Dec 2009 19:10:26 +0100 Subject: Stabilize tests on X11 --- tests/auto/qdoublespinbox/tst_qdoublespinbox.cpp | 9 ++++++--- tests/auto/qlineedit/tst_qlineedit.cpp | 1 + tests/auto/qlistview/tst_qlistview.cpp | 4 +++- tests/auto/qspinbox/tst_qspinbox.cpp | 5 ++++- 4 files changed, 14 insertions(+), 5 deletions(-) diff --git a/tests/auto/qdoublespinbox/tst_qdoublespinbox.cpp b/tests/auto/qdoublespinbox/tst_qdoublespinbox.cpp index 157c39d..7f03153 100644 --- a/tests/auto/qdoublespinbox/tst_qdoublespinbox.cpp +++ b/tests/auto/qdoublespinbox/tst_qdoublespinbox.cpp @@ -1065,17 +1065,20 @@ void tst_QDoubleSpinBox::taskQTBUG_5008_textFromValueAndValidate() //we use the French delimiters here QString textFromValue (double value) const - { + { return locale().toString(value); } } spinbox; spinbox.show(); spinbox.activateWindow(); spinbox.setFocus(); + QApplication::setActiveWindow(&spinbox); QTest::qWaitForWindowShown(&spinbox); - QCOMPARE(spinbox.text(), spinbox.locale().toString(spinbox.value())); + QTRY_VERIFY(spinbox.hasFocus()); + QTRY_COMPARE(static_cast(&spinbox), QApplication::activeWindow()); + QCOMPARE(spinbox.text(), spinbox.locale().toString(spinbox.value())); spinbox.lineEdit()->setCursorPosition(2); //just after the first thousand separator - QTest::keyClick(0, Qt::Key_0); // let's insert a 0 + QTest::keyClick(0, Qt::Key_0); // let's insert a 0 QCOMPARE(spinbox.value(), 10000.); spinbox.clearFocus(); //make sure the value is correctly formatted QCOMPARE(spinbox.text(), spinbox.locale().toString(spinbox.value())); diff --git a/tests/auto/qlineedit/tst_qlineedit.cpp b/tests/auto/qlineedit/tst_qlineedit.cpp index 79d1b3a..8b8078b 100644 --- a/tests/auto/qlineedit/tst_qlineedit.cpp +++ b/tests/auto/qlineedit/tst_qlineedit.cpp @@ -3360,6 +3360,7 @@ void tst_QLineEdit::task174640_editingFinished() QApplication::setActiveWindow(&mw); mw.activateWindow(); QTest::qWaitForWindowShown(&mw); + QTRY_COMPARE(&mw, QApplication::activeWindow()); QSignalSpy editingFinishedSpy(le1, SIGNAL(editingFinished())); diff --git a/tests/auto/qlistview/tst_qlistview.cpp b/tests/auto/qlistview/tst_qlistview.cpp index 24a553f..98001c8 100644 --- a/tests/auto/qlistview/tst_qlistview.cpp +++ b/tests/auto/qlistview/tst_qlistview.cpp @@ -1787,8 +1787,10 @@ void tst_QListView::task262152_setModelColumnNavigate() view.setModelColumn(1); view.show(); + QApplication::setActiveWindow(&view); QTest::qWaitForWindowShown(&view); - QTest::qWait(120); + QTest::qWait(30); + QTRY_COMPARE(static_cast(&view), QApplication::activeWindow()); QTest::keyClick(&view, Qt::Key_Down); QTest::qWait(30); QTRY_COMPARE(view.currentIndex(), model.index(1,1)); diff --git a/tests/auto/qspinbox/tst_qspinbox.cpp b/tests/auto/qspinbox/tst_qspinbox.cpp index cd65135..e5e63a0 100644 --- a/tests/auto/qspinbox/tst_qspinbox.cpp +++ b/tests/auto/qspinbox/tst_qspinbox.cpp @@ -1025,7 +1025,7 @@ void tst_QSpinBox::taskQTBUG_5008_textFromValueAndValidate() //we use the French delimiters here QString textFromValue (int value) const - { + { return locale().toString(value); } @@ -1033,7 +1033,10 @@ void tst_QSpinBox::taskQTBUG_5008_textFromValueAndValidate() spinbox.show(); spinbox.activateWindow(); spinbox.setFocus(); + QApplication::setActiveWindow(&spinbox); QTest::qWaitForWindowShown(&spinbox); + QTRY_VERIFY(spinbox.hasFocus()); + QTRY_COMPARE(static_cast(&spinbox), QApplication::activeWindow()); QCOMPARE(spinbox.text(), spinbox.locale().toString(spinbox.value())); spinbox.lineEdit()->setCursorPosition(2); //just after the first thousand separator QTest::keyClick(0, Qt::Key_0); // let's insert a 0 -- cgit v0.12 From 1b4ff1bab4ccc4bdc403b84920314f76fbca02c5 Mon Sep 17 00:00:00 2001 From: Bill King Date: Thu, 3 Dec 2009 09:49:49 +1000 Subject: Fixes: OCI QSqlDatabase.tables() does not work with system tables. Task-number: QTBUG-5298 Reviewed-by: Justin McPherson --- src/sql/drivers/oci/qsql_oci.cpp | 83 +++++++++++++++++----------- tests/auto/qsqldatabase/tst_qsqldatabase.cpp | 16 ++++++ 2 files changed, 68 insertions(+), 31 deletions(-) diff --git a/src/sql/drivers/oci/qsql_oci.cpp b/src/sql/drivers/oci/qsql_oci.cpp index 17f2c92..f130087 100644 --- a/src/sql/drivers/oci/qsql_oci.cpp +++ b/src/sql/drivers/oci/qsql_oci.cpp @@ -2200,26 +2200,34 @@ bool QOCIDriver::rollbackTransaction() QStringList QOCIDriver::tables(QSql::TableType type) const { QStringList tl; + QStringList sysUsers = QStringList() << QLatin1String("MDSYS") + << QLatin1String("LBACSYS") + << QLatin1String("SYS") + << QLatin1String("SYSTEM") + << QLatin1String("WKSYS") + << QLatin1String("CTXSYS") + << QLatin1String("WMSYS"); + + QString user = d->user; + if ( isIdentifierEscaped(user, QSqlDriver::TableName)) + user = stripDelimiters(user, QSqlDriver::TableName); + else + user = user.toUpper(); + + if(sysUsers.contains(user)) + sysUsers.removeAll(user);; + if (!isOpen()) return tl; QSqlQuery t(createResult()); t.setForwardOnly(true); if (type & QSql::Tables) { - t.exec(QLatin1String("select owner, table_name from all_tables " - "where owner != 'MDSYS' " - "and owner != 'LBACSYS' " - "and owner != 'SYS' " - "and owner != 'SYSTEM' " - "and owner != 'WKSYS'" - "and owner != 'CTXSYS'" - "and owner != 'WMSYS'")); - - QString user = d->user; - if ( isIdentifierEscaped(user, QSqlDriver::TableName)) - user = stripDelimiters(user, QSqlDriver::TableName); - else - user = user.toUpper(); + QString query = QLatin1String("select owner, table_name from all_tables where "); + QStringList whereList; + foreach(const QString &sysUserName, sysUsers) + whereList << QLatin1String("owner != '") + sysUserName + QLatin1String("' "); + t.exec(query + whereList.join(QLatin1String(" and "))); while (t.next()) { if (t.value(0).toString().toUpper() != user.toUpper()) @@ -2229,30 +2237,21 @@ QStringList QOCIDriver::tables(QSql::TableType type) const } // list all table synonyms as well - t.exec(QLatin1String("select owner, synonym_name from all_synonyms " - "where owner != 'MDSYS' " - "and owner != 'LBACSYS' " - "and owner != 'SYS' " - "and owner != 'SYSTEM' " - "and owner != 'WKSYS'" - "and owner != 'CTXSYS'" - "and owner != 'WMSYS'")); + query = QLatin1String("select owner, synonym_name from all_synonyms where "); + t.exec(query + whereList.join(QLatin1String(" and "))); while (t.next()) { if (t.value(0).toString() != d->user) - tl.append(t.value(0).toString() + QLatin1String(".") + t.value(1).toString()); + tl.append(t.value(0).toString() + QLatin1Char('.') + t.value(1).toString()); else tl.append(t.value(1).toString()); } } if (type & QSql::Views) { - t.exec(QLatin1String("select owner, view_name from all_views " - "where owner != 'MDSYS' " - "and owner != 'LBACSYS' " - "and owner != 'SYS' " - "and owner != 'SYSTEM' " - "and owner != 'WKSYS'" - "and owner != 'CTXSYS'" - "and owner != 'WMSYS'")); + QString query = QLatin1String("select owner, view_name from all_views where "); + QStringList whereList; + foreach(const QString &sysUserName, sysUsers) + whereList << QLatin1String("owner != '") + sysUserName + QLatin1String("' "); + t.exec(query + whereList.join(QLatin1String(" and "))); while (t.next()) { if (t.value(0).toString().toUpper() != d->user.toUpper()) tl.append(t.value(0).toString() + QLatin1Char('.') + t.value(1).toString()); @@ -2265,6 +2264,28 @@ QStringList QOCIDriver::tables(QSql::TableType type) const while (t.next()) { tl.append(t.value(0).toString()); } + QString query = QLatin1String("select owner, table_name from all_tables where "); + QStringList whereList; + foreach(const QString &sysUserName, sysUsers) + whereList << QLatin1String("owner = '") + sysUserName + QLatin1String("' "); + t.exec(query + whereList.join(QLatin1String(" or "))); + + while (t.next()) { + if (t.value(0).toString().toUpper() != user.toUpper()) + tl.append(t.value(0).toString() + QLatin1Char('.') + t.value(1).toString()); + else + tl.append(t.value(1).toString()); + } + + // list all table synonyms as well + query = QLatin1String("select owner, synonym_name from all_synonyms where "); + t.exec(query + whereList.join(QLatin1String(" or "))); + while (t.next()) { + if (t.value(0).toString() != d->user) + tl.append(t.value(0).toString() + QLatin1String(".") + t.value(1).toString()); + else + tl.append(t.value(1).toString()); + } } return tl; } diff --git a/tests/auto/qsqldatabase/tst_qsqldatabase.cpp b/tests/auto/qsqldatabase/tst_qsqldatabase.cpp index fe7c3ea..f840ca6 100644 --- a/tests/auto/qsqldatabase/tst_qsqldatabase.cpp +++ b/tests/auto/qsqldatabase/tst_qsqldatabase.cpp @@ -86,6 +86,8 @@ private slots: void open(); void tables_data() { generic_data(); } void tables(); + void oci_tables_data() { generic_data("QOCI"); } + void oci_tables(); void transaction_data() { generic_data(); } void transaction(); void eventNotification_data() { generic_data(); } @@ -380,6 +382,7 @@ void tst_QSqlDatabase::dropTestTables(QSqlDatabase db) if (db.driverName().startsWith("QOCI")) { q.exec("drop user "+qTableName("CREATOR")+" cascade"); q.exec("drop user "+qTableName("APPUSER")+" cascade"); + q.exec("DROP TABLE system."+qTableName("mypassword")); } } @@ -2481,5 +2484,18 @@ void tst_QSqlDatabase::mysql_savepointtest() QVERIFY_SQL(q, exec("savepoint foo")); } +void tst_QSqlDatabase::oci_tables() +{ + QFETCH(QString, dbName); + QSqlDatabase db = QSqlDatabase::database(dbName); + CHECK_DATABASE(db); + QSqlQuery q(db); + QString systemTableName("system."+qTableName("mypassword")); + QVERIFY_SQL(q, exec("CREATE TABLE "+systemTableName+"(name VARCHAR(20))")); + QVERIFY(!db.tables().contains(systemTableName.toUpper())); + qDebug() << db.tables(QSql::SystemTables); + QVERIFY(db.tables(QSql::SystemTables).contains(systemTableName.toUpper())); +} + QTEST_MAIN(tst_QSqlDatabase) #include "tst_qsqldatabase.moc" -- cgit v0.12 From ae2c3a96519ede274bd3a67566f007b1cba24ff8 Mon Sep 17 00:00:00 2001 From: Gabriel de Dietrich Date: Wed, 2 Dec 2009 12:42:38 +0100 Subject: QCompleter wouldn't emit highlighted() and activated() signals Completion was checked before sending the textEdited() signal from QLineEdit. The behaviour has been reverted as in 4.5. Reviewed-by: aalpert Task-number: QTBUG-6386 --- src/gui/widgets/qlineedit_p.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/gui/widgets/qlineedit_p.cpp b/src/gui/widgets/qlineedit_p.cpp index d03c003..4437fef 100644 --- a/src/gui/widgets/qlineedit_p.cpp +++ b/src/gui/widgets/qlineedit_p.cpp @@ -103,12 +103,12 @@ void QLineEditPrivate::_q_handleWindowActivate() void QLineEditPrivate::_q_textEdited(const QString &text) { Q_Q(QLineEdit); + emit q->textEdited(text); #ifndef QT_NO_COMPLETER - if (control->completer() && - control->completer()->completionMode() != QCompleter::InlineCompletion) + if (control->completer() + && control->completer()->completionMode() != QCompleter::InlineCompletion) control->complete(-1); // update the popup on cut/paste/del #endif - emit q->textEdited(text); } void QLineEditPrivate::_q_cursorPositionChanged(int from, int to) -- cgit v0.12 From 5cab18e5e3946b0dc14d678c8a317522d25e3003 Mon Sep 17 00:00:00 2001 From: Alexis Menard Date: Thu, 3 Dec 2009 10:54:58 +0100 Subject: Add extra auto-test for topLevel list corruption. Adding auto-tests make QA people happy. Reviewed-by:TrustMe --- tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp | 36 ++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp b/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp index a8017ff..38abc3d 100644 --- a/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp +++ b/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp @@ -4211,6 +4211,42 @@ void tst_QGraphicsScene::siblingIndexAlwaysValid() //If there are in the list that's bad, we crash... QVERIFY(!QGraphicsScenePrivate::get(&scene)->topLevelItems.contains(static_cast(child))); + //Other case + QGraphicsScene scene2; + // works with bsp tree index + scene2.setItemIndexMethod(QGraphicsScene::NoIndex); + + QGraphicsView view2(&scene2); + + // first add the blue rect + QGraphicsRectItem* const item1 = new QGraphicsRectItem(QRect( 10, 10, 10, 10 )); + item1->setPen(QColor(Qt::blue)); + item1->setBrush(Qt::blue); + scene2.addItem(item1); + + // then add the red rect + QGraphicsRectItem* const item2 = new QGraphicsRectItem(5, 5, 10, 10); + item2->setPen(QColor(Qt::red)); + item2->setBrush(Qt::red); + scene2.addItem(item2); + + // now the blue one is visible on top of the red one -> swap them (important for the bug) + item1->setZValue(1.0); + item2->setZValue(0.0); + + view2.show(); + + // handle events as a real life app would do + QApplication::processEvents(); + + // now delete the red rect + delete item2; + + // handle events as a real life app would do + QApplication::processEvents(); + + //We should not crash + } void tst_QGraphicsScene::taskQTBUG_5904_crashWithDeviceCoordinateCache() -- cgit v0.12 From 2263a796ac6fc84002ff075eb6cbc67e0ec27802 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Thu, 3 Dec 2009 17:20:03 +0100 Subject: Fixes broken selection with Shift and extended selection ItemAt() is in viewport coordinate. Pressed index is in coordinate relative to the whole view (regression since Qt 4.5) Reviewed-by: thierry Task-number: QTBUG-6407 --- src/gui/itemviews/qabstractitemview.cpp | 4 +-- .../qabstractitemview/tst_qabstractitemview.cpp | 42 ++++++++++++++++++++++ 2 files changed, 44 insertions(+), 2 deletions(-) diff --git a/src/gui/itemviews/qabstractitemview.cpp b/src/gui/itemviews/qabstractitemview.cpp index acfeff8..de6e6cb 100644 --- a/src/gui/itemviews/qabstractitemview.cpp +++ b/src/gui/itemviews/qabstractitemview.cpp @@ -1625,7 +1625,7 @@ void QAbstractItemView::mousePressEvent(QMouseEvent *event) QPoint offset = d->offset(); if ((command & QItemSelectionModel::Current) == 0) d->pressedPosition = pos + offset; - else if (!indexAt(d->pressedPosition).isValid()) + else if (!indexAt(d->pressedPosition - offset).isValid()) d->pressedPosition = visualRect(currentIndex()).center() + offset; if (edit(index, NoEditTriggers, event)) @@ -2195,7 +2195,7 @@ void QAbstractItemView::keyPressEvent(QKeyEvent *event) // note that we don't check if the new current index is enabled because moveCursor() makes sure it is if (command & QItemSelectionModel::Current) { d->selectionModel->setCurrentIndex(newCurrent, QItemSelectionModel::NoUpdate); - if (!indexAt(d->pressedPosition).isValid()) + if (!indexAt(d->pressedPosition - d->offset()).isValid()) d->pressedPosition = visualRect(oldCurrent).center() + d->offset(); QRect rect(d->pressedPosition - d->offset(), visualRect(newCurrent).center()); setSelection(rect, command); diff --git a/tests/auto/qabstractitemview/tst_qabstractitemview.cpp b/tests/auto/qabstractitemview/tst_qabstractitemview.cpp index db840f4..6479829 100644 --- a/tests/auto/qabstractitemview/tst_qabstractitemview.cpp +++ b/tests/auto/qabstractitemview/tst_qabstractitemview.cpp @@ -46,6 +46,7 @@ #include #include #include +#include #include #include #include @@ -224,6 +225,7 @@ private slots: void shiftArrowSelectionAfterScrolling(); void shiftSelectionAfterRubberbandSelection(); void ctrlRubberbandSelection(); + void QTBUG6407_extendedSelection(); }; class MyAbstractItemDelegate : public QAbstractItemDelegate @@ -1433,5 +1435,45 @@ void tst_QAbstractItemView::ctrlRubberbandSelection() QVERIFY(selected.contains(index2)); } +void tst_QAbstractItemView::QTBUG6407_extendedSelection() +{ + QListWidget view; + view.setSelectionMode(QAbstractItemView::ExtendedSelection); + for(int i = 0; i < 50; ++i) + view.addItem(QString::number(i)); + + view.resize(200,200); + + view.show(); + QApplication::setActiveWindow(&view); + QTest::qWaitForWindowShown(&view); + QTRY_COMPARE(static_cast(&view), QApplication::activeWindow()); + + view.verticalScrollBar()->setValue(view.verticalScrollBar()->maximum()); + QTest::qWait(20); + + QModelIndex index49 = view.model()->index(49,0); + QPoint p = view.visualRect(index49).center(); + QVERIFY(view.viewport()->rect().contains(p)); + QTest::mouseClick(view.viewport(), Qt::LeftButton, 0, p); + QCOMPARE(view.currentIndex(), index49); + QCOMPARE(view.selectedItems().count(), 1); + + QModelIndex index47 = view.model()->index(47,0); + p = view.visualRect(index47).center(); + QVERIFY(view.viewport()->rect().contains(p)); + QTest::mouseClick(view.viewport(), Qt::LeftButton, Qt::ShiftModifier, p); + QCOMPARE(view.currentIndex(), index47); + QCOMPARE(view.selectedItems().count(), 3); //49, 48, 47; + + QModelIndex index44 = view.model()->index(44,0); + p = view.visualRect(index44).center(); + QVERIFY(view.viewport()->rect().contains(p)); + QTest::mouseClick(view.viewport(), Qt::LeftButton, Qt::ShiftModifier, p); + QCOMPARE(view.currentIndex(), index44); + QCOMPARE(view.selectedItems().count(), 6); //49 .. 44; + +} + QTEST_MAIN(tst_QAbstractItemView) #include "tst_qabstractitemview.moc" -- cgit v0.12 From 0ced23b6af63c42b04977faf94deb3ff0a57ff4e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan-Arve=20S=C3=A6ther?= Date: Thu, 3 Dec 2009 21:35:20 +0100 Subject: Some doc fixes - Remove a lie. - When referring to the size of an anchor, refer to it consistently as 'spacing' instead of magnitude. --- src/gui/graphicsview/qgraphicsanchorlayout.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gui/graphicsview/qgraphicsanchorlayout.cpp b/src/gui/graphicsview/qgraphicsanchorlayout.cpp index 686096c..6718a28 100644 --- a/src/gui/graphicsview/qgraphicsanchorlayout.cpp +++ b/src/gui/graphicsview/qgraphicsanchorlayout.cpp @@ -158,7 +158,7 @@ QGraphicsAnchor::~QGraphicsAnchor() \property QGraphicsAnchor::sizePolicy \brief the size policy for the QGraphicsAnchor. - By setting the size policy on an anchor you can configure how the item can resize itself + By setting the size policy on an anchor you can configure how the anchor can resize itself from its preferred spacing. For instance, if the anchor has the size policy QSizePolicy::Minimum, the spacing is the minimum size of the anchor. However, its size can grow up to the anchors maximum size. If the default size policy is QSizePolicy::Fixed, @@ -247,7 +247,7 @@ QGraphicsAnchorLayout::~QGraphicsAnchorLayout() /*! Creates an anchor between the edge \a firstEdge of item \a firstItem and the edge \a secondEdge - of item \a secondItem. The magnitude of the anchor is picked up from the style. Anchors + of item \a secondItem. The spacing of the anchor is picked up from the style. Anchors between a layout edge and an item edge will have a size of 0. If there is already an anchor between the edges, the the new anchor will replace the old one. -- cgit v0.12 From 108ab335537d20bc74aa9115d46cf91243223c4e Mon Sep 17 00:00:00 2001 From: Rhys Weatherley Date: Fri, 4 Dec 2009 17:03:41 +1000 Subject: Better check for EGL extension strings The previous code might have failed if the desired extension name was a prefix of another name: "EGL_foo" member of "EGL_foo_bar". This change introduces a more precise check. Task-number: QTBUG-6454 Reviewed-by: Sarah Smith --- src/gui/egl/qegl.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/gui/egl/qegl.cpp b/src/gui/egl/qegl.cpp index cf28dc4..6ee4bfc 100644 --- a/src/gui/egl/qegl.cpp +++ b/src/gui/egl/qegl.cpp @@ -429,7 +429,10 @@ QString QEglContext::extensions() bool QEglContext::hasExtension(const char* extensionName) { - return extensions().contains(QLatin1String(extensionName)); + QList extensions = + QByteArray(reinterpret_cast + (eglQueryString(QEglContext::defaultDisplay(0), EGL_EXTENSIONS))).split(' '); + return extensions.contains(extensionName); } QEglContext *QEglContext::currentContext(QEgl::API api) -- cgit v0.12 From 696099f8e3179787114df40d6ce6fef97bfa33dc Mon Sep 17 00:00:00 2001 From: Rohan McGovern Date: Fri, 4 Dec 2009 15:54:47 +1000 Subject: Fixed compile for S60. QObjectPrivate::isSignalConnected was inlined, update QtCoreu.def --- src/s60installs/eabi/QtCoreu.def | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/s60installs/eabi/QtCoreu.def b/src/s60installs/eabi/QtCoreu.def index 6a4cdbd..89fa76f 100644 --- a/src/s60installs/eabi/QtCoreu.def +++ b/src/s60installs/eabi/QtCoreu.def @@ -2556,7 +2556,7 @@ EXPORTS _ZNK14QObjectPrivate10senderListEv @ 2555 NONAME _ZNK14QObjectPrivate11signalIndexEPKc @ 2556 NONAME _ZNK14QObjectPrivate12receiverListEPKc @ 2557 NONAME - _ZNK14QObjectPrivate17isSignalConnectedEi @ 2558 NONAME + _ZNK14QObjectPrivate17isSignalConnectedEi @ 2558 NONAME ABSENT _ZNK14QObjectPrivate8isSenderEPK7QObjectPKc @ 2559 NONAME _ZNK14QStringMatcher7indexInEPK5QCharii @ 2560 NONAME _ZNK14QStringMatcher7indexInERK7QStringi @ 2561 NONAME -- cgit v0.12 From c0b81480b2909b18ac15bdd124a562ae005c2f41 Mon Sep 17 00:00:00 2001 From: Rhys Weatherley Date: Fri, 4 Dec 2009 17:17:00 +1000 Subject: Rebind window surface fbo after native GL rendering If the user called QGLFramebufferObject::bind()/release() during a beginNativePainting() callout, the release() would reset the context's fbo to zero, not the actual window surface fbo. Task-number: QTBUG-6204 Reviewed-by: Tom --- src/opengl/qgl.cpp | 1 + src/opengl/qgl_p.h | 1 + src/opengl/qglframebufferobject.cpp | 4 ++-- src/opengl/qglpaintdevice.cpp | 10 ++++++++++ 4 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp index 5ada125..94b8aa5 100644 --- a/src/opengl/qgl.cpp +++ b/src/opengl/qgl.cpp @@ -1495,6 +1495,7 @@ void QGLContextPrivate::init(QPaintDevice *dev, const QGLFormat &format) version_flags_cached = false; version_flags = QGLFormat::OpenGL_Version_None; current_fbo = 0; + default_fbo = 0; active_engine = 0; } diff --git a/src/opengl/qgl_p.h b/src/opengl/qgl_p.h index 8e472e5..ab72c9c 100644 --- a/src/opengl/qgl_p.h +++ b/src/opengl/qgl_p.h @@ -328,6 +328,7 @@ public: GLint max_texture_size; GLuint current_fbo; + GLuint default_fbo; QPaintEngine *active_engine; static inline QGLContextGroup *contextGroup(const QGLContext *ctx) { return ctx->d_ptr->group; } diff --git a/src/opengl/qglframebufferobject.cpp b/src/opengl/qglframebufferobject.cpp index d79283e..d0297c9 100644 --- a/src/opengl/qglframebufferobject.cpp +++ b/src/opengl/qglframebufferobject.cpp @@ -899,8 +899,8 @@ bool QGLFramebufferObject::release() #endif if (current) { - current->d_ptr->current_fbo = 0; - glBindFramebuffer(GL_FRAMEBUFFER_EXT, 0); + current->d_ptr->current_fbo = current->d_ptr->default_fbo; + glBindFramebuffer(GL_FRAMEBUFFER_EXT, current->d_ptr->default_fbo); } return true; diff --git a/src/opengl/qglpaintdevice.cpp b/src/opengl/qglpaintdevice.cpp index 2867de5..bcd90a5 100644 --- a/src/opengl/qglpaintdevice.cpp +++ b/src/opengl/qglpaintdevice.cpp @@ -89,6 +89,12 @@ void QGLPaintDevice::beginPaint() ctx->d_ptr->current_fbo = m_thisFBO; glBindFramebuffer(GL_FRAMEBUFFER_EXT, m_thisFBO); } + + // Set the default fbo for the context to m_thisFBO so that + // if some raw GL code between beginNativePainting() and + // endNativePainting() calls QGLFramebufferObject::release(), + // painting will revert to the window surface's fbo. + ctx->d_ptr->default_fbo = m_thisFBO; } void QGLPaintDevice::ensureActiveTarget() @@ -101,6 +107,8 @@ void QGLPaintDevice::ensureActiveTarget() ctx->d_ptr->current_fbo = m_thisFBO; glBindFramebuffer(GL_FRAMEBUFFER_EXT, m_thisFBO); } + + ctx->d_ptr->default_fbo = m_thisFBO; } void QGLPaintDevice::endPaint() @@ -111,6 +119,8 @@ void QGLPaintDevice::endPaint() ctx->d_ptr->current_fbo = m_previousFBO; glBindFramebuffer(GL_FRAMEBUFFER_EXT, m_previousFBO); } + + ctx->d_ptr->default_fbo = 0; } QGLFormat QGLPaintDevice::format() const -- cgit v0.12 From c9d0b0bb9d2e3745f6e2a562ac02526f78ca8ff6 Mon Sep 17 00:00:00 2001 From: Pierre Rossi Date: Fri, 4 Dec 2009 00:10:04 +0100 Subject: Apparently fixes some build issues on some old unixes... Reviewed-by: Marius Storm-Olsen --- qmake/generators/unix/unixmake.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qmake/generators/unix/unixmake.cpp b/qmake/generators/unix/unixmake.cpp index faa6415..44a461e 100644 --- a/qmake/generators/unix/unixmake.cpp +++ b/qmake/generators/unix/unixmake.cpp @@ -88,7 +88,7 @@ UnixMakefileGenerator::init() if(project->isEmpty("QMAKE_LIBTOOL")) project->values("QMAKE_LIBTOOL").append("libtool --silent"); if(project->isEmpty("QMAKE_SYMBOLIC_LINK")) - project->values("QMAKE_SYMBOLIC_LINK").append("ln -sf"); + project->values("QMAKE_SYMBOLIC_LINK").append("ln -f -s"); /* this should probably not be here, but I'm using it to wrap the .t files */ if(project->first("TEMPLATE") == "app") -- cgit v0.12 From b6cf9e28c2fef9112789e98ac9d1eda45a407889 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Fri, 4 Dec 2009 14:36:48 +0100 Subject: Fix compilation with Sun CC 5.9: it was crashing with this code. Definitely a compiler bug. Reviewed-by: Kent Hansen --- src/gui/image/qimagepixmapcleanuphooks.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/gui/image/qimagepixmapcleanuphooks.cpp b/src/gui/image/qimagepixmapcleanuphooks.cpp index 650075b..e411cd1 100644 --- a/src/gui/image/qimagepixmapcleanuphooks.cpp +++ b/src/gui/image/qimagepixmapcleanuphooks.cpp @@ -93,11 +93,11 @@ void QImagePixmapCleanupHooks::removeImageHook(_qt_image_cleanup_hook_64 hook) imageHooks.removeAll(hook); } - void QImagePixmapCleanupHooks::executePixmapModificationHooks(QPixmap* pm) { - for (int i = 0; i < qt_image_and_pixmap_cleanup_hooks()->pixmapModificationHooks.count(); ++i) - qt_image_and_pixmap_cleanup_hooks()->pixmapModificationHooks[i](pm); + QImagePixmapCleanupHooks *h = qt_image_and_pixmap_cleanup_hooks(); + for (int i = 0; i < h->pixmapModificationHooks.count(); ++i) + h->pixmapModificationHooks[i](pm); if (qt_pixmap_cleanup_hook_64) qt_pixmap_cleanup_hook_64(pm->cacheKey()); @@ -105,7 +105,8 @@ void QImagePixmapCleanupHooks::executePixmapModificationHooks(QPixmap* pm) void QImagePixmapCleanupHooks::executePixmapDestructionHooks(QPixmap* pm) { - for (int i = 0; i < qt_image_and_pixmap_cleanup_hooks()->pixmapDestructionHooks.count(); ++i) + QImagePixmapCleanupHooks *h = qt_image_and_pixmap_cleanup_hooks(); + for (int i = 0; i < h->pixmapModificationHooks.count(); ++i) qt_image_and_pixmap_cleanup_hooks()->pixmapDestructionHooks[i](pm); if (qt_pixmap_cleanup_hook_64) -- cgit v0.12 From 77f274672480e5980d9f42e4fd94c9770279543b Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Fri, 4 Dec 2009 15:01:49 +0100 Subject: doc: Example page now lists images used by the example It just links to an empty page at the moment, i.e., it doesn't load the images. But I will add that. Task-number: QTBUG-4484 --- tools/qdoc3/config.cpp | 12 +++++ tools/qdoc3/config.h | 1 + tools/qdoc3/cppcodeparser.cpp | 67 ++++++++++++++++++++++- tools/qdoc3/cppcodeparser.h | 1 + tools/qdoc3/generator.cpp | 94 +++++++++++++++++++++++++-------- tools/qdoc3/generator.h | 4 ++ tools/qdoc3/node.cpp | 12 ++++- tools/qdoc3/node.h | 1 + tools/qdoc3/test/qt-build-docs.qdocconf | 1 + tools/qdoc3/test/qt.qdocconf | 1 + 10 files changed, 168 insertions(+), 26 deletions(-) diff --git a/tools/qdoc3/config.cpp b/tools/qdoc3/config.cpp index 0fc3606..1a4e46e 100644 --- a/tools/qdoc3/config.cpp +++ b/tools/qdoc3/config.cpp @@ -399,6 +399,13 @@ QStringList Config::getAllFiles(const QString &filesVar, } /*! + \a fileName is the path of the file to find. + + \a files and \a dirs are the lists where we must find the + components of \a fileName. + + \a location is used for obtaining the file and line numbers + for report qdoc errors. */ QString Config::findFile(const Location& location, const QStringList& files, @@ -527,6 +534,11 @@ QString Config::findFile(const Location& location, } /*! + Copies the \a sourceFilePath to the file name constructed by + concatenating \a targetDirPath and \a userFriendlySourceFilePath. + \a location is for identifying the file and line number where + a qdoc error occurred. The constructed output file name is + returned. */ QString Config::copyFile(const Location& location, const QString& sourceFilePath, diff --git a/tools/qdoc3/config.h b/tools/qdoc3/config.h index 725129a..33e5739 100644 --- a/tools/qdoc3/config.h +++ b/tools/qdoc3/config.h @@ -161,6 +161,7 @@ class Config #define CONFIG_VERSIONSYM "versionsym" #define CONFIG_FILEEXTENSIONS "fileextensions" +#define CONFIG_IMAGEEXTENSIONS "imageextensions" #ifdef QDOC_QML #define CONFIG_QMLONLY "qmlonly" diff --git a/tools/qdoc3/cppcodeparser.cpp b/tools/qdoc3/cppcodeparser.cpp index ce71e51..41a2456 100644 --- a/tools/qdoc3/cppcodeparser.cpp +++ b/tools/qdoc3/cppcodeparser.cpp @@ -197,8 +197,14 @@ CppCodeParser::CppCodeParser() */ CppCodeParser::~CppCodeParser() { + // nothing. } +/*! + The constructor initializes a map of special node types + for identifying important nodes. And it initializes + some filters for identifying certain kinds of files. + */ void CppCodeParser::initializeParser(const Config &config) { CodeParser::initializeParser(config); @@ -220,24 +226,46 @@ void CppCodeParser::initializeParser(const Config &config) exampleNameFilter = exampleFilePatterns.join(" "); else exampleNameFilter = "*.cpp *.h *.js *.xq *.svg *.xml *.ui"; + + QStringList exampleImagePatterns = config.getStringList( + CONFIG_EXAMPLES + Config::dot + CONFIG_IMAGEEXTENSIONS); + + if (!exampleImagePatterns.isEmpty()) + exampleImageFilter = exampleImagePatterns.join(" "); + else + exampleImageFilter = "*.png"; } +/*! + Clear the map of common node types and call + the same function in the base class. + */ void CppCodeParser::terminateParser() { nodeTypeMap.clear(); CodeParser::terminateParser(); } +/*! + Returns "Cpp". + */ QString CppCodeParser::language() { return "Cpp"; } +/*! + Returns a list of extensions for header files. + */ QString CppCodeParser::headerFileNameFilter() { return "*.ch *.h *.h++ *.hh *.hpp *.hxx"; } +/*! + Returns a list of extensions for source files, i.e. not + header files. + */ QString CppCodeParser::sourceFileNameFilter() { return "*.c++ *.cc *.cpp *.cxx"; @@ -299,6 +327,12 @@ void CppCodeParser::parseSourceFile(const Location& location, fclose(in); } +/*! + This is called after all the header files have been parsed. + I think the most important thing it does is resolve class + inheritance links in the tree. But it also initializes a + bunch of stuff. + */ void CppCodeParser::doneParsingHeaderFiles(Tree *tree) { tree->resolveInheritance(); @@ -345,6 +379,12 @@ void CppCodeParser::doneParsingHeaderFiles(Tree *tree) mutableAssociativeIteratorClasses.clear(); } +/*! + This is called after all the source files (i.e., not the + header files) have been parsed. It traverses the tree to + resolve property links, normalize overload signatures, and + do other housekeeping of the tree. + */ void CppCodeParser::doneParsingSourceFiles(Tree *tree) { tree->root()->makeUndocumentedChildrenInternal(); @@ -353,6 +393,13 @@ void CppCodeParser::doneParsingSourceFiles(Tree *tree) tree->resolveProperties(); } +/*! + This function searches the \a tree to find a FunctionNode + for a function with the signature \a synopsis. If the + \a relative node is provided, the search begins there. If + \a fuzzy is true, base classes are searched. The function + node is returned, if found. + */ const FunctionNode *CppCodeParser::findFunctionNode(const QString& synopsis, Tree *tree, Node *relative, @@ -2212,6 +2259,7 @@ void CppCodeParser::createExampleFileNodes(FakeNode *fake) exampleDirs, proFileName, userFriendlyFilePath); + if (fullPath.isEmpty()) { QString tmp = proFileName; proFileName = examplePath + "/" + "qbuild.pro"; @@ -2231,8 +2279,18 @@ void CppCodeParser::createExampleFileNodes(FakeNode *fake) int sizeOfBoringPartOfName = fullPath.size() - proFileName.size(); fullPath.truncate(fullPath.lastIndexOf('/')); - QStringList exampleFiles = Config::getFilesHere(fullPath, - exampleNameFilter); + QStringList exampleFiles = Config::getFilesHere(fullPath,exampleNameFilter); + QString imagesPath = fullPath + "/images"; + QStringList imageFiles = Config::getFilesHere(imagesPath,exampleImageFilter); + +#if 0 + qDebug() << "examplePath:" << examplePath; + qDebug() << " exampleFiles" << exampleFiles; + qDebug() << "imagesPath:" << imagesPath; + qDebug() << "fullPath:" << fullPath; + qDebug() << " imageFiles" << imageFiles; +#endif + if (!exampleFiles.isEmpty()) { // move main.cpp and to the end, if it exists QString mainCpp; @@ -2259,6 +2317,11 @@ void CppCodeParser::createExampleFileNodes(FakeNode *fake) (void) new FakeNode(fake, exampleFile.mid(sizeOfBoringPartOfName), Node::File); + foreach (const QString &imageFile, imageFiles) { + FakeNode* newFake = new FakeNode(fake, + imageFile.mid(sizeOfBoringPartOfName), + Node::Image); + } } QT_END_NAMESPACE diff --git a/tools/qdoc3/cppcodeparser.h b/tools/qdoc3/cppcodeparser.h index e2e9d55..fff5bd9 100644 --- a/tools/qdoc3/cppcodeparser.h +++ b/tools/qdoc3/cppcodeparser.h @@ -185,6 +185,7 @@ class CppCodeParser : public CodeParser static QStringList exampleFiles; static QStringList exampleDirs; QString exampleNameFilter; + QString exampleImageFilter; }; QT_END_NAMESPACE diff --git a/tools/qdoc3/generator.cpp b/tools/qdoc3/generator.cpp index f7569ce..9389268 100644 --- a/tools/qdoc3/generator.cpp +++ b/tools/qdoc3/generator.cpp @@ -138,14 +138,15 @@ void Generator::initialize(const Config &config) while (g != generators.end()) { if (outputFormats.contains((*g)->format())) { (*g)->initializeGenerator(config); - QStringList extraImages = config.getStringList(CONFIG_EXTRAIMAGES + - Config::dot + - (*g)->format()); + QStringList extraImages = + config.getStringList(CONFIG_EXTRAIMAGES+Config::dot+(*g)->format()); QStringList::ConstIterator e = extraImages.begin(); while (e != extraImages.end()) { QString userFriendlyFilePath; QString filePath = Config::findFile(config.lastLocation(), - imageFiles, imageDirs, *e, + imageFiles, + imageDirs, + *e, imgFileExts[(*g)->format()], userFriendlyFilePath); if (!filePath.isEmpty()) @@ -529,33 +530,80 @@ void Generator::generateInheritedBy(const ClassNode *classe, } } -void Generator::generateExampleFiles(const FakeNode *fake, CodeMarker *marker) +void Generator::generateFileList(const FakeNode* fake, + CodeMarker* marker, + Node::SubType subtype, + const QString& tag) { - if (fake->childNodes().isEmpty()) - return; - + int count = 0; + Text text; OpenedList openedList(OpenedList::Bullet); - Text text; - text << Atom::ParaLeft << "Files:" << Atom::ParaRight + text << Atom::ParaLeft << tag << Atom::ParaRight << Atom(Atom::ListLeft, openedList.styleString()); - foreach (const Node *child, fake->childNodes()) { - QString exampleFile = child->name(); - openedList.next(); - text << Atom(Atom::ListItemNumber, openedList.numberString()) - << Atom(Atom::ListItemLeft, openedList.styleString()) - << Atom::ParaLeft - << Atom(Atom::Link, exampleFile) - << Atom(Atom::FormattingLeft, ATOM_FORMATTING_LINK) - << exampleFile - << Atom(Atom::FormattingRight, ATOM_FORMATTING_LINK) - << Atom::ParaRight - << Atom(Atom::ListItemRight, openedList.styleString()); + + foreach (const Node* child, fake->childNodes()) { + if (child->subType() == subtype) { + ++count; + QString file = child->name(); + + if (file == "network/qftp/images/dir.png") + qDebug() << "FILE:" << file; + + openedList.next(); + text << Atom(Atom::ListItemNumber, openedList.numberString()) + << Atom(Atom::ListItemLeft, openedList.styleString()) + << Atom::ParaLeft + << Atom(Atom::Link, file) + << Atom(Atom::FormattingLeft, ATOM_FORMATTING_LINK) + << file + << Atom(Atom::FormattingRight, ATOM_FORMATTING_LINK) + << Atom::ParaRight + << Atom(Atom::ListItemRight, openedList.styleString()); + } } text << Atom(Atom::ListRight, openedList.styleString()); - generateText(text, fake, marker); + if (count > 0) + generateText(text, fake, marker); } +void Generator::generateExampleFiles(const FakeNode *fake, CodeMarker *marker) +{ + if (fake->childNodes().isEmpty()) + return; + generateFileList(fake, marker, Node::File, QString("Files:")); + generateFileList(fake, marker, Node::Image, QString("Images:")); +} + +#if 0 + QList::ConstIterator g = generators.begin(); + while (g != generators.end()) { + if (outputFormats.contains((*g)->format())) { + (*g)->initializeGenerator(config); + QStringList extraImages = + config.getStringList(CONFIG_EXTRAIMAGES+Config::dot+(*g)->format()); + QStringList::ConstIterator e = extraImages.begin(); + while (e != extraImages.end()) { + QString userFriendlyFilePath; + QString filePath = Config::findFile(config.lastLocation(), + imageFiles, + imageDirs, + *e, + imgFileExts[(*g)->format()], + userFriendlyFilePath); + if (!filePath.isEmpty()) + Config::copyFile(config.lastLocation(), + filePath, + userFriendlyFilePath, + (*g)->outputDir() + + "/images"); + ++e; + } + } + ++g; + } +#endif + void Generator::generateModuleWarning(const ClassNode *classe, CodeMarker *marker) { diff --git a/tools/qdoc3/generator.h b/tools/qdoc3/generator.h index 0258534..7667789 100644 --- a/tools/qdoc3/generator.h +++ b/tools/qdoc3/generator.h @@ -119,6 +119,10 @@ class Generator CodeMarker *marker, bool generate, int& numGeneratedAtoms); + void generateFileList(const FakeNode* fake, + CodeMarker* marker, + Node::SubType subtype, + const QString& tag); void generateExampleFiles(const FakeNode *fake, CodeMarker *marker); void generateModuleWarning(const ClassNode *classe, CodeMarker *marker); diff --git a/tools/qdoc3/node.cpp b/tools/qdoc3/node.cpp index 373002c..b855823 100644 --- a/tools/qdoc3/node.cpp +++ b/tools/qdoc3/node.cpp @@ -767,6 +767,9 @@ FakeNode::FakeNode(InnerNode *parent, const QString& name, SubType subtype) } /*! + Returns the fake node's full title, which is usually + just title(), but for some SubType values is different + from title() */ QString FakeNode::fullTitle() const { @@ -776,6 +779,12 @@ QString FakeNode::fullTitle() const else return title(); } + else if (sub == Image) { + if (title().isEmpty()) + return name().mid(name().lastIndexOf('/') + 1) + " Image File"; + else + return title(); + } else if (sub == HeaderFile) { if (title().isEmpty()) return name(); @@ -788,13 +797,14 @@ QString FakeNode::fullTitle() const } /*! + Returns the subtitle. */ QString FakeNode::subTitle() const { if (!stle.isEmpty()) return stle; - if (sub == File) { + if ((sub == File) || (sub == Image)) { if (title().isEmpty() && name().contains("/")) return name(); } diff --git a/tools/qdoc3/node.h b/tools/qdoc3/node.h index dbdc174..223f528 100644 --- a/tools/qdoc3/node.h +++ b/tools/qdoc3/node.h @@ -89,6 +89,7 @@ class Node Example, HeaderFile, File, + Image, Group, Module, Page, diff --git a/tools/qdoc3/test/qt-build-docs.qdocconf b/tools/qdoc3/test/qt-build-docs.qdocconf index d1733e5..09a4e4c 100644 --- a/tools/qdoc3/test/qt-build-docs.qdocconf +++ b/tools/qdoc3/test/qt-build-docs.qdocconf @@ -97,6 +97,7 @@ excludedirs = $QT_SOURCE_TREE/src/3rdparty/clucene \ sources.fileextensions = "*.cpp *.qdoc *.mm" examples.fileextensions = "*.cpp *.h *.js *.xq *.svg *.xml *.ui *.qhp *.qhcp" +examples.imageextensions = "*.png" exampledirs = $QT_SOURCE_TREE/doc/src \ $QT_SOURCE_TREE/examples \ diff --git a/tools/qdoc3/test/qt.qdocconf b/tools/qdoc3/test/qt.qdocconf index d70ef58..58bb2a3 100644 --- a/tools/qdoc3/test/qt.qdocconf +++ b/tools/qdoc3/test/qt.qdocconf @@ -100,6 +100,7 @@ excludedirs = $QTDIR/src/3rdparty/clucene \ sources.fileextensions = "*.cpp *.qdoc *.mm" examples.fileextensions = "*.cpp *.h *.js *.xq *.svg *.xml *.ui *.qhp *.qhcp" +examples.imageextensions = "*.png" exampledirs = $QTDIR/doc/src \ $QTDIR/examples \ -- cgit v0.12