void TableWidget::updateGeometries(){ QTableView::updateGeometries(); int width = 0; if(!verticalHeader()->isHidden()) { width = qMax(verticalHeader()->minimumWidth(), verticalHeader()->sizeHint().width()); width = qMin(width, verticalHeader()->maximumWidth()); } int height = 0; if(!horizontalHeader()->isHidden()) { height = qMax(horizontalHeader()->minimumHeight(), horizontalHeader()->sizeHint().height()); height = qMin(height, horizontalHeader()->maximumHeight()); } // update headers QRect vg = viewport()->geometry(); int verticalLeft = isRightToLeft() ? vg.right() + 1 : (vg.left() - width); int horizontalTop = vg.top() - height; cornerButton->setGeometry(verticalLeft, horizontalTop, width, height);}