Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Update: Forum Guidelines & Code of Conduct


    Qt World Summit: Early-Bird Tickets

    Setting Focus on Button and let verticalScrollbar to Top does not work

    Mobile and Embedded
    verticalscrollb stackedwidget issue qt5.5 scrolling focus embedded
    1
    1
    787
    Loading More Posts
    • 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.
    • B
      BluTiGeS last edited by

      Hi all,

      I have a StackedWidget containing a Scrollbar with some labels and Buttons in it.
      The labels are placed at the top and the buttons below.

      In the constructor I set the focus to the button (preselected) scrollbar moves a bit down (so far its okay)

      But I wanted to have the scrollbar at top at startup so I thought I just set the Scrollbar to 0

      @
      ui->pushButtonDefault->setFocus();
      ui->scrollArea->verticalScrollBar()->setValue( 0 ); //scroll to top
      @

      But the scrollbar does not move to the top if the button setFocus is called before, this only works if I do not set the Focus to the Button or let a Timer timeout slot call the scrollbar function after some seconds.

      Does anyone have an idea why this happens? Is it not allowed to set these in this combination?

      Many Thanks

      1 Reply Last reply Reply Quote 0
      • First post
        Last post