import QtQuick 2.0 Rectangle { width: 360 height: 360 Text { text: qsTr("Hello World: " + parent.width + " x " + parent.height) anchors.centerIn: parent } onWidthChanged: print("onWidthChanged: " + width + " x " + height) onHeightChanged: print("onHeightChanged: " + width + " x " + height) MouseArea { anchors.fill: parent onClicked: { Qt.quit(); } } }
Monday, July 15, 2013
Get window size of Qt Quick 2 Application, and handle size changed.
This example of QML show how to get width and height of window, and implement handle of onWidthChanged and onHeightChanged, which will be called automatically once window width or height changed.
Labels
Dev. tools
(13)
how to
(10)
Internet of Things (IoT)
(1)
learn Qt
(1)
misc
(1)
misc.
(1)
mobile
(2)
news
(6)
OpenCV
(1)
OpenGL
(1)
QML
(1)
qml example
(40)
Qt
(2)
Qt Cloud
(1)
Qt Creator
(3)
Qt Creator Examples
(4)
Qt Enterprise Embedded
(1)
Qt Examples
(1)
Qt for Android
(5)
Qt for iOS
(2)
Qt for MCU
(1)
Qt news
(1)
Qt Quick
(3)
Qt Quick Control
(1)
Qt Quick Designer
(2)
QtQuick example
(14)
QtQuick.Controls examples
(13)
Ubuntu SDK
(1)
VirtualBox
(1)
WebEngine
(1)