Results 1 to 4 of 4

Thread: resize QUndoView

  1. #1
    Join Date
    Feb 2009
    Posts
    20

    Default resize QUndoView

    I want to resize the a UndoView to its optimal horizontal size. That means the lenght of the biggest item (text).

    I don't found a option 'resizeToContent''. So how can I achive this goal?

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

    Default Re: resize QUndoView

    Retrieve size hint for the items and calculate the width needed to fit the widest item. Compensate for the decorations and margins and set that as the (minimum) width of the view. Alternatively you can guess the right size of the view by looking at the size of the viewport (through the range of the horizontal scroll bar for example).
    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
    Feb 2009
    Posts
    20

    Default Re: resize QUndoView

    What is the viewport?

    In the docs I found not much about it:
    If you need to provide a scrolling view onto another widget, it may be more convenient to use the QScrollArea class because this provides a viewport widget and scroll bars.

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

    Default Re: resize QUndoView

    Viewport is the part of the scroll area that actually gets scrolled. See the detailed description of QAbstractScrollArea.
    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. Replies: 1
    Last Post: 10th August 2008, 18:55
  2. Replies: 2
    Last Post: 22nd January 2008, 16:10
  3. QGraphicsScene / QGraphicsView speed after resize
    By themolecule in forum Qt Programming
    Replies: 1
    Last Post: 21st July 2007, 23:46
  4. Custom Shape Widget (resize)
    By PiXeL16 in forum Qt Programming
    Replies: 7
    Last Post: 12th February 2007, 07:00
  5. postponing resize event
    By Honestmath in forum Qt Programming
    Replies: 11
    Last Post: 26th February 2006, 00: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
  •  
Qt is a trademark of The Qt Company.