From 30ada569454de1ec1d10bf7261d413ddd9b962a5 Mon Sep 17 00:00:00 2001 From: Alexis Menard Date: Tue, 30 Mar 2010 01:58:07 +0200 Subject: Fix QFileSystemModel to not install useless watchers on the filesystem When someone call setRootPath we need to remove the previous watcher. This save memory and also it avoids Qt Creator to run out of filesystem watcher which then leads to a crash. If you call setRootPath on the previous path all changes that might happen in between will be propagated in the model. Task-number:QTBUG-8632 Reviewed-by:Friedemann Kleint --- src/gui/dialogs/qfilesystemmodel.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/gui/dialogs/qfilesystemmodel.cpp b/src/gui/dialogs/qfilesystemmodel.cpp index 6fd947c..3757ad7 100644 --- a/src/gui/dialogs/qfilesystemmodel.cpp +++ b/src/gui/dialogs/qfilesystemmodel.cpp @@ -1361,6 +1361,16 @@ QModelIndex QFileSystemModel::setRootPath(const QString &newPath) if (!showDrives && !newPathDir.exists()) return d->index(rootPath()); + //We remove the watcher on the previous path + if (!rootPath().isEmpty()) { + //This remove the watcher for the old rootPath + d->fileInfoGatherer.removePath(rootPath()); + //This line "marks" the node as dirty, so the next fetchMore + //call on the path will ask the gatherer to install a watcher again + //But it doesn't re-fetch everything + d->node(rootPath())->populatedChildren = false; + } + // We have a new valid root path d->rootDir = newPathDir; QModelIndex newRootIndex; -- cgit v0.12 From 87fae30fc63460e0ed2cc98f55a22e28d7520311 Mon Sep 17 00:00:00 2001 From: Alexis Menard Date: Tue, 30 Mar 2010 03:01:27 +0200 Subject: Add a a layout property in QGraphicsWidget. Reviewed-by:michael brasser --- src/gui/graphicsview/qgraphicswidget.cpp | 1 + src/gui/graphicsview/qgraphicswidget.h | 2 ++ tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp | 3 ++- 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/gui/graphicsview/qgraphicswidget.cpp b/src/gui/graphicsview/qgraphicswidget.cpp index 131ee87..654a432 100644 --- a/src/gui/graphicsview/qgraphicswidget.cpp +++ b/src/gui/graphicsview/qgraphicswidget.cpp @@ -801,6 +801,7 @@ void QGraphicsWidget::setLayout(QGraphicsLayout *l) l->setParentLayoutItem(this); l->d_func()->reparentChildItems(this); l->invalidate(); + emit layoutChanged(); } /*! diff --git a/src/gui/graphicsview/qgraphicswidget.h b/src/gui/graphicsview/qgraphicswidget.h index 468a134..730674c 100644 --- a/src/gui/graphicsview/qgraphicswidget.h +++ b/src/gui/graphicsview/qgraphicswidget.h @@ -82,6 +82,7 @@ class Q_GUI_EXPORT QGraphicsWidget : public QGraphicsObject, public QGraphicsLay Q_PROPERTY(Qt::WindowFlags windowFlags READ windowFlags WRITE setWindowFlags) Q_PROPERTY(QString windowTitle READ windowTitle WRITE setWindowTitle) Q_PROPERTY(QRectF geometry READ geometry WRITE setGeometry NOTIFY geometryChanged) + Q_PROPERTY(QGraphicsLayout* layout READ layout WRITE setLayout NOTIFY layoutChanged) public: QGraphicsWidget(QGraphicsItem *parent = 0, Qt::WindowFlags wFlags = 0); ~QGraphicsWidget(); @@ -176,6 +177,7 @@ public: Q_SIGNALS: void geometryChanged(); + void layoutChanged(); public Q_SLOTS: bool close(); diff --git a/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp b/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp index 5a3a54c..b78ef26 100644 --- a/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp +++ b/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp @@ -942,6 +942,7 @@ void tst_QGraphicsWidget::layout() layout->addItem(item); children.append(item); } + QSignalSpy spy(&widget, SIGNAL(layoutChanged())); widget.setLayout(layout); QTRY_COMPARE(widget.layout(), static_cast(layout)); @@ -950,7 +951,7 @@ void tst_QGraphicsWidget::layout() QCOMPARE(item->parentWidget(), (QGraphicsWidget *)&widget); QVERIFY(item->geometry() != QRectF(0, 0, -1, -1)); } - + QCOMPARE(spy.count(), 1); // don't crash widget.setLayout(0); } -- cgit v0.12 From 1d094129c0c3994df4e59cd9eda6981a7b131903 Mon Sep 17 00:00:00 2001 From: Alexis Menard Date: Tue, 30 Mar 2010 03:10:10 +0200 Subject: struct -> class, it's better. Reviewed-by:TrustMe --- src/gui/graphicsview/qgraphicsitem_p.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/gui/graphicsview/qgraphicsitem_p.h b/src/gui/graphicsview/qgraphicsitem_p.h index 669ae1b..eb5fac7 100644 --- a/src/gui/graphicsview/qgraphicsitem_p.h +++ b/src/gui/graphicsview/qgraphicsitem_p.h @@ -74,7 +74,8 @@ class QGraphicsItemPrivate; #ifndef QDECLARATIVELISTPROPERTY #define QDECLARATIVELISTPROPERTY template -struct QDeclarativeListProperty { +class QDeclarativeListProperty { +public: typedef void (*AppendFunction)(QDeclarativeListProperty *, T*); typedef int (*CountFunction)(QDeclarativeListProperty *); typedef T *(*AtFunction)(QDeclarativeListProperty *, int); -- cgit v0.12 From 84c7f73e8405b7e89202a2d3dcab140a656d618a Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Tue, 30 Mar 2010 12:06:10 +0200 Subject: Compile on MingW MingW apparently doesn't support the GDI function GetCharABCWidthsI(), so the getGlyphBearings()-optimization is disabled for that compiler. Reviewed-by: Friedemann Kleint --- src/gui/text/qfontengine_win.cpp | 2 ++ src/gui/text/qfontengine_win_p.h | 2 ++ 2 files changed, 4 insertions(+) diff --git a/src/gui/text/qfontengine_win.cpp b/src/gui/text/qfontengine_win.cpp index a133b48..92fb7de 100644 --- a/src/gui/text/qfontengine_win.cpp +++ b/src/gui/text/qfontengine_win.cpp @@ -649,6 +649,7 @@ static const ushort char_table[] = { static const int char_table_entries = sizeof(char_table)/sizeof(ushort); +#ifndef Q_CC_MINGW void QFontEngineWin::getGlyphBearings(glyph_t glyph, qreal *leftBearing, qreal *rightBearing) { HDC hdc = shared_dc(); @@ -673,6 +674,7 @@ void QFontEngineWin::getGlyphBearings(glyph_t glyph, qreal *leftBearing, qreal * } #endif } +#endif // Q_CC_MINGW qreal QFontEngineWin::minLeftBearing() const { diff --git a/src/gui/text/qfontengine_win_p.h b/src/gui/text/qfontengine_win_p.h index f19e48e..68b53b5 100644 --- a/src/gui/text/qfontengine_win_p.h +++ b/src/gui/text/qfontengine_win_p.h @@ -106,7 +106,9 @@ public: virtual QImage alphaMapForGlyph(glyph_t, const QTransform &xform); virtual QImage alphaRGBMapForGlyph(glyph_t t, int margin, const QTransform &xform); +#ifndef Q_CC_MINGW virtual void getGlyphBearings(glyph_t glyph, qreal *leftBearing = 0, qreal *rightBearing = 0); +#endif int getGlyphIndexes(const QChar *ch, int numChars, QGlyphLayout *glyphs, bool mirrored) const; void getCMap(); -- cgit v0.12 From 09ce407aaa4a00013a606bf0011faf6cbc654c72 Mon Sep 17 00:00:00 2001 From: David Boddie Date: Tue, 30 Mar 2010 15:56:26 +0200 Subject: Doc: Added links and notes to modules, ActiveQt and XMLPatterns docs. Reviewed-by: Trust Me --- doc/src/frameworks-technologies/activeqt.qdoc | 5 ++++- doc/src/modules.qdoc | 11 +++++++++++ src/xmlpatterns/api/qxmlresultitems.cpp | 4 ++++ 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/doc/src/frameworks-technologies/activeqt.qdoc b/doc/src/frameworks-technologies/activeqt.qdoc index 5e8473f..6273337 100644 --- a/doc/src/frameworks-technologies/activeqt.qdoc +++ b/doc/src/frameworks-technologies/activeqt.qdoc @@ -70,7 +70,10 @@ controls. \endlist - The ActiveQt framework consists of two frameworks: + For more information about using ActiveX with Qt, see + \l{Building ActiveX servers and controls with Qt}. + + The ActiveQt framework consists of two modules: \list \o The \l{Using ActiveX controls and COM objects in Qt}{QAxContainer} diff --git a/doc/src/modules.qdoc b/doc/src/modules.qdoc index 44d6ed6..2b749de 100644 --- a/doc/src/modules.qdoc +++ b/doc/src/modules.qdoc @@ -517,6 +517,13 @@ This module is part of the \l{Qt Full Framework Edition} and the \l{Open Source Versions of Qt}. + \section1 Further Links + + General overviews of XQuery and XSchema can be found in the + \l{Using XML Technologies} document. + + An introduction to the XQuery language can be found in \l{A Short Path to XQuery}. + \section1 License Information The XML Schema implementation provided by this module contains the \c xml.xsd file @@ -855,6 +862,8 @@ \brief The QAxContainer module is a Windows-only extension for accessing ActiveX controls and COM objects. + QAxServer is part of the \l{ActiveQt Framework}. + \section1 License Information The QAxContainer module is not covered by the \l{GNU General Public License (GPL)}, @@ -905,6 +914,8 @@ \brief The QAxServer module is a Windows-only static library that you can use to turn a standard Qt binary into a COM server. + QAxServer is part of the \l{ActiveQt Framework}. + \section1 License Information The QAxContainer module is not covered by the \l{GNU General Public License (GPL)}, diff --git a/src/xmlpatterns/api/qxmlresultitems.cpp b/src/xmlpatterns/api/qxmlresultitems.cpp index c474082..98c5bdc 100644 --- a/src/xmlpatterns/api/qxmlresultitems.cpp +++ b/src/xmlpatterns/api/qxmlresultitems.cpp @@ -70,6 +70,10 @@ QT_BEGIN_NAMESPACE sequence and returns it, and current() always returns the QXmlItem that next() returned the last time it was called. + \note When using the QXmlResultItems overload of QXmlQuery::evaluateTo() + to execute a query, it is advisable to create a new instance of this + class for each new set of results rather than reusing an old instance. + \sa QXmlItem::isNode(), QXmlItem::isAtomicValue(), QXmlNodeModelIndex */ -- cgit v0.12