You can use a singleshot QTimer to trigger something if a resizeEvent has not been received for a certain period, say 500 milliseconds. This is approximately "the end of resizing"
#include <QtGui>
#include <QDebug>
Q_OBJECT
public:
m_resizeTimer.setSingleShot(true);
connect(&m_resizeTimer, SIGNAL(timeout()), SLOT(resizeDone()));
}
protected:
qDebug() << Q_FUNC_INFO;
m_resizeTimer.start(500);
}
private slots:
void resizeDone() {
qDebug() << Q_FUNC_INFO;
}
private:
};
int main(int argc, char**argv) {
Widget w;
w.show();
return app.exec();
}
#include "main.moc"
#include <QtGui>
#include <QDebug>
class Widget: public QWidget {
Q_OBJECT
public:
Widget(QWidget *p = 0): QWidget(p) {
m_resizeTimer.setSingleShot(true);
connect(&m_resizeTimer, SIGNAL(timeout()), SLOT(resizeDone()));
}
protected:
void resizeEvent(QResizeEvent *e) {
qDebug() << Q_FUNC_INFO;
m_resizeTimer.start(500);
QWidget::resizeEvent(e);
}
private slots:
void resizeDone() {
qDebug() << Q_FUNC_INFO;
}
private:
QTimer m_resizeTimer;
};
int main(int argc, char**argv) {
QApplication app(argc, argv);
Widget w;
w.show();
return app.exec();
}
#include "main.moc"
To copy to clipboard, switch view to plain text mode
Bookmarks