PDA

View Full Version : QML item explorer



nuliknol
4th January 2017, 01:41
Does Qt (5.8) have any sort of explorer of QML items ? Or is there any option for to draw a rectangle around the items to visualize its boundaries at runtime? (of course, this is for development only, the prototyping phase)

Because... I am having a hard time understanding how much width and height do my items take when rendered by QML engine. So, a sort of explorer, like those you have in Firefox or Chrome that help you to understand the how much space is a particular item using , will be of a big help!

TIA
Nulik

anda_skoa
4th January 2017, 15:42
You can easily draw a rectangle around any item with a Rectangle



Item {
// any item you have

Rectangle {
anchors.fill: parent
color: "transparent"
border.color: "red"
}
}

You can move the Rectangle code into a helper file, e.g. "SizeHint.qml" and then use it like this


Item {
// any item you have
SizeHint {}
}


And, last but not least, there is GammaRay (https://www.kdab.com/development-resources/qt-tools/gammaray/)

Cheers,
_