Details
-
Bug
-
Resolution: Done
-
P2: Important
-
5.6.1
-
None
-
Windows 7 32/64, 10 32/64
-
2937ab9e320ea04fdfda8e3a252559d4762e811e
Description
QHeaderView::setCascadingSectionResizes(true) causes problems with interactive resizing of column if it's called for horizontal header of QTableView with hidden columns. Interactive resizing of columns next to hidden looks messed (see attached picture).
Code to reproduce:
#include <QApplication> #include <QMainWindow> #include <QVBoxLayout> #include <QHeaderView> #include <QTableView> #include <QAbstractTableModel> class Model: public QAbstractTableModel { public: int rowCount(const QModelIndex &) const override { return 2; } int columnCount(const QModelIndex &) const override { return 3; } QVariant data(const QModelIndex &index, int role) const override { if (!index.isValid()) return QVariant(); if (role = Qt::DisplayRole) return QString("Data"); return QVariant(); } }; int main(int argc, char *argv[]) { QApplication a(argc, argv); QWidget *pw = new QWidget(); QVBoxLayout *pl = new QVBoxLayout(pw); QTableView *pv = new QTableView(pw); pl->addWidget(pv); pv->setModel(new Model); pv->horizontalHeader()->setCascadingSectionResizes(true); // this causes problem pv->hideColumn(1); pw->show(); return a.exec(); }
Just run and try to resize (expand/shrink) last column.