Hi,
Is there any signal or a way to check when resize is complete for QWidget?
Actually I want to stop the drawing on my map control when it is being resized and then start it again once the resize is complete.
Regards,
Raj
Printable View
Hi,
Is there any signal or a way to check when resize is complete for QWidget?
Actually I want to stop the drawing on my map control when it is being resized and then start it again once the resize is complete.
Regards,
Raj
Try reimplement QWidget::resizeEvent or using QObject::eventFilter.Quote:
Is there any signal or a way to check when resize is complete for QWidget?
When do you consider the resize "complete"?
You can do something like this, which stops the widget's layout from updating until there has been no resize event for a configurable time:
Code:
#include <QtGui> #include <QDebug> { Q_OBJECT public: { m_timer->setSingleShot(true); connect(m_timer, SIGNAL(timeout()), SLOT(resizeStopped())); // Just for example content l->addWidget(f); setLayout(l); } protected: { if (l) { m_timer->start(StoppedTimeout); l->setEnabled(false); } } private slots: void resizeStopped() { if (l) { l->setEnabled(true); l->update(); } } private: enum { StoppedTimeout = 500 }; QTimer *m_timer; }; int main(int argc, char**argv) { LazyResizeWidget w; w.resize(640, 480); w.show(); return app.exec(); } #include "main.moc"
Do you mean when the user is resizing the window (by dragging an edge or a corner)?
If so, and if the target platform is Windows, what you need are the WM_ENTERSIZEMOVE and WM_EXITSIZEMOVE messages. I don’t have a good opportunity to test right now, but if QWidget::winEvent gets those messages, you should be able to use them to do what you need.
Thanks Coises ...