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. How to get QScrollArera's current position? (segfault) [Solved]
Forum Updated to NodeBB v4.3 + New Features

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

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 805 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.
  • K Offline
    K Offline
    krix
    wrote on last edited by
    #1

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

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      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.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • K Offline
        K Offline
        krix
        wrote on last edited by
        #3

        Thanks SGaist again, your post was very useful!

        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