NAME

QObject - Interface to the Qt QObject class

SYNOPSIS

use QObject;

use signals 'sig1()', ..., 'sigx(int)';

use slots 'slot1()', ..., 'sigx(int,int)';

Member functions

new, blockSignals, className, connect, disconnect, dumpObjectInfo, dumpObjectTree, event, eventFilter, highPriority, inherits, insertChild, installEventFilter, isA, isWidgetType, killTimer, killTimers, name, parent, removeChild, removeEventFilter, setName, signalsBlocked, startTimer, timerEvent

Overridable functions

event, eventFilter, timerEvent

DESCRIPTION

Except for children() and queryList(), every public QObject member-function is fully-implemented. Unless noted below, all of those functions are completely direct interfaces.

$connected = $reciever->connect(sender, signal, member)

Do NOT attempt to use SIGNAL() or SLOT() on the signal and member arguments. They are not needed by PerlQt, because the connect() function can automatically determine whether the member argument is a signal or a slot, and the signal will always be a signal. The signal and member arguments must be strings. And at the moment, there isn't much room for error.

$connected = QObject::connect(sender, signal, reciever, member)

Same as above listing, just as a normal function with a different argument-list.

$disconnected = $sender->disconnect(signal = undef, reciever = undef, member = undef)

Remember NOT to use SIGNAL() and SLOT() with disconnect(). This function takes over for both the static disconnect() and the 3-arg member disconnect() in Qt.

$disconnected = $sender->disconnect(reciever, member = undef)

Same warning about SIGNAL() and SLOT() as above.

Signals and slots

Signals and slots are implemented in a limited way at the moment. You may use no-arg signals and slots freely, as well as 1 and 2 integer argument signals and slots, and string signals.

The declaration of signals and slots is done through the usage of 'use signals' and 'use slots'. Any classes which have QObject in their inheritance tree are free to use signals/slots after their superclass has been included via use.

use signals 'sig1()', ..., 'sigx(int,string)'

The arguments to use signals must be strings representing the signal prototypes excluding the object parameter. You may use qw() to quote the function prototypes, but it warns about commas when -w is in use.

Add spaces at your own risk. Misspell at your own risk. PerlQt doesn't do any error-checking yet. All error-checking that is done is done by Qt. You may run use signals as many times as you want. I'm pretty sure that if you define the same signal-name twice, the latter prototype is used. But you should get a redefined function warning. Also, the argument-types are not checked yet.

Running use signals exports a function named emit into your namespace. It does nothing, and is just there for clarity and consistency with Qt where the emit keyword is just as void. When you emit a signal, you must call it as a method-call $self->signal(), and not as 'signal()' or signal() because it is not a string and it is not a normal function.

use slots 'slot1(int)', ..., 'slotx(const string, int)'

The arguments to use slots must be strings representing the prototypes of the slots you want to declare excluding the object parameter. The slot functions aren't cached by PerlQt, and are always called as full method-calls.

Once you declare a function as being a slot, you may use connect() to connect any signal, Perl or C++, to it.

BUGS

Signals and slots still have a way to go before achieving a state which can be considered 'good'. What is available now is good enough for many uses, but time and attention must be paid to signals and slots.

SEE ALSO

qobject(3qt), QGlobal(3)

AUTHOR

Ashley Winters <jql@accessone.com>

1 POD Error

The following errors were encountered while parsing the POD:

Around line 374:

You forgot a '=back' before '=head2'