|
|
wrapper classA wrapper for the existing Qt widgets. |
||||||||||||
| Inherits | ||||||||||||
| object widget | ||||||||||||
| Description | ||||||||||||
This class "wraps" existing kvirc widgets and allows using the widget class API to manipulate them. You can use it, for example, to set the geometry of the kvirc main window or to apply some crazy graphical changes to the UI. The KVIrc Qt widgets are arranged in trees (just as the objects). The difference is that there can be more than one toplevel widget and so more than one tree. You can use $objects.dump() to take a look at the KVIrc Qt objects tree. Here is a part of the tree:
As you can see the objects are identified by their names (for example "mdi_manager") and by their class names (for example KviChannelWindow). To wrap a specific widget you must provide a path in the tree composed of search specifiers. Each search specifier can have one of the following forms:
The first three forms may be preceeded by the prefix '*' which will tell KVS to perform a recursive search from this point. Let's see some examples. The form (1) mathches the first widget with the specified class name. For instance:
This will wrap the first top level object with class KviMainWindow. Now you can use any widget or object methods on it.
If you want to wrap the kvirc status bar you can use a composite path:
The form (2) matches both the class and the widget name. In this way you can differentiate between children that have the same class. For instance:
In this way KVS was able to pick the vertical scrollbar instead of the horizontal one (which comes first in the list). (Now try to move a window out of the MDI area: the vertical scroll bar will be inverted!). The form (3) matches only the name and ignores the class. In our sample tree the following example is equivalent to the previous one.
If you don't want to specify the full path to the widget you can try to use a recursive search which may skip some levels. Keep in mind that the recursive search is breadth-first and will return the first widget that matches. In our sample tree the following would match the first widget with class KviChannelWindow.
The following would match the first widget with name #kvirc
The recursive search can start at any level, so if starting from the root does not work properly you might try specifying a part of the path and then searching recursively.
The form (4) allows you to jump directly to a specific kvirc channel/query/console window, without the need of looking it up in the tree.
Finally the last form allows you to jump N levels up in the tree. If N is omitted it is assumed to be 1.
Experiment with it :) |