Results 1 to 6 of 6

Thread: QResizeEvent called 3 times

  1. #1
    Join Date
    Jun 2010
    Posts
    97
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default QResizeEvent called 3 times

    I have a call which has implemented QMainWindow. I want to call a funtion when it is maximized. Hence I have reimplemented resize event of QMainWindow. But I call this function inside this event, it gets called 3 times since in main class I have writtern app.showMaximized();

    Can any one let me know I resize event gets call multiple times.



    Thanks

    Manish

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: QResizeEvent called 3 times

    Have you checked the values?

    Maybe the windowing system resizes the window three times?

    Cheers,
    _

  3. #3
    Join Date
    Jun 2010
    Posts
    97
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QResizeEvent called 3 times

    Yes, I have checked the values, it is show old values of size as (-1,-1) then (680,420) and (680,420)

  4. #4
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: QResizeEvent called 3 times

    Does the windowState() change at one of these three?

    Cheers,
    _

  5. #5
    Join Date
    Apr 2013
    Location
    Prague
    Posts
    258
    Thanks
    3
    Thanked 65 Times in 59 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: QResizeEvent called 3 times

    Just guessing: the calls are "on the way" calls during resolving the geometry (ctor, layouts, decorations and so on). As to your attempts: do not connect() resize(), call showFullScreen() or showMaximized() from your handler (or the ctor) and then call size(). As to the documentation, you could get some problems with X. You need to try.

  6. #6
    Join Date
    Jun 2010
    Posts
    97
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QResizeEvent called 3 times

    WindowState is definitely changed once. Since during design time in QT Creator, QMainWindow has its default size when created using new application wizard. But when I run the application, I have mentioned showMaximized to the instance of class which has extended QMainWindow class.

    In the class which has extended QMainWindow, I have re-implemented resize event and have capture that if change.type() == QWindowStateChange and then isMaximized() function. Then only I am calling my custom code. But despite this it is calling 3 times.

    WindowState is definitely changed once. Since during design time in QT Creator, QMainWindow has its default size when created using new application wizard. But when I run the application, I have mentioned showMaximized to the instance of class which has extended QMainWindow class.

    In the class which has extended QMainWindow, I have re-implemented resize event and have capture that if change.type() == QWindowStateChange and then isMaximized() function. Then only I am calling my custom code. But despite this it is calling 3 times.

Similar Threads

  1. Replies: 8
    Last Post: 11th February 2014, 10:01
  2. Replies: 12
    Last Post: 16th September 2011, 23:48
  3. Qt bug? Signal emitted once, slot called multiple times
    By MattPhillips in forum Qt Programming
    Replies: 22
    Last Post: 1st December 2010, 22:32
  4. filterAcceptRows() is being called many times for same souceRow.
    By kaushal_gaurav in forum Qt Programming
    Replies: 2
    Last Post: 19th February 2009, 03:49
  5. Replies: 0
    Last Post: 17th May 2008, 18:06

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.