Sophie

Sophie

distrib > Mandriva > 2010.0 > i586 > media > contrib-release > by-pkgid > a6711891ce757817bba854bf3f25205a > files > 2190

qtjambi-doc-4.3.3-3mdv2008.1.i586.rpm

<class name="QSignalMapper" doc="/**
&lt;p&gt;The &lt;a href=&quot;QSignalMapper.html#QSignalMapper(com.trolltech.qt.core.QObject)&quot;&gt;&lt;tt&gt;QSignalMapper&lt;/tt&gt;&lt;/a&gt; class bundles signals from identifiable senders.&lt;/p&gt;
&lt;p&gt;This class collects a set of parameterless signals, and re-emits them with integer, string or widget parameters corresponding to the object that sent the signal.&lt;/p&gt;
&lt;p&gt;The class supports the mapping of particular strings or integers with particular objects using &lt;a href=&quot;QSignalMapper.html#setMapping(com.trolltech.qt.core.QObject, int)&quot;&gt;&lt;tt&gt;setMapping&lt;/tt&gt;&lt;/a&gt;. The objects' signals can then be connected to the &lt;a href=&quot;QSignalMapper.html#map(com.trolltech.qt.core.QObject)&quot;&gt;&lt;tt&gt;map&lt;/tt&gt;&lt;/a&gt; slot which will emit the mapped() signal with the string or integer associated with the original signalling object. Mappings can be removed later using &lt;a href=&quot;QSignalMapper.html#removeMappings(com.trolltech.qt.core.QObject)&quot;&gt;&lt;tt&gt;removeMappings&lt;/tt&gt;&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Example: Suppose we want to create a custom widget that contains a group of buttons (like a tool palette). One approach is to connect each button's &lt;tt&gt;clicked()&lt;/tt&gt; signal to its own custom slot; but in this example we want to connect all the buttons to a single slot and parameterize the slot by the button that was clicked.&lt;/p&gt;
&lt;p&gt;Here's the definition of a simple custom widget that has a single signal, &lt;tt&gt;clicked()&lt;/tt&gt;, which is emitted with the text of the button that was clicked:&lt;/p&gt;
&lt;pre&gt;    class ButtonWidget : public QWidget
    {
        Q_OBJECT

    public:
        ButtonWidget(QStringList texts, QWidget *parent = 0);

    signals:
        void clicked(const QString &amp;amp;text);

    private:
        QSignalMapper *signalMapper;
    };&lt;/pre&gt;
&lt;p&gt;The only function that we need to implement is the constructor:&lt;/p&gt;
&lt;pre&gt;    ButtonWidget::ButtonWidget(QStringList texts, QWidget *parent)
        : QWidget(parent)
    {
        signalMapper = new QSignalMapper(this);

        QGridLayout *gridLayout = new QGridLayout;
        for (int i = 0; i &amp;lt; texts.size(); ++i) {
            QPushButton *button = new QPushButton(texts[i]);
            connect(button, SIGNAL(clicked()), signalMapper, SLOT(map()));
            signalMapper-&amp;gt;setMapping(button, texts[i]);
            gridLayout-&amp;gt;addWidget(button, i / 3, i % 3);
        }

        connect(signalMapper, SIGNAL(mapped(const QString &amp;amp;)),
                this, SIGNAL(clicked(const QString &amp;amp;)));

        setLayout(gridLayout);
    }&lt;/pre&gt;
&lt;p&gt;A list of texts is passed to the constructor. A signal mapper is constructed and for each text in the list a &lt;a href=&quot;%2E%2E/gui/QPushButton.html&quot;&gt;&lt;tt&gt;QPushButton&lt;/tt&gt;&lt;/a&gt; is created. We connect each button's &lt;tt&gt;clicked()&lt;/tt&gt; signal to the signal mapper's &lt;a href=&quot;QSignalMapper.html#map(com.trolltech.qt.core.QObject)&quot;&gt;&lt;tt&gt;map&lt;/tt&gt;&lt;/a&gt; slot, and create a mapping in the signal mapper from each button to the button's text. Finally we connect the signal mapper's mapped() signal to the custom widget's &lt;tt&gt;clicked()&lt;/tt&gt; signal. When the user clicks a button, the custom widget will emit a single &lt;tt&gt;clicked()&lt;/tt&gt; signal whose argument is the text of the button the user clicked.&lt;/p&gt;

