Results 1 to 6 of 6

Thread: let QWidget send simultaneous resizeevent when resize happens

  1. #1
    Join Date
    Jun 2014
    Posts
    20
    Thanks
    2

    Default let QWidget send simultaneous resizeevent when resize happens

    Hello all,

    in my project im using another layout system other than QLayout.
    there is a layout algorithm which triggers a size calculation when QWidget::resize() happens.

    i read the doc of QWidget::resize() only when the widget is visible he sends a resizeevent immediately.
    is there any way to let a widget always send a resizeevent when resize happens?

    ps: currently im using the trick with flag WA_WState_Visible, since this flag is even not documented i assume it is not supposed to use.

    Thank you.

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: let QWidget send simultaneous resizeevent when resize happens

    Why do you want to calculate the layout when the widget is hidden? Maybe you could recalculate the layout when showEvent() happens to avoid the problem. Better yet implement your own layout as a proper QLayout subclass.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    Jun 2014
    Posts
    20
    Thanks
    2

    Default Re: let QWidget send simultaneous resizeevent when resize happens

    Quote Originally Posted by wysota View Post
    Why do you want to calculate the layout when the widget is hidden? Maybe you could recalculate the layout when showEvent() happens to avoid the problem. Better yet implement your own layout as a proper QLayout subclass.
    Hello. We are not creating a new project while porting it to Qt.
    because of historical reason the old layout we cannot remove in the near future.

    may i know whether it is not recommanded to trigger a resizeevent before the widget visible?

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: let QWidget send simultaneous resizeevent when resize happens

    Quote Originally Posted by cic1988 View Post
    Hello. We are not creating a new project while porting it to Qt.
    because of historical reason the old layout we cannot remove in the near future.
    I have no idea what you mean by that.

    may i know whether it is not recommanded to trigger a resizeevent before the widget visible?
    All widgets gain their physical attributes (like font size, size, etc.) when they are shown for the first time.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  5. #5
    Join Date
    Jun 2014
    Posts
    20
    Thanks
    2

    Default Re: let QWidget send simultaneous resizeevent when resize happens

    Quote Originally Posted by wysota View Post
    I have no idea what you mean by that.
    you suggest me to use QLayout. I wrote why i didnt use it.


    Quote Originally Posted by wysota View Post
    All widgets gain their physical attributes (like font size, size, etc.) when they are shown for the first time.
    then it's clear. Thanks.

  6. #6
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: let QWidget send simultaneous resizeevent when resize happens

    Quote Originally Posted by cic1988 View Post
    you suggest me to use QLayout. I wrote why i didnt use it.
    Almost all you need to do to make your layout QLayout compatible is to reimplement QLayout::setGeometry() and position all widgets from within that method.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. How to disable resize in a QWidget
    By aguleo in forum Newbie
    Replies: 2
    Last Post: 17th February 2013, 20:58
  2. Replies: 15
    Last Post: 11th September 2012, 07:26
  3. ResizeEvent/Resize out of control
    By C167 in forum Qt Programming
    Replies: 13
    Last Post: 25th June 2008, 09:27
  4. QWidget::resizeEvent is not called
    By maximAL in forum Qt Programming
    Replies: 9
    Last Post: 3rd February 2008, 16:41
  5. Resize QWidget in QMainWindow
    By aamer4yu in forum Qt Programming
    Replies: 1
    Last Post: 8th March 2007, 12:16

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.