aboutsummaryrefslogtreecommitdiffstats
path: root/doc/codesnippets/doc/src/snippets/code/src_gui_kernel_qlayout.cpp
blob: 12f12391331893294ecba6207743b043f321e49a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
//! [0]

def paintLayout(self, painter, item):
    layout = item.layout()

    if layout:
        for layout_item in layout:
            self.paintLayout(painter, layout_item)

    painter.drawRect(item.geometry())

def paintEvent(self, event):
    painter = QPainter(self)
    if self.layout():
        self.paintLayout(painter, self.layout())

//! [0]


//! [1]
child = layout.takeAt(0)
while child:
    ...
    del child
//! [1]