Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

No Format
borderColor#404040
bgColor#F0F0F0
borderWidth1
titleSet widget to be deleted from memory when closed
borderStyledashed

qsetattribute deleteonclose

If this attribute was not set, closing the widget would merely make it invisible while still residing in memory, though sometimes this is the desired behaviour. When the deleteonclose attribute is set redisplaying the widget requires the whole widget to be recreated.

...

No Format
borderColor#404040
bgColor#F0F0F0
borderWidth1
titleSet window title to "Hello"
borderStyledashed


qsetwindowtitle "Hello"

The qsetwindowtitle command sets the window title. While there may be several windows available, QTcl will simply apply the command to the most recently created widget, which in this case is the QWidget window. The most recently created widget is also the so-called current widget. It does not matter whether the widget is visible or not. This is in fact how most Qt commands work.

...

No Format
borderColor#404040
bgColor#F0F0F0
borderWidth1
titleCreate a layout
borderStyledashed

qvboxlayout {
	
}

The qvboxlayout command creates a layout manager for the window. A layout manager is also known as a geometry manager. The task of the layout manager is to arrange the widgets in a particular order. For instance, the QVBoxLayout layout manager stacks widgets vertically in their order of creation. There are two other layout managers in QTcl:

...

No Format
borderColor#404040
bgColor#F0F0F0
borderWidth1
titleCreate a push button
borderStyledashed


qpushbutton "Hello world!"

The command qpushbutton creates the conventional button found in user interfaces. There are several types of buttons available in QTcl. Right now this button only has one argument which is the button text. Thus we need a second argument to tell the button what to do when being clicked.

...

No Format
borderColor#404040
bgColor#F0F0F0
borderWidth1
titleAdd an executing command to the button
borderStyledashed


qinformation Information "Hello world!"

This command displays a simple information dialog with an 'OK' button.

...

No Format
borderColor#404040
bgColor#F0F0F0
borderWidth1
titleAdd an executing command to the button
borderStyledashed

qshow $w

QTcl will then draw the most recently created widget, or current widget, on to the screen. In this case the current widget is the window, which is then displayed along with its contents.

...