Results 1 to 8 of 8

Thread: Editing resizeEvent of a form-set object

  1. #1
    Join Date
    Jun 2011
    Location
    Porto Alegre, Brazil
    Posts
    482
    Thanks
    165
    Thanked 2 Times in 2 Posts
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Default Editing resizeEvent of a form-set object

    Hello!

    I'm having a situation where I put some QwtPlot inside a QSplitter in the .ui and that needs to be resize() each time the size of the QSplitter changes. For that, I guess, I need to extend the QSplitter resizeEvent() adding there the code to resize the QwtPlot each time its fired.

    The problem is that I have no idea of how to do that, since resizeEvent() is not a signal or slot of QSplitter. I know how to do the edit the resizeEvent() when I'm working in the .h and .cpp of a given class:

    Qt Code:
    1. //.h
    2.  
    3. //....
    4. protected:
    5. void resizeEvent(QResizeEvent *event);
    6.  
    7. //...
    8.  
    9. //.cpp
    10.  
    11. //...
    12.  
    13. void MainWindow::resizeEvent(QResizeEvent *event)
    14. {
    15. //code that should be executed when MainWindonw fires a resizeEvent();
    16. }
    To copy to clipboard, switch view to plain text mode 


    , but not "externaly". So how should I do this? Remember though: I want to "edit", so-to-speak, the resizeEvent() of a specific QSplitter, not making this valid to the entire class.


    Thanks,

    Momergil

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

    Default Re: Editing resizeEvent of a form-set object

    You can always install an event filter on a specified instance of QSplitter to capture events of that instance only. However I have no idea what you need it for.
    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 2011
    Location
    Porto Alegre, Brazil
    Posts
    482
    Thanks
    165
    Thanked 2 Times in 2 Posts
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Editing resizeEvent of a form-set object

    Well, how exactly should I do that? (could you provide a code example?)

    Well, once again, I need because I need to capture the resizeEvent() of a particular QSplitter in my form.

  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: Editing resizeEvent of a form-set object

    Isn't that what a Splitter is doing as part of its normal behavior?

    I just tried with two QTextEdit in a splitter in QtDesigner and even in preview mode it resizes the two edit widgets whenever the slider handle is moved.

    Cheers,
    _

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

    Default Re: Editing resizeEvent of a form-set object

    If you remember to put widgets in a layout...

    @Momergil:
    Quote Originally Posted by Momergil
    Well, how exactly should I do that? (could you provide a code example?)
    See QObject::installEventFilter()
    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.


  6. #6
    Join Date
    Jun 2011
    Location
    Porto Alegre, Brazil
    Posts
    482
    Thanks
    165
    Thanked 2 Times in 2 Posts
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Editing resizeEvent of a form-set object

    Quote Originally Posted by anda_skoa View Post
    Isn't that what a Splitter is doing as part of its normal behavior?

    I just tried with two QTextEdit in a splitter in QtDesigner and even in preview mode it resizes the two edit widgets whenever the slider handle is moved.

    Cheers,
    _
    Not exactly. If you move the slider handler of the QSplitter, the size of its child widgets do change, but no the size of the QSplitter itself, and the changes of QSplitter's size that I want to capture, not of the widgets that it possess.


    Wysota,

    thanks, I'll give a look at that and see what I can do.

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

    Default Re: Editing resizeEvent of a form-set object

    Quote Originally Posted by Momergil View Post
    If you move the slider handler of the QSplitter, the size of its child widgets do change, but no the size of the QSplitter itself
    That's how a splitter is to behave. Manipulating inside of a window shouldn't influence outside of the window. If you wish to resize the window, do it the way it is supposed to be done -- by dragging the outer window frame (or whatever mechanism exists in the window manager you are using).
    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.


  8. #8
    Join Date
    Jun 2011
    Location
    Porto Alegre, Brazil
    Posts
    482
    Thanks
    165
    Thanked 2 Times in 2 Posts
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Editing resizeEvent of a form-set object

    Quote Originally Posted by wysota View Post
    That's how a splitter is to behave. Manipulating inside of a window shouldn't influence outside of the window. If you wish to resize the window, do it the way it is supposed to be done -- by dragging the outer window frame (or whatever mechanism exists in the window manager you are using).
    Well, I know that it is supposed to be so ^^ I was only telling anda_skoa the difference between what we get with moving the slider hander of QSplitter and what I actually want to grab

    --
    Now I was thinking: if the QSplitter is inside a QGridLayout or something that when I resize the MainWindow it automatically resizes the QSpliter thanks to the layout, than actually I don't need the resizeEvent of the QSplitter, since it will happen always when the MainWindow's resizeEvent happens. :S

Similar Threads

  1. Replies: 2
    Last Post: 12th September 2010, 19:01
  2. Form , set object externally
    By giacomelli.fabio in forum Newbie
    Replies: 10
    Last Post: 31st December 2009, 13:03
  3. Multiple form object creation
    By kpmsivachand in forum Qt Programming
    Replies: 2
    Last Post: 3rd February 2009, 01:09
  4. A form returning an object.
    By cbarmpar in forum Qt Programming
    Replies: 3
    Last Post: 8th September 2008, 05:21
  5. Passing an object from one form to the other.
    By cbarmpar in forum Qt Programming
    Replies: 10
    Last Post: 3rd September 2008, 14:12

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
  •  
Qt is a trademark of The Qt Company.