Results 1 to 11 of 11

Thread: resizeEvent help pls

  1. #1
    Join Date
    Jan 2006
    Posts
    667
    Thanks
    10
    Thanked 80 Times in 74 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default resizeEvent help pls

    Hi,

    I have a widget which always needs to be square in shape. Therefore when user resizes the widget how can i make it square while he is resizing it (not after he is finished resizing)?

    Thanks

  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: resizeEvent help pls

    Did you try heightForWidth?

  3. #3
    Join Date
    Jan 2006
    Posts
    667
    Thanks
    10
    Thanked 80 Times in 74 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: resizeEvent help pls

    Can you please give me a simple example?

    Thanks

  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: resizeEvent help pls

    int QWidget::heightForWidth ( int w ) const [virtual]
    Returns the preferred height for this widget, given the width w.
    If this widget has a layout, the default implementation returns the layout's preferred height. if there is no layout, the default implementation returns -1 indicating that the preferred height does not depend on the width.
    And http://doc.trolltech.com/qq/qq04-height-for-width.html

  5. #5
    Join Date
    Jan 2006
    Posts
    667
    Thanks
    10
    Thanked 80 Times in 74 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: resizeEvent help pls

    Hi,

    Thanks for reply. I have already read it, but how would i use this and reimplement the resizeEvent and achieve my goal.

    I have already tries this. Bu the problem is only after the user finishes resizing the widget resizes itself again and only then it is a square. What is want is that when user drags the edge of the widget, the widget should resize itself in such a way that it is always square.

    For example when the width is incresed the height should also increase along with the width and thr vice-versa.

    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: resizeEvent help pls

    Quote Originally Posted by munna
    For example when the width is incresed the height should also increase along with the width and thr vice-versa.
    I don't think you can do that... It is the window manager who is responsible for this. The resize event is generated when the resize finishes.

  7. #7
    Join Date
    Jan 2006
    Posts
    667
    Thanks
    10
    Thanked 80 Times in 74 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: resizeEvent help pls

    But an application which is written using pascal is doing it and i want to reproduce the same effect in my application also.

    If it was windows manager that was responsible for it then how is it possible using pascal?

    Thanks

  8. #8
    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: resizeEvent help pls

    Quote Originally Posted by munna
    If it was windows manager that was responsible for it then how is it possible using pascal?
    It is probably window-manager dependent Or it causes a resize event to be generated with every mouse move while changing size (it's probably the same as opaque window sizing).

  9. #9
    Join Date
    Jan 2006
    Posts
    10
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4
    Platforms
    MacOS X Windows

    Default Re: resizeEvent help pls

    Quote Originally Posted by munna
    But an application which is written using pascal is doing it and i want to reproduce the same effect in my application also.

    If it was windows manager that was responsible for it then how is it possible using pascal?

    Thanks
    You could handle the mouse down, move and up events yourself. I did this when I needed the illusion of a main window but did not want the standard windows capation bar. So essentially, the window was a frameless window. When a mouse down occurred in a predefined region of window, it moved the window around until a mouse up occured. Worked very well. I am certain the same could be done for resizeing the window.

  10. #10
    Join Date
    Jun 2010
    Posts
    1
    Qt products
    Qt3 Qt4

    Default Re: resizeEvent help pls

    I want to resize a frameless window with adding 8 squers in the 8 sides of window. please help me!

  11. #11
    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: resizeEvent help pls

    Quote Originally Posted by soodeh View Post
    I want to resize a frameless window with adding 8 squers in the 8 sides of window. please help me!
    And what exactly is the problem?
    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. What cannot be done in resizeEvent(..)?
    By nifei in forum Qt Programming
    Replies: 2
    Last Post: 29th December 2008, 02:48
  2. Image on QLabel and resizeEvent
    By ^NyAw^ in forum Qt Programming
    Replies: 2
    Last Post: 12th September 2008, 09:32
  3. Reimplement of resizeEvent
    By Shawn in forum Qt Programming
    Replies: 20
    Last Post: 27th May 2007, 10:04
  4. resizeEvent from parent to child?
    By ChasW in forum Qt Programming
    Replies: 3
    Last Post: 11th February 2007, 18:21
  5. Question about resizeEvent
    By SkripT in forum Qt Programming
    Replies: 1
    Last Post: 28th February 2006, 16:13

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.