From f1b77574f89ca601cf761717302c2dbf65ba9027 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Tue, 27 Sep 2016 21:45:18 +0200 Subject: [doc] Fix docs of QLayoutItem::widget() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit QWidget does not inherit QLayoutItem (unlike QLayout and QSpacerItem, which do), so don't claim that in the docs. Added a note. Added cross-references between layout(), widget() and spacerItem(). Change-Id: I518b6842ef76fd1b72226b790dab75f429fae556 Reviewed-by: Mitch Curtis Reviewed-by: Topi Reiniƶ --- src/widgets/kernel/qlayoutitem.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'src/widgets') diff --git a/src/widgets/kernel/qlayoutitem.cpp b/src/widgets/kernel/qlayoutitem.cpp index 03988aab99..41944d63ac 100644 --- a/src/widgets/kernel/qlayoutitem.cpp +++ b/src/widgets/kernel/qlayoutitem.cpp @@ -300,6 +300,8 @@ void QLayoutItem::invalidate() /*! If this item is a QLayout, it is returned as a QLayout; otherwise 0 is returned. This function provides type-safe casting. + + \sa spacerItem(), widget() */ QLayout * QLayoutItem::layout() { @@ -309,6 +311,8 @@ QLayout * QLayoutItem::layout() /*! If this item is a QSpacerItem, it is returned as a QSpacerItem; otherwise 0 is returned. This function provides type-safe casting. + + \sa layout(), widget() */ QSpacerItem * QLayoutItem::spacerItem() { @@ -339,8 +343,14 @@ QSpacerItem * QSpacerItem::spacerItem() */ /*! - If this item is a QWidget, it is returned as a QWidget; otherwise - 0 is returned. This function provides type-safe casting. + If this item manages a QWidget, returns that widget. Otherwise, + \c nullptr is returned. + + \note While the functions layout() and spacerItem() perform casts, this + function returns another object: QLayout and QSpacerItem inherit QLayoutItem, + while QWidget does not. + + \sa layout(), spacerItem() */ QWidget * QLayoutItem::widget() { -- cgit v1.2.3 From d6b6c15d338320a8f9fb3299121c3b338f2b6481 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Fri, 30 Sep 2016 11:41:07 +0200 Subject: QFileSystemModel: fix unused variable with QT_NO_FILESYSTEMWATCHER The QFileInfo 'info' is only used in code conditional on QT_NO_FILESYSTEMWATCHER, so move the definiton into the conditionally-compiled block, too. Turn it into an rvalue while at it. Change-Id: I9983bfdcd0b32d0abecf7c588973a60df9de8cbc Reviewed-by: Thiago Macieira Reviewed-by: Edward Welbourne --- src/widgets/dialogs/qfilesystemmodel.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src/widgets') diff --git a/src/widgets/dialogs/qfilesystemmodel.cpp b/src/widgets/dialogs/qfilesystemmodel.cpp index 441a54bd7d..a4d4230044 100644 --- a/src/widgets/dialogs/qfilesystemmodel.cpp +++ b/src/widgets/dialogs/qfilesystemmodel.cpp @@ -889,11 +889,10 @@ bool QFileSystemModel::setData(const QModelIndex &idx, const QVariant &value, in parentNode->visibleChildren.removeAt(visibleLocation); QFileSystemModelPrivate::QFileSystemNode * oldValue = parentNode->children.value(oldName); parentNode->children[newName] = oldValue; - QFileInfo info(parentPath, newName); oldValue->fileName = newName; oldValue->parent = parentNode; #ifndef QT_NO_FILESYSTEMWATCHER - oldValue->populate(d->fileInfoGatherer.getInfo(info)); + oldValue->populate(d->fileInfoGatherer.getInfo(QFileInfo(parentPath, newName))); #endif oldValue->isVisible = true; -- cgit v1.2.3 From bf595c4e78187e78d7bedc3e9f95fe5b38683fed Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Fri, 30 Sep 2016 11:23:21 +0200 Subject: QFileSystemModel: Plug leak on file renaming In setData(), the old code both called Private::addNode(), which creates a QFileSystemNode and adds it to the parent's QHash of children, and also re-purposed the old node by taking it out of the children hash, adjusting the fileName member of the node and putting it back into the children hash under the new name, where it would overwrite the node just added under the same (new) name in addNode(). Since the hash stores naked pointers, no-one deletes the node that was put into the hash first. Fix by dropping the addNode() call completely. Change-Id: I0c37917fd0ffd74716393786c69b5bb172aa372e Reviewed-by: Edward Welbourne --- src/widgets/dialogs/qfilesystemmodel.cpp | 1 - 1 file changed, 1 deletion(-) (limited to 'src/widgets') diff --git a/src/widgets/dialogs/qfilesystemmodel.cpp b/src/widgets/dialogs/qfilesystemmodel.cpp index a4d4230044..8e4697077e 100644 --- a/src/widgets/dialogs/qfilesystemmodel.cpp +++ b/src/widgets/dialogs/qfilesystemmodel.cpp @@ -885,7 +885,6 @@ bool QFileSystemModel::setData(const QModelIndex &idx, const QVariant &value, in QFileSystemModelPrivate::QFileSystemNode *parentNode = indexNode->parent; int visibleLocation = parentNode->visibleLocation(parentNode->children.value(indexNode->fileName)->fileName); - d->addNode(parentNode, newName,indexNode->info->fileInfo()); parentNode->visibleChildren.removeAt(visibleLocation); QFileSystemModelPrivate::QFileSystemNode * oldValue = parentNode->children.value(oldName); parentNode->children[newName] = oldValue; -- cgit v1.2.3 From 72a1a72776533c2cf95a020876c0959c6af14608 Mon Sep 17 00:00:00 2001 From: Sergio Martins Date: Mon, 26 Sep 2016 18:23:56 +0100 Subject: docs: Don't mark qDrawBorderPixmap() as overload Because it doesn't overload anything. Change-Id: I871df10b4a0a46da238a5d1061cfb1aa34ccee03 Reviewed-by: Marc Mutz --- src/widgets/styles/qdrawutil.cpp | 1 - 1 file changed, 1 deletion(-) (limited to 'src/widgets') diff --git a/src/widgets/styles/qdrawutil.cpp b/src/widgets/styles/qdrawutil.cpp index 2a4d392413..dd02bad4d5 100644 --- a/src/widgets/styles/qdrawutil.cpp +++ b/src/widgets/styles/qdrawutil.cpp @@ -763,7 +763,6 @@ void qDrawPlainRect(QPainter *p, const QRect &r, const QColor &c, \fn void qDrawBorderPixmap(QPainter *painter, const QRect &target, const QMargins &margins, const QPixmap &pixmap) \relates \since 4.6 - \overload \brief The qDrawBorderPixmap function is for drawing a pixmap into the margins of a rectangle. -- cgit v1.2.3 From c3605980d95f28d8ab6dc11eb349ad87ed3adaa9 Mon Sep 17 00:00:00 2001 From: Frederik Schwarzer Date: Thu, 29 Sep 2016 17:05:07 +0200 Subject: Fix some typos and minor sentence structure issues in docs Change-Id: Ibede1aeb046e2df6723e3041152bfae22a9fde32 Reviewed-by: Thiago Macieira --- src/widgets/doc/src/model-view-programming.qdoc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/widgets') diff --git a/src/widgets/doc/src/model-view-programming.qdoc b/src/widgets/doc/src/model-view-programming.qdoc index 0032e77c6a..784e25b1d9 100644 --- a/src/widgets/doc/src/model-view-programming.qdoc +++ b/src/widgets/doc/src/model-view-programming.qdoc @@ -253,7 +253,7 @@ \snippet shareddirmodel/main.cpp 0 The model is set up to use data from a certain file system. The call to - \l{QFileSystemModel::}{setRootPath()} tell the model which drive on the + \l{QFileSystemModel::}{setRootPath()} tells the model which drive on the file system to expose to the views. We create two views so that we can examine the items held in the model in two @@ -304,7 +304,7 @@ signals and slots mechanism. This section describes some basic concepts that are central to the way - item of data are accessed by other components via a model class. More + items of data are accessed by other components via a model class. More advanced concepts are discussed in later sections. \section3 Model indexes @@ -1869,7 +1869,7 @@ \codeline \snippet qsortfilterproxymodel/main.cpp 1 - Since proxy models are inherit from QAbstractItemModel, they can be connected to + Since proxy models inherit from QAbstractItemModel, they can be connected to any kind of view, and can be shared between views. They can also be used to process the information obtained from other proxy models in a pipeline arrangement. -- cgit v1.2.3