Results 1 to 4 of 4

Thread: window resizing done

  1. #1
    Join Date
    Aug 2011
    Posts
    19
    Thanks
    9
    Qt products
    Qt4

    Default window resizing done

    hi,

    Resizing window is a continuous process -
    mouse down, drag drag drag .. , mouse up

    It seems that any dragging can invoke a resizing event.
    Does Qt exist an event at the end of resizing ?

    Thank your for any reply.

  2. #2
    Join Date
    Mar 2011
    Location
    Hyderabad, India
    Posts
    1,882
    Thanks
    3
    Thanked 452 Times in 435 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows
    Wiki edits
    15

    Default Re: window resizing done

    Resizing window is a continuous process -
    It's not that stright forward to say continuous, it is actualy invidual mouse movement events triggering resizeEvent

    Each resizeEvent by itself is the indication that widget should resize now. There is not concept of last event/end of resize.

    In short No.
    When you know how to do it then you may do it wrong.
    When you don't know how to do it then it is not that you may do it wrong but you may not do it right.

  3. The following user says thank you to Santosh Reddy for this useful post:

    chiaminhsu (23rd January 2013)

  4. #3
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,734
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: window resizing done

    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"

    Qt Code:
    1. #include <QtGui>
    2. #include <QDebug>
    3.  
    4.  
    5. class Widget: public QWidget {
    6. Q_OBJECT
    7. public:
    8. Widget(QWidget *p = 0): QWidget(p) {
    9. m_resizeTimer.setSingleShot(true);
    10. connect(&m_resizeTimer, SIGNAL(timeout()), SLOT(resizeDone()));
    11. }
    12.  
    13. protected:
    14. void resizeEvent(QResizeEvent *e) {
    15. qDebug() << Q_FUNC_INFO;
    16. m_resizeTimer.start(500);
    17. QWidget::resizeEvent(e);
    18. }
    19.  
    20. private slots:
    21. void resizeDone() {
    22. qDebug() << Q_FUNC_INFO;
    23. }
    24.  
    25. private:
    26. QTimer m_resizeTimer;
    27. };
    28.  
    29.  
    30. int main(int argc, char**argv) {
    31. QApplication app(argc, argv);
    32. Widget w;
    33. w.show();
    34. return app.exec();
    35. }
    36.  
    37. #include "main.moc"
    To copy to clipboard, switch view to plain text mode 

  5. The following user says thank you to ChrisW67 for this useful post:

    chiaminhsu (23rd January 2013)

  6. #4
    Join Date
    Aug 2011
    Posts
    19
    Thanks
    9
    Qt products
    Qt4

    Default Re: window resizing done

    oh ... I never think about it. Thank your replay

Similar Threads

  1. resizing child window with parent window
    By sujan.dasmahapatra in forum Qt Programming
    Replies: 3
    Last Post: 8th May 2012, 20:02
  2. resizing the scene to the window
    By Urthas in forum Newbie
    Replies: 0
    Last Post: 12th November 2010, 08:23
  3. Replies: 10
    Last Post: 26th October 2010, 00:59
  4. Replies: 3
    Last Post: 2nd March 2010, 21:58
  5. [QT4] Any way to disable window resizing ?
    By Amalsek in forum Qt Programming
    Replies: 5
    Last Post: 15th May 2006, 12:36

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.