@see &lt;a href=&quot;QObject.html#QObject(com.trolltech.qt.core.QObject)&quot;&gt;&lt;tt&gt;QObject&lt;/tt&gt;&lt;/a&gt;
@see &lt;a href=&quot;%2E%2E/gui/QButtonGroup.html&quot;&gt;&lt;tt&gt;QButtonGroup&lt;/tt&gt;&lt;/a&gt;
@see &lt;a href=&quot;%2E%2E/gui/QActionGroup.html&quot;&gt;&lt;tt&gt;QActionGroup&lt;/tt&gt;&lt;/a&gt; */">
    <signal name="protected final void mappedQWidget(com.trolltech.qt.gui.QWidget arg__1)" doc="/**
&lt;p&gt;This signal is emitted when &lt;a href=&quot;QSignalMapper.html#map(com.trolltech.qt.core.QObject)&quot;&gt;&lt;tt&gt;map&lt;/tt&gt;&lt;/a&gt; is signalled from an object that has a widget mapping set. The object's mapped widget is passed in &lt;tt&gt;arg__1&lt;/tt&gt;.&lt;/p&gt;
&lt;dl&gt;
&lt;dt&gt;&lt;b&gt;Compatible Slot Signatures:&lt;/b&gt;&lt;/dt&gt;
&lt;dd&gt;&lt;tt&gt;void mySlot(com.trolltech.qt.gui.QWidget arg__1)&lt;/tt&gt;&lt;/dd&gt;
&lt;dd&gt;&lt;tt&gt;void mySlot()&lt;/tt&gt;&lt;/dd&gt;
&lt;/dl&gt;
&lt;dl&gt;
&lt;dt&gt;&lt;b&gt;See Also:&lt;/b&gt;&lt;/dt&gt;
&lt;dd&gt;&lt;a href=&quot;QSignalMapper.html#setMapping(com.trolltech.qt.core.QObject, int)&quot;&gt;&lt;tt&gt;setMapping&lt;/tt&gt;&lt;/a&gt;&lt;/dd&gt;
&lt;/dl&gt;
 */"/>
    <signal name="protected final void mappedQObject(com.trolltech.qt.core.QObject arg__1)" doc="/**
&lt;p&gt;This signal is emitted when &lt;a href=&quot;QSignalMapper.html#map(com.trolltech.qt.core.QObject)&quot;&gt;&lt;tt&gt;map&lt;/tt&gt;&lt;/a&gt; is signalled from an object that has an object mapping set. The object provided by the map is passed in &lt;tt&gt;arg__1&lt;/tt&gt;.&lt;/p&gt;
&lt;dl&gt;
&lt;dt&gt;&lt;b&gt;Compatible Slot Signatures:&lt;/b&gt;&lt;/dt&gt;
&lt;dd&gt;&lt;tt&gt;void mySlot(com.trolltech.qt.core.QObject arg__1)&lt;/tt&gt;&lt;/dd&gt;
&lt;dd&gt;&lt;tt&gt;void mySlot()&lt;/tt&gt;&lt;/dd&gt;
&lt;/dl&gt;
&lt;dl&gt;
&lt;dt&gt;&lt;b&gt;See Also:&lt;/b&gt;&lt;/dt&gt;
&lt;dd&gt;&lt;a href=&quot;QSignalMapper.html#setMapping(com.trolltech.qt.core.QObject, int)&quot;&gt;&lt;tt&gt;setMapping&lt;/tt&gt;&lt;/a&gt;&lt;/dd&gt;
&lt;/dl&gt;
 */"/>
    <signal name="protected final void mappedString(java.lang.String arg__1)" doc="/**
