Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Wiki Markup
{alias:templateqdelete}
h2. Name

*qdelete* — delete object

h2. Syntax
{panel:|borderStyle=solid|borderWidth=1|bgColor=#FFFFAA}

*qdelete* \[_widget_]

*qdelete* \[_treeitem_]

*qdelete* \[_tableitem_]

{panel}

h2. 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. 

h2. Arguments
_widget_
{indent} 
The widget to be deleted. If this argument is omitted the current widget will be used. 
{indent} 

_treeitem_
{indent} 
An item in a [QTreeWidget]. If this argument is omitted the current treeitem will be used. 
{indent} 

_tableitem_
{indent} 
An item in a [QTableWidget]. If this argument is omitted the current tableitem will be used. 
{indent} 

h2. Examples

h3. Ex.1: Delete
{anchor:Delete}

{noformat:|borderWidth=1|bgColor=#eeeeee}
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

{noformat}

!att:_img_cmd^qdelete.png!

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