frozenTableView->setModel(model());
frozenTableView->setFocusPolicy(Qt::NoFocus);
frozenTableView->verticalHeader()->hide();
- frozenTableView->horizontalHeader()->setResizeMode(QHeaderView::Fixed);
+ frozenTableView->horizontalHeader()->setSectionResizeMode(QHeaderView::Fixed);
viewport()->stackUnder(frozenTableView);
//! [init part1]
tree = new QTreeWidget(this);
tree->setObjectName(QLatin1String("tree"));
tree->setHeaderLabels(QStringList(tr("database")));
- tree->header()->setResizeMode(QHeaderView::Stretch);
+ tree->header()->setSectionResizeMode(QHeaderView::Stretch);
QAction *refreshAction = new QAction(tr("Refresh"), tree);
metaDataAction = new QAction(tr("Show Schema"), tree);
connect(refreshAction, SIGNAL(triggered()), SLOT(refresh()));
QStringList labels;
labels << tr("Title") << tr("Location");
- header()->setResizeMode(QHeaderView::Stretch);
+ header()->setSectionResizeMode(QHeaderView::Stretch);
setHeaderLabels(labels);
folderIcon.addPixmap(style()->standardPixmap(QStyle::SP_DirClosedIcon),
QStringList headerLabels;
headerLabels << tr("Title") << tr("Link");
treeWidget->setHeaderLabels(headerLabels);
- treeWidget->header()->setResizeMode(QHeaderView::ResizeToContents);
+ treeWidget->header()->setSectionResizeMode(QHeaderView::ResizeToContents);
connect(&manager, SIGNAL(finished(QNetworkReply*)),
this, SLOT(finished(QNetworkReply*)));
labels << tr("Title") << tr("Location");
treeWidget = new QTreeWidget;
- treeWidget->header()->setResizeMode(QHeaderView::Stretch);
+ treeWidget->header()->setSectionResizeMode(QHeaderView::Stretch);
treeWidget->setHeaderLabels(labels);
setCentralWidget(treeWidget);
labels << tr("Title") << tr("Location");
treeWidget = new QTreeWidget;
- treeWidget->header()->setResizeMode(QHeaderView::Stretch);
+ treeWidget->header()->setSectionResizeMode(QHeaderView::Stretch);
treeWidget->setHeaderLabels(labels);
setCentralWidget(treeWidget);
A header can be fixed in place, or made movable with setSectionsMovable(). It can
be made clickable with setSectionsClickable(), and has resizing behavior in
- accordance with setResizeMode() and setSectionResizeMode()
+ accordance with setSectionResizeMode()
\note Double-clicking on a header to resize a section only applies for
visible rows.
The resize mode specifies the behavior of the header sections. It can be
set on the entire header view or on individual sections using
- setResizeMode().
+ setSectionResizeMode().
\value Interactive The user can resize the section. The section can also be
resized programmatically using resizeSection(). The section size
/*!
Returns the length along the orientation of the header.
- \sa sizeHint(), setResizeMode(), offset()
+ \sa sizeHint(), setSectionResizeMode(), offset()
*/
int QHeaderView::length() const
Returns the width (or height for vertical headers) of the given
\a logicalIndex.
- \sa length(), setResizeMode(), defaultSectionSize()
+ \sa length(), setSectionResizeMode(), defaultSectionSize()
*/
int QHeaderView::sectionSize(int logicalIndex) const
\sa resizeMode(), length(), sectionResized()
*/
-void QHeaderView::setResizeMode(ResizeMode mode)
+void QHeaderView::setSectionResizeMode(ResizeMode mode)
{
Q_D(QHeaderView);
initializeSections();
*/
/*!
+ \obsolete
+ \fn void QHeaderView::setResizeMode(ResizeMode mode)
+
+ Use setSectionResizeMode instead.
+
+ \sa setSectionResizeMode()
+*/
+
+/*!
Returns the resize mode that applies to the section specified by the given
\a logicalIndex.
- \sa setResizeMode()
+ \sa setSectionResizeMode()
*/
QHeaderView::ResizeMode QHeaderView::sectionResizeMode(int logicalIndex) const
property will override the resize mode set on the last section in the
header.
- \sa setResizeMode()
+ \sa setSectionResizeMode()
*/
bool QHeaderView::stretchLastSection() const
{
The default value is false.
- \sa setResizeMode()
+ \sa setSectionResizeMode()
*/
bool QHeaderView::cascadingSectionResizes() const
{
This property only affects sections that have \l Interactive or \l Fixed
as their resize mode.
- \sa setResizeMode() minimumSectionSize
+ \sa setSectionResizeMode() minimumSectionSize
*/
int QHeaderView::defaultSectionSize() const
{
This property is honored by all \l{ResizeMode}{resize modes}.
- \sa setResizeMode() defaultSectionSize
+ \sa setSectionResizeMode() defaultSectionSize
*/
int QHeaderView::minimumSectionSize() const
{
void setHighlightSections(bool highlight);
bool highlightSections() const;
- void setResizeMode(ResizeMode mode);
ResizeMode sectionResizeMode(int logicalIndex) const;
+ void setSectionResizeMode(ResizeMode mode);
void setSectionResizeMode(int logicalIndex, ResizeMode mode);
#if QT_DEPRECATED_SINCE(5, 0)
+ inline QT_DEPRECATED void setResizeMode(ResizeMode mode)
+ { setSectionResizeMode(mode); }
inline QT_DEPRECATED void setResizeMode(int logicalindex, ResizeMode mode)
{ setSectionResizeMode(logicalindex, mode); }
inline QT_DEPRECATED ResizeMode resizeMode(int logicalindex) const
d->m_model->setView(d->m_view);
d->m_view->setSelectionBehavior(QAbstractItemView::SelectItems);
d->m_view->setSelectionMode(QAbstractItemView::SingleSelection);
- d->m_view->horizontalHeader()->setResizeMode(QHeaderView::Stretch);
+ d->m_view->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch);
d->m_view->horizontalHeader()->setSectionsClickable(false);
- d->m_view->verticalHeader()->setResizeMode(QHeaderView::Stretch);
+ d->m_view->verticalHeader()->setSectionResizeMode(QHeaderView::Stretch);
d->m_view->verticalHeader()->setSectionsClickable(false);
d->m_selection = d->m_view->selectionModel();
d->createNavigationBar(this);
model.cols = 1;
model.rows = 1;
- view.setResizeMode(QHeaderView::Interactive);
+ view.setSectionResizeMode(QHeaderView::Interactive);
view.setModel(&model);
view.show();
{
// resizeMode must not be called with an invalid index
int last = view->count() - 1;
- view->setResizeMode(QHeaderView::Interactive);
+ view->setSectionResizeMode(QHeaderView::Interactive);
QCOMPARE(view->sectionResizeMode(last), QHeaderView::Interactive);
QCOMPARE(view->sectionResizeMode(1), QHeaderView::Interactive);
- view->setResizeMode(QHeaderView::Stretch);
+ view->setSectionResizeMode(QHeaderView::Stretch);
QCOMPARE(view->sectionResizeMode(last), QHeaderView::Stretch);
QCOMPARE(view->sectionResizeMode(1), QHeaderView::Stretch);
- view->setResizeMode(QHeaderView::Custom);
+ view->setSectionResizeMode(QHeaderView::Custom);
QCOMPARE(view->sectionResizeMode(last), QHeaderView::Custom);
QCOMPARE(view->sectionResizeMode(1), QHeaderView::Custom);
view->setSectionHidden(0, true);
QCOMPARE(view->sectionsHidden(), true);
QVERIFY(view->sectionSize(0) == 0);
- view->setResizeMode(QHeaderView::Interactive);
+ view->setSectionResizeMode(QHeaderView::Interactive);
view->setSectionHidden(0, false);
QVERIFY(view->sectionSize(0) > 0);
QVERIFY(view->sectionSize(0) == 0);
view->setSectionHidden(0, true);
QVERIFY(view->sectionSize(0) == 0);
- view->setResizeMode(QHeaderView::Stretch);
+ view->setSectionResizeMode(QHeaderView::Stretch);
view->setSectionHidden(0, false);
QVERIFY(view->sectionSize(0) > 0);
QCOMPARE(view->hiddenSectionCount(), 5);
- view->setResizeMode(QHeaderView::Stretch);
+ view->setSectionResizeMode(QHeaderView::Stretch);
QCOMPARE(view->hiddenSectionCount(), 5);
// Remove some rows and make sure they are now still counted
QHeaderView h((Qt::Orientation)direction);
h.setModel(&m);
- h.setResizeMode((QHeaderView::ResizeMode)mode);
+ h.setSectionResizeMode((QHeaderView::ResizeMode)mode);
m.insertRow(insert);
for (int i = 0; i < h.count(); ++i)
QCOMPARE(h.sectionResizeMode(i), (QHeaderView::ResizeMode)mode);
tv.horizontalHeader()->setSortIndicatorShown(true);
tv.horizontalHeader()->setSectionsClickable(true);
tv.horizontalHeader()->setStretchLastSection(true);
- tv.horizontalHeader()->setResizeMode(QHeaderView::Interactive);
+ tv.horizontalHeader()->setSectionResizeMode(QHeaderView::Interactive);
tv.setModel(proxyModel);
tv.setColumnHidden(5, true);
qtv.setModel(&amodel);
QHeaderView *hv = qtv.verticalHeader();
hv->setDefaultSectionSize(25);
- hv->setResizeMode(QHeaderView::ResizeToContents);
+ hv->setSectionResizeMode(QHeaderView::ResizeToContents);
qtv.show();
hv->hideSection(0);
QStandardItemModel model(1, 3);
model.setData(model.index(0, 0), "Word wrapping text goes here.");
tableView.setModel(&model);
- tableView.verticalHeader()->setResizeMode(QHeaderView::ResizeToContents);
+ tableView.verticalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents);
const int orderedHeight = tableView.sizeHintForRow(0);
tableView.horizontalHeader()->moveSection(2, 0);
const int reorderedHeight = tableView.sizeHintForRow(0);
{
QDirModel model;
QTreeView treeView;
- treeView.header()->setResizeMode(QHeaderView::ResizeToContents);
+ treeView.header()->setSectionResizeMode(QHeaderView::ResizeToContents);
treeView.setModel(&model);
treeView.setColumnHidden(2, true);
treeView.setColumnHidden(3, true);