&lt;p&gt;This signal is emitted when &lt;a href=&quot;QSignalMapper.html#map(com.trolltech.qt.core.QObject)&quot;&gt;&lt;tt&gt;map&lt;/tt&gt;&lt;/a&gt; is signalled from an object that has a string mapping set. The object's mapped string is passed in &lt;tt&gt;arg__1&lt;/tt&gt;.&lt;/p&gt;
&lt;dl&gt;
&lt;dt&gt;&lt;b&gt;Compatible Slot Signatures:&lt;/b&gt;&lt;/dt&gt;
&lt;dd&gt;&lt;tt&gt;void mySlot(java.lang.String arg__1)&lt;/tt&gt;&lt;/dd&gt;
&lt;dd&gt;&lt;tt&gt;void mySlot()&lt;/tt&gt;&lt;/dd&gt;
&lt;/dl&gt;
&lt;dl&gt;
&lt;dt&gt;&lt;b&gt;See Also:&lt;/b&gt;&lt;/dt&gt;
&lt;dd&gt;&lt;a href=&quot;QSignalMapper.html#setMapping(com.trolltech.qt.core.QObject, int)&quot;&gt;&lt;tt&gt;setMapping&lt;/tt&gt;&lt;/a&gt;&lt;/dd&gt;
&lt;/dl&gt;
 */"/>
    <signal name="protected final void mappedInteger(int arg__1)" doc="/**
&lt;p&gt;This signal is emitted when &lt;a href=&quot;QSignalMapper.html#map(com.trolltech.qt.core.QObject)&quot;&gt;&lt;tt&gt;map&lt;/tt&gt;&lt;/a&gt; is signalled from an object that has an integer mapping set. The object's mapped integer is passed in &lt;tt&gt;arg__1&lt;/tt&gt;.&lt;/p&gt;
&lt;dl&gt;
&lt;dt&gt;&lt;b&gt;Compatible Slot Signatures:&lt;/b&gt;&lt;/dt&gt;
&lt;dd&gt;&lt;tt&gt;void mySlot(int arg__1)&lt;/tt&gt;&lt;/dd&gt;
&lt;dd&gt;&lt;tt&gt;void mySlot()&lt;/tt&gt;&lt;/dd&gt;
&lt;/dl&gt;
&lt;dl&gt;
&lt;dt&gt;&lt;b&gt;See Also:&lt;/b&gt;&lt;/dt&gt;
&lt;dd&gt;&lt;a href=&quot;QSignalMapper.html#setMapping(com.trolltech.qt.core.QObject, int)&quot;&gt;&lt;tt&gt;setMapping&lt;/tt&gt;&lt;/a&gt;&lt;/dd&gt;
&lt;/dl&gt;
 */"/>
    <method name="public QSignalMapper(com.trolltech.qt.core.QObject parent)" doc="/**
&lt;p&gt;Constructs a &lt;a href=&quot;QSignalMapper.html#QSignalMapper(com.trolltech.qt.core.QObject)&quot;&gt;&lt;tt&gt;QSignalMapper&lt;/tt&gt;&lt;/a&gt; with parent &lt;tt&gt;parent&lt;/tt&gt;.&lt;/p&gt;
 */"/>
    <method name="public QSignalMapper()" doc="/**
&lt;p&gt;Equivalent to &lt;a href=&quot;QSignalMapper.html#QSignalMapper(com.trolltech.qt.core.QObject)&quot;&gt;&lt;tt&gt;QSignalMapper&lt;/tt&gt;&lt;/a&gt;(0). */"/>
    <method name="public final void map()" doc="/**
&lt;p&gt;This slot emits signals based on which object sends signals to it.&lt;/p&gt;
 */"/>
    <method name="public final void map(com.trolltech.qt.core.QObject sender)" doc="/**
&lt;p&gt;This slot emits signals based on the &lt;tt&gt;sender&lt;/tt&gt; object.&lt;/p&gt;
 */"/>
    <method name="public final com.trolltech.qt.core.QObject mapping(java.lang.String text)"/>
    <method name="public final com.trolltech.qt.core.QObject mapping(com.trolltech.qt.gui.QWidget widget)" doc="/**
&lt;p&gt;Returns the sender &lt;a href=&quot;QObject.html#QObject(com.trolltech.qt.core.QObject)&quot;&gt;&lt;tt&gt;QObject&lt;/tt&gt;&lt;/a&gt; that is associated with the given &lt;tt&gt;widget&lt;/tt&gt;.&lt;/p&gt;
 */"/>
    <method name="public final com.trolltech.qt.core.QObject mapping(com.trolltech.qt.core.QObject object)" doc="/**
