Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. Setting Focus on Button and let verticalScrollbar to Top does not work

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

Scheduled Pinned Locked Moved Mobile and Embedded
verticalscrollbstackedwidgetissueqt5.5scrollingfocusembedded
1 Posts 1 Posters 997 Views
  • 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 Offline
    B Offline
    BluTiGeS
    wrote on 12 Oct 2015, 15:19 last edited by
    #1

    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
    0

    1/1

    12 Oct 2015, 15:19

    • Login

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