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. Phone contacts header label scrolling in/out
Forum Updated to NodeBB v4.3 + New Features

Phone contacts header label scrolling in/out

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
2 Posts 2 Posters 202 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.
  • E Offline
    E Offline
    Elynsyon
    wrote on last edited by
    #1

    Hello,

    i am trying to implement a phone contacts like scrolling, where you have one static letter label not moving until the next section is reached. Then this label should slowly scroll out until the new section label is at top.

    This is what i have tried so far. Having a form file with a QWidget. In the widget i have a QScrollArea(content holding non-static labels and buttons in each section) and a QLabel(the static label that should stay on top).
    I am processing the Gesture Event to check if the user moved the vertical scroll area. The following is the snippet of my gesture event:

    const int static_header_height = 40;
    const QPoint scroll_area_pos = m_ui->CalleeScrollArea->verticalScrollBar()->pos();
    QLabel * header_label = qobject_cast<QLabel*>(m_ui->CalleeScrollArea->childAt(scroll_area_pos));
    QPushButton * callee_button = qobject_cast<QPushButton*>(m_ui->CalleeScrollArea->childAt(scroll_area_pos));
    const bool is_header_at_top = header_label != nullptr;;
    if(is_header_at_top)
    {
    	const int header_label_height = header_label->height();
    	const int visible_header_label_height = header_label->visibleRegion().boundingRect().height();
    	const int header_subtract_height = header_label_height - visible_header_label_height;
    	m_ui->StaticHeaderLabel->setFixedHeight(static_header_height - header_subtract_height);
    }
    else
    {
    	m_ui->StaticHeaderLabel->setFixedHeight(static_header_height);
    }
    

    With this the static header label gets smaller but the header in the scroll area gets also smaller. This is probably due to resizing(scroll are gets more space).

    I also trying moving the labels without success...

    I don't really know how to tackle this problem. I am doing it wrong alltogether? Is there a more convenient way to achieve this?

    Thanks in advance.

    1 Reply Last reply
    0
    • M Offline
      M Offline
      Melody242
      wrote on last edited by
      #2
      This post is deleted!
      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