&lt;p&gt;Returns the sender &lt;a href=&quot;QObject.html#QObject(com.trolltech.qt.core.QObject)&quot;&gt;&lt;tt&gt;QObject&lt;/tt&gt;&lt;/a&gt; that is associated with the given &lt;tt&gt;object&lt;/tt&gt;.&lt;/p&gt;
 */"/>
    <method name="public final com.trolltech.qt.core.QObject mapping(int id)" doc="/**
&lt;p&gt;Returns the sender &lt;a href=&quot;QObject.html#QObject(com.trolltech.qt.core.QObject)&quot;&gt;&lt;tt&gt;QObject&lt;/tt&gt;&lt;/a&gt; that is associated with the given &lt;tt&gt;id&lt;/tt&gt;.&lt;/p&gt;

@see &lt;a href=&quot;QSignalMapper.html#setMapping(com.trolltech.qt.core.QObject, int)&quot;&gt;&lt;tt&gt;setMapping&lt;/tt&gt;&lt;/a&gt; */"/>
    <method name="public final void removeMappings(com.trolltech.qt.core.QObject sender)" doc="/**
&lt;p&gt;Removes all mappings for &lt;tt&gt;sender&lt;/tt&gt;.&lt;/p&gt;
&lt;p&gt;This is done automatically when mapped objects are destroyed.&lt;/p&gt;
 */"/>
    <method name="public final void setMapping(com.trolltech.qt.core.QObject sender, com.trolltech.qt.core.QObject object)" doc="/**
&lt;p&gt;Adds a mapping so that when &lt;a href=&quot;QSignalMapper.html#map(com.trolltech.qt.core.QObject)&quot;&gt;&lt;tt&gt;map&lt;/tt&gt;&lt;/a&gt; is signalled from the given &lt;tt&gt;sender&lt;/tt&gt;, the signal mapped(&lt;tt&gt;object&lt;/tt&gt; ) is emitted.&lt;/p&gt;
&lt;p&gt;There may be at most one object for each sender.&lt;/p&gt;
 */"/>
    <method name="public final void setMapping(com.trolltech.qt.core.QObject sender, java.lang.String text)" doc="/**
&lt;p&gt;Adds a mapping so that when &lt;a href=&quot;QSignalMapper.html#map(com.trolltech.qt.core.QObject)&quot;&gt;&lt;tt&gt;map&lt;/tt&gt;&lt;/a&gt; is signalled from the given &lt;tt&gt;sender&lt;/tt&gt;, the signal mapped(&lt;tt&gt;text&lt;/tt&gt; ) is emitted.&lt;/p&gt;
&lt;p&gt;There may be at most one text for each sender.&lt;/p&gt;
 */"/>
    <method name="public final void setMapping(com.trolltech.qt.core.QObject sender, com.trolltech.qt.gui.QWidget widget)" doc="/**
&lt;p&gt;Adds a mapping so that when &lt;a href=&quot;QSignalMapper.html#map(com.trolltech.qt.core.QObject)&quot;&gt;&lt;tt&gt;map&lt;/tt&gt;&lt;/a&gt; is signalled from the given &lt;tt&gt;sender&lt;/tt&gt;, the signal mapped(&lt;tt&gt;widget&lt;/tt&gt; ) is emitted.&lt;/p&gt;
&lt;p&gt;There may be at most one widget for each sender.&lt;/p&gt;
 */"/>
    <method name="public final void setMapping(com.trolltech.qt.core.QObject sender, int id)" doc="/**
&lt;p&gt;Adds a mapping so that when &lt;a href=&quot;QSignalMapper.html#map(com.trolltech.qt.core.QObject)&quot;&gt;&lt;tt&gt;map&lt;/tt&gt;&lt;/a&gt; is signalled from the given &lt;tt&gt;sender&lt;/tt&gt;, the signal mapped(&lt;tt&gt;id&lt;/tt&gt;) is emitted.&lt;/p&gt;
&lt;p&gt;There may be at most one integer ID for each sender.&lt;/p&gt;

@see &lt;a href=&quot;QSignalMapper.html#mapping(int)&quot;&gt;&lt;tt&gt;mapping&lt;/tt&gt;&lt;/a&gt; */"/>
</class>