Track QHeaderView geometry
-
I'm trying to adjust a margin of a layout depending on the width of QHeadeView. There is a QHeadeView::geometriesChanged() signal, which expected signals any header geometry changes. However debug shows that this signal is not emitted, when the corresponding model is reset, for example. If a call my slot manually - the margin is updated correctly, but any changes in underlying QAbstractTableModel are ignored.
Is there any other way to achieve what I want?
@
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent)
{
//...
connect(ui->tradeTableView->verticalHeader(),
&QHeaderView::geometriesChanged, = {
int width=this->ui->tradeTableView->verticalHeader()->width();
this->ui->tradeFiltersHorizontalLayout->setContentsMargins(width,0,0,0);
} );
}
@
wrong:
!https://farm4.staticflickr.com/3897/14618950274_9146ea1f02_z.jpg(wrong)!
correct:
!https://farm4.staticflickr.com/3883/14434426158_057906a2a6_z.jpg(correct)!