qdelete - delete object

Name

qdelete — delete object

Syntax

qdelete [widget]

qdelete [treeitem]

qdelete [tableitem]

Description

The qdelete deletes an widget or item from memory. Any children the widget may have are also deleted. If the object is drawn on the screen it will be erased.

To make a widget invisible without deleting it use the qclose command. Many applications do not need qdelete, but rely on qshow, qclose, and qraise to manage visibility/invisibility issues.

Arguments

widget

The widget to be deleted. If this argument is omitted the current widget will be used.

treeitem

An item in a qtreewidget. If this argument is omitted the current treeitem will be used.

tableitem

An item in a qtablewidget. If this argument is omitted the current tableitem will be used.

Examples

Ex.1: Delete

set w1 [qwidget ]
qsetwindowtitle "Window 1"

set w2 [qwidget]
qsetwindowtitle "Window 2"

set layout [qvboxlayout $w1]
set button [qpushbutton "Delete W2" { qdelete $w2 } ]
qaddwidget $layout $button

qshow $w1
qshow $w2

The above script creates two windows - pressing the button will delete the windows titled "Window 2".