Movatterモバイル変換


[0]ホーム

URL:


We bake cookies in your browser for a better experience. Using this site means that you consent.Read More

Menu

Qt Documentation

  • Qt 4.8
  • AnchorChanges QML Element

AnchorChanges QML Element

TheAnchorChanges element allows you to change the anchors of an item in a state.More...

Properties

Detailed Description

TheAnchorChanges element is used to modify the anchors of an item in aState.

AnchorChanges cannot be used to modify the margins on an item. For this, usePropertyChanges intead.

In the following example we change the top and bottom anchors of an item usingAnchorChanges, and the top and bottom anchor margins usingPropertyChanges:

import QtQuick 1.0Rectangle {id:windowwidth:120;height:120color:"black"Rectangle {id:myRect;width:50;height:50;color:"red" }states:State {name:"reanchored"AnchorChanges {target:myRectanchors.top:window.topanchors.bottom:window.bottom        }PropertyChanges {target:myRectanchors.topMargin:10anchors.bottomMargin:10        }    }MouseArea {anchors.fill:parent;onClicked:window.state="reanchored" }}

AnchorChanges can be animated usingAnchorAnimation.

//animate our anchor changesTransition {AnchorAnimation {}}

Margin animations can be animated usingNumberAnimation.

For more information on anchors seeAnchor Layouts.

Property Documentation

anchors group

anchors.left :AnchorLine

anchors.right :AnchorLine

anchors.horizontalCenter :AnchorLine

anchors.top :AnchorLine

anchors.bottom :AnchorLine

anchors.verticalCenter :AnchorLine

anchors.baseline :AnchorLine

These properties change the respective anchors of the item.

To reset an anchor you can assignundefined:

AnchorChanges {target:myItemanchors.left:undefined//remove myItem's left anchoranchors.right:otherItem.right}

target :Item

This property holds theItem for which the anchor changes will be applied.


© 2016 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of theGNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.


[8]ページ先頭

©2009-2025 Movatter.jp