summaryrefslogtreecommitdiffstats
path: root/src/gui/itemviews
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/itemviews')
-rw-r--r--src/gui/itemviews/qabstractitemview.cpp152
-rw-r--r--src/gui/itemviews/qdirmodel.cpp5
-rw-r--r--src/gui/itemviews/qfileiconprovider.cpp44
-rw-r--r--src/gui/itemviews/qitemdelegate.cpp6
-rw-r--r--src/gui/itemviews/qitemselectionmodel.cpp322
-rw-r--r--src/gui/itemviews/qlistview.cpp10
-rw-r--r--src/gui/itemviews/qlistwidget.cpp25
-rw-r--r--src/gui/itemviews/qsortfilterproxymodel.cpp42
-rw-r--r--src/gui/itemviews/qtablewidget.cpp2
-rw-r--r--src/gui/itemviews/qtreeview.cpp2
-rw-r--r--src/gui/itemviews/qtreewidget.cpp8
11 files changed, 348 insertions, 270 deletions
diff --git a/src/gui/itemviews/qabstractitemview.cpp b/src/gui/itemviews/qabstractitemview.cpp
index 88879777d..8b6b5cb34 100644
--- a/src/gui/itemviews/qabstractitemview.cpp
+++ b/src/gui/itemviews/qabstractitemview.cpp
@@ -851,8 +851,8 @@ QAbstractItemDelegate *QAbstractItemView::itemDelegateForColumn(int column) cons
}
/*!
- Returns the item delegate used by this view and model for
- the given \a index.
+ Returns the item delegate used by this view and model for
+ the given \a index.
*/
QAbstractItemDelegate *QAbstractItemView::itemDelegate(const QModelIndex &index) const
{
@@ -861,14 +861,14 @@ QAbstractItemDelegate *QAbstractItemView::itemDelegate(const QModelIndex &index)
}
/*!
- \property QAbstractItemView::selectionMode
- \brief which selection mode the view operates in
+ \property QAbstractItemView::selectionMode
+ \brief which selection mode the view operates in
- This property controls whether the user can select one or many items
- and, in many-item selections, whether the selection must be a
- continuous range of items.
+ This property controls whether the user can select one or many items
+ and, in many-item selections, whether the selection must be a
+ continuous range of items.
- \sa SelectionMode SelectionBehavior
+ \sa SelectionMode SelectionBehavior
*/
void QAbstractItemView::setSelectionMode(SelectionMode mode)
{
@@ -883,13 +883,13 @@ QAbstractItemView::SelectionMode QAbstractItemView::selectionMode() const
}
/*!
- \property QAbstractItemView::selectionBehavior
- \brief which selection behavior the view uses
+ \property QAbstractItemView::selectionBehavior
+ \brief which selection behavior the view uses
- This property holds whether selections are done
- in terms of single items, rows or columns.
+ This property holds whether selections are done
+ in terms of single items, rows or columns.
- \sa SelectionMode SelectionBehavior
+ \sa SelectionMode SelectionBehavior
*/
void QAbstractItemView::setSelectionBehavior(QAbstractItemView::SelectionBehavior behavior)
@@ -990,11 +990,11 @@ QModelIndex QAbstractItemView::rootIndex() const
}
/*!
- Selects all item in the view.
- This function wil use the selection selection behavior
- set on the view when selecting.
+ Selects all items in the view.
+ This function will use the selection behavior
+ set on the view when selecting.
- \sa setSelection(), selectedIndexes(), clearSelection()
+ \sa setSelection(), selectedIndexes(), clearSelection()
*/
void QAbstractItemView::selectAll()
{
@@ -1223,10 +1223,10 @@ bool QAbstractItemView::tabKeyNavigation() const
#ifndef QT_NO_DRAGANDDROP
/*!
- \property QAbstractItemView::showDropIndicator
- \brief whether the drop indicator is shown when dragging items and dropping.
+ \property QAbstractItemView::showDropIndicator
+ \brief whether the drop indicator is shown when dragging items and dropping.
- \sa dragEnabled DragDropMode dragDropOverwriteMode acceptDrops
+ \sa dragEnabled DragDropMode dragDropOverwriteMode acceptDrops
*/
void QAbstractItemView::setDropIndicatorShown(bool enable)
@@ -1242,10 +1242,10 @@ bool QAbstractItemView::showDropIndicator() const
}
/*!
- \property QAbstractItemView::dragEnabled
- \brief whether the view supports dragging of its own items
+ \property QAbstractItemView::dragEnabled
+ \brief whether the view supports dragging of its own items
- \sa showDropIndicator DragDropMode dragDropOverwriteMode acceptDrops
+ \sa showDropIndicator DragDropMode dragDropOverwriteMode acceptDrops
*/
void QAbstractItemView::setDragEnabled(bool enable)
@@ -1281,11 +1281,11 @@ bool QAbstractItemView::dragEnabled() const
*/
/*!
- \property QAbstractItemView::dragDropMode
- \brief the drag and drop event the view will act upon
+ \property QAbstractItemView::dragDropMode
+ \brief the drag and drop event the view will act upon
- \since 4.2
- \sa showDropIndicator dragDropOverwriteMode
+ \since 4.2
+ \sa showDropIndicator dragDropOverwriteMode
*/
void QAbstractItemView::setDragDropMode(DragDropMode behavior)
{
@@ -1321,14 +1321,14 @@ QAbstractItemView::DragDropMode QAbstractItemView::dragDropMode() const
#endif // QT_NO_DRAGANDDROP
/*!
- \property QAbstractItemView::alternatingRowColors
- \brief whether to draw the background using alternating colors
+ \property QAbstractItemView::alternatingRowColors
+ \brief whether to draw the background using alternating colors
- If this property is true, the item background will be drawn using
- QPalette::Base and QPalette::AlternateBase; otherwise the background
- will be drawn using the QPalette::Base color.
+ If this property is true, the item background will be drawn using
+ QPalette::Base and QPalette::AlternateBase; otherwise the background
+ will be drawn using the QPalette::Base color.
- By default, this property is false.
+ By default, this property is false.
*/
void QAbstractItemView::setAlternatingRowColors(bool enable)
{
@@ -2257,8 +2257,8 @@ void QAbstractItemView::inputMethodEvent(QInputMethodEvent *event)
\value BelowItem The item will be dropped below the index.
\value OnViewport The item will be dropped onto a region of the viewport with
-no items. The way each view handles items dropped onto the viewport depends on
-the behavior of the underlying model in use.
+ no items. The way each view handles items dropped onto the viewport depends on
+ the behavior of the underlying model in use.
*/
@@ -2275,11 +2275,11 @@ QAbstractItemView::DropIndicatorPosition QAbstractItemView::dropIndicatorPositio
#endif
/*!
- This convenience function returns a list of all selected and
- non-hidden item indexes in the view. The list contains no
- duplicates, and is not sorted.
+ This convenience function returns a list of all selected and
+ non-hidden item indexes in the view. The list contains no
+ duplicates, and is not sorted.
- \sa QItemSelectionModel::selectedIndexes()
+ \sa QItemSelectionModel::selectedIndexes()
*/
QModelIndexList QAbstractItemView::selectedIndexes() const
{
@@ -2361,8 +2361,8 @@ bool QAbstractItemView::edit(const QModelIndex &index, EditTrigger trigger, QEve
}
/*!
- \internal
- Updates the data shown in the open editor widgets in the view.
+ \internal
+ Updates the data shown in the open editor widgets in the view.
*/
void QAbstractItemView::updateEditorData()
{
@@ -2371,8 +2371,8 @@ void QAbstractItemView::updateEditorData()
}
/*!
- \internal
- Updates the geometry of the open editor widgets in the view.
+ \internal
+ Updates the geometry of the open editor widgets in the view.
*/
void QAbstractItemView::updateEditorGeometries()
{
@@ -2421,7 +2421,7 @@ void QAbstractItemView::updateGeometries()
}
/*!
- \internal
+ \internal
*/
void QAbstractItemView::verticalScrollbarValueChanged(int value)
{
@@ -2432,7 +2432,7 @@ void QAbstractItemView::verticalScrollbarValueChanged(int value)
}
/*!
- \internal
+ \internal
*/
void QAbstractItemView::horizontalScrollbarValueChanged(int value)
{
@@ -2534,9 +2534,9 @@ void QAbstractItemView::closeEditor(QWidget *editor, QAbstractItemDelegate::EndE
}
/*!
- Commit the data in the \a editor to the model.
+ Commit the data in the \a editor to the model.
- \sa closeEditor()
+ \sa closeEditor()
*/
void QAbstractItemView::commitData(QWidget *editor)
{
@@ -2555,9 +2555,9 @@ void QAbstractItemView::commitData(QWidget *editor)
}
/*!
- This function is called when the given \a editor has been destroyed.
+ This function is called when the given \a editor has been destroyed.
- \sa closeEditor()
+ \sa closeEditor()
*/
void QAbstractItemView::editorDestroyed(QObject *editor)
{
@@ -2628,12 +2628,12 @@ int QAbstractItemView::verticalStepsPerItem() const
}
/*!
- Moves to and selects the item best matching the string \a search.
- If no item is found nothing happens.
+ Moves to and selects the item best matching the string \a search.
+ If no item is found nothing happens.
- In the default implementation, the search is reset if \a search is empty, or
- the time interval since the last search has exceeded
- QApplication::keyboardInputInterval().
+ In the default implementation, the search is reset if \a search is empty, or
+ the time interval since the last search has exceeded
+ QApplication::keyboardInputInterval().
*/
void QAbstractItemView::keyboardSearch(const QString &search)
{
@@ -2687,9 +2687,9 @@ void QAbstractItemView::keyboardSearch(const QString &search)
setCurrentIndex(firstMatch);
break;
}
- int row = firstMatch.row() + 1;
- if (row >= d->model->rowCount(firstMatch.parent()))
- row = 0;
+ int row = firstMatch.row() + 1;
+ if (row >= d->model->rowCount(firstMatch.parent()))
+ row = 0;
current = firstMatch.sibling(row, firstMatch.column());
}
} while (current != start && firstMatch.isValid());
@@ -2796,9 +2796,9 @@ void QAbstractItemView::openPersistentEditor(const QModelIndex &index)
}
/*!
- Closes the persistent editor for the item at the given \a index.
+ Closes the persistent editor for the item at the given \a index.
- \sa openPersistentEditor()
+ \sa openPersistentEditor()
*/
void QAbstractItemView::closePersistentEditor(const QModelIndex &index)
{
@@ -3333,14 +3333,14 @@ void QAbstractItemView::setDirtyRegion(const QRegion &region)
}
/*!
- Prepares the view for scrolling by (\a{dx},\a{dy}) pixels by moving the dirty regions in the
- opposite direction. You only need to call this function if you are implementing a scrolling
- viewport in your view subclass.
+ Prepares the view for scrolling by (\a{dx},\a{dy}) pixels by moving the dirty regions in the
+ opposite direction. You only need to call this function if you are implementing a scrolling
+ viewport in your view subclass.
- If you implement scrollContentsBy() in a subclass of QAbstractItemView, call this function
- before you call QWidget::scroll() on the viewport. Alternatively, just call update().
+ If you implement scrollContentsBy() in a subclass of QAbstractItemView, call this function
+ before you call QWidget::scroll() on the viewport. Alternatively, just call update().
- \sa scrollContentsBy(), dirtyRegionOffset(), setDirtyRegion()
+ \sa scrollContentsBy(), dirtyRegionOffset(), setDirtyRegion()
*/
void QAbstractItemView::scrollDirtyRegion(int dx, int dy)
{
@@ -3349,13 +3349,13 @@ void QAbstractItemView::scrollDirtyRegion(int dx, int dy)
}
/*!
- Returns the offset of the dirty regions in the view.
+ Returns the offset of the dirty regions in the view.
- If you use scrollDirtyRegion() and implement a paintEvent() in a subclass of
- QAbstractItemView, you should translate the area given by the paint event with
- the offset returned from this function.
+ If you use scrollDirtyRegion() and implement a paintEvent() in a subclass of
+ QAbstractItemView, you should translate the area given by the paint event with
+ the offset returned from this function.
- \sa scrollDirtyRegion(), setDirtyRegion()
+ \sa scrollDirtyRegion(), setDirtyRegion()
*/
QPoint QAbstractItemView::dirtyRegionOffset() const
{
@@ -3527,7 +3527,7 @@ QItemSelectionModel::SelectionFlags QAbstractItemViewPrivate::extendedSelectionC
const bool shiftKeyPressed = modifiers & Qt::ShiftModifier;
const bool controlKeyPressed = modifiers & Qt::ControlModifier;
if (((index == pressedIndex && selectionModel->isSelected(index))
- || !index.isValid()) && state != QAbstractItemView::DragSelectingState
+ || !index.isValid()) && state != QAbstractItemView::DragSelectingState
&& !shiftKeyPressed && !controlKeyPressed && !rightButtonPressed)
return QItemSelectionModel::ClearAndSelect|selectionBehaviorFlags();
return QItemSelectionModel::NoUpdate;
@@ -3759,7 +3759,7 @@ void QAbstractItemViewPrivate::updateEditorData(const QModelIndex &tl, const QMo
but the behavior is view dependant (table just clears the selected indexes for example).
Either remove the selected rows or clear them
- */
+*/
void QAbstractItemViewPrivate::clearOrRemove()
{
#ifndef QT_NO_DRAGANDDROP
@@ -3795,7 +3795,7 @@ void QAbstractItemViewPrivate::clearOrRemove()
When persistent aeditor gets/loses focus, we need to check
and setcorrectly the current index.
- */
+*/
void QAbstractItemViewPrivate::checkPersistentEditorFocus()
{
Q_Q(QAbstractItemView);
@@ -3882,10 +3882,10 @@ bool QAbstractItemViewPrivate::openEditor(const QModelIndex &index, QEvent *even
}
/*
- \internal
+ \internal
- returns the pair QRect/QModelIndex that should be painted on the viewports's rect
- */
+ returns the pair QRect/QModelIndex that should be painted on the viewports's rect
+*/
QItemViewPaintPairs QAbstractItemViewPrivate::draggablePaintPairs(const QModelIndexList &indexes, QRect *r) const
{
diff --git a/src/gui/itemviews/qdirmodel.cpp b/src/gui/itemviews/qdirmodel.cpp
index c25149b15..c5618b608 100644
--- a/src/gui/itemviews/qdirmodel.cpp
+++ b/src/gui/itemviews/qdirmodel.cpp
@@ -228,7 +228,10 @@ void QDirModelPrivate::invalidate()
\note QDirModel requires an instance of a GUI application.
- \sa nameFilters(), setFilter(), filter(), QListView, QTreeView,
+ \note The usage of QDirModel is not recommended anymore. The
+ QFileSystemModel class is a more performant alternative.
+
+ \sa nameFilters(), setFilter(), filter(), QListView, QTreeView, QFileSystemModel
{Dir View Example}, {Model Classes}
*/
diff --git a/src/gui/itemviews/qfileiconprovider.cpp b/src/gui/itemviews/qfileiconprovider.cpp
index 1856f4dd4..dd4341b62 100644
--- a/src/gui/itemviews/qfileiconprovider.cpp
+++ b/src/gui/itemviews/qfileiconprovider.cpp
@@ -45,15 +45,15 @@
#include <qstyle.h>
#include <qapplication.h>
#include <qdir.h>
+#include <qpixmapcache.h>
#if defined(Q_WS_WIN)
#define _WIN32_IE 0x0500
#include <qt_windows.h>
#include <commctrl.h>
#include <objbase.h>
#include <private/qpixmapdata_p.h>
-#include <qpixmapcache.h>
#elif defined(Q_WS_MAC)
-#include <private/qt_mac_p.h>
+#include <private/qt_cocoa_helpers_mac_p.h>
#endif
#include <private/qfunctions_p.h>
@@ -314,6 +314,31 @@ QIcon QFileIconProviderPrivate::getWinIcon(const QFileInfo &fileInfo) const
QIcon QFileIconProviderPrivate::getMacIcon(const QFileInfo &fi) const
{
QIcon retIcon;
+ QString fileExtension = fi.suffix().toUpper();
+ fileExtension.prepend(QLatin1String("."));
+
+ const QString keyBase = QLatin1String("qt_") + fileExtension;
+
+ QPixmap pixmap;
+ if (fi.isFile() && !fi.isExecutable() && !fi.isSymLink()) {
+ QPixmapCache::find(keyBase + QLatin1String("16"), pixmap);
+ }
+
+ if (!pixmap.isNull()) {
+ retIcon.addPixmap(pixmap);
+ if (QPixmapCache::find(keyBase + QLatin1String("32"), pixmap)) {
+ retIcon.addPixmap(pixmap);
+ if (QPixmapCache::find(keyBase + QLatin1String("64"), pixmap)) {
+ retIcon.addPixmap(pixmap);
+ if (QPixmapCache::find(keyBase + QLatin1String("128"), pixmap)) {
+ retIcon.addPixmap(pixmap);
+ return retIcon;
+ }
+ }
+ }
+ }
+
+
FSRef macRef;
OSStatus status = FSPathMakeRef(reinterpret_cast<const UInt8*>(fi.canonicalFilePath().toUtf8().constData()),
&macRef, 0);
@@ -326,12 +351,23 @@ QIcon QFileIconProviderPrivate::getMacIcon(const QFileInfo &fi) const
return retIcon;
IconRef iconRef;
SInt16 iconLabel;
- status = GetIconRefFromFileInfo(&macRef, macName.length, macName.unicode, kIconServicesCatalogInfoMask, &info, kIconServicesNormalUsageFlag, &iconRef, &iconLabel);
+ status = GetIconRefFromFileInfo(&macRef, macName.length, macName.unicode,
+ kIconServicesCatalogInfoMask, &info, kIconServicesNormalUsageFlag,
+ &iconRef, &iconLabel);
if (status != noErr)
return retIcon;
- extern void qt_mac_constructQIconFromIconRef(const IconRef, const IconRef, QIcon*, QStyle::StandardPixmap = QStyle::SP_CustomBase); // qmacstyle_mac.cpp
qt_mac_constructQIconFromIconRef(iconRef, 0, &retIcon);
ReleaseIconRef(iconRef);
+
+ pixmap = retIcon.pixmap(16);
+ QPixmapCache::insert(keyBase + QLatin1String("16"), pixmap);
+ pixmap = retIcon.pixmap(32);
+ QPixmapCache::insert(keyBase + QLatin1String("32"), pixmap);
+ pixmap = retIcon.pixmap(64);
+ QPixmapCache::insert(keyBase + QLatin1String("64"), pixmap);
+ pixmap = retIcon.pixmap(128);
+ QPixmapCache::insert(keyBase + QLatin1String("128"), pixmap);
+
return retIcon;
}
#endif
diff --git a/src/gui/itemviews/qitemdelegate.cpp b/src/gui/itemviews/qitemdelegate.cpp
index a2851133a..336ca79aa 100644
--- a/src/gui/itemviews/qitemdelegate.cpp
+++ b/src/gui/itemviews/qitemdelegate.cpp
@@ -861,6 +861,8 @@ void QItemDelegate::drawBackground(QPainter *painter,
/*!
\internal
+
+ Code duplicated in QCommonStylePrivate::viewItemLayout
*/
void QItemDelegate::doLayout(const QStyleOptionViewItem &option,
@@ -882,8 +884,10 @@ void QItemDelegate::doLayout(const QStyleOptionViewItem &option,
int w, h;
textRect->adjust(-textMargin, 0, textMargin, 0); // add width padding
- if (textRect->height() == 0 && !hasPixmap)
+ if (textRect->height() == 0 && (!hasPixmap || !hint)) {
+ //if there is no text, we still want to have a decent height for the item sizeHint and the editor size
textRect->setHeight(option.fontMetrics.height());
+ }
QSize pm(0, 0);
if (hasPixmap) {
diff --git a/src/gui/itemviews/qitemselectionmodel.cpp b/src/gui/itemviews/qitemselectionmodel.cpp
index 87825d9d4..9dad95f86 100644
--- a/src/gui/itemviews/qitemselectionmodel.cpp
+++ b/src/gui/itemviews/qitemselectionmodel.cpp
@@ -303,45 +303,44 @@ QModelIndexList QItemSelectionRange::indexes() const
}
/*!
- \class QItemSelection
+ \class QItemSelection
- \brief The QItemSelection class manages information about selected items in a model.
+ \brief The QItemSelection class manages information about selected items in a model.
- \ingroup model-view
-
- A QItemSelection describes the items in a model that have been
- selected by the user. A QItemSelection is basically a list of
- selection ranges, see QItemSelectionRange. It provides functions for
- creating and manipulating selections, and selecting a range of items
- from a model.
+ \ingroup model-view
- The QItemSelection class is one of the \l{Model/View Classes}
- and is part of Qt's \l{Model/View Programming}{model/view framework}.
+ A QItemSelection describes the items in a model that have been
+ selected by the user. A QItemSelection is basically a list of
+ selection ranges, see QItemSelectionRange. It provides functions for
+ creating and manipulating selections, and selecting a range of items
+ from a model.
- An item selection can be constructed and initialized to contain a
- range of items from an existing model. The following example constructs
- a selection that contains a range of items from the given \c model,
- beginning at the \c topLeft, and ending at the \c bottomRight.
+ The QItemSelection class is one of the \l{Model/View Classes}
+ and is part of Qt's \l{Model/View Programming}{model/view framework}.
- \snippet doc/src/snippets/code/src_gui_itemviews_qitemselectionmodel.cpp 0
+ An item selection can be constructed and initialized to contain a
+ range of items from an existing model. The following example constructs
+ a selection that contains a range of items from the given \c model,
+ beginning at the \c topLeft, and ending at the \c bottomRight.
- An empty item selection can be constructed, and later populated as
- required. So, if the model is going to be unavailable when we construct
- the item selection, we can rewrite the above code in the following way:
+ \snippet doc/src/snippets/code/src_gui_itemviews_qitemselectionmodel.cpp 0
- \snippet doc/src/snippets/code/src_gui_itemviews_qitemselectionmodel.cpp 1
+ An empty item selection can be constructed, and later populated as
+ required. So, if the model is going to be unavailable when we construct
+ the item selection, we can rewrite the above code in the following way:
- QItemSelection saves memory, and avoids unnecessary work, by working with
- selection ranges rather than recording the model item index for each
- item in the selection. Generally, an instance of this class will contain
- a list of non-overlapping selection ranges.
+ \snippet doc/src/snippets/code/src_gui_itemviews_qitemselectionmodel.cpp 1
- Use merge() to merge one item selection into another without making
- overlapping ranges. Use split() to split one selection range into
- smaller ranges based on a another selection range.
+ QItemSelection saves memory, and avoids unnecessary work, by working with
+ selection ranges rather than recording the model item index for each
+ item in the selection. Generally, an instance of this class will contain
+ a list of non-overlapping selection ranges.
- \sa {Model/View Programming}, QItemSelectionModel
+ Use merge() to merge one item selection into another without making
+ overlapping ranges. Use split() to split one selection range into
+ smaller ranges based on a another selection range.
+ \sa {Model/View Programming}, QItemSelectionModel
*/
/*!
@@ -420,14 +419,14 @@ QModelIndexList QItemSelection::indexes() const
}
/*!
- Merges the \a other selection with this QItemSelection using the
- \a command given. This method guarantees that no ranges are overlapping.
+ Merges the \a other selection with this QItemSelection using the
+ \a command given. This method guarantees that no ranges are overlapping.
- Note that only QItemSelectionModel::Select,
- QItemSelectionModel::Deselect, and QItemSelectionModel::Toggle are
- supported.
+ Note that only QItemSelectionModel::Select,
+ QItemSelectionModel::Deselect, and QItemSelectionModel::Toggle are
+ supported.
- \sa split()
+ \sa split()
*/
void QItemSelection::merge(const QItemSelection &other, QItemSelectionModel::SelectionFlags command)
{
@@ -479,10 +478,10 @@ void QItemSelection::merge(const QItemSelection &other, QItemSelectionModel::Sel
}
/*!
- Splits the selection \a range using the selection \a other range.
- Removes all items in \a other from \a range and puts the result in \a result.
- This can be compared with the semantics of the \e subtract operation of a set.
- \sa merge()
+ Splits the selection \a range using the selection \a other range.
+ Removes all items in \a other from \a range and puts the result in \a result.
+ This can be compared with the semantics of the \e subtract operation of a set.
+ \sa merge()
*/
void QItemSelection::split(const QItemSelectionRange &range,
@@ -529,11 +528,11 @@ void QItemSelection::split(const QItemSelectionRange &range,
}
/*!
- \internal
+ \internal
- returns a QItemSelection where all ranges have been expanded to:
- Rows: left: 0 and right: columnCount()-1
- Columns: top: 0 and bottom: rowCount()-1
+ returns a QItemSelection where all ranges have been expanded to:
+ Rows: left: 0 and right: columnCount()-1
+ Columns: top: 0 and bottom: rowCount()-1
*/
QItemSelection QItemSelectionModelPrivate::expandSelection(const QItemSelection &selection,
@@ -568,7 +567,7 @@ QItemSelection QItemSelectionModelPrivate::expandSelection(const QItemSelection
}
/*!
- \internal
+ \internal
*/
void QItemSelectionModelPrivate::_q_rowsAboutToBeRemoved(const QModelIndex &parent,
int start, int end)
@@ -599,7 +598,7 @@ void QItemSelectionModelPrivate::_q_rowsAboutToBeRemoved(const QModelIndex &pare
}
/*!
- \internal
+ \internal
*/
void QItemSelectionModelPrivate::_q_columnsAboutToBeRemoved(const QModelIndex &parent,
int start, int end)
@@ -630,9 +629,9 @@ void QItemSelectionModelPrivate::_q_columnsAboutToBeRemoved(const QModelIndex &p
}
/*!
- \internal
+ \internal
- Split selection ranges if columns are about to be inserted in the middle.
+ Split selection ranges if columns are about to be inserted in the middle.
*/
void QItemSelectionModelPrivate::_q_columnsAboutToBeInserted(const QModelIndex &parent,
int start, int end)
@@ -659,9 +658,9 @@ void QItemSelectionModelPrivate::_q_columnsAboutToBeInserted(const QModelIndex &
}
/*!
- \internal
+ \internal
- Split selection ranges if rows are about to be inserted in the middle.
+ Split selection ranges if rows are about to be inserted in the middle.
*/
void QItemSelectionModelPrivate::_q_rowsAboutToBeInserted(const QModelIndex &parent,
int start, int end)
@@ -688,11 +687,11 @@ void QItemSelectionModelPrivate::_q_rowsAboutToBeInserted(const QModelIndex &par
}
/*!
- \internal
+ \internal
- Split selection into individual (persistent) indexes. This is done in
- preparation for the layoutChanged() signal, where the indexes can be
- merged again.
+ Split selection into individual (persistent) indexes. This is done in
+ preparation for the layoutChanged() signal, where the indexes can be
+ merged again.
*/
void QItemSelectionModelPrivate::_q_layoutAboutToBeChanged()
{
@@ -726,10 +725,10 @@ void QItemSelectionModelPrivate::_q_layoutAboutToBeChanged()
}
/*!
- \internal
+ \internal
- Merges \a indexes into an item selection made up of ranges.
- Assumes that the indexes are sorted.
+ Merges \a indexes into an item selection made up of ranges.
+ Assumes that the indexes are sorted.
*/
static QItemSelection mergeIndexes(const QList<QPersistentModelIndex> &indexes)
{
@@ -774,9 +773,9 @@ static QItemSelection mergeIndexes(const QList<QPersistentModelIndex> &indexes)
}
/*!
- \internal
+ \internal
- Merge the selected indexes into selection ranges again.
+ Merge the selected indexes into selection ranges again.
*/
void QItemSelectionModelPrivate::_q_layoutChanged()
{
@@ -818,41 +817,41 @@ void QItemSelectionModelPrivate::_q_layoutChanged()
}
/*!
- \class QItemSelectionModel
+ \class QItemSelectionModel
- \brief The QItemSelectionModel class keeps track of a view's selected items.
+ \brief The QItemSelectionModel class keeps track of a view's selected items.
- \ingroup model-view
+ \ingroup model-view
- A QItemSelectionModel keeps track of the selected items in a view, or
- in several views onto the same model. It also keeps track of the
- currently selected item in a view.
+ A QItemSelectionModel keeps track of the selected items in a view, or
+ in several views onto the same model. It also keeps track of the
+ currently selected item in a view.
- The QItemSelectionModel class is one of the \l{Model/View Classes}
- and is part of Qt's \l{Model/View Programming}{model/view framework}.
+ The QItemSelectionModel class is one of the \l{Model/View Classes}
+ and is part of Qt's \l{Model/View Programming}{model/view framework}.
- The selected items are stored using ranges. Whenever you want to
- modify the selected items use select() and provide either a
- QItemSelection, or a QModelIndex and a QItemSelectionModel::SelectionFlag.
+ The selected items are stored using ranges. Whenever you want to
+ modify the selected items use select() and provide either a
+ QItemSelection, or a QModelIndex and a QItemSelectionModel::SelectionFlag.
- The QItemSelectionModel takes a two layer approach to selection
- management, dealing with both selected items that have been committed
- and items that are part of the current selection. The current
- selected items are part of the current interactive selection (for
- example with rubber-band selection or keyboard-shift selections).
+ The QItemSelectionModel takes a two layer approach to selection
+ management, dealing with both selected items that have been committed
+ and items that are part of the current selection. The current
+ selected items are part of the current interactive selection (for
+ example with rubber-band selection or keyboard-shift selections).
- To update the currently selected items, use the bitwise OR of
- QItemSelectionModel::Current and any of the other SelectionFlags.
- If you omit the QItemSelectionModel::Current command, a new current
- selection will be created, and the previous one added to the whole
- selection. All functions operate on both layers; for example,
- selectedItems() will return items from both layers.
+ To update the currently selected items, use the bitwise OR of
+ QItemSelectionModel::Current and any of the other SelectionFlags.
+ If you omit the QItemSelectionModel::Current command, a new current
+ selection will be created, and the previous one added to the whole
+ selection. All functions operate on both layers; for example,
+ selectedItems() will return items from both layers.
- \sa {Model/View Programming}, QAbstractItemModel, {Chart Example}
+ \sa {Model/View Programming}, QAbstractItemModel, {Chart Example}
*/
/*!
- Constructs a selection model that operates on the specified item \a model.
+ Constructs a selection model that operates on the specified item \a model.
*/
QItemSelectionModel::QItemSelectionModel(QAbstractItemModel *model)
: QObject(*new QItemSelectionModelPrivate, model)
@@ -875,7 +874,7 @@ QItemSelectionModel::QItemSelectionModel(QAbstractItemModel *model)
}
/*!
- Constructs a selection model that operates on the specified item \a model with \a parent.
+ Constructs a selection model that operates on the specified item \a model with \a parent.
*/
QItemSelectionModel::QItemSelectionModel(QAbstractItemModel *model, QObject *parent)
: QObject(*new QItemSelectionModelPrivate, parent)
@@ -898,7 +897,7 @@ QItemSelectionModel::QItemSelectionModel(QAbstractItemModel *model, QObject *par
}
/*!
- \internal
+ \internal
*/
QItemSelectionModel::QItemSelectionModel(QItemSelectionModelPrivate &dd, QAbstractItemModel *model)
: QObject(dd, model)
@@ -921,7 +920,7 @@ QItemSelectionModel::QItemSelectionModel(QItemSelectionModelPrivate &dd, QAbstra
}
/*!
- Destroys the selection model.
+ Destroys the selection model.
*/
QItemSelectionModel::~QItemSelectionModel()
{
@@ -943,10 +942,10 @@ QItemSelectionModel::~QItemSelectionModel()
}
/*!
- Selects the model item \a index using the specified \a command, and emits
- selectionChanged().
+ Selects the model item \a index using the specified \a command, and emits
+ selectionChanged().
- \sa QItemSelectionModel::SelectionFlags
+ \sa QItemSelectionModel::SelectionFlags
*/
void QItemSelectionModel::select(const QModelIndex &index, QItemSelectionModel::SelectionFlags command)
{
@@ -955,37 +954,37 @@ void QItemSelectionModel::select(const QModelIndex &index, QItemSelectionModel::
}
/*!
- \fn void QItemSelectionModel::currentChanged(const QModelIndex &current, const QModelIndex &previous)
+ \fn void QItemSelectionModel::currentChanged(const QModelIndex &current, const QModelIndex &previous)
- This signal is emitted whenever the current item changes. The \a previous
- model item index is replaced by the \a current index as the selection's
- current item.
+ This signal is emitted whenever the current item changes. The \a previous
+ model item index is replaced by the \a current index as the selection's
+ current item.
- Note that this signal will not be emitted when the item model is reset.
+ Note that this signal will not be emitted when the item model is reset.
- \sa currentIndex() setCurrentIndex() selectionChanged()
+ \sa currentIndex() setCurrentIndex() selectionChanged()
*/
/*!
- \fn void QItemSelectionModel::currentColumnChanged(const QModelIndex &current, const QModelIndex &previous)
+ \fn void QItemSelectionModel::currentColumnChanged(const QModelIndex &current, const QModelIndex &previous)
- This signal is emitted if the \a current item changes and its column is
- different to the column of the \a previous current item.
+ This signal is emitted if the \a current item changes and its column is
+ different to the column of the \a previous current item.
- Note that this signal will not be emitted when the item model is reset.
+ Note that this signal will not be emitted when the item model is reset.
- \sa currentChanged() currentRowChanged() currentIndex() setCurrentIndex()
+ \sa currentChanged() currentRowChanged() currentIndex() setCurrentIndex()
*/
/*!
- \fn void QItemSelectionModel::currentRowChanged(const QModelIndex &current, const QModelIndex &previous)
+ \fn void QItemSelectionModel::currentRowChanged(const QModelIndex &current, const QModelIndex &previous)
- This signal is emitted if the \a current item changes and its row is
- different to the row of the \a previous current item.
+ This signal is emitted if the \a current item changes and its row is
+ different to the row of the \a previous current item.
- Note that this signal will not be emitted when the item model is reset.
+ Note that this signal will not be emitted when the item model is reset.
- \sa currentChanged() currentColumnChanged() currentIndex() setCurrentIndex()
+ \sa currentChanged() currentColumnChanged() currentIndex() setCurrentIndex()
*/
/*!
@@ -1002,32 +1001,32 @@ void QItemSelectionModel::select(const QModelIndex &index, QItemSelectionModel::
*/
/*!
- \enum QItemSelectionModel::SelectionFlag
+ \enum QItemSelectionModel::SelectionFlag
- This enum describes the way the selection model will be updated.
+ This enum describes the way the selection model will be updated.
- \value NoUpdate No selection will be made.
- \value Clear The complete selection will be cleared.
- \value Select All specified indexes will be selected.
- \value Deselect All specified indexes will be deselected.
- \value Toggle All specified indexes will be selected or
- deselected depending on their current state.
- \value Current The current selection will be updated.
- \value Rows All indexes will be expanded to span rows.
- \value Columns All indexes will be expanded to span columns.
- \value SelectCurrent A combination of Select and Current, provided for
- convenience.
- \value ToggleCurrent A combination of Toggle and Current, provided for
- convenience.
- \value ClearAndSelect A combination of Clear and Select, provided for
- convenience.
+ \value NoUpdate No selection will be made.
+ \value Clear The complete selection will be cleared.
+ \value Select All specified indexes will be selected.
+ \value Deselect All specified indexes will be deselected.
+ \value Toggle All specified indexes will be selected or
+ deselected depending on their current state.
+ \value Current The current selection will be updated.
+ \value Rows All indexes will be expanded to span rows.
+ \value Columns All indexes will be expanded to span columns.
+ \value SelectCurrent A combination of Select and Current, provided for
+ convenience.
+ \value ToggleCurrent A combination of Toggle and Current, provided for
+ convenience.
+ \value ClearAndSelect A combination of Clear and Select, provided for
+ convenience.
*/
/*!
- Selects the item \a selection using the specified \a command, and emits
- selectionChanged().
+ Selects the item \a selection using the specified \a command, and emits
+ selectionChanged().
- \sa QItemSelectionModel::SelectionFlag
+ \sa QItemSelectionModel::SelectionFlag
*/
void QItemSelectionModel::select(const QItemSelection &selection, QItemSelectionModel::SelectionFlags command)
{
@@ -1067,7 +1066,7 @@ void QItemSelectionModel::select(const QItemSelection &selection, QItemSelection
}
/*!
- Clears the selection model. Emits selectionChanged() and currentChanged().
+ Clears the selection model. Emits selectionChanged() and currentChanged().
*/
void QItemSelectionModel::clear()
{
@@ -1083,7 +1082,7 @@ void QItemSelectionModel::clear()
}
/*!
- Clears the selection model. Does not emit any signals.
+ Clears the selection model. Does not emit any signals.
*/
void QItemSelectionModel::reset()
{
@@ -1093,8 +1092,8 @@ void QItemSelectionModel::reset()
}
/*!
- \since 4.2
- Clears the selection in the selection model. Emits selectionChanged().
+ \since 4.2
+ Clears the selection in the selection model. Emits selectionChanged().
*/
void QItemSelectionModel::clearSelection()
{
@@ -1110,14 +1109,14 @@ void QItemSelectionModel::clearSelection()
/*!
- Sets the model item \a index to be the current item, and emits
- currentChanged(). The current item is used for keyboard navigation and
- focus indication; it is independent of any selected items, although a
- selected item can also be the current item.
+ Sets the model item \a index to be the current item, and emits
+ currentChanged(). The current item is used for keyboard navigation and
+ focus indication; it is independent of any selected items, although a
+ selected item can also be the current item.
- Depending on the specified \a command, the \a index can also become part
- of the current selection.
- \sa select()
+ Depending on the specified \a command, the \a index can also become part
+ of the current selection.
+ \sa select()
*/
void QItemSelectionModel::setCurrentIndex(const QModelIndex &index, QItemSelectionModel::SelectionFlags command)
{
@@ -1141,8 +1140,8 @@ void QItemSelectionModel::setCurrentIndex(const QModelIndex &index, QItemSelecti
}
/*!
- Returns the model item index for the current item, or an invalid index
- if there is no current item.
+ Returns the model item index for the current item, or an invalid index
+ if there is no current item.
*/
QModelIndex QItemSelectionModel::currentIndex() const
{
@@ -1150,7 +1149,7 @@ QModelIndex QItemSelectionModel::currentIndex() const
}
/*!
- Returns true if the given model item \a index is selected.
+ Returns true if the given model item \a index is selected.
*/
bool QItemSelectionModel::isSelected(const QModelIndex &index) const
{
@@ -1187,12 +1186,12 @@ bool QItemSelectionModel::isSelected(const QModelIndex &index) const
}
/*!
- Returns true if all items are selected in the \a row with the given
- \a parent.
+ Returns true if all items are selected in the \a row with the given
+ \a parent.
- Note that this function is usually faster than calling isSelected()
- on all items in the same row and that unselectable items are
- ignored.
+ Note that this function is usually faster than calling isSelected()
+ on all items in the same row and that unselectable items are
+ ignored.
*/
bool QItemSelectionModel::isRowSelected(int row, const QModelIndex &parent) const
{
@@ -1247,12 +1246,12 @@ bool QItemSelectionModel::isRowSelected(int row, const QModelIndex &parent) cons
}
/*!
- Returns true if all items are selected in the \a column with the given
- \a parent.
+ Returns true if all items are selected in the \a column with the given
+ \a parent.
- Note that this function is usually faster than calling isSelected()
- on all items in the same column and that unselectable items are
- ignored.
+ Note that this function is usually faster than calling isSelected()
+ on all items in the same column and that unselectable items are
+ ignored.
*/
bool QItemSelectionModel::isColumnSelected(int column, const QModelIndex &parent) const
{
@@ -1307,8 +1306,8 @@ bool QItemSelectionModel::isColumnSelected(int column, const QModelIndex &parent
}
/*!
- Returns true if there are any items selected in the \a row with the given
- \a parent.
+ Returns true if there are any items selected in the \a row with the given
+ \a parent.
*/
bool QItemSelectionModel::rowIntersectsSelection(int row, const QModelIndex &parent) const
{
@@ -1336,8 +1335,8 @@ bool QItemSelectionModel::rowIntersectsSelection(int row, const QModelIndex &par
}
/*!
- Returns true if there are any items selected in the \a column with the given
- \a parent.
+ Returns true if there are any items selected in the \a column with the given
+ \a parent.
*/
bool QItemSelectionModel::columnIntersectsSelection(int column, const QModelIndex &parent) const
{
@@ -1377,15 +1376,14 @@ bool QItemSelectionModel::hasSelection() const
QItemSelection sel = d->ranges;
sel.merge(d->currentSelection, d->currentCommand);
return !sel.isEmpty();
- }
- else {
+ } else {
return !(d->ranges.isEmpty() && d->currentSelection.isEmpty());
}
}
/*!
- Returns a list of all selected model item indexes. The list contains no
- duplicates, and is not sorted.
+ Returns a list of all selected model item indexes. The list contains no
+ duplicates, and is not sorted.
*/
QModelIndexList QItemSelectionModel::selectedIndexes() const
{
@@ -1396,10 +1394,10 @@ QModelIndexList QItemSelectionModel::selectedIndexes() const
}
/*!
- \since 4.2
- Returns the indexes in the given \a column for the rows where all columns are selected.
+ \since 4.2
+ Returns the indexes in the given \a column for the rows where all columns are selected.
- \sa selectedIndexes(), selectedColumns()
+ \sa selectedIndexes(), selectedColumns()
*/
QModelIndexList QItemSelectionModel::selectedRows(int column) const
@@ -1460,7 +1458,7 @@ QModelIndexList QItemSelectionModel::selectedColumns(int row) const
}
/*!
- Returns the selection ranges stored in the selection model.
+ Returns the selection ranges stored in the selection model.
*/
const QItemSelection QItemSelectionModel::selection() const
{
@@ -1480,7 +1478,7 @@ const QItemSelection QItemSelectionModel::selection() const
}
/*!
- Returns the item model operated on by the selection model.
+ Returns the item model operated on by the selection model.
*/
const QAbstractItemModel *QItemSelectionModel::model() const
{
@@ -1488,8 +1486,8 @@ const QAbstractItemModel *QItemSelectionModel::model() const
}
/*!
- Compares the two selections \a newSelection and \a oldSelection
- and emits selectionChanged() with the deselected and selected items.
+ Compares the two selections \a newSelection and \a oldSelection
+ and emits selectionChanged() with the deselected and selected items.
*/
void QItemSelectionModel::emitSelectionChanged(const QItemSelection &newSelection,
const QItemSelection &oldSelection)
diff --git a/src/gui/itemviews/qlistview.cpp b/src/gui/itemviews/qlistview.cpp
index 40f28d434..148d20474 100644
--- a/src/gui/itemviews/qlistview.cpp
+++ b/src/gui/itemviews/qlistview.cpp
@@ -1563,7 +1563,10 @@ void QListView::setSelection(const QRect &rect, QItemSelectionModel::SelectionFl
}
// middle rectangle
if (top.bottom() < bottom.top()) {
- middle.setTop(top.bottom() + 1);
+ if (gridSize().isValid() && !gridSize().isNull())
+ middle.setTop(top.top() + gridSize().height());
+ else
+ middle.setTop(top.bottom() + 1);
middle.setLeft(qMin(top.left(), bottom.left()));
middle.setBottom(bottom.top() - 1);
middle.setRight(qMax(top.right(), bottom.right()));
@@ -1590,7 +1593,10 @@ void QListView::setSelection(const QRect &rect, QItemSelectionModel::SelectionFl
// only set middle if the
middle.setTop(0);
middle.setBottom(ch);
- middle.setLeft(left.right() + 1);
+ if (gridSize().isValid() && !gridSize().isNull())
+ middle.setLeft(left.left() + gridSize().width());
+ else
+ middle.setLeft(left.right() + 1);
middle.setRight(right.left() - 1);
} else if (left.bottom() < right.top()) {
left.setBottom(right.top() - 1);
diff --git a/src/gui/itemviews/qlistwidget.cpp b/src/gui/itemviews/qlistwidget.cpp
index 7113217ff..25656571b 100644
--- a/src/gui/itemviews/qlistwidget.cpp
+++ b/src/gui/itemviews/qlistwidget.cpp
@@ -561,6 +561,13 @@ Qt::DropActions QListModel::supportedDropActions() const
given \a parent.
If the parent is not specified, the item will need to be inserted into a
list widget with QListWidget::insertItem().
+
+ \note that this constructor inserts this same object into the model of
+ the parent that is passed to the constructor. If the model is sorted then
+ the behavior of the insert is undetermined since the model will call
+ the '<' operator method on this object which has still not yet been
+ constructed. In this case it would be better not to specify the parent
+ and use the QListWidget::insertItem method to insert the item instead.
\sa type()
*/
@@ -582,6 +589,13 @@ QListWidgetItem::QListWidgetItem(QListWidget *view, int type)
given \a text and \a parent.
If the parent is not specified, the item will need to be inserted into a
list widget with QListWidget::insertItem().
+
+ \note that this constructor inserts this same object into the model of
+ the parent that is passed to the constructor. If the model is sorted then
+ the behavior of the insert is undetermined since the model will call
+ the '<' operator method on this object which has still not yet been
+ constructed. In this case it would be better not to specify the parent
+ and use the QListWidget::insertItem method to insert the item instead.
\sa type()
*/
@@ -605,7 +619,14 @@ QListWidgetItem::QListWidgetItem(const QString &text, QListWidget *view, int typ
given \a icon, \a text and \a parent.
If the parent is not specified, the item will need to be inserted into a
list widget with QListWidget::insertItem().
-
+
+ \note that this constructor inserts this same object into the model of
+ the parent that is passed to the constructor. If the model is sorted then
+ the behavior of the insert is undetermined since the model will call
+ the '<' operator method on this object which has still not yet been
+ constructed. In this case it would be better not to specify the parent
+ and use the QListWidget::insertItem method to insert the item instead.
+
\sa type()
*/
QListWidgetItem::QListWidgetItem(const QIcon &icon,const QString &text,
@@ -1268,7 +1289,7 @@ void QListWidgetPrivate::_q_dataChanged(const QModelIndex &topLeft,
This signal is emitted whenever the selection changes.
- \sa selectedItems() isItemSelected() currentItemChanged()
+ \sa selectedItems() QListWidgetItem::isSelected() currentItemChanged()
*/
/*!
diff --git a/src/gui/itemviews/qsortfilterproxymodel.cpp b/src/gui/itemviews/qsortfilterproxymodel.cpp
index 30a8c960a..fdc09ca1a 100644
--- a/src/gui/itemviews/qsortfilterproxymodel.cpp
+++ b/src/gui/itemviews/qsortfilterproxymodel.cpp
@@ -146,6 +146,7 @@ public:
const QModelIndex &source_parent) const;
QModelIndex proxy_to_source(const QModelIndex &proxyIndex) const;
QModelIndex source_to_proxy(const QModelIndex &sourceIndex) const;
+ bool can_create_mapping(const QModelIndex &source_parent) const;
void remove_from_mapping(const QModelIndex &source_parent);
@@ -354,6 +355,25 @@ QModelIndex QSortFilterProxyModelPrivate::source_to_proxy(const QModelIndex &sou
return create_index(proxy_row, proxy_column, it);
}
+bool QSortFilterProxyModelPrivate::can_create_mapping(const QModelIndex &source_parent) const
+{
+ if (source_parent.isValid()) {
+ QModelIndex source_grand_parent = source_parent.parent();
+ IndexMap::const_iterator it = source_index_mapping.constFind(source_grand_parent);
+ if (it == source_index_mapping.constEnd()) {
+ // Don't care, since we don't have mapping for the grand parent
+ return false;
+ }
+ Mapping *gm = it.value();
+ if (gm->proxy_rows.at(source_parent.row()) == -1 ||
+ gm->proxy_columns.at(source_parent.column()) == -1) {
+ // Don't care, since parent is filtered
+ return false;
+ }
+ }
+ return true;
+}
+
/*!
\internal
@@ -659,20 +679,8 @@ void QSortFilterProxyModelPrivate::source_items_inserted(
return;
IndexMap::const_iterator it = source_index_mapping.constFind(source_parent);
if (it == source_index_mapping.constEnd()) {
- if (source_parent.isValid()) {
- QModelIndex source_grand_parent = source_parent.parent();
- it = source_index_mapping.constFind(source_grand_parent);
- if (it == source_index_mapping.constEnd()) {
- // Don't care, since we don't have mapping for the grand parent
- return;
- }
- Mapping *gm = it.value();
- if (gm->proxy_rows.at(source_parent.row()) == -1 ||
- gm->proxy_columns.at(source_parent.column()) == -1) {
- // Don't care, since parent is filtered
- return;
- }
- }
+ if (!can_create_mapping(source_parent))
+ return;
it = create_mapping(source_parent);
Mapping *m = it.value();
QModelIndex proxy_parent = q->mapFromSource(source_parent);
@@ -1186,7 +1194,8 @@ void QSortFilterProxyModelPrivate::_q_sourceRowsAboutToBeInserted(
Q_UNUSED(end);
//Force the creation of a mapping now, even if its empty.
//We need it because the proxy can be acessed at the moment it emits rowsAboutToBeInserted in insert_source_items
- create_mapping(source_parent);
+ if (can_create_mapping(source_parent))
+ create_mapping(source_parent);
}
void QSortFilterProxyModelPrivate::_q_sourceRowsInserted(
@@ -1217,7 +1226,8 @@ void QSortFilterProxyModelPrivate::_q_sourceColumnsAboutToBeInserted(
Q_UNUSED(end);
//Force the creation of a mapping now, even if its empty.
//We need it because the proxy can be acessed at the moment it emits columnsAboutToBeInserted in insert_source_items
- create_mapping(source_parent);
+ if (can_create_mapping(source_parent))
+ create_mapping(source_parent);
}
void QSortFilterProxyModelPrivate::_q_sourceColumnsInserted(
diff --git a/src/gui/itemviews/qtablewidget.cpp b/src/gui/itemviews/qtablewidget.cpp
index d975d58e5..5756f35b7 100644
--- a/src/gui/itemviews/qtablewidget.cpp
+++ b/src/gui/itemviews/qtablewidget.cpp
@@ -1719,7 +1719,7 @@ void QTableWidgetPrivate::_q_dataChanged(const QModelIndex &topLeft,
This signal is emitted whenever the selection changes.
- \sa selectedItems() isItemSelected()
+ \sa selectedItems() QTableWidgetItem::isSelected()
*/
diff --git a/src/gui/itemviews/qtreeview.cpp b/src/gui/itemviews/qtreeview.cpp
index f7fa3ad45..7536d72c6 100644
--- a/src/gui/itemviews/qtreeview.cpp
+++ b/src/gui/itemviews/qtreeview.cpp
@@ -2853,7 +2853,7 @@ int QTreeView::rowHeight(const QModelIndex &index) const
}
/*!
- \reimp
+ \internal
*/
void QTreeView::horizontalScrollbarAction(int action)
{
diff --git a/src/gui/itemviews/qtreewidget.cpp b/src/gui/itemviews/qtreewidget.cpp
index ccfa568de..e724a7d2c 100644
--- a/src/gui/itemviews/qtreewidget.cpp
+++ b/src/gui/itemviews/qtreewidget.cpp
@@ -2437,7 +2437,7 @@ void QTreeWidgetPrivate::_q_dataChanged(const QModelIndex &topLeft,
\note This signal will not be emitted if an item changes its state when
expandAll() is invoked.
- \sa isItemExpanded(), itemCollapsed(), expandItem()
+ \sa QTreeWidgetItem::isExpanded(), itemCollapsed(), expandItem()
*/
/*!
@@ -2449,7 +2449,7 @@ void QTreeWidgetPrivate::_q_dataChanged(const QModelIndex &topLeft,
\note This signal will not be emitted if an item changes its state when
collapseAll() is invoked.
- \sa isItemExpanded(), itemExpanded(), collapseItem()
+ \sa QTreeWidgetItem::isExpanded(), itemExpanded(), collapseItem()
*/
/*!
@@ -3109,9 +3109,9 @@ bool QTreeWidget::isItemExpanded(const QTreeWidgetItem *item) const
\sa expandItem(), collapseItem(), itemExpanded()
- \obsolete
+ \obsolete
- This function is deprecated. Use \l{QTreeWidgetItem::setExpanded()} instead.
+ This function is deprecated. Use \l{QTreeWidgetItem::setExpanded()} instead.
*/
void QTreeWidget::setItemExpanded(const QTreeWidgetItem *item, bool expand)
{