#include class MyTableWidget : public QTableWidget { Q_OBJECT public: MyTableWidget(int row, int column, QWidget *parent = 0) : QTableWidget(row, column, parent) { updateTimer = new QTimer(this); updateTimer->setInterval(500); connect(updateTimer, SIGNAL(timeout()), this, SLOT(delayedUpdateScrollBar())); } public slots: void updateScrollBar() { updateTimer->start(); } void delayedUpdateScrollBar() { if (QApplication::mouseButtons() & Qt::LeftButton) // assume its still resizing return; updateTimer->stop(); if (horizontalScrollBar()->value() == horizontalScrollBar()->maximum()) horizontalHeader()->setOffsetToLastSection(); else horizontalHeader()->setOffsetToSectionPosition(horizontalScrollBar()->value()); viewport()->update(); } private: QTimer *updateTimer; }; #include "main.moc" int main(int argc, char **argv) { QApplication a(argc,argv); MyTableWidget tw(5, 2); tw.connect(tw.horizontalHeader(), SIGNAL(sectionResized(int, int, int)), &tw, SLOT(updateScrollBar())); tw.show(); return a.exec(); }