I am using QT to develop a rich UI application.
Additionally to the answers by Patrice Bernassola and Frank Osterfeld the stacking order might be of interest. It corresponds to the order of the children which you get by findChildren
and the ways to manipulate the order are using raise_
(with the trailing underscore), lower
or stackUnder
.
An example changing the order with each of the 3 available functions using PySide is here:
from PySide import QtGui
app = QtGui.QApplication([])
window = QtGui.QWidget()
window.resize(400, 300)
window.show()
rA = QtGui.QLabel()
rA.name='square'
rA.resize(100, 100)
rA.setStyleSheet('background-color:red;')
rA.setParent(window)
rA.show()
text = QtGui.QLabel('text')
text.name='text'
text.setParent(window)
text.show()
# text was added later than rA: initial order is square under text
rA.raise_()
rA.lower()
text.stackUnder(rA)
children = window.findChildren(QtGui.QWidget)
for child in children:
print(child.name)
app.exec_()