diff options
author | Christoph Schleifenbaum <christoph@kdab.com> | 2011-12-22 19:33:28 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-04-22 17:56:55 +0200 |
commit | ae0fd6884d30ae2ce084e239468696aaec7f5795 (patch) | |
tree | 7342d45c8b2c9cbf309d2347812c4d83f1701ac3 /src/widgets/itemviews/qtableview.cpp | |
parent | 7df16fb4ccbe0476bc34274a77e98eec4e8d2d93 (diff) |
QAbstractScrollArea - add SizeAdjustPolicy and viewportSizeHint
This patch adds SizeAdjustPolicy to QAbstractScrollArea.
If it is set to AdjustToContents it will make use of the new
protected viewportSizeHint() (BC since it was reserved in Qt5).
This function returns a suggested size based on contents.
Change-Id: I5d8aa517e88b8b21c5712e62b4d574c3aad99d3b
Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
Diffstat (limited to 'src/widgets/itemviews/qtableview.cpp')
-rw-r--r-- | src/widgets/itemviews/qtableview.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/widgets/itemviews/qtableview.cpp b/src/widgets/itemviews/qtableview.cpp index 573df1db6a..37c52948b0 100644 --- a/src/widgets/itemviews/qtableview.cpp +++ b/src/widgets/itemviews/qtableview.cpp @@ -1056,6 +1056,19 @@ QTableView::~QTableView() /*! \reimp */ +QSize QTableView::viewportSizeHint() const +{ + Q_D(const QTableView); + QSize result( (d->verticalHeader->isHidden() ? 0 : d->verticalHeader->width()) + d->horizontalHeader->length(), + (d->horizontalHeader->isHidden() ? 0 : d->horizontalHeader->height()) + d->verticalHeader->length()); + result += QSize(verticalScrollBar()->isVisible() ? verticalScrollBar()->width() : 0, + horizontalScrollBar()->isVisible() ? horizontalScrollBar()->height() : 0); + return result; +} + +/*! + \reimp +*/ void QTableView::setModel(QAbstractItemModel *model) { Q_D(QTableView); |