Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Layouts in ScrollViews
Forum Updated to NodeBB v4.3 + New Features

Layouts in ScrollViews

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
1 Posts 1 Posters 349 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.
  • L Offline
    L Offline
    Leon_2001
    wrote on last edited by
    #1

    Hello,

    I have some Problems using Layouts in Scrollviews, probably more on how ScrollViews in general work.

    My Layout always has the width and height of 0, although the ScrollView has something around 1300x700 (which is my Laptop screen - some margins ...)

    import QtQuick 2.10
    import QtQuick.Controls 2.3
    import QtQuick.Layouts 1.3
    
    ScrollView {
      id: root
      anchors.fill: parent
    
      RowLayout {
        anchors.fill: parent
    
        Rectangle {
          Layout.fillWidth: true
          Layout.fillHeight: true
          color: "blue"
        }
        Component.onCompleted: { console.log(width); console.log(height) }
      }
      Component.onCompleted: { console.log(root.width); console.log(root.height) }
    }
    
    

    It would be great if anyone could explain me, why the width and height are 0 and therefore the rectangle does not fill the screen.

    Just to explain my goal. In the End, there should be two Components inside the ScrollView next to each other filling the screen width, but having only the height as necessary (implicit height).
    -> A Textarea with lineNumbers ... I tried several possibilities and one worked, but it wasn't perfect. In General, the difficulty is that the TextArea has to be attached to a Flickable or directly inside a ScrollView for autoscroll and things like this.

    From the docs:
    " A TextArea that is placed inside a ScrollView does the following:

    Sets the content size automatically
    Ensures that the background decoration stays in place
    Clips the content "

    -> I don't know how to achieve this behaviour if there are lineNumbers next to the Textarea (which of course should scroll automatically too).

    Thanks for any advice!

    Greetings Leon

    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