How to get QScrollArera's current position? (segfault) [Solved]

  • scrollArea->horizontalScrollBar()->value() and ->pos() does not works, segmentation fault.

  • Lifetime Qt Champion

    There are several problems:

    Don't use c style cast when dealing with QObject derived class, there qobjec_cast for that.

    The parent of DrawWidget is probably not what you think it is.

    You are creating a tight coupling with the parent which is a bad idea. The parent object should be responsible for modifying it's child/children. The child widget should not try to change itself based on the parent it has.

  • Thanks SGaist again, your post was very useful!

Log in to reply