Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Calling updateGeometry() in resizeEvent() causes segFault when QScrollArea scrollbar does not exist
Forum Updated to NodeBB v4.3 + New Features

Calling updateGeometry() in resizeEvent() causes segFault when QScrollArea scrollbar does not exist

Scheduled Pinned Locked Moved General and Desktop
1 Posts 1 Posters 594 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    Triebr
    wrote on last edited by
    #1

    I have a QScrollArea with a list of widgets inside (using a Horizontal Box Layout).

    The QScrollArea is the lower half of a vertical splitter, and when I increase the height of the scroll area, the contents adjust their width to maintain a square apsect ratio. I achieve this by overriding the resizeEvent()

    @ QSize WidgetSpriteFrameView_Frame::sizeHint() const
    {

        return hint;
    

    }
    void WidgetSpriteFrameView_Frame::resizeEvent(QResizeEvent * e)
    {

    hint = QSize(height(),height());
    
    updateGeometry();
    

    }
    @

    The size policy is (QSizePolicy::Fixed,QSizePolicy::MinimumExpanding).

    This seems to work great, but only when there is a scroll bar on the scroll view. Look carefully at the following GIF for a demonstration:
    http://fat.gfycat.com/CompassionateImmediateElkhound.gif

    As you can see, it crashes right as the scroll bar is taken away. If I set the scrollbar to ScrollBarAlwaysOn, then everything works, but this is ugly and I would like to have it set to ScrollBarAsNeeded.

    The segmentation occurs when updateGeometry(); is called.

    Any advice on how to fix this?

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved