Document the BC break of viewportSizeHint() in itemviews
Since users were not supposed to use this feature at all, just live with the BC break, but document it. In order to prevent possible problems in the future, introduce dummy overrides in QAbstractItemView and QListView as well. Also, fix the visibility of the overrides (it's protected, not public). Task-number: QTBUG-34667 Change-Id: Ib4554ae5e1e7d3ce4ea8e8703e1fea9e2231edb0 Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
This commit is contained in:
parent
ef6544ee27
commit
c819a89269
8
dist/changes-5.2.0
vendored
8
dist/changes-5.2.0
vendored
@ -34,8 +34,12 @@ QtWidgets
|
||||
---------
|
||||
|
||||
- QAbstractScrollArea now has a SizeAdjustPolicy. If it is set to AdjustToContents
|
||||
it will make use of the new protected viewportSizeHint() (binary compatible since it
|
||||
was reserved in Qt5). This function returns a suggested size based on contents.
|
||||
it will make use of the protected viewportSizeHint() virtual function. This
|
||||
function returns a suggested size based on contents. Note that although the
|
||||
viewportSizeHint() virtual function was reserved in 5.0, user code was not
|
||||
supposed to be overriding it (as the function was private and undocumented).
|
||||
Code that was overriding viewportSizeHint() needs to be recompiled against 5.2
|
||||
for this feature to work correctly.
|
||||
|
||||
- QTreeView now has setTreePosition to allow the treestructure to show data from other
|
||||
columns than logicalindex zero.
|
||||
|
@ -1390,6 +1390,15 @@ bool QAbstractItemView::showDropIndicator() const
|
||||
return d->showDropIndicator;
|
||||
}
|
||||
|
||||
/*!
|
||||
\since 5.2
|
||||
\reimp
|
||||
*/
|
||||
QSize QAbstractItemView::viewportSizeHint() const
|
||||
{
|
||||
return QAbstractScrollArea::viewportSizeHint();
|
||||
}
|
||||
|
||||
/*!
|
||||
\property QAbstractItemView::dragEnabled
|
||||
\brief whether the view supports dragging of its own items
|
||||
|
@ -346,6 +346,8 @@ protected:
|
||||
DropIndicatorPosition dropIndicatorPosition() const;
|
||||
#endif
|
||||
|
||||
QSize viewportSizeHint() const Q_DECL_OVERRIDE;
|
||||
|
||||
private:
|
||||
Q_DECLARE_PRIVATE(QAbstractItemView)
|
||||
Q_DISABLE_COPY(QAbstractItemView)
|
||||
|
@ -3200,6 +3200,16 @@ int QListView::visualIndex(const QModelIndex &index) const
|
||||
return visualIndex;
|
||||
}
|
||||
|
||||
|
||||
/*!
|
||||
\since 5.2
|
||||
\reimp
|
||||
*/
|
||||
QSize QListView::viewportSizeHint() const
|
||||
{
|
||||
return QAbstractItemView::viewportSizeHint();
|
||||
}
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // QT_NO_LISTVIEW
|
||||
|
@ -180,6 +180,8 @@ protected:
|
||||
void selectionChanged(const QItemSelection &selected, const QItemSelection &deselected);
|
||||
void currentChanged(const QModelIndex ¤t, const QModelIndex &previous);
|
||||
|
||||
QSize viewportSizeHint() const Q_DECL_OVERRIDE;
|
||||
|
||||
private:
|
||||
int visualIndex(const QModelIndex &index) const;
|
||||
|
||||
|
@ -118,8 +118,6 @@ public:
|
||||
|
||||
void sortByColumn(int column, Qt::SortOrder order);
|
||||
|
||||
QSize viewportSizeHint() const;
|
||||
|
||||
public Q_SLOTS:
|
||||
void selectRow(int row);
|
||||
void selectColumn(int column);
|
||||
@ -161,6 +159,8 @@ protected:
|
||||
|
||||
void updateGeometries();
|
||||
|
||||
QSize viewportSizeHint() const Q_DECL_OVERRIDE;
|
||||
|
||||
int sizeHintForRow(int row) const;
|
||||
int sizeHintForColumn(int column) const;
|
||||
|
||||
|
@ -147,8 +147,6 @@ public:
|
||||
void dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight, const QVector<int> &roles = QVector<int>());
|
||||
void selectAll();
|
||||
|
||||
QSize viewportSizeHint() const;
|
||||
|
||||
Q_SIGNALS:
|
||||
void expanded(const QModelIndex &index);
|
||||
void collapsed(const QModelIndex &index);
|
||||
@ -208,6 +206,8 @@ protected:
|
||||
|
||||
void updateGeometries();
|
||||
|
||||
QSize viewportSizeHint() const Q_DECL_OVERRIDE;
|
||||
|
||||
int sizeHintForColumn(int column) const;
|
||||
int indexRowSizeHint(const QModelIndex &index) const;
|
||||
int rowHeight(const QModelIndex &index) const;
|
||||
|
@ -69,7 +69,6 @@ public:
|
||||
void setWidgetResizable(bool resizable);
|
||||
|
||||
QSize sizeHint() const;
|
||||
QSize viewportSizeHint() const;
|
||||
|
||||
bool focusNextPrevChild(bool next);
|
||||
|
||||
@ -86,6 +85,8 @@ protected:
|
||||
void resizeEvent(QResizeEvent *);
|
||||
void scrollContentsBy(int dx, int dy);
|
||||
|
||||
QSize viewportSizeHint() const Q_DECL_OVERRIDE;
|
||||
|
||||
private:
|
||||
Q_DECLARE_PRIVATE(QScrollArea)
|
||||
Q_DISABLE_COPY(QScrollArea)
|
||||
|
Loading…
Reference in New Issue
Block a user