Results 1 to 2 of 2

Thread: Resize with QSizeGrip

  1. #1
    Join Date
    Jan 2006
    Location
    Maui, Hawaii
    Posts
    120
    Thanks
    65
    Thanked 4 Times in 4 Posts
    Qt products
    Qt3 Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Resize with QSizeGrip

    Right now I'm displaying pixmaps at the central widget in a QMainWindow.

    The problem is the pixmap does not auto-scale to smaller than the original size automatically, although I can scale it smaller using QPixmap::scaleTo().

    The problem with using scaleTo() is I want to call it when the user is resizing the QMainWindow, but QMainWindow does not generate a resizeEvent() if the user is trying to make the window smaller than what the child widgets can hold. Since my QLabel that displays the pixmaps is always expanding, any shrinking of the window will be seen as too small for the child widgets and the resizeEvent function never gets called.

    So I'm trying to figure out how I can catch the code when the user clicks on the sizeGrip so I can properly set the parameters in scaleTo().

    I suppose I could subclass a QSizeGrip, re-implement the mouseClickEvent, and then disable the default QSizeGrip I get for free using the QMainWindow class.

    Would that work? Is there a more elegant way to do it?

  2. #2
    Join Date
    Jan 2006
    Location
    Maui, Hawaii
    Posts
    120
    Thanks
    65
    Thanked 4 Times in 4 Posts
    Qt products
    Qt3 Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Resize with QSizeGrip

    Hmm ... reimplementing QSizeGrip sounds like a bumpy road at best.

    I checked out this example:

    http://doc.trolltech.com/4.2/desktop-screenshot.html

    And it looks like something very similar to what I'm doing (reimplementing a QLabel to display pixmaps and trying to resize it). Unfortunately their strategy was to call resizeEvent in the QLabel subclass. This resizeEvent is never triggered if the QLabel already takes up all the discretionary space and the user is trying to make the window smaller.

    So it doesn't help.

Similar Threads

  1. Replies: 1
    Last Post: 10th August 2008, 19:55
  2. Replies: 2
    Last Post: 22nd January 2008, 17:10
  3. QGraphicsScene / QGraphicsView speed after resize
    By themolecule in forum Qt Programming
    Replies: 1
    Last Post: 22nd July 2007, 00:46
  4. Custom Shape Widget (resize)
    By PiXeL16 in forum Qt Programming
    Replies: 7
    Last Post: 12th February 2007, 08:00
  5. postponing resize event
    By Honestmath in forum Qt Programming
    Replies: 11
    Last Post: 26th February 2006, 01:32

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.