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. How can I set center anchors for ScrollView property "contentitem"?
Forum Updated to NodeBB v4.3 + New Features

How can I set center anchors for ScrollView property "contentitem"?

Scheduled Pinned Locked Moved QML and Qt Quick
1 Posts 1 Posters 1.1k 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.
  • N Offline
    N Offline
    ningen
    wrote on last edited by
    #1

    I want set rectangle position to application window center
    But there is always only top left anchors. My code is:
    @import QtQuick 2.2
    import QtQuick.Controls 1.1
    import QtQuick.Window 2.0
    import "qrc:/qml"
    ApplicationWindow {
    visible:true
    id:wp
    ScrollView
    {
    id: wpScroll;
    anchors.fill: parent
    contentItem: Rectangle
    {
    width: 800
    height: 800
    color : "yellow"
    anchors.centerIn: wp.center ///wp=:ApplicationWindow

        Rectangle{
            width: 200;
            height: 200;
            color:"red"
            anchors.bottom:  parent.bottom
        }
    }
    

    }@

    !http://www.7image.ru/pics/1214/469892113.png(Yellow Rect is top left align instead of centered position)!